27#ifndef OPM_CPGRID_VANGUARD_HPP
28#define OPM_CPGRID_VANGUARD_HPP
30#include <opm/common/TimingMacros.hpp>
32#include <opm/models/common/multiphasebaseproperties.hh>
33#include <opm/models/blackoil/blackoilproperties.hh>
48template <
class TypeTag>
52namespace Opm::Properties {
56 using InheritsFrom = std::tuple<FlowBaseVanguard>;
61template<
class TypeTag>
65template<
class TypeTag>
67 using type = Dune::CpGrid;
69template<
class TypeTag>
71 using type = GetPropType<TypeTag, Properties::Grid>;
85template <
class TypeTag>
88 GetPropType<TypeTag, Properties::GridView>,
89 GetPropType<TypeTag, Properties::Scalar>>
94 using Scalar = GetPropType<TypeTag, Properties::Scalar>;
95 using Simulator = GetPropType<TypeTag, Properties::Simulator>;
96 using ElementMapper = GetPropType<TypeTag, Properties::ElementMapper>;
99 using Grid = GetPropType<TypeTag, Properties::Grid>;
101 using EquilGrid = GetPropType<TypeTag, Properties::EquilGrid>;
102 using GridView = GetPropType<TypeTag, Properties::GridView>;
104 static constexpr int dimensionworld = Grid::dimensionworld;
105 using Indices = GetPropType<TypeTag, Properties::Indices>;
106 static constexpr bool waterEnabled = Indices::waterEnabled;
107 static constexpr bool gasEnabled = Indices::gasEnabled;
108 static constexpr bool oilEnabled = Indices::oilEnabled;
110 using Element =
typename GridView::template Codim<0>::Entity;
117 this->callImplementationInit();
125 const auto& runspec = this->
eclState().runspec();
126 const auto& config = this->
eclState().getSimulationConfig();
127 const auto& phases = runspec.phases();
130 if (config.isThermal()) {
131 if (getPropValue<TypeTag, Properties::EnableEnergy>() ==
false) {
132 throw std::runtime_error(
"Input specifies energy while simulator has disabled it, try xxx_energy");
135 if (getPropValue<TypeTag, Properties::EnableEnergy>() ==
true) {
136 throw std::runtime_error(
"Input specifies no energy while simulator has energy, try run without _energy");
140 if (config.isDiffusive()) {
141 if (getPropValue<TypeTag, Properties::EnableDiffusion>() ==
false) {
142 throw std::runtime_error(
"Input specifies diffusion while simulator has disabled it, try xxx_diffusion");
146 if (runspec.micp()) {
147 if (getPropValue<TypeTag, Properties::EnableMICP>() ==
false) {
148 throw std::runtime_error(
"Input specifies MICP while simulator has it disabled");
152 if (phases.active(Phase::BRINE)) {
153 if (getPropValue<TypeTag, Properties::EnableBrine>() ==
false) {
154 throw std::runtime_error(
"Input specifies Brine while simulator has it disabled");
158 if (phases.active(Phase::POLYMER)) {
159 if (getPropValue<TypeTag, Properties::EnablePolymer>() ==
false) {
160 throw std::runtime_error(
"Input specifies Polymer while simulator has it disabled");
165 if (phases.active(Phase::ZFRACTION)) {
166 if (getPropValue<TypeTag, Properties::EnableExtbo>() ==
false) {
167 throw std::runtime_error(
"Input specifies ExBo while simulator has it disabled");
170 if (phases.active(Phase::FOAM)) {
171 if (getPropValue<TypeTag, Properties::EnableFoam>() ==
false) {
172 throw std::runtime_error(
"Input specifies Foam while simulator has it disabled");
176 if (phases.active(Phase::SOLVENT)) {
177 if (getPropValue<TypeTag, Properties::EnableSolvent>() ==
false) {
178 throw std::runtime_error(
"Input specifies Solvent while simulator has it disabled");
181 if(phases.active(Phase::WATER)){
182 if(waterEnabled ==
false){
183 throw std::runtime_error(
"Input specifies water while simulator has it disabled");
186 if(phases.active(Phase::GAS)){
187 if(gasEnabled ==
false){
188 throw std::runtime_error(
"Input specifies gas while simulator has it disabled");
191 if(phases.active(Phase::OIL)){
192 if(oilEnabled ==
false){
193 throw std::runtime_error(
"Input specifies oil while simulator has it disabled");
206 globalTrans_.reset();
209 const TransmissibilityType& globalTransmissibility()
const
211 assert( globalTrans_ !=
nullptr );
212 return *globalTrans_;
215 void releaseGlobalTransmissibility()
217 globalTrans_.reset();
228 if (
const auto& extPFile = this->externalPartitionFile();
229 !extPFile.empty() && (extPFile !=
"none"))
236 this->zoltanImbalanceTol(), this->gridView(),
241 this->updateGridView_();
242 this->updateCartesianToCompressedMapping_();
243 this->updateCellDepths_();
244 this->updateCellThickness_();
247 this->distributeFieldProps_(this->
eclState());
251 unsigned int gridEquilIdxToGridIdx(
unsigned int elemIndex)
const {
255 unsigned int gridIdxToEquilGridIdx(
unsigned int elemIndex)
const {
265 std::function<std::array<double,dimensionworld>(
int)>
271 const std::vector<int>& globalCell()
273 return this->
grid().globalCell();
279 this->doCreateGrids_(this->
eclState());
282 void allocTrans()
override
284 OPM_TIMEBLOCK(allocateTrans);
285 globalTrans_.reset(
new TransmissibilityType(this->
eclState(),
290 getPropValue<TypeTag, Properties::EnableEnergy>(),
291 getPropValue<TypeTag, Properties::EnableDiffusion>(),
292 getPropValue<TypeTag, Properties::EnableDispersion>()));
293 globalTrans_->update(
false);
296 double getTransmissibility(
unsigned I,
unsigned J)
const override
298 return globalTrans_->transmissibility(I,J);
302 const std::string& zoltanParams()
const override
304 return this->zoltanParams_;
309 void filterConnections_()
311 this->doFilterConnections_(this->
schedule());
314 std::unique_ptr<TransmissibilityType> globalTrans_;
This file ensures that flow can be compiled in the presence of dune-fem.
Helper class for grid instantiation of ECL file-format using problems.
Helper class for grid instantiation of ECL file-format using problems.
Definition CollectDataOnIORank.hpp:49
Helper class for grid instantiation of ECL file-format using problems.
Definition CpGridVanguard.hpp:90
void releaseGlobalTransmissibilities()
Free the memory occupied by the global transmissibility object.
Definition CpGridVanguard.hpp:204
void checkConsistency()
Checking consistency of simulator.
Definition CpGridVanguard.hpp:123
std::function< std::array< double, dimensionworld >(int)> cellCentroids() const
Get function to query cell centroids for a distributed grid.
Definition CpGridVanguard.hpp:266
void loadBalance()
Distribute the simulation grid over multiple processes.
Definition CpGridVanguard.hpp:225
Helper class for grid instantiation of ECL file-format using problems.
Definition FlowBaseVanguard.hpp:216
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:496
int numJacobiBlocks() const
Number of blocks in the Block-Jacobi preconditioner.
Definition FlowGenericVanguard.hpp:200
const Schedule & schedule() const
Return a reference to the object that managages the ECL schedule.
Definition FlowGenericVanguard.hpp:129
ParallelWellStruct parallelWells_
Information about wells in parallel.
Definition FlowGenericVanguard.hpp:328
bool enableDistributedWells() const
Whether perforations of a well might be distributed.
Definition FlowGenericVanguard.hpp:238
const EclipseState & eclState() const
Return a reference to the internalized ECL deck.
Definition FlowGenericVanguard.hpp:120
bool ownersFirst() const
Parameter that decide if cells owned by rank are ordered before ghost cells.
Definition FlowGenericVanguard.hpp:212
Dune::EdgeWeightMethod edgeWeightsMethod() const
Parameter deciding the edge-weight strategy of the load balancer.
Definition FlowGenericVanguard.hpp:194
Definition GenericCpGridVanguard.hpp:78
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
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
Definition Transmissibility.hpp:54
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition BlackoilPhases.hpp:27
Definition FlowBaseVanguard.hpp:64
Definition CpGridVanguard.hpp:55