ECOGEN 6.0
Evolutive, Compressible, Open, Genuine, Easy, N-phase
Loading...
Searching...
No Matches
MeshCartesianAMR.h
Go to the documentation of this file.
1//
2// ,---. ,--, .---. ,--, ,---. .-. .-.
3// | .-' .' .') / .-. ) .' .' | .-' | \| |
4// | `-. | |(_) | | |(_) | | __ | `-. | | |
5// | .-' \ \ | | | | \ \ ( _) | .-' | |\ |
6// | `--. \ `-. \ `-' / \ `-) ) | `--. | | |)|
7// /( __.' \____\ )---' )\____/ /( __.' /( (_)
8// (__) (_) (__) (__) (__)
9// Official webSite: https://code-mphi.github.io/ECOGEN/
10//
11// This file is part of ECOGEN.
12//
13// ECOGEN is the legal property of its developers, whose names
14// are listed in the copyright file included with this source
15// distribution.
16//
17// ECOGEN is free software: you can redistribute it and/or modify
18// it under the terms of the GNU General Public License as published
19// by the Free Software Foundation, either version 3 of the License,
20// or (at your option) any later version.
21//
22// ECOGEN is distributed in the hope that it will be useful,
23// but WITHOUT ANY WARRANTY; without even the implied warranty of
24// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25// GNU General Public License for more details.
26//
27// You should have received a copy of the GNU General Public License
28// along with ECOGEN (file LICENSE).
29// If not, see <http://www.gnu.org/licenses/>.
30
31#ifndef MESHCARTESIANAMR_H
32#define MESHCARTESIANAMR_H
33
34#include "MeshCartesian.h"
35
37{
38 public:
39 MeshCartesianAMR(double lX,
40 int numberCellsX,
41 double lY,
42 int numberCellsY,
43 double lZ,
44 int numberCellsZ,
45 std::vector<stretchZone> stretchX,
46 std::vector<stretchZone> stretchY,
47 std::vector<stretchZone> stretchZ,
48 int lvlMax = 0,
49 double criteriaVar = 1.e10,
50 bool varRho = false,
51 bool varP = false,
52 bool varU = false,
53 bool varAlpha = false,
54 double xiSplit = 1.,
55 double xiJoin = 1.);
56 ~MeshCartesianAMR() override;
57
59 TypeMeshContainer<Cell*>& cellsGhost,
61 const int& resumeSimulation,
62 bool /*pretraitementParallele*/,
63 SimulationOrder schemeOrder) override;
65 TypeMeshContainer<Cell*>& cellsGhost,
67 const int& resumeSimulation,
68 SimulationOrder schemeOrder);
71 TypeMeshContainer<Cell*>& cellsGhost,
73 SimulationOrder schemeOrder);
75 TypeMeshContainer<Cell*>& cellsGhost,
76 const SimulationOrder schemeOrder,
77 const decomposition::Key<3> nKey,
78 const int neighbour,
79 const int cell_idx);
81 TypeMeshContainer<Cell*>* cellsLvlGhost,
82 TypeMeshContainer<CellInterface*>* cellInterfacesLvl,
83 const std::vector<AddPhys*>& addPhys,
84 int& nbCellsTotalAMR,
85 std::vector<GeometricalDomain*>& domains,
86 Eos** eos,
87 const int& resumeSimulation,
88 SimulationOrder schemeOrder,
89 std::vector<GeometricalDomain*>& solidDomains) override;
91 TypeMeshContainer<Cell*>* cellsLvlGhost,
92 TypeMeshContainer<CellInterface*>* cellInterfacesLvl,
93 const int& lvl,
94 const std::vector<AddPhys*>& addPhys,
95 int& nbCellsTotalAMR,
96 Eos** eos) override;
97 std::string whoAmI() const override;
98
99 //Printing / Reading
100 void writeHeaderPiece(std::ofstream& fileStream, TypeMeshContainer<Cell*>* cellsLvl) const override;
101 size_t getNodes(std::vector<double>& dataset, std::vector<Cell*>* cellsLvl) const override;
102 size_t getConnectivity(std::vector<double>& dataset, std::vector<Cell*>* cellsLvl) const override;
103 size_t getConnectivity(std::vector<int64_t>& dataset, std::vector<Cell*>* /*cellsLvl*/) const override;
104 size_t getConnectivity(std::vector<int32_t>& dataset, std::vector<Cell*>* /*cellsLvl*/) const override;
105 void getOffsets(std::vector<double>& dataset, std::vector<Cell*>* cellsLvl) const override;
106 void getOffsets(std::vector<int64_t>& dataset, std::vector<Cell*>* /*cellsLvl*/) const override;
107 void getOffsets(std::vector<int32_t>& dataset, std::vector<Cell*>* /*cellsLvl*/) const override;
108 void getTypeCell(std::vector<double>& dataset, std::vector<Cell*>* cellsLvl) const override;
109 void getTypeCell(std::vector<unsigned char>& dataset, std::vector<Cell*>* cellsLvl) const override;
110 void getData(TypeMeshContainer<Cell*>* cellsLvl, std::vector<double>& dataset, const int var, int phase) const override;
111 void getData(TypeMeshContainer<Cell*>* cellsLvl, std::vector<float>& dataset, const int var, int phase) const override;
112 void setDataSet(std::vector<double>& dataset, TypeMeshContainer<Cell*>* cellsLvl, const int var, int phase) const override;
113 void refineCellAndCellInterfaces(Cell* cell, const std::vector<AddPhys*>& addPhys, int& nbCellsTotalAMR) override;
114 void printDomainDecomposition(std::ofstream& fileStream) override;
115 void readDomainDecomposition(std::ifstream& fileStream) override;
116
117 //Accesseurs
118 int getLvlMax() const override { return m_lvlMax; };
119
120 //Pour parallele
121 void initializePersistentCommunications(const TypeMeshContainer<Cell*>& cells, SimulationOrder schemeOrder) override;
122 void finalizeParallele(const int& lvlMax) override;
124 TypeMeshContainer<Cell*>* cellsLvlGhost,
125 TypeMeshContainer<CellInterface*>* cellInterfacesLvl,
126 SimulationOrder schemeOrder,
127 const std::vector<AddPhys*>& addPhys,
128 Eos** eos,
129 int& nbCellsTotalAMR,
130 std::vector<GeometricalDomain*>& solidDomains,
131 bool init = false) override;
133 bool init,
134 int lvl,
135 bool& balance,
136 std::vector<typename decomposition::Key<3>::value_type>& indicesSendStartGlobal,
137 std::vector<typename decomposition::Key<3>::value_type>& indicesSendEndGlobal,
138 std::vector<typename decomposition::Key<3>::value_type>& indicesReceiveStartGlobal,
139 std::vector<typename decomposition::Key<3>::value_type>& indicesReceiveEndGlobal);
140 virtual void balance(TypeMeshContainer<Cell*>* cellsLvl,
141 TypeMeshContainer<Cell*>* cellsLvlGhost,
142 TypeMeshContainer<CellInterface*>* cellInterfacesLvl,
143 SimulationOrder schemeOrder,
144 const std::vector<AddPhys*>& addPhys,
145 Eos** eos,
146 int& nbCellsTotalAMR,
147 std::vector<typename decomposition::Key<3>::value_type>& indicesSendStartGlobal,
148 std::vector<typename decomposition::Key<3>::value_type>& indicesSendEndGlobal,
149 std::vector<typename decomposition::Key<3>::value_type>& indicesReceiveStartGlobal,
150 std::vector<typename decomposition::Key<3>::value_type>& indicesReceiveEndGlobal,
151 std::vector<GeometricalDomain*>& solidDomains);
152
153 private:
154 template <typename T> size_t getConnectivity_private(std::vector<T>& dataset, std::vector<Cell*>* cellsLvl) const;
155 template <typename T> void getOffsets_private(std::vector<T>& dataset, std::vector<Cell*>* cellsLvl, uint64_t maxVal) const;
156 template <typename T> void getTypeCell_private(std::vector<T>& dataset, std::vector<Cell*>* cellsLvl) const;
157 template <typename T> void getData_private(TypeMeshContainer<Cell*>* cellsLvl, std::vector<T>& dataset, const int var, int phase) const;
158
164};
165
166#endif // MESHCARTESIANAMR_H
std::vector< Type > TypeMeshContainer
Template for the type of the mesh container (std::list for now, but may change to something else if w...
Definition Tools.h:194
SimulationOrder
Enumeration for the scheme order of the simulation.
Definition Tools.h:148
Base class for a mesh cell.
Definition Cell.h:59
General class for Equation of State (EOS).
Definition Eos.h:62
size_t getConnectivity(std::vector< double > &dataset, std::vector< Cell * > *cellsLvl) const override
Store connectivities of mesh cells in a flat vector of double.
Definition MeshCartesianAMR.cpp:790
~MeshCartesianAMR() override
Definition MeshCartesianAMR.cpp:71
double m_xiJoin
Value of xi to split or join the cells.
Definition MeshCartesianAMR.h:162
void createGhostCell(const TypeMeshContainer< Cell * > &cells, TypeMeshContainer< Cell * > &cellsGhost, const SimulationOrder schemeOrder, const decomposition::Key< 3 > nKey, const int neighbour, const int cell_idx)
Definition MeshCartesianAMR.cpp:172
virtual void balance(TypeMeshContainer< Cell * > *cellsLvl, TypeMeshContainer< Cell * > *cellsLvlGhost, TypeMeshContainer< CellInterface * > *cellInterfacesLvl, SimulationOrder schemeOrder, const std::vector< AddPhys * > &addPhys, Eos **eos, int &nbCellsTotalAMR, std::vector< typename decomposition::Key< 3 >::value_type > &indicesSendStartGlobal, std::vector< typename decomposition::Key< 3 >::value_type > &indicesSendEndGlobal, std::vector< typename decomposition::Key< 3 >::value_type > &indicesReceiveStartGlobal, std::vector< typename decomposition::Key< 3 >::value_type > &indicesReceiveEndGlobal, std::vector< GeometricalDomain * > &solidDomains)
Definition MeshCartesianAMR.cpp:1303
void finalizeParallele(const int &lvlMax) override
Definition MeshCartesianAMR.cpp:1012
size_t getConnectivity_private(std::vector< T > &dataset, std::vector< Cell * > *cellsLvl) const
Definition MeshCartesianAMR.cpp:763
double m_xiSplit
Definition MeshCartesianAMR.h:162
void getTypeCell_private(std::vector< T > &dataset, std::vector< Cell * > *cellsLvl) const
Definition MeshCartesianAMR.cpp:856
void getData(TypeMeshContainer< Cell * > *cellsLvl, std::vector< double > &dataset, const int var, int phase) const override
Definition MeshCartesianAMR.cpp:883
void refineCellAndCellInterfaces(Cell *cell, const std::vector< AddPhys * > &addPhys, int &nbCellsTotalAMR) override
Definition MeshCartesianAMR.cpp:965
void getOffsets(std::vector< double > &dataset, std::vector< Cell * > *cellsLvl) const override
Store offsets in connectivity array of mesh cells.
Definition MeshCartesianAMR.cpp:834
bool m_varP
Definition MeshCartesianAMR.h:161
size_t getNodes(std::vector< double > &dataset, std::vector< Cell * > *cellsLvl) const override
Store coordinates of mesh nodes in a flat vector.
Definition MeshCartesianAMR.cpp:696
void initializeGeometrieAMR(TypeMeshContainer< Cell * > &cells, TypeMeshContainer< Cell * > &cellsGhost, TypeMeshContainer< CellInterface * > &cellInterfaces, const int &resumeSimulation, SimulationOrder schemeOrder)
Definition MeshCartesianAMR.cpp:89
int m_lvlMax
Niveau maximal sur l arbre AMR (si m_lvlMax = 0, pas d AMR).
Definition MeshCartesianAMR.h:159
bool m_varU
Definition MeshCartesianAMR.h:161
int initializeGeometrie(TypeMeshContainer< Cell * > &cells, TypeMeshContainer< Cell * > &cellsGhost, TypeMeshContainer< CellInterface * > &cellInterfaces, const int &resumeSimulation, bool, SimulationOrder schemeOrder) override
renvoi le number de dimensions (1,2 ou 3)
Definition MeshCartesianAMR.cpp:75
void writeHeaderPiece(std::ofstream &fileStream, TypeMeshContainer< Cell * > *cellsLvl) const override
Definition MeshCartesianAMR.cpp:677
bool m_varAlpha
Choice on which variation we coarsen or refine.
Definition MeshCartesianAMR.h:161
void initializePersistentCommunications(const TypeMeshContainer< Cell * > &cells, SimulationOrder schemeOrder) override
Definition MeshCartesianAMR.cpp:989
void parallelLoadBalancingAMR(TypeMeshContainer< Cell * > *cellsLvl, TypeMeshContainer< Cell * > *cellsLvlGhost, TypeMeshContainer< CellInterface * > *cellInterfacesLvl, SimulationOrder schemeOrder, const std::vector< AddPhys * > &addPhys, Eos **eos, int &nbCellsTotalAMR, std::vector< GeometricalDomain * > &solidDomains, bool init=false) override
Definition MeshCartesianAMR.cpp:1016
decomposition::Decomposition m_decomp
Parallel domain decomposition based on keys.
Definition MeshCartesianAMR.h:163
void getTypeCell(std::vector< double > &dataset, std::vector< Cell * > *cellsLvl) const override
Definition MeshCartesianAMR.cpp:879
std::string whoAmI() const override
Definition MeshCartesianAMR.cpp:671
double m_criteriaVar
Value of criteria to not pass on the variation of a variable for coarsening or refining (put xi=1....
Definition MeshCartesianAMR.h:160
void getOffsets_private(std::vector< T > &dataset, std::vector< Cell * > *cellsLvl, uint64_t maxVal) const
Definition MeshCartesianAMR.cpp:811
void procedureRaffinementInitialization(TypeMeshContainer< Cell * > *cellsLvl, TypeMeshContainer< Cell * > *cellsLvlGhost, TypeMeshContainer< CellInterface * > *cellInterfacesLvl, const std::vector< AddPhys * > &addPhys, int &nbCellsTotalAMR, std::vector< GeometricalDomain * > &domains, Eos **eos, const int &resumeSimulation, SimulationOrder schemeOrder, std::vector< GeometricalDomain * > &solidDomains) override
Definition MeshCartesianAMR.cpp:512
void createCellInterfacesFacesAndGhostCells(TypeMeshContainer< Cell * > &cells, TypeMeshContainer< Cell * > &cellsGhost, TypeMeshContainer< CellInterface * > &cellInterfaces, SimulationOrder schemeOrder)
Definition MeshCartesianAMR.cpp:234
void assignElementProperties(TypeMeshContainer< Cell * > &cells, std::vector< decomposition::Key< 3 > > &keys)
Definition MeshCartesianAMR.cpp:141
void procedureRaffinement(TypeMeshContainer< Cell * > *cellsLvl, TypeMeshContainer< Cell * > *cellsLvlGhost, TypeMeshContainer< CellInterface * > *cellInterfacesLvl, const int &lvl, const std::vector< AddPhys * > &addPhys, int &nbCellsTotalAMR, Eos **eos) override
Definition MeshCartesianAMR.cpp:561
void setDataSet(std::vector< double > &dataset, TypeMeshContainer< Cell * > *cellsLvl, const int var, int phase) const override
Definition MeshCartesianAMR.cpp:914
bool m_varRho
Definition MeshCartesianAMR.h:161
MeshCartesianAMR(double lX, int numberCellsX, double lY, int numberCellsY, double lZ, int numberCellsZ, std::vector< stretchZone > stretchX, std::vector< stretchZone > stretchY, std::vector< stretchZone > stretchZ, int lvlMax=0, double criteriaVar=1.e10, bool varRho=false, bool varP=false, bool varU=false, bool varAlpha=false, double xiSplit=1., double xiJoin=1.)
Definition MeshCartesianAMR.cpp:39
int getLvlMax() const override
Definition MeshCartesianAMR.h:118
void getData_private(TypeMeshContainer< Cell * > *cellsLvl, std::vector< T > &dataset, const int var, int phase) const
Definition MeshCartesianAMR.cpp:898
void printDomainDecomposition(std::ofstream &fileStream) override
Definition MeshCartesianAMR.cpp:974
virtual void computePotentialBalancing(TypeMeshContainer< Cell * > *cellsLvl, bool init, int lvl, bool &balance, std::vector< typename decomposition::Key< 3 >::value_type > &indicesSendStartGlobal, std::vector< typename decomposition::Key< 3 >::value_type > &indicesSendEndGlobal, std::vector< typename decomposition::Key< 3 >::value_type > &indicesReceiveStartGlobal, std::vector< typename decomposition::Key< 3 >::value_type > &indicesReceiveEndGlobal)
Definition MeshCartesianAMR.cpp:1068
void readDomainDecomposition(std::ifstream &fileStream) override
Definition MeshCartesianAMR.cpp:978
MeshCartesian(double lX, int numberCellsX, double lY, int numberCellsY, double lZ, int numberCellsZ, std::vector< stretchZone > stretchX, std::vector< stretchZone > stretchY, std::vector< stretchZone > stretchZ)
Definition MeshCartesian.cpp:36
Definition decomposition.hpp:43
Definition key.hpp:43
unsigned long long int value_type
Definition key.hpp:46