30#ifndef OPM_FLOW_PROBLEM_HPP
31#define OPM_FLOW_PROBLEM_HPP
33#include <dune/common/version.hh>
34#include <dune/common/fvector.hh>
35#include <dune/common/fmatrix.hh>
37#include <opm/common/utility/TimeService.hpp>
39#include <opm/input/eclipse/EclipseState/EclipseState.hpp>
40#include <opm/input/eclipse/Parser/ParserKeywords/E.hpp>
41#include <opm/input/eclipse/Schedule/Schedule.hpp>
43#include <opm/material/common/ConditionalStorage.hpp>
44#include <opm/material/common/Valgrind.hpp>
45#include <opm/material/densead/Evaluation.hpp>
46#include <opm/material/fluidmatrixinteractions/EclMaterialLawManager.hpp>
47#include <opm/material/thermal/EclThermalLawManager.hpp>
53#include <opm/output/eclipse/EclipseIO.hpp>
62#include <opm/simulators/flow/FlowUtils.hpp>
65#include <opm/simulators/timestepping/AdaptiveTimeStepping.hpp>
66#include <opm/simulators/timestepping/SimulatorReport.hpp>
68#include <opm/simulators/utils/DeferredLoggingErrorHelpers.hpp>
69#include <opm/simulators/utils/ParallelSerialization.hpp>
70#include <opm/simulators/utils/satfunc/RelpermDiagnostics.hpp>
72#include <opm/utility/CopyablePtr.hpp>
88template <
class TypeTag>
91 GetPropType<TypeTag, Properties::FluidSystem>>
108 enum { dim = GridView::dimension };
109 enum { dimWorld = GridView::dimensionworld };
113 enum { numPhases = FluidSystem::numPhases };
114 enum { numComponents = FluidSystem::numComponents };
132 enum { gasPhaseIdx = FluidSystem::gasPhaseIdx };
133 enum { oilPhaseIdx = FluidSystem::oilPhaseIdx };
134 enum { waterPhaseIdx = FluidSystem::waterPhaseIdx };
138 enum { gasCompIdx = FluidSystem::gasCompIdx };
139 enum { oilCompIdx = FluidSystem::oilCompIdx };
140 enum { waterCompIdx = FluidSystem::waterCompIdx };
145 using Element =
typename GridView::template Codim<0>::Entity;
149 using MaterialLawParams =
typename EclMaterialLawManager::MaterialLawParams;
150 using SolidEnergyLawParams =
typename EclThermalLawManager::SolidEnergyLawParams;
151 using ThermalConductionLawParams =
typename EclThermalLawManager::ThermalConductionLawParams;
161 using DimMatrix = Dune::FieldMatrix<Scalar, dimWorld, dimWorld>;
165 using DirectionalMobilityPtr = Utility::CopyablePtr<DirectionalMobility<TypeTag, Evaluation>>;
181 ParentType::registerParameters();
191 const std::string&)>
addKey,
199 return detail::eclPositionalParameter(
addKey,
210 : ParentType(simulator)
211 ,
BaseType(simulator.vanguard().eclState(),
212 simulator.vanguard().schedule(),
213 simulator.vanguard().gridView())
214 , transmissibilities_(simulator.vanguard().eclState(),
215 simulator.vanguard().gridView(),
216 simulator.vanguard().cartesianIndexMapper(),
217 simulator.vanguard().grid(),
218 simulator.vanguard().cellCentroids(),
222 , wellModel_(simulator)
223 , aquiferModel_(simulator)
224 , pffDofData_(simulator.gridView(),
this->elementMapper())
225 , tracerModel_(simulator)
227 const auto& vanguard = simulator.vanguard();
229 enableDriftCompensation_ = Parameters::Get<Parameters::EnableDriftCompensation>();
231 enableVtkOutput_ = Parameters::Get<Parameters::EnableVtkOutput>();
233 this->enableTuning_ = Parameters::Get<Parameters::EnableTuning>();
234 this->initialTimeStepSize_ = Parameters::Get<Parameters::InitialTimeStepSize<Scalar>>();
235 this->maxTimeStepAfterWellEvent_ = Parameters::Get<Parameters::TimeStepAfterEventInDays<Scalar>>() * 24 * 60 * 60;
241 if (Parameters::IsSet<Parameters::NumPressurePointsEquil>())
243 this->numPressurePointsEquil_ = Parameters::Get<Parameters::NumPressurePointsEquil>();
245 this->numPressurePointsEquil_ = simulator.vanguard().eclState().getTableManager().getEqldims().getNumDepthNodesP();
248 explicitRockCompaction_ = Parameters::Get<Parameters::ExplicitRockCompaction>();
257 void prefetch(
const Element&
elem)
const
258 { pffDofData_.prefetch(
elem); }
271 template <
class Restarter>
278 wellModel_.deserialize(
res);
281 aquiferModel_.deserialize(
res);
290 template <
class Restarter>
293 wellModel_.serialize(
res);
295 aquiferModel_.serialize(
res);
298 int episodeIndex()
const
300 return std::max(this->simulator().episodeIndex(), 0);
310 auto& simulator = this->simulator();
312 auto& eclState = simulator.vanguard().eclState();
313 const auto& schedule = simulator.vanguard().schedule();
314 const auto& events = schedule[
episodeIdx].events();
316 if (
episodeIdx >= 0 && events.hasEvent(ScheduleEvents::GEO_MODIFIER)) {
324 const auto&
cc = simulator.vanguard().grid().comm();
325 eclState.apply_schedule_keywords(
miniDeck );
326 eclBroadcast(
cc, eclState.getTransMult() );
329 std::function<
unsigned int(
unsigned int)>
equilGridToGrid = [&simulator](
unsigned int i) {
330 return simulator.vanguard().gridEquilIdxToGridIdx(i);
334 using TransUpdateQuantities =
typename Vanguard::TransmissibilityType::TransUpdateQuantities;
335 transmissibilities_.update(
true, TransUpdateQuantities::All,
equilGridToGrid);
336 this->referencePorosity_[1] = this->referencePorosity_[0];
337 updateReferencePorosity_();
339 this->model().linearizer().updateDiscretizationParameters();
342 bool tuningEvent = this->beginEpisode_(enableExperiments, this->episodeIndex());
345 wellModel_.beginEpisode();
348 aquiferModel_.beginEpisode();
351 Scalar
dt = limitNextTimeStepSize_(simulator.episodeLength());
356 dt = std::min(
dt, this->initialTimeStepSize_);
357 simulator.setTimeStepSize(
dt);
367 const int timeStepSize = this->simulator().timeStepSize();
369 this->beginTimeStep_(enableExperiments,
371 this->simulator().timeStepIndex(),
372 this->simulator().startTime(),
373 this->simulator().time(),
375 this->simulator().endTime());
383 if (nonTrivialBoundaryConditions()) {
384 this->model().linearizer().updateBoundaryConditionData();
387 wellModel_.beginTimeStep();
388 aquiferModel_.beginTimeStep();
389 tracerModel_.beginTimeStep();
399 wellModel_.beginIteration();
400 aquiferModel_.beginIteration();
409 wellModel_.endIteration();
410 aquiferModel_.endIteration();
427 const int rank = this->simulator().gridView().comm().rank();
429 std::cout <<
"checking conservativeness of solution\n";
432 this->model().checkConservativeness(-1,
true);
434 std::cout <<
"solution is sufficiently conservative\n";
439 auto& simulator = this->simulator();
440 simulator.setTimeStepIndex(simulator.timeStepIndex()+1);
442 this->wellModel_.endTimeStep();
443 this->aquiferModel_.endTimeStep();
444 this->tracerModel_.endTimeStep();
447 this->model().linearizer().updateFlowsInfo();
449 if (this->enableDriftCompensation_) {
452 const auto& residual = this->model().linearizer().residual();
472 this->wellModel_.endEpisode();
473 this->aquiferModel_.endEpisode();
475 const auto& schedule = this->simulator().vanguard().schedule();
478 if (
episodeIdx + 1 >=
static_cast<int>(schedule.size()) - 1) {
479 this->simulator().setFinished(
true);
484 this->simulator().startNextEpisode(schedule.stepLength(
episodeIdx + 1));
496 if (Parameters::Get<Parameters::EnableWriteAllSolutions>() ||
497 this->simulator().episodeWillBeOver()) {
498 ParentType::writeOutput(
verbose);
505 template <
class Context>
526 template <
class Context>
532 return pffDofData_.get(context.element(),
toDofLocalIdx).transmissibility;
546 template <
class Context>
552 return *pffDofData_.get(context.element(),
toDofLocalIdx).diffusivity;
584 template <
class Context>
614 template <
class Context>
621 return *pffDofData_.get(context.element(),
toDofLocalIdx).thermalHalfTransIn;
627 template <
class Context>
634 return *pffDofData_.get(context.element(),
toDofLocalIdx).thermalHalfTransOut;
640 template <
class Context>
652 {
return transmissibilities_; }
656 {
return tracerModel_; }
658 TracerModel& tracerModel()
659 {
return tracerModel_; }
669 template <
class Context>
682 template <
class Context>
697 return this->simulator().vanguard().cellCenterDepth(
globalSpaceIdx);
703 template <
class Context>
713 template <
class Context>
723 template <
class Context>
733 return materialLawManager_->materialLawParams(
globalDofIdx);
744 template <
class Context>
745 const SolidEnergyLawParams&
757 template <
class Context>
758 const ThermalConductionLawParams &
762 return thermalLawManager_->thermalConductionLawParams(
globalSpaceIdx);
772 {
return materialLawManager_; }
774 template <
class Flu
idState>
776 std::array<Evaluation,numPhases> &mobility,
777 DirectionalMobilityPtr &
dirMob,
778 FluidState &fluidState,
786 MaterialLaw::relativePermeabilities(mobility,
materialParams, fluidState);
787 Valgrind::CheckDefined(mobility);
789 if (materialLawManager_->hasDirectionalRelperms()
790 || materialLawManager_->hasDirectionalImbnum())
792 using Dir = FaceDir::DirEnum;
793 constexpr int ndim = 3;
794 dirMob = std::make_unique<DirectionalMobility<TypeTag, Evaluation>>();
795 Dir
facedirs[
ndim] = {Dir::XPlus, Dir::YPlus, Dir::ZPlus};
796 for (
int i = 0; i<
ndim; i++) {
808 {
return materialLawManager_; }
814 template <
class Context>
822 template <
class Context>
830 template <
class Context>
838 template <
class Context>
847 template <
class Context>
855 {
return this->simulator().vanguard().caseName(); }
860 template <
class Context>
866 return asImp_().initialFluidState(
globalDofIdx).temperature(0);
874 return asImp_().initialFluidState(
globalDofIdx).temperature(0);
877 const SolidEnergyLawParams&
881 return this->thermalLawManager_->solidEnergyLawParams(
globalSpaceIdx);
883 const ThermalConductionLawParams &
887 return this->thermalLawManager_->thermalConductionLawParams(
globalSpaceIdx);
901 if (!this->vapparsActive(this->episodeIndex()))
918 if (!this->vapparsActive(this->episodeIndex()))
930 this->model().invalidateAndUpdateIntensiveQuantities(0);
936 if (!this->model().enableStorageCache() || !this->recycleFirstIterationStorage()) {
937 this->model().invalidateAndUpdateIntensiveQuantities(1);
945 aquiferModel_.initialSolutionApplied();
950 this->model().invalidateAndUpdateIntensiveQuantities(0);
959 template <
class Context>
992 virtual void addToSourceDense(RateVector&
rate,
1002 {
return wellModel_; }
1005 {
return wellModel_; }
1007 const AquiferModel& aquiferModel()
const
1008 {
return aquiferModel_; }
1010 AquiferModel& mutableAquiferModel()
1011 {
return aquiferModel_; }
1013 bool nonTrivialBoundaryConditions()
const
1014 {
return nonTrivialBoundaryConditions_; }
1026 if (this->nextTimeStepSize_ > 0.0)
1027 return this->nextTimeStepSize_;
1029 const auto& simulator = this->simulator();
1034 return this->initialTimeStepSize_;
1039 const auto& newtonMethod = this->model().newtonMethod();
1040 return limitNextTimeStepSize_(newtonMethod.suggestTimeStepSize(simulator.timeStepSize()));
1048 template <
class LhsEval>
1052 if (this->rockCompPoroMult_.empty() &&
this->rockCompPoroMultWc_.empty())
1056 if (!this->rockTableIdx_.empty())
1061 if (!this->minRefPressure_.empty())
1067 if (!this->overburdenPressure_.empty())
1071 if (!this->rockCompPoroMult_.empty()) {
1076 assert(!this->rockCompPoroMultWc_.empty());
1088 template <
class LhsEval>
1091 const bool implicit = !this->explicitRockCompaction_;
1093 : this->simulator().problem().getRockCompTransMultVal(
elementIdx);
1100 template <
class LhsEval>
1105 const bool implicit = !this->explicitRockCompaction_;
1107 : this->simulator().problem().getRockCompTransMultVal(
elementIdx);
1116 if (!nonTrivialBoundaryConditions_) {
1117 return { BCType::NONE, RateVector(0.0) };
1119 FaceDir::DirEnum dir = FaceDir::FromIntersectionIndex(
directionId);
1120 const auto& schedule = this->simulator().vanguard().schedule();
1122 return { BCType::NONE, RateVector(0.0) };
1124 if (schedule[this->episodeIndex()].
bcprop.size() == 0) {
1125 return { BCType::NONE, RateVector(0.0) };
1127 const auto&
bc = schedule[this->episodeIndex()].bcprop[bcindex_(dir)[
globalSpaceIdx]];
1128 if (
bc.bctype!=BCType::RATE) {
1129 return {
bc.bctype, RateVector(0.0) };
1132 RateVector
rate = 0.0;
1133 switch (
bc.component) {
1134 case BCComponent::OIL:
1135 rate[Indices::canonicalToActiveComponentIndex(oilCompIdx)] =
bc.rate;
1137 case BCComponent::GAS:
1138 rate[Indices::canonicalToActiveComponentIndex(gasCompIdx)] =
bc.rate;
1140 case BCComponent::WATER:
1141 rate[Indices::canonicalToActiveComponentIndex(waterCompIdx)] =
bc.rate;
1143 case BCComponent::SOLVENT:
1144 this->handleSolventBC(
bc,
rate);
1146 case BCComponent::POLYMER:
1147 this->handlePolymerBC(
bc,
rate);
1149 case BCComponent::NONE:
1150 throw std::logic_error(
"you need to specify the component when RATE type is set in BC");
1154 return {
bc.bctype,
rate};
1158 template<
class Serializer>
1170 Implementation& asImp_()
1171 {
return *
static_cast<Implementation *
>(
this); }
1173 const Implementation& asImp_()
const
1174 {
return *
static_cast<const Implementation *
>(
this); }
1177 template<
class UpdateFunc>
1178 void updateProperty_(
const std::string&
failureMsg,
1182 const auto& model = this->simulator().model();
1183 const auto& primaryVars = model.solution(0);
1184 const auto& vanguard = this->simulator().vanguard();
1185 std::size_t numGridDof = primaryVars.size();
1186 OPM_BEGIN_PARALLEL_TRY_CATCH();
1188#pragma omp parallel for
1191 const auto&
iq = *model.cachedIntensiveQuantities(
dofIdx, 0);
1194 OPM_END_PARALLEL_TRY_CATCH(
failureMsg, vanguard.grid().comm());
1197 bool updateMaxOilSaturation_()
1204 this->updateProperty_(
"FlowProblem::updateMaxOilSaturation_() failed:",
1215 bool updateMaxOilSaturation_(
unsigned compressedDofIdx,
const IntensiveQuantities&
iq)
1218 const auto&
fs =
iq.fluidState();
1219 const Scalar So =
decay<Scalar>(
fs.saturation(refPressurePhaseIdx_()));
1220 auto&
mos = this->maxOilSaturation_;
1229 bool updateMaxWaterSaturation_()
1233 if (this->maxWaterSaturation_.empty())
1236 this->maxWaterSaturation_[1] = this->maxWaterSaturation_[0];
1237 this->updateProperty_(
"FlowProblem::updateMaxWaterSaturation_() failed:",
1246 bool updateMaxWaterSaturation_(
unsigned compressedDofIdx,
const IntensiveQuantities&
iq)
1249 const auto&
fs =
iq.fluidState();
1251 auto&
mow = this->maxWaterSaturation_;
1260 bool updateMinPressure_()
1264 if (this->minRefPressure_.empty())
1267 this->updateProperty_(
"FlowProblem::updateMinPressure_() failed:",
1277 const auto&
fs =
iq.fluidState();
1292 std::function<std::vector<double>(
const FieldPropsManager&,
const std::string&)>
1293 fieldPropDoubleOnLeafAssigner_()
1295 const auto&
lookup = this->lookUpData_;
1306 template<
typename IntType>
1307 std::function<std::vector<IntType>(
const FieldPropsManager&,
const std::string&,
bool)>
1308 fieldPropIntTypeOnLeafAssigner_()
1310 const auto&
lookup = this->lookUpData_;
1317 void readMaterialParameters_()
1320 const auto& simulator = this->simulator();
1321 const auto& vanguard = simulator.vanguard();
1322 const auto& eclState = vanguard.eclState();
1325 OPM_BEGIN_PARALLEL_TRY_CATCH();
1326 this->updatePvtnum_();
1327 this->updateSatnum_();
1330 this->updateMiscnum_();
1332 this->updatePlmixnum_();
1334 OPM_END_PARALLEL_TRY_CATCH(
"Invalid region numbers: ", vanguard.gridView().comm());
1337 updateReferencePorosity_();
1338 this->referencePorosity_[1] = this->referencePorosity_[0];
1343 materialLawManager_ = std::make_shared<EclMaterialLawManager>();
1344 materialLawManager_->initFromState(eclState);
1345 materialLawManager_->initParamsForElements(eclState, this->model().numGridDof(),
1347 this-> lookupIdxOnLevelZeroAssigner_());
1351 void readThermalParameters_()
1353 if constexpr (enableEnergy)
1355 const auto& simulator = this->simulator();
1356 const auto& vanguard = simulator.vanguard();
1357 const auto& eclState = vanguard.eclState();
1360 thermalLawManager_ = std::make_shared<EclThermalLawManager>();
1361 thermalLawManager_->initParamsForElements(eclState, this->model().numGridDof(),
1362 this-> fieldPropDoubleOnLeafAssigner_(),
1367 void updateReferencePorosity_()
1369 const auto& simulator = this->simulator();
1370 const auto& vanguard = simulator.vanguard();
1371 const auto& eclState = vanguard.eclState();
1373 std::size_t numDof = this->model().numGridDof();
1375 this->referencePorosity_[0].resize(numDof);
1377 const auto&
fp = eclState.fieldProps();
1378 const std::vector<double>
porvData =
this -> fieldPropDoubleOnLeafAssigner_()(
fp,
"PORV");
1386 Scalar dofVolume = simulator.model().dofTotalVolume(
sfcdofIdx);
1392 virtual void readInitialCondition_()
1395 const auto& simulator = this->simulator();
1396 const auto& vanguard = simulator.vanguard();
1397 const auto& eclState = vanguard.eclState();
1399 if (eclState.getInitConfig().hasEquil())
1400 readEquilInitialCondition_();
1402 readExplicitInitialCondition_();
1405 std::size_t
numElems = this->model().numGridDof();
1407 const auto&
fs = asImp_().initialFluidStates()[
elemIdx];
1408 if (!this->maxWaterSaturation_.empty() && waterPhaseIdx > -1)
1409 this->maxWaterSaturation_[
elemIdx] = std::max(this->maxWaterSaturation_[
elemIdx],
fs.saturation(waterPhaseIdx));
1410 if (!this->maxOilSaturation_.empty() && oilPhaseIdx > -1)
1411 this->maxOilSaturation_[
elemIdx] = std::max(this->maxOilSaturation_[
elemIdx],
fs.saturation(oilPhaseIdx));
1412 if (!this->minRefPressure_.empty() && refPressurePhaseIdx_() > -1)
1413 this->minRefPressure_[
elemIdx] = std::min(this->minRefPressure_[
elemIdx],
fs.pressure(refPressurePhaseIdx_()));
1417 virtual void readEquilInitialCondition_() = 0;
1418 virtual void readExplicitInitialCondition_() = 0;
1421 bool updateHysteresis_()
1423 if (!materialLawManager_->enableHysteresis())
1428 this->updateProperty_(
"FlowProblem::updateHysteresis_() failed:",
1445 Scalar getRockCompTransMultVal(std::size_t
dofIdx)
const
1447 if (this->rockCompTransMultVal_.empty())
1450 return this->rockCompTransMultVal_[
dofIdx];
1460 Scalar transmissibility;
1464 void updatePffDofData_()
1468 const Stencil& stencil,
1472 const auto& elementMapper = this->model().elementMapper();
1479 if constexpr (enableEnergy) {
1483 if constexpr (enableDiffusion)
1485 if (enableDispersion)
1490 pffDofData_.update(
distFn);
1495 void readBoundaryConditions_()
1497 const auto& simulator = this->simulator();
1498 const auto& vanguard = simulator.vanguard();
1499 const auto&
bcconfig = vanguard.eclState().getSimulationConfig().bcconfig();
1501 nonTrivialBoundaryConditions_ =
true;
1503 std::size_t
numCartDof = vanguard.cartesianSize();
1504 unsigned numElems = vanguard.gridView().size(0);
1512 &vanguard](
const auto&
bcface,
1518 std::array<int, 3> tmp = {i,j,
k};
1527 std::vector<int>& data = bcindex_(
bcface.dir);
1528 const int index =
bcface.index;
1538 Scalar limitNextTimeStepSize_(Scalar
dtNext)
const
1540 if constexpr (enableExperiments) {
1541 const auto& simulator = this->simulator();
1542 const auto& schedule = simulator.vanguard().schedule();
1546 Scalar maxTimeStepSize = Parameters::Get<Parameters::SolverMaxTimeStepInDays<Scalar>>() * 24 * 60 * 60;
1548 if (this->enableTuning_) {
1550 maxTimeStepSize =
tuning.TSMAXZ;
1556 simulator.episodeStartTime() + simulator.episodeLength()
1557 - (simulator.startTime() + simulator.time());
1567 if (simulator.episodeStarts()) {
1570 const auto& events = simulator.vanguard().schedule()[
reportStepIdx].events();
1572 events.hasEvent(ScheduleEvents::NEW_WELL)
1573 || events.hasEvent(ScheduleEvents::PRODUCTION_UPDATE)
1574 || events.hasEvent(ScheduleEvents::INJECTION_UPDATE)
1575 || events.hasEvent(ScheduleEvents::WELL_STATUS_CHANGE);
1577 dtNext = std::min(
dtNext, this->maxTimeStepAfterWellEvent_);
1584 int refPressurePhaseIdx_()
const {
1585 if (FluidSystem::phaseIsActive(oilPhaseIdx)) {
1588 else if (FluidSystem::phaseIsActive(gasPhaseIdx)) {
1592 return waterPhaseIdx;
1596 void updateRockCompTransMultVal_()
1598 const auto& model = this->simulator().model();
1599 std::size_t numGridDof = this->model().numGridDof();
1600 this->rockCompTransMultVal_.resize(numGridDof, 1.0);
1602 const auto&
iq = *model.cachedIntensiveQuantities(
elementIdx, 0);
1613 template <
class LhsEval>
1617 if (this->rockCompTransMult_.empty() &&
this->rockCompTransMultWc_.empty())
1621 if (!this->rockTableIdx_.empty())
1627 if (!this->minRefPressure_.empty())
1633 if (!this->overburdenPressure_.empty())
1636 if (!this->rockCompTransMult_.empty())
1640 assert(!this->rockCompTransMultWc_.empty());
1647 typename Vanguard::TransmissibilityType transmissibilities_;
1649 std::shared_ptr<EclMaterialLawManager> materialLawManager_;
1650 std::shared_ptr<EclThermalLawManager> thermalLawManager_;
1652 bool enableDriftCompensation_;
1653 GlobalEqVector drift_;
1655 WellModel wellModel_;
1656 AquiferModel aquiferModel_;
1658 bool enableVtkOutput_;
1667 std::array<std::vector<T>,6> data;
1669 void resize(std::size_t size, T
defVal)
1671 for (
auto&
d : data)
1675 const std::vector<T>& operator()(FaceDir::DirEnum dir)
const
1677 if (dir == FaceDir::DirEnum::Unknown)
1678 throw std::runtime_error(
"Tried to access BC data for the 'Unknown' direction");
1680 int div =
static_cast<int>(dir);
1681 while ((
div /= 2) >= 1)
1687 std::vector<T>& operator()(FaceDir::DirEnum dir)
1689 return const_cast<std::vector<T>&
>(std::as_const(*
this)(dir));
1693 virtual void handleSolventBC(
const BCProp::BCFace&, RateVector&)
const = 0;
1695 virtual void handlePolymerBC(
const BCProp::BCFace&, RateVector&)
const = 0;
1698 bool nonTrivialBoundaryConditions_ =
false;
1699 bool explicitRockCompaction_ =
false;
1700 bool first_step_ =
true;
Helper class for grid instantiation of ECL file-format using problems.
This is a "dummy" gradient calculator which does not do anything.
Collects necessary output values and pass it to opm-common's ECL output.
Computes the initial condition based on the EQUIL keyword from ECL.
This problem simulates an input file given in the data format used by the commercial ECLiPSE simulato...
A class which handles tracers as specified in by ECL.
This problem simulates an input file given in the data format used by the commercial ECLiPSE simulato...
Definition FlowGenericProblem.hpp:63
Scalar maxPolymerAdsorption(unsigned elemIdx) const
Returns the max polymer adsorption value.
Definition FlowGenericProblem_impl.hpp:709
unsigned pvtRegionIndex(unsigned elemIdx) const
Returns the index the relevant PVT region given a cell index.
Definition FlowGenericProblem_impl.hpp:668
Scalar rockReferencePressure(unsigned globalSpaceIdx) const
Direct access to rock reference pressure.
Definition FlowGenericProblem_impl.hpp:290
static std::string briefDescription()
Returns a human readable description of the problem for the help message.
Definition FlowGenericProblem_impl.hpp:97
Scalar porosity(unsigned globalSpaceIdx, unsigned timeIdx) const
Direct indexed access to the porosity.
Definition FlowGenericProblem_impl.hpp:305
Scalar rockCompressibility(unsigned globalSpaceIdx) const
Direct access to rock compressibility.
Definition FlowGenericProblem_impl.hpp:275
unsigned miscnumRegionIndex(unsigned elemIdx) const
Returns the index the relevant MISC region given a cell index.
Definition FlowGenericProblem_impl.hpp:688
unsigned satnumRegionIndex(unsigned elemIdx) const
Returns the index the relevant saturation function region given a cell index.
Definition FlowGenericProblem_impl.hpp:678
unsigned plmixnumRegionIndex(unsigned elemIdx) const
Returns the index the relevant PLMIXNUM (for polymer module) region given a cell index.
Definition FlowGenericProblem_impl.hpp:698
bool shouldWriteOutput() const
Always returns true.
Definition FlowGenericProblem.hpp:293
static std::string helpPreamble(int, const char **argv)
Returns the string that is printed before the list of command line parameters in the help message.
Definition FlowGenericProblem_impl.hpp:82
bool shouldWriteRestartFile() const
Returns true if an eWoms restart file should be written to disk.
Definition FlowGenericProblem.hpp:302
This problem simulates an input file given in the data format used by the commercial ECLiPSE simulato...
Definition FlowProblem.hpp:92
const WellModel & wellModel() const
Returns a reference to the ECL well manager used by the problem.
Definition FlowProblem.hpp:1001
Scalar transmissibility(unsigned globalCenterElemIdx, unsigned globalElemIdx) const
Direct access to the transmissibility between two elements.
Definition FlowProblem.hpp:538
static int handlePositionalParameter(std::function< void(const std::string &, const std::string &)> addKey, std::set< std::string > &seenParams, std::string &errorMsg, int, const char **argv, int paramIdx, int)
Handles positional command line parameters.
Definition FlowProblem.hpp:190
const DimMatrix & intrinsicPermeability(unsigned globalElemIdx) const
This method returns the intrinsic permeability tensor given a global element index.
Definition FlowProblem.hpp:520
unsigned pvtRegionIndex(const Context &context, unsigned spaceIdx, unsigned timeIdx) const
Returns the index of the relevant region for thermodynmic properties.
Definition FlowProblem.hpp:815
Scalar porosity(const Context &context, unsigned spaceIdx, unsigned timeIdx) const
Definition FlowProblem.hpp:670
void beginIteration()
Called by the simulator before each Newton-Raphson iteration.
Definition FlowProblem.hpp:396
unsigned satnumRegionIndex(const Context &context, unsigned spaceIdx, unsigned timeIdx) const
Returns the index of the relevant region for thermodynmic properties.
Definition FlowProblem.hpp:823
Scalar thermalHalfTransmissibilityOut(const Context &context, unsigned faceIdx, unsigned timeIdx) const
Definition FlowProblem.hpp:628
Scalar transmissibilityBoundary(const Context &elemCtx, unsigned boundaryFaceIdx) const
Definition FlowProblem.hpp:585
Scalar thermalHalfTransmissibility(const unsigned globalSpaceIdxIn, const unsigned globalSpaceIdxOut) const
Definition FlowProblem.hpp:605
Scalar rockCompressibility(const Context &context, unsigned spaceIdx, unsigned timeIdx) const
Definition FlowProblem.hpp:704
Scalar maxOilSaturation(unsigned globalDofIdx) const
Returns an element's historic maximum oil phase saturation that was observed during the simulation.
Definition FlowProblem.hpp:899
std::string name() const
The problem name.
Definition FlowProblem.hpp:854
LhsEval rockCompTransMultiplier(const IntensiveQuantities &intQuants, unsigned elementIdx) const
Calculate the transmissibility multiplier due to water induced rock compaction.
Definition FlowProblem.hpp:1089
void endIteration()
Called by the simulator after each Newton-Raphson iteration.
Definition FlowProblem.hpp:406
FlowProblem(Simulator &simulator)
Definition FlowProblem.hpp:209
const Vanguard::TransmissibilityType & eclTransmissibilities() const
Return a reference to the object that handles the "raw" transmissibilities.
Definition FlowProblem.hpp:651
Scalar nextTimeStepSize() const
Propose the size of the next time step to the simulator.
Definition FlowProblem.hpp:1022
LhsEval computeRockCompTransMultiplier_(const IntensiveQuantities &intQuants, unsigned elementIdx) const
Calculate the transmissibility multiplier due to water induced rock compaction.
Definition FlowProblem.hpp:1614
const ThermalConductionLawParams & thermalConductionLawParams(const Context &context, unsigned spaceIdx, unsigned timeIdx) const
Definition FlowProblem.hpp:759
Scalar transmissibility(const Context &context, unsigned fromDofLocalIdx, unsigned toDofLocalIdx) const
Definition FlowProblem.hpp:527
virtual void beginEpisode()
Called by the simulator before an episode begins.
Definition FlowProblem.hpp:306
Scalar dofCenterDepth(unsigned globalSpaceIdx) const
Direct indexed acces to the depth of an degree of freedom [m].
Definition FlowProblem.hpp:695
LhsEval wellTransMultiplier(const IntensiveQuantities &intQuants, unsigned elementIdx) const
Return the well transmissibility multiplier due to rock changues.
Definition FlowProblem.hpp:1101
std::shared_ptr< const EclMaterialLawManager > materialLawManager() const
Returns the ECL material law manager.
Definition FlowProblem.hpp:771
unsigned plmixnumRegionIndex(const Context &context, unsigned spaceIdx, unsigned timeIdx) const
Returns the index of the relevant region for thermodynmic properties.
Definition FlowProblem.hpp:839
Scalar temperature(const Context &context, unsigned spaceIdx, unsigned timeIdx) const
Definition FlowProblem.hpp:861
Scalar thermalHalfTransmissibilityBoundary(const Context &elemCtx, unsigned boundaryFaceIdx) const
Definition FlowProblem.hpp:641
unsigned miscnumRegionIndex(const Context &context, unsigned spaceIdx, unsigned timeIdx) const
Returns the index of the relevant region for thermodynmic properties.
Definition FlowProblem.hpp:831
const DimMatrix & intrinsicPermeability(const Context &context, unsigned spaceIdx, unsigned timeIdx) const
Definition FlowProblem.hpp:506
Scalar maxPolymerAdsorption(const Context &context, unsigned spaceIdx, unsigned timeIdx) const
Returns the max polymer adsorption value.
Definition FlowProblem.hpp:848
void beginTimeStep()
Called by the simulator before each time integration.
Definition FlowProblem.hpp:363
Scalar thermalHalfTransmissibilityIn(const Context &context, unsigned faceIdx, unsigned timeIdx) const
Definition FlowProblem.hpp:615
void setMaxOilSaturation(unsigned globalDofIdx, Scalar value)
Sets an element's maximum oil phase saturation observed during the simulation.
Definition FlowProblem.hpp:916
const SolidEnergyLawParams & solidEnergyLawParams(const Context &context, unsigned spaceIdx, unsigned timeIdx) const
Return the parameters for the energy storage law of the rock.
Definition FlowProblem.hpp:746
Scalar dispersivity(const unsigned globalCellIn, const unsigned globalCellOut) const
give the dispersivity for a face i.e.
Definition FlowProblem.hpp:565
static void registerParameters()
Registers all available parameters for the problem and the model.
Definition FlowProblem.hpp:179
virtual void endEpisode()
Called by the simulator after the end of an episode.
Definition FlowProblem.hpp:468
void source(RateVector &rate, const Context &context, unsigned spaceIdx, unsigned timeIdx) const
Evaluate the source term for all phases within a given sub-control-volume.
Definition FlowProblem.hpp:960
virtual void endTimeStep()
Called by the simulator after each time integration.
Definition FlowProblem.hpp:416
virtual void initialSolutionApplied()
Callback used by the model to indicate that the initial solution has been determined for all degrees ...
Definition FlowProblem.hpp:927
const MaterialLawParams & materialLawParams(const Context &context, unsigned spaceIdx, unsigned timeIdx) const
Definition FlowProblem.hpp:724
Scalar thermalTransmissibilityBoundary(const unsigned globalSpaceIdx, const unsigned boundaryFaceIdx) const
Direct access to a boundary transmissibility.
Definition FlowProblem.hpp:572
void writeOutput(bool verbose=true)
Write the requested quantities of the current solution into the output files.
Definition FlowProblem.hpp:491
Scalar diffusivity(const Context &context, unsigned fromDofLocalIdx, unsigned toDofLocalIdx) const
Definition FlowProblem.hpp:547
void deserialize(Restarter &res)
This method restores the complete state of the problem and its sub-objects from disk.
Definition FlowProblem.hpp:272
std::shared_ptr< EclMaterialLawManager > materialLawManager()
Definition FlowProblem.hpp:807
Scalar dofCenterDepth(const Context &context, unsigned spaceIdx, unsigned timeIdx) const
Returns the depth of an degree of freedom [m].
Definition FlowProblem.hpp:683
LhsEval rockCompPoroMultiplier(const IntensiveQuantities &intQuants, unsigned elementIdx) const
Calculate the porosity multiplier due to water induced rock compaction.
Definition FlowProblem.hpp:1049
Scalar transmissibilityBoundary(const unsigned globalSpaceIdx, const unsigned boundaryFaceIdx) const
Direct access to a boundary transmissibility.
Definition FlowProblem.hpp:595
void serialize(Restarter &res)
This method writes the complete state of the problem and its subobjects to disk.
Definition FlowProblem.hpp:291
Scalar rockReferencePressure(const Context &context, unsigned spaceIdx, unsigned timeIdx) const
Definition FlowProblem.hpp:714
Scalar diffusivity(const unsigned globalCellIn, const unsigned globalCellOut) const
give the transmissibility for a face i.e.
Definition FlowProblem.hpp:558
A random-access container which stores data attached to a grid's degrees of freedom in a prefetch fri...
Definition pffgridvector.hh:49
This class is intend to be a relperm diagnostics, to detect wrong input of relperm table and endpoint...
Definition RelpermDiagnostics.hpp:50
void diagnosis(const EclipseState &eclState, const CartesianIndexMapper &cartesianIndexMapper)
This function is used to diagnosis relperm in eclipse data file.
Definition RelpermDiagnostics.cpp:826
A class which handles tracers as specified in by ECL.
Definition TracerModel.hpp:68
This file contains definitions related to directional mobilities.
The base class for the element-centered finite-volume discretization scheme.
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition blackoilboundaryratevector.hh:37
constexpr auto getPropValue()
get the value data member of a property
Definition propertysystem.hh:242
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:235
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type GetProp
get the type of a property (equivalent to old macro GET_PROP(...))
Definition propertysystem.hh:226
Definition FlowProblem.hpp:1666
Definition FlowProblem.hpp:1455