27 #ifndef OPM_GENERIC_CPGRID_VANGUARD_HPP 28 #define OPM_GENERIC_CPGRID_VANGUARD_HPP 30 #include <opm/grid/CpGrid.hpp> 31 #include <opm/grid/cpgrid/LevelCartesianIndexMapper.hpp> 48 class ParallelEclipseState;
56 class MPIPartitionFromFile
59 explicit MPIPartitionFromFile(
const std::filesystem::path& partitionFile)
60 : partitionFile_(partitionFile)
63 std::vector<int> operator()(
const Dune::CpGrid& grid)
const;
66 std::filesystem::path partitionFile_{};
76 extern std::optional<std::function<std::vector<int> (
const Dune::CpGrid&)>>
externalLoadBalancer;
78 template<
class ElementMapper,
class Gr
idView,
class Scalar>
83 using Element =
typename GridView::template Codim<0>::Entity;
99 const Dune::CpGrid&
grid()
const 147 const std::vector<int>& cellPartition()
const 149 return this->cell_part_;
159 void doLoadBalance_(
const Dune::EdgeWeightMethod edgeWeightsMethod,
160 const bool ownersFirst,
161 const bool addCorners,
162 const int numOverlap,
163 const Dune::PartitionMethod partitionMethod,
164 const bool serialPartitioning,
165 const bool enableDistributedWells,
166 const bool allowSplittingInactiveWells,
167 const double imbalanceTol,
168 const GridView& gridView,
169 const Schedule& schedule,
170 EclipseState& eclState,
171 FlowGenericVanguard::ParallelWellStruct& parallelWells,
172 const int numJacobiBlocks,
173 const bool enableEclOutput);
175 void distributeFieldProps_(EclipseState& eclState);
178 std::vector<double> extractFaceTrans(
const GridView& gridView)
const;
180 void distributeGrid(
const Dune::EdgeWeightMethod edgeWeightsMethod,
181 const bool ownersFirst,
182 const bool addCorners,
183 const int numOverlap,
184 const Dune::PartitionMethod partitionMethod,
185 const bool serialPartitioning,
186 const bool enableDistributedWells,
187 const double imbalanceTol,
188 const bool loadBalancerSet,
189 const bool useTransToFilterOverlap,
190 const std::vector<double>& faceTrans,
191 const std::vector<Well>& wells,
192 const std::unordered_map<std::string, std::set<int>>& possibleFutureConnections,
193 EclipseState& eclState,
194 FlowGenericVanguard::ParallelWellStruct& parallelWells);
196 void distributeGrid(
const Dune::EdgeWeightMethod edgeWeightsMethod,
197 const bool ownersFirst,
198 const bool addCorners,
199 const int numOverlap,
200 const Dune::PartitionMethod partitionMethod,
201 const bool serialPartitioning,
202 const bool enableDistributedWells,
203 const double imbalanceTol,
204 const bool loadBalancerSet,
205 const bool useTransToFilterOverlap,
206 const std::vector<double>& faceTrans,
207 const std::vector<Well>& wells,
208 const std::unordered_map<std::string, std::set<int>>& possibleFutureConnections,
209 ParallelEclipseState* eclState,
210 FlowGenericVanguard::ParallelWellStruct& parallelWells);
213 virtual const std::string& zoltanParams()
const = 0;
214 virtual double zoltanPhgEdgeSizeThreshold()
const = 0;
215 virtual const std::string& metisParams()
const = 0;
221 void doCreateGrids_(
bool edge_conformal, EclipseState& eclState);
222 void addLgrsUpdateLeafView(
const LgrCollection& lgrCollection,
226 virtual void allocTrans() = 0;
227 virtual double getTransmissibility(
unsigned I,
unsigned J)
const = 0;
229 Scalar computeCellThickness(
const Element& element)
const;
231 std::unique_ptr<Dune::CpGrid> grid_;
232 std::unique_ptr<Dune::CpGrid> equilGrid_;
233 std::unique_ptr<CartesianIndexMapper> cartesianIndexMapper_;
234 std::unique_ptr<CartesianIndexMapper> equilCartesianIndexMapper_;
235 std::unique_ptr<LevelCartesianIndexMapper> levelCartesianIndexMapper_;
238 std::vector<int> cell_part_{};
243 #endif // OPM_GENERIC_CPGRID_VANGUARD_HPP const CartesianIndexMapper & equilCartesianIndexMapper() const
Returns mapper from compressed to cartesian indices for the EQUIL grid.
Definition: GenericCpGridVanguard.cpp:636
Definition: EclGenericWriter.hpp:52
Helper class for grid instantiation of ECL file-format using problems.
void allocCartMapper()
Distribute the simulation grid over multiple processes.
Dune::CpGrid & grid()
Return a reference to the simulation grid.
Definition: GenericCpGridVanguard.hpp:93
Definition: GenericCpGridVanguard.hpp:79
Structs needed for tpfalinearizer and its gpuparams struct extracted to be defined in one place that ...
Definition: blackoilbioeffectsmodules.hh:45
void releaseEquilGrid()
Indicates that the initial condition has been computed and the memory used by the EQUIL grid can be r...
Definition: GenericCpGridVanguard.cpp:145
static void setExternalLoadBalancer(const std::function< std::vector< int >(const Dune::CpGrid &)> &loadBalancer)
Sets a function that returns external load balancing information when passed the grid.
Definition: GenericCpGridVanguard.hpp:125
const Dune::CpGrid & grid() const
Return a reference to the simulation grid.
Definition: GenericCpGridVanguard.hpp:99
const CartesianIndexMapper & cartesianIndexMapper() const
Returns the object which maps a global element index of the simulation grid to the corresponding elem...
Definition: GenericCpGridVanguard.cpp:622
const LevelCartesianIndexMapper levelCartesianIndexMapper() const
Returns the object which maps a global element index of the simulation grid to the corresponding elem...
Definition: GenericCpGridVanguard.cpp:629
Definition: CollectDataOnIORank.hpp:50
std::optional< std::function< std::vector< int >const Dune::CpGrid &)> > externalLoadBalancer
optional functor returning external load balancing information
Definition: GenericCpGridVanguard.cpp:132
const Dune::CpGrid & equilGrid() const
Returns a refefence to the grid which should be used by the EQUIL initialization code.
Definition: GenericCpGridVanguard.cpp:614