27 #ifndef OPM_CPGRID_VANGUARD_HPP 28 #define OPM_CPGRID_VANGUARD_HPP 30 #include <opm/common/TimingMacros.hpp> 47 template <
class TypeTag>
55 using InheritsFrom = std::tuple<FlowBaseVanguard>;
60 template<
class TypeTag>
64 template<
class TypeTag>
66 using type = Dune::CpGrid;
68 template<
class TypeTag>
84 template <
class TypeTag>
87 GetPropType<TypeTag, Properties::GridView>,
88 GetPropType<TypeTag, Properties::Scalar>>
103 static constexpr
int dimensionworld = Grid::dimensionworld;
105 static constexpr
bool waterEnabled = Indices::waterEnabled;
106 static constexpr
bool gasEnabled = Indices::gasEnabled;
107 static constexpr
bool oilEnabled = Indices::oilEnabled;
109 using Element =
typename GridView::template Codim<0>::Entity;
116 this->callImplementationInit();
119 int compressedIndexForInteriorLGR(
const std::string& lgr_tag,
const Connection& conn)
const override 121 const std::array<int,3> lgr_ijk = {conn.getI(), conn.getJ(), conn.getK()};
122 const auto& lgr_level = this->
grid().getLgrNameToLevel().at(lgr_tag);
126 const auto& lgr_dim = this->
grid().currentData()[lgr_level]->logicalCartesianSize();
127 const auto lgr_cartesian_index = (lgr_ijk[2]*lgr_dim[0]*lgr_dim[1]) + (lgr_ijk[1]*lgr_dim[0]) + (lgr_ijk[0]);
135 const auto& runspec = this->
eclState().runspec();
136 const auto& config = this->
eclState().getSimulationConfig();
137 const auto& phases = runspec.phases();
140 if (config.isThermal()) {
141 if (getPropValue<TypeTag, Properties::EnergyModuleType>() != EnergyModules::FullyImplicitThermal) {
142 throw std::runtime_error(
"Input specifies energy while simulator has disabled it, try xxx_energy");
145 if (getPropValue<TypeTag, Properties::EnergyModuleType>() == EnergyModules::FullyImplicitThermal) {
146 throw std::runtime_error(
"Input specifies no energy while simulator has energy, try run without _energy");
150 if (config.isDiffusive()) {
151 if (getPropValue<TypeTag, Properties::EnableDiffusion>() ==
false) {
152 throw std::runtime_error(
"Input specifies diffusion while simulator has disabled it, try xxx_diffusion");
156 if (runspec.micp()) {
157 if (getPropValue<TypeTag, Properties::EnableBioeffects>() ==
false) {
158 throw std::runtime_error(
"Input specifies MICP while simulator has it disabled");
162 if (runspec.biof()) {
163 if (getPropValue<TypeTag, Properties::EnableBioeffects>() ==
false) {
164 throw std::runtime_error(
"Input specifies Biofilm while simulator has it disabled");
168 if (phases.active(Phase::BRINE)) {
169 if (getPropValue<TypeTag, Properties::EnableBrine>() ==
false) {
170 throw std::runtime_error(
"Input specifies Brine while simulator has it disabled");
174 if (phases.active(Phase::POLYMER)) {
175 if (getPropValue<TypeTag, Properties::EnablePolymer>() ==
false) {
176 throw std::runtime_error(
"Input specifies Polymer while simulator has it disabled");
181 if (phases.active(Phase::ZFRACTION)) {
182 if (getPropValue<TypeTag, Properties::EnableExtbo>() ==
false) {
183 throw std::runtime_error(
"Input specifies ExBo while simulator has it disabled");
186 if (phases.active(Phase::FOAM)) {
187 if (getPropValue<TypeTag, Properties::EnableFoam>() ==
false) {
188 throw std::runtime_error(
"Input specifies Foam while simulator has it disabled");
192 if (phases.active(Phase::SOLVENT)) {
193 if (getPropValue<TypeTag, Properties::EnableSolvent>() ==
false) {
194 throw std::runtime_error(
"Input specifies Solvent while simulator has it disabled");
197 if(phases.active(Phase::WATER)){
198 if(waterEnabled ==
false){
199 throw std::runtime_error(
"Input specifies water while simulator has it disabled");
202 if(phases.active(Phase::GAS)){
203 if(gasEnabled ==
false){
204 throw std::runtime_error(
"Input specifies gas while simulator has it disabled");
207 if(phases.active(Phase::OIL)){
208 if(oilEnabled ==
false){
209 throw std::runtime_error(
"Input specifies oil while simulator has it disabled");
222 globalTrans_.reset();
225 const TransmissibilityType& globalTransmissibility()
const 227 assert( globalTrans_ !=
nullptr );
228 return *globalTrans_;
239 if (
const auto& extPFile = this->externalPartitionFile();
240 !extPFile.empty() && (extPFile !=
"none"))
246 this->addCorners(), this->numOverlap(),
247 this->partitionMethod(), this->serialPartitioning(),
249 this->allow_splitting_inactive_wells_,
250 this->imbalanceTol(),
256 this->updateGridView_();
257 this->updateCartesianToCompressedMapping_();
258 this->updateCellDepths_();
259 this->updateCellThickness_();
262 this->distributeFieldProps_(this->
eclState());
273 if (
const auto& lgrs = this->
eclState().getLgrs(); lgrs.size() > 0) {
274 OpmLog::info(
"\nAdding LGRs to the grid and updating its leaf grid view");
275 this->addLgrsUpdateLeafView(lgrs, lgrs.size(), *this->grid_);
277 this->updateGridView_();
278 this->updateCellDepths_();
279 this->updateCellThickness_();
281 if (this->grid_->comm().size()>1) {
285 OpmLog::info(
"\nAdding LGRs to the global view and updating its leaf grid view");
286 this->grid_->switchToGlobalView();
287 this->addLgrsUpdateLeafView(lgrs, lgrs.size(), *this->grid_);
288 this->grid_->switchToDistributedView();
289 this->grid_->syncDistributedGlobalCellIds();
294 unsigned int gridEquilIdxToGridIdx(
unsigned int elemIndex)
const {
298 unsigned int gridIdxToEquilGridIdx(
unsigned int elemIndex)
const {
308 std::function<std::array<double,dimensionworld>(int)>
314 const std::vector<int>& globalCell()
316 return this->
grid().globalCell();
322 this->doCreateGrids_(this->edgeConformal(), this->
eclState());
325 void allocTrans()
override 327 OPM_TIMEBLOCK(allocateTrans);
328 globalTrans_.reset(
new TransmissibilityType(this->
eclState(),
333 getPropValue<TypeTag, Properties::EnergyModuleType>() == EnergyModules::FullyImplicitThermal ||
334 getPropValue<TypeTag, Properties::EnergyModuleType>() == EnergyModules::SequentialImplicitThermal,
335 getPropValue<TypeTag, Properties::EnableDiffusion>(),
336 getPropValue<TypeTag, Properties::EnableDispersion>()));
337 globalTrans_->update(
false, TransmissibilityType::TransUpdateQuantities::Trans);
340 double getTransmissibility(
unsigned I,
unsigned J)
const override 342 return globalTrans_->transmissibility(I,J);
346 const std::string& zoltanParams()
const override 348 return this->zoltanParams_;
351 double zoltanPhgEdgeSizeThreshold()
const override 353 return this->zoltanPhgEdgeSizeThreshold_;
356 const std::string& metisParams()
const override 358 return this->metisParams_;
366 std::unique_ptr<TransmissibilityType> globalTrans_;
371 #endif // OPM_CPGRID_VANGUARD_HPP const Schedule & schedule() const
Return a reference to the object that managages the ECL schedule.
Definition: FlowGenericVanguard.hpp:177
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type::type GetPropType
get the type alias defined in the property (equivalent to old macro GET_PROP_TYPE(...))
Definition: propertysystem.hh:233
Dune::EdgeWeightMethod edgeWeightsMethod() const
Parameter deciding the edge-weight strategy of the load balancer.
Definition: FlowGenericVanguard.hpp:242
int numJacobiBlocks() const
Number of blocks in the Block-Jacobi preconditioner.
Definition: FlowGenericVanguard.hpp:248
const EclipseState & eclState() const
Return a reference to the internalized ECL deck.
Definition: FlowGenericVanguard.hpp:168
void checkConsistency()
Checking consistency of simulator.
Definition: CpGridVanguard.hpp:133
Definition: CpGridVanguard.hpp:54
Helper class for grid instantiation of ECL file-format using problems.
bool ownersFirst() const
Parameter that decide if cells owned by rank are ordered before ghost cells.
Definition: FlowGenericVanguard.hpp:260
const GridView & gridView() const
Returns a reference to the grid view to be used.
Definition: basevanguard.hh:70
std::optional< std::vector< std::unordered_map< std::size_t, std::size_t > > > lgrMappers_
Mapping between LGR cartesian and compressed cells.
Definition: FlowBaseVanguard.hpp:450
bool enableDistributedWells() const
Whether perforations of a well might be distributed.
Definition: FlowGenericVanguard.hpp:311
Defines the common properties required by the porous medium multi-phase models.
bool enableEclOutput() const
Whether or not to emit result files that are compatible with a commercial reservoir simulator...
Definition: FlowGenericVanguard.hpp:318
Dune::CpGrid & grid()
Return a reference to the simulation grid.
Definition: GenericCpGridVanguard.hpp:93
Definition: FlowBaseVanguard.hpp:70
Definition: GenericCpGridVanguard.hpp:79
Structs needed for tpfalinearizer and its gpuparams struct extracted to be defined in one place that ...
Definition: blackoilbioeffectsmodules.hh:45
std::function< std::array< double, dimensionworld >int)> cellCentroids() const
Get function to query cell centroids for a distributed grid.
Definition: CpGridVanguard.hpp:309
Declares the properties required by the black oil model.
void addLgrs()
Add LGRs and update Leaf Grid View in the simulation grid.
Definition: CpGridVanguard.hpp:269
Helper class for grid instantiation of ECL file-format using problems.
This file ensures that flow can be compiled in the presence of dune-fem.
void loadBalance()
Distribute the simulation grid over multiple processes.
Definition: CpGridVanguard.hpp:236
The type of the DUNE grid.
Definition: basicproperties.hh:104
Property which provides a Vanguard (manages grids)
Definition: basicproperties.hh:100
Helper class for grid instantiation of ECL file-format using problems.
Definition: FlowBaseVanguard.hpp:56
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 CartesianIndexMapper & cartesianIndexMapper() const
Returns the object which maps a global element index of the simulation grid to the corresponding elem...
Definition: GenericCpGridVanguard.cpp:622
Helper class for grid instantiation of ECL file-format using problems.
Definition: CpGridVanguard.hpp:48
Definition: Transmissibility.hpp:54
void releaseGlobalTransmissibilities()
Free the memory occupied by the global transmissibility object.
Definition: CpGridVanguard.hpp:220
ParallelWellStruct parallelWells_
Information about wells in parallel.
Definition: FlowGenericVanguard.hpp:431
Definition: CollectDataOnIORank.hpp:50
Manages the initializing and running of time dependent problems.
Definition: simulator.hh:83
Definition: blackoilmodel.hh:75
std::function< std::array< double, dimensionworld >int)> cellCentroids_(const CartMapper &cartMapper, const bool &isCpGrid) const
Get function to query cell centroids for a distributed grid.
Definition: FlowBaseVanguard.hpp:305