27#ifndef OPM_GENERIC_CPGRID_VANGUARD_HPP
28#define OPM_GENERIC_CPGRID_VANGUARD_HPP
30#include <opm/grid/CpGrid.hpp>
47 class ParallelEclipseState;
55class MPIPartitionFromFile
58 explicit MPIPartitionFromFile(
const std::filesystem::path& partitionFile)
59 : partitionFile_(partitionFile)
62 std::vector<int> operator()(
const Dune::CpGrid& grid)
const;
65 std::filesystem::path partitionFile_{};
77template<
class ElementMapper,
class Gr
idView,
class Scalar>
81 using Element =
typename GridView::template Codim<0>::Entity;
97 const Dune::CpGrid&
grid()
const
139 const std::vector<int>& cellPartition()
const
141 return this->cell_part_;
151 void doLoadBalance_(
const Dune::EdgeWeightMethod edgeWeightsMethod,
152 const bool ownersFirst,
153 const bool serialPartitioning,
154 const bool enableDistributedWells,
155 const double zoltanImbalanceTol,
156 const GridView& gridView,
157 const Schedule& schedule,
158 EclipseState& eclState,
159 FlowGenericVanguard::ParallelWellStruct& parallelWells,
160 const int numJacobiBlocks);
162 void distributeFieldProps_(EclipseState& eclState);
165 std::vector<double> extractFaceTrans(
const GridView& gridView)
const;
167 void distributeGrid(
const Dune::EdgeWeightMethod edgeWeightsMethod,
168 const bool ownersFirst,
169 const bool serialPartitioning,
170 const bool enableDistributedWells,
171 const double zoltanImbalanceTol,
172 const bool loadBalancerSet,
173 const std::vector<double>& faceTrans,
174 const std::vector<Well>& wells,
175 EclipseState& eclState,
176 FlowGenericVanguard::ParallelWellStruct& parallelWells);
178 void distributeGrid(
const Dune::EdgeWeightMethod edgeWeightsMethod,
179 const bool ownersFirst,
180 const bool serialPartitioning,
181 const bool enableDistributedWells,
182 const double zoltanImbalanceTol,
183 const bool loadBalancerSet,
184 const std::vector<double>& faceTrans,
185 const std::vector<Well>& wells,
186 ParallelEclipseState* eclState,
187 FlowGenericVanguard::ParallelWellStruct& parallelWells);
190 virtual const std::string& zoltanParams()
const = 0;
196 void doCreateGrids_(EclipseState& eclState);
197 void addLgrsUpdateLeafView(
const LgrCollection& lgrCollection,
const int lgrsSize);
199 virtual void allocTrans() = 0;
200 virtual double getTransmissibility(
unsigned I,
unsigned J)
const = 0;
203 void doFilterConnections_(Schedule& schedule);
205 Scalar computeCellThickness(
const Element& element)
const;
207 std::unique_ptr<Dune::CpGrid> grid_;
208 std::unique_ptr<Dune::CpGrid> equilGrid_;
209 std::unique_ptr<CartesianIndexMapper> cartesianIndexMapper_;
210 std::unique_ptr<CartesianIndexMapper> equilCartesianIndexMapper_;
213 std::vector<int> cell_part_{};
Helper class for grid instantiation of ECL file-format using problems.
Definition CollectDataOnIORank.hpp:49
Definition GenericCpGridVanguard.hpp:78
void releaseEquilGrid()
Indicates that the initial condition has been computed and the memory used by the EQUIL grid can be r...
Definition GenericCpGridVanguard.cpp:136
const Dune::CpGrid & equilGrid() const
Returns a refefence to the grid which should be used by the EQUIL initialization code.
Definition GenericCpGridVanguard.cpp:535
const CartesianIndexMapper & cartesianIndexMapper() const
Returns the object which maps a global element index of the simulation grid to the corresponding elem...
Definition GenericCpGridVanguard.cpp:543
const CartesianIndexMapper & equilCartesianIndexMapper() const
Returns mapper from compressed to cartesian indices for the EQUIL grid.
Definition GenericCpGridVanguard.cpp:550
const Dune::CpGrid & grid() const
Return a reference to the simulation grid.
Definition GenericCpGridVanguard.hpp:97
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:123
Dune::CpGrid & grid()
Return a reference to the simulation grid.
Definition GenericCpGridVanguard.hpp:91
void allocCartMapper()
Distribute the simulation grid over multiple processes.
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition BlackoilPhases.hpp:27
std::optional< std::function< std::vector< int >(const Dune::CpGrid &)> > externalLoadBalancer
optional functor returning external load balancing information
Definition GenericCpGridVanguard.cpp:123