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 std::vector<double>& faceTrans,
190 const std::vector<Well>& wells,
191 const std::unordered_map<std::string, std::set<int>>& possibleFutureConnections,
192 EclipseState& eclState,
193 FlowGenericVanguard::ParallelWellStruct& parallelWells);
195 void distributeGrid(
const Dune::EdgeWeightMethod edgeWeightsMethod,
196 const bool ownersFirst,
197 const bool addCorners,
198 const int numOverlap,
199 const Dune::PartitionMethod partitionMethod,
200 const bool serialPartitioning,
201 const bool enableDistributedWells,
202 const double imbalanceTol,
203 const bool loadBalancerSet,
204 const std::vector<double>& faceTrans,
205 const std::vector<Well>& wells,
206 const std::unordered_map<std::string, std::set<int>>& possibleFutureConnections,
207 ParallelEclipseState* eclState,
208 FlowGenericVanguard::ParallelWellStruct& parallelWells);
211 virtual const std::string& zoltanParams()
const = 0;
212 virtual double zoltanPhgEdgeSizeThreshold()
const = 0;
213 virtual const std::string& metisParams()
const = 0;
219 void doCreateGrids_(
bool edge_conformal, EclipseState& eclState);
220 void addLgrsUpdateLeafView(
const LgrCollection& lgrCollection,
224 virtual void allocTrans() = 0;
225 virtual double getTransmissibility(
unsigned I,
unsigned J)
const = 0;
227 Scalar computeCellThickness(
const Element& element)
const;
229 std::unique_ptr<Dune::CpGrid> grid_;
230 std::unique_ptr<Dune::CpGrid> equilGrid_;
231 std::unique_ptr<CartesianIndexMapper> cartesianIndexMapper_;
232 std::unique_ptr<CartesianIndexMapper> equilCartesianIndexMapper_;
233 std::unique_ptr<LevelCartesianIndexMapper> levelCartesianIndexMapper_;
236 std::vector<int> cell_part_{};
241 #endif // OPM_GENERIC_CPGRID_VANGUARD_HPP const CartesianIndexMapper & equilCartesianIndexMapper() const
Returns mapper from compressed to cartesian indices for the EQUIL grid.
Definition: GenericCpGridVanguard.cpp:627
Definition: EclGenericWriter.hpp:50
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
This file contains a set of helper functions used by VFPProd / VFPInj.
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:144
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:613
const LevelCartesianIndexMapper levelCartesianIndexMapper() const
Returns the object which maps a global element index of the simulation grid to the corresponding elem...
Definition: GenericCpGridVanguard.cpp:620
Definition: CollectDataOnIORank.hpp:49
std::optional< std::function< std::vector< int >const Dune::CpGrid &)> > externalLoadBalancer
optional functor returning external load balancing information
Definition: GenericCpGridVanguard.cpp:131
const Dune::CpGrid & equilGrid() const
Returns a refefence to the grid which should be used by the EQUIL initialization code.
Definition: GenericCpGridVanguard.cpp:605