24#ifndef EWOMS_BLACK_OIL_PRIMARY_VARIABLES_HH
25#define EWOMS_BLACK_OIL_PRIMARY_VARIABLES_HH
27#include <dune/common/fvector.hh>
29#include <opm/material/common/Valgrind.hpp>
30#include <opm/material/constraintsolvers/NcpFlash.hpp>
31#include <opm/material/fluidsystems/BlackOilFluidSystem.hpp>
32#include <opm/material/fluidstates/CompositionalFluidState.hpp>
33#include <opm/material/fluidstates/SimpleModularFluidState.hpp>
60template <
class TypeTag>
75 enum { numEq = getPropValue<TypeTag, Properties::NumEq>() };
78 enum { waterSwitchIdx = Indices::waterSwitchIdx };
79 enum { pressureSwitchIdx = Indices::pressureSwitchIdx };
80 enum { compositionSwitchIdx = Indices::compositionSwitchIdx };
81 enum { saltConcentrationIdx = Indices::saltConcentrationIdx };
82 enum { solventSaturationIdx = Indices::solventSaturationIdx };
84 static constexpr bool compositionSwitchEnabled = Indices::compositionSwitchIdx >= 0;
85 static constexpr bool waterEnabled = Indices::waterEnabled;
86 static constexpr bool gasEnabled = Indices::gasEnabled;
87 static constexpr bool oilEnabled = Indices::oilEnabled;
90 enum { numPhases = getPropValue<TypeTag, Properties::NumPhases>() };
91 enum { gasPhaseIdx = FluidSystem::gasPhaseIdx };
92 enum { waterPhaseIdx = FluidSystem::waterPhaseIdx };
93 enum { oilPhaseIdx = FluidSystem::oilPhaseIdx };
96 enum { numComponents = getPropValue<TypeTag, Properties::NumComponents>() };
97 enum { enableSolvent = getPropValue<TypeTag, Properties::EnableSolvent>() };
98 enum { enableExtbo = getPropValue<TypeTag, Properties::EnableExtbo>() };
99 enum { enablePolymer = getPropValue<TypeTag, Properties::EnablePolymer>() };
100 enum { enableFoam = getPropValue<TypeTag, Properties::EnableFoam>() };
101 enum { enableBrine = getPropValue<TypeTag, Properties::EnableBrine>() };
102 enum { enableSaltPrecipitation = getPropValue<TypeTag, Properties::EnableSaltPrecipitation>() };
103 enum { enableVapwat = getPropValue<TypeTag, Properties::EnableVapwat>() };
104 enum { enableEnergy = getPropValue<TypeTag, Properties::EnableEnergy>() };
105 enum { enableTemperature = getPropValue<TypeTag, Properties::EnableTemperature>() };
106 enum { enableMICP = getPropValue<TypeTag, Properties::EnableMICP>() };
107 enum { gasCompIdx = FluidSystem::gasCompIdx };
108 enum { waterCompIdx = FluidSystem::waterCompIdx };
109 enum { oilCompIdx = FluidSystem::oilCompIdx };
111 using Toolbox = MathToolbox<Evaluation>;
112 using ComponentVector = Dune::FieldVector<Scalar, numComponents>;
121 static_assert(numPhases == 3,
"The black-oil model assumes three phases!");
122 static_assert(numComponents == 3,
"The black-oil model assumes three components!");
160 Valgrind::SetUndefined(*
this);
170 Valgrind::SetUndefined(primaryVarsMeaningWater_);
171 Valgrind::SetUndefined(primaryVarsMeaningGas_);
172 Valgrind::SetUndefined(primaryVarsMeaningPressure_);
173 Valgrind::SetUndefined(primaryVarsMeaningBrine_);
174 Valgrind::SetUndefined(primaryVarsMeaningSolvent_);
187 result.pvtRegionIdx_ = 1;
193 for (
size_t i = 0; i < result.size(); ++i) {
203 pressureScale_ = Parameters::Get<Parameters::PressureScale<Scalar>>();
208 Parameters::Register<Parameters::PressureScale<Scalar>>
209 (
"Scaling of pressure primary variable");
214 pressureScale_ = val;
221 if (varIdx == pressureSwitchIdx) {
222 scale = this->pressureScale_;
224 if (std::is_same<Evaluation, Scalar>::value)
225 return (*
this)[varIdx] * scale;
228 if (timeIdx == linearizationType.time)
229 return Toolbox::createVariable((*
this)[varIdx], varIdx) * scale;
231 return Toolbox::createConstant((*
this)[varIdx]) * scale;
243 { pvtRegionIdx_ =
static_cast<unsigned short>(value); }
249 {
return pvtRegionIdx_; }
256 {
return primaryVarsMeaningWater_; }
263 { primaryVarsMeaningWater_ = newMeaning; }
270 {
return primaryVarsMeaningPressure_; }
277 { primaryVarsMeaningPressure_ = newMeaning; }
284 {
return primaryVarsMeaningGas_; }
291 { primaryVarsMeaningGas_ = newMeaning; }
294 {
return primaryVarsMeaningBrine_; }
302 { primaryVarsMeaningBrine_ = newMeaning; }
306 {
return primaryVarsMeaningSolvent_; }
314 { primaryVarsMeaningSolvent_ = newMeaning; }
319 template <
class Flu
idState>
321 const MaterialLawParams& matParams,
322 bool isInEquilibrium =
false)
324 using ConstEvaluation =
typename std::remove_reference<typename FluidState::Scalar>::type;
325 using FsEvaluation =
typename std::remove_const<ConstEvaluation>::type;
326 using FsToolbox = MathToolbox<FsEvaluation>;
330 for (
unsigned phaseIdx = 1; phaseIdx < numPhases; ++phaseIdx) {
331 Valgrind::CheckDefined(fluidState.temperature(0));
332 Valgrind::CheckDefined(fluidState.temperature(phaseIdx));
334 assert(fluidState.temperature(0) == fluidState.temperature(phaseIdx));
340 if (isInEquilibrium) {
347 typename FluidSystem::template ParameterCache<Scalar> paramCache;
348 paramCache.setRegionIndex(pvtRegionIdx_);
349 paramCache.setMaxOilSat(FsToolbox::value(fluidState.saturation(oilPhaseIdx)));
352 using NcpFlash = NcpFlash<Scalar, FluidSystem>;
353 using FlashFluidState = CompositionalFluidState<Scalar, FluidSystem>;
354 FlashFluidState fsFlash;
355 fsFlash.setTemperature(FsToolbox::value(fluidState.temperature(0)));
356 for (
unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
357 fsFlash.setPressure(phaseIdx, FsToolbox::value(fluidState.pressure(phaseIdx)));
358 fsFlash.setSaturation(phaseIdx, FsToolbox::value(fluidState.saturation(phaseIdx)));
359 for (
unsigned compIdx = 0; compIdx < numComponents; ++compIdx)
360 fsFlash.setMoleFraction(phaseIdx, compIdx, FsToolbox::value(fluidState.moleFraction(phaseIdx, compIdx)));
363 paramCache.updateAll(fsFlash);
364 for (
unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
365 if (!FluidSystem::phaseIsActive(phaseIdx))
368 Scalar rho = FluidSystem::template density<FlashFluidState, Scalar>(fsFlash, paramCache, phaseIdx);
369 fsFlash.setDensity(phaseIdx, rho);
373 ComponentVector globalMolarities(0.0);
374 for (
unsigned compIdx = 0; compIdx < numComponents; ++compIdx) {
375 for (
unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
376 if (!FluidSystem::phaseIsActive(phaseIdx))
379 globalMolarities[compIdx] +=
380 fsFlash.saturation(phaseIdx) * fsFlash.molarity(phaseIdx, compIdx);
388 NcpFlash::template solve<MaterialLaw>(fsFlash, matParams, paramCache, globalMolarities);
397 template <
class Flu
idState>
400 using ConstEvaluation =
typename std::remove_reference<typename FluidState::Scalar>::type;
401 using FsEvaluation =
typename std::remove_const<ConstEvaluation>::type;
402 using FsToolbox = MathToolbox<FsEvaluation>;
404 bool gasPresent = FluidSystem::phaseIsActive(gasPhaseIdx)?(fluidState.saturation(gasPhaseIdx) > 0.0):
false;
405 bool oilPresent = FluidSystem::phaseIsActive(oilPhaseIdx)?(fluidState.saturation(oilPhaseIdx) > 0.0):
false;
406 bool waterPresent = FluidSystem::phaseIsActive(waterPhaseIdx)?(fluidState.saturation(waterPhaseIdx) > 0.0):
false;
407 const auto& saltSaturation = BlackOil::getSaltSaturation_<FluidSystem, FluidState, Scalar>(fluidState, pvtRegionIdx_);
408 bool precipitatedSaltPresent = enableSaltPrecipitation?(saltSaturation > 0.0):
false;
409 bool oneActivePhases = FluidSystem::numActivePhases() == 1;
416 if (gasPresent && FluidSystem::enableVaporizedOil() && !oilPresent){
418 }
else if (FluidSystem::phaseIsActive(oilPhaseIdx)) {
420 }
else if ( waterPresent && FluidSystem::enableDissolvedGasInWater() && !gasPresent){
422 }
else if (FluidSystem::phaseIsActive(gasPhaseIdx)) {
425 assert(FluidSystem::phaseIsActive(waterPhaseIdx));
433 if ( waterPresent && gasPresent ){
435 }
else if (gasPresent && FluidSystem::enableVaporizedWater()) {
437 }
else if (waterPresent && FluidSystem::enableDissolvedGasInWater()) {
439 }
else if (FluidSystem::phaseIsActive(waterPhaseIdx) && !oneActivePhases) {
450 if ( gasPresent && oilPresent ) {
452 }
else if (oilPresent && FluidSystem::enableDissolvedGas()) {
454 }
else if (gasPresent && FluidSystem::enableVaporizedOil()){
456 }
else if (FluidSystem::phaseIsActive(gasPhaseIdx) && FluidSystem::phaseIsActive(oilPhaseIdx)) {
463 if constexpr (enableSaltPrecipitation){
464 if (precipitatedSaltPresent)
475 this->setScaledPressure_(FsToolbox::value(fluidState.pressure(oilPhaseIdx)));
478 this->setScaledPressure_(FsToolbox::value(fluidState.pressure(gasPhaseIdx)));
481 this->setScaledPressure_(FsToolbox::value(fluidState.pressure(waterPhaseIdx)));
484 throw std::logic_error(
"No valid primary variable selected for pressure");
489 (*this)[waterSwitchIdx] = FsToolbox::value(fluidState.saturation(waterPhaseIdx));
494 const auto& rvw = BlackOil::getRvw_<FluidSystem, FluidState, Scalar>(fluidState, pvtRegionIdx_);
495 (*this)[waterSwitchIdx] = rvw;
500 const auto& Rsw = BlackOil::getRsw_<FluidSystem, FluidState, Scalar>(fluidState, pvtRegionIdx_);
501 (*this)[waterSwitchIdx] = Rsw;
509 throw std::logic_error(
"No valid primary variable selected for water");
514 (*this)[compositionSwitchIdx] = FsToolbox::value(fluidState.saturation(gasPhaseIdx));
519 const auto& rs = BlackOil::getRs_<FluidSystem, FluidState, Scalar>(fluidState, pvtRegionIdx_);
520 (*this)[compositionSwitchIdx] = rs;
525 const auto& rv = BlackOil::getRv_<FluidSystem, FluidState, Scalar>(fluidState, pvtRegionIdx_);
526 (*this)[compositionSwitchIdx] = rv;
534 throw std::logic_error(
"No valid primary variable selected for composision");
550 unsigned globalDofIdx,
551 [[maybe_unused]] Scalar swMaximum,
552 Scalar thresholdWaterFilledCell, Scalar eps = 0.0)
569 Scalar saltConcentration = 0.0;
570 const Scalar& T = asImp_().temperature_(problem, globalDofIdx);
572 sw = (*this)[waterSwitchIdx];
574 sg = (*this)[compositionSwitchIdx];
583 if constexpr (enableSaltPrecipitation) {
586 saltConcentration = saltSolubility;
587 Scalar saltSat = (*this)[saltConcentrationIdx];
590 (*this)[saltConcentrationIdx] = saltSolubility;
594 saltConcentration = (*this)[saltConcentrationIdx];
595 if (saltConcentration > saltSolubility + eps){
597 (*this)[saltConcentrationIdx] = 0.0;
605 if constexpr (enableSolvent) {
607 Scalar p = (*this)[pressureSwitchIdx];
610 Scalar solSat = (*this)[solventSaturationIdx];
613 (*this)[solventSaturationIdx] = solLimit;
618 Scalar rsolw = (*this)[solventSaturationIdx];
619 if (rsolw > solLimit + eps){
621 (*this)[solventSaturationIdx] = 0.0;
628 bool changed =
false;
636 if (sw >= thresholdWaterFilledCell && !FluidSystem::enableDissolvedGasInWater()) {
639 if constexpr (waterEnabled) {
640 (*this)[Indices::waterSwitchIdx] = std::min(swMaximum, sw);
644 if constexpr (compositionSwitchEnabled)
645 (*
this)[Indices::compositionSwitchIdx] = 0.0;
649 if constexpr (compositionSwitchEnabled)
658 unsigned satnumRegionIdx = problem.satnumRegionIndex(globalDofIdx);
659 Scalar Sp = saltConcentration_();
660 Scalar porosityFactor = min(1.0 - Sp, 1.0);
662 pcFactor_ = pcfactTable.eval(porosityFactor,
true);
672 if(sw < -eps && sg > eps && FluidSystem::enableVaporizedWater()) {
673 Scalar p = this->pressure_();
675 std::array<Scalar, numPhases> pC = { 0.0 };
676 const MaterialLawParams& matParams = problem.materialLawParams(globalDofIdx);
677 Scalar so = 1.0 - sg - solventSaturation_();
678 computeCapillaryPressures_(pC, so, sg + solventSaturation_(), 0.0, matParams);
679 p += pcFactor_ * (pC[gasPhaseIdx] - pC[oilPhaseIdx]);
681 Scalar rvwSat = FluidSystem::gasPvt().saturatedWaterVaporizationFactor(pvtRegionIdx_,
686 (*this)[Indices::waterSwitchIdx] = rvwSat;
692 if(sg < -eps && sw > eps && FluidSystem::enableDissolvedGasInWater()) {
693 const Scalar pg = this->pressure_();
695 std::array<Scalar, numPhases> pC = { 0.0 };
696 const MaterialLawParams& matParams = problem.materialLawParams(globalDofIdx);
697 Scalar so = 1.0 - sw - solventSaturation_();
698 computeCapillaryPressures_(pC, so, 0.0, sw, matParams);
699 Scalar pw = pg + pcFactor_ * (pC[waterPhaseIdx] - pC[gasPhaseIdx]);
700 Scalar rswSat = FluidSystem::waterPvt().saturatedGasDissolutionFactor(pvtRegionIdx_,
705 Scalar rswMax = problem.maxGasDissolutionFactor(0, globalDofIdx);
706 (*this)[Indices::waterSwitchIdx] = min(rswSat, rswMax);
708 this->setScaledPressure_(pw);
716 const Scalar& rvw = (*this)[waterSwitchIdx];
717 Scalar p = this->pressure_();
719 std::array<Scalar, numPhases> pC = { 0.0 };
720 const MaterialLawParams& matParams = problem.materialLawParams(globalDofIdx);
721 Scalar so = 1.0 - sg - solventSaturation_();
722 computeCapillaryPressures_(pC, so, sg + solventSaturation_(), 0.0, matParams);
723 p += pcFactor_ * (pC[gasPhaseIdx] - pC[oilPhaseIdx]);
725 Scalar rvwSat = FluidSystem::gasPvt().saturatedWaterVaporizationFactor(pvtRegionIdx_,
730 if (rvw > rvwSat*(1.0 + eps)) {
732 (*this)[Indices::waterSwitchIdx] = 0.0;
742 const Scalar& pw = this->pressure_();
744 Scalar rswSat = FluidSystem::waterPvt().saturatedGasDissolutionFactor(pvtRegionIdx_,
749 Scalar rsw = (*this)[Indices::waterSwitchIdx];
750 Scalar rswMax = problem.maxGasDissolutionFactor(0, globalDofIdx);
751 if (rsw > min(rswSat, rswMax)) {
754 (*this)[Indices::waterSwitchIdx] = 1.0;
756 std::array<Scalar, numPhases> pC = { 0.0 };
757 const MaterialLawParams& matParams = problem.materialLawParams(globalDofIdx);
758 computeCapillaryPressures_(pC, 0.0, 0.0, 1.0, matParams);
759 Scalar pg = pw + pcFactor_ * (pC[gasPhaseIdx] - pC[waterPhaseIdx]);
760 this->setScaledPressure_(pg);
770 throw std::logic_error(
"No valid primary variable selected for water");
784 Scalar s = 1.0 - sw - solventSaturation_();
785 if (sg < -eps && s > 0.0 && FluidSystem::enableDissolvedGas()) {
786 const Scalar po = this->pressure_();
788 Scalar soMax = std::max(s, problem.maxOilSaturation(globalDofIdx));
789 Scalar rsMax = problem.maxGasDissolutionFactor(0, globalDofIdx);
793 : FluidSystem::oilPvt().saturatedGasDissolutionFactor(pvtRegionIdx_,
798 (*this)[Indices::compositionSwitchIdx] = std::min(rsMax, rsSat);
801 Scalar so = 1.0 - sw - solventSaturation_() - sg;
802 if (so < -eps && sg > 0.0 && FluidSystem::enableVaporizedOil()) {
807 const Scalar po = this->pressure_();
808 std::array<Scalar, numPhases> pC = { 0.0 };
809 const MaterialLawParams& matParams = problem.materialLawParams(globalDofIdx);
810 computeCapillaryPressures_(pC, 0.0, sg + solventSaturation_(), sw, matParams);
811 Scalar pg = po + pcFactor_ * (pC[gasPhaseIdx] - pC[oilPhaseIdx]);
816 this->setScaledPressure_(pg);
817 Scalar soMax = problem.maxOilSaturation(globalDofIdx);
818 Scalar rvMax = problem.maxOilVaporizationFactor(0, globalDofIdx);
822 : FluidSystem::gasPvt().saturatedOilVaporizationFactor(pvtRegionIdx_,
828 (*this)[Indices::compositionSwitchIdx] = std::min(rvMax, rvSat);
838 const Scalar po = this->pressure_();
839 Scalar so = 1.0 - sw - solventSaturation_();
840 Scalar soMax = std::max(so, problem.maxOilSaturation(globalDofIdx));
841 Scalar rsMax = problem.maxGasDissolutionFactor(0, globalDofIdx);
845 : FluidSystem::oilPvt().saturatedGasDissolutionFactor(pvtRegionIdx_,
851 Scalar rs = (*this)[Indices::compositionSwitchIdx];
852 if (rs > std::min(rsMax, rsSat*(Scalar{1.0} + eps))) {
855 (*this)[Indices::compositionSwitchIdx] = 0.0;
866 const Scalar pg = this->pressure_();
867 Scalar soMax = problem.maxOilSaturation(globalDofIdx);
868 Scalar rvMax = problem.maxOilVaporizationFactor(0, globalDofIdx);
872 : FluidSystem::gasPvt().saturatedOilVaporizationFactor(pvtRegionIdx_,
878 Scalar rv = (*this)[Indices::compositionSwitchIdx];
879 if (rv > std::min(rvMax, rvSat*(Scalar{1.0} + eps))) {
883 Scalar sg2 = 1.0 - sw - solventSaturation_();
884 std::array<Scalar, numPhases> pC = { 0.0 };
885 const MaterialLawParams& matParams = problem.materialLawParams(globalDofIdx);
886 computeCapillaryPressures_(pC,
888 sg2 + solventSaturation_(),
891 Scalar po = pg + pcFactor_ * (pC[oilPhaseIdx] - pC[gasPhaseIdx]);
895 this->setScaledPressure_(po);
896 (*this)[Indices::compositionSwitchIdx] = sg2;
906 throw std::logic_error(
"No valid primary variable selected for water");
918 sw = (*this)[Indices::waterSwitchIdx];
921 sg = (*this)[Indices::compositionSwitchIdx];
925 ssol =(*this) [Indices::solventSaturationIdx];
927 Scalar so = 1.0 - sw - sg - ssol;
928 sw = std::min(std::max(sw, Scalar{0.0}), Scalar{1.0});
929 so = std::min(std::max(so, Scalar{0.0}), Scalar{1.0});
930 sg = std::min(std::max(sg, Scalar{0.0}), Scalar{1.0});
931 ssol = std::min(std::max(ssol, Scalar{0.0}), Scalar{1.0});
932 Scalar st = sw + so + sg + ssol;
938 (*this)[Indices::waterSwitchIdx] = sw;
940 (*this)[Indices::compositionSwitchIdx] = sg;
942 (*this) [Indices::solventSaturationIdx] = ssol;
950 for (
unsigned i = 0; i < numEq; ++i)
967 for (
unsigned i = 0; i < this->size(); ++i)
968 Valgrind::CheckDefined((*
this)[i]);
971 Valgrind::CheckDefined(primaryVarsMeaningWater_);
972 Valgrind::CheckDefined(primaryVarsMeaningGas_);
973 Valgrind::CheckDefined(primaryVarsMeaningPressure_);
974 Valgrind::CheckDefined(primaryVarsMeaningBrine_);
975 Valgrind::CheckDefined(primaryVarsMeaningSolvent_);
977 Valgrind::CheckDefined(pvtRegionIdx_);
981 template<
class Serializer>
984 using FV = Dune::FieldVector<Scalar, getPropValue<TypeTag, Properties::NumEq>()>;
985 serializer(
static_cast<FV&
>(*
this));
986 serializer(primaryVarsMeaningWater_);
987 serializer(primaryVarsMeaningPressure_);
988 serializer(primaryVarsMeaningGas_);
989 serializer(primaryVarsMeaningBrine_);
990 serializer(primaryVarsMeaningSolvent_);
991 serializer(pvtRegionIdx_);
997 this->primaryVarsMeaningWater_ == rhs.primaryVarsMeaningWater_ &&
998 this->primaryVarsMeaningPressure_ == rhs.primaryVarsMeaningPressure_ &&
999 this->primaryVarsMeaningGas_ == rhs.primaryVarsMeaningGas_ &&
1000 this->primaryVarsMeaningBrine_ == rhs.primaryVarsMeaningBrine_ &&
1001 this->primaryVarsMeaningSolvent_ == rhs.primaryVarsMeaningSolvent_ &&
1002 this->pvtRegionIdx_ == rhs.pvtRegionIdx_;
1006 Implementation& asImp_()
1007 {
return *
static_cast<Implementation*
>(
this); }
1009 const Implementation& asImp_()
const
1010 {
return *
static_cast<const Implementation*
>(
this); }
1012 Scalar solventSaturation_()
const
1014 if constexpr (enableSolvent) {
1016 return (*
this)[Indices::solventSaturationIdx];
1021 Scalar zFraction_()
const
1023 if constexpr (enableExtbo)
1024 return (*
this)[Indices::zFractionIdx];
1029 Scalar polymerConcentration_()
const
1031 if constexpr (enablePolymer)
1032 return (*
this)[Indices::polymerConcentrationIdx];
1037 Scalar foamConcentration_()
const
1039 if constexpr (enableFoam)
1040 return (*
this)[Indices::foamConcentrationIdx];
1045 Scalar saltConcentration_()
const
1047 if constexpr (enableBrine)
1048 return (*
this)[Indices::saltConcentrationIdx];
1053 Scalar temperature_(
const Problem& problem, [[maybe_unused]]
unsigned globalDofIdx)
const
1055 if constexpr (enableEnergy)
1056 return (*
this)[Indices::temperatureIdx];
1057 else if constexpr( enableTemperature)
1058 return problem.temperature(globalDofIdx, 0);
1061 return FluidSystem::reservoirTemperature();
1064 Scalar microbialConcentration_()
const
1066 if constexpr (enableMICP)
1067 return (*
this)[Indices::microbialConcentrationIdx];
1072 Scalar oxygenConcentration_()
const
1074 if constexpr (enableMICP)
1075 return (*
this)[Indices::oxygenConcentrationIdx];
1080 Scalar ureaConcentration_()
const
1082 if constexpr (enableMICP)
1083 return (*
this)[Indices::ureaConcentrationIdx];
1088 Scalar biofilmConcentration_()
const
1090 if constexpr (enableMICP)
1091 return (*
this)[Indices::biofilmConcentrationIdx];
1096 Scalar calciteConcentration_()
const
1098 if constexpr (enableMICP)
1099 return (*
this)[Indices::calciteConcentrationIdx];
1104 template <
class Container>
1105 void computeCapillaryPressures_(Container& result,
1109 const MaterialLawParams& matParams)
const
1111 using SatOnlyFluidState = SimpleModularFluidState<Scalar,
1123 SatOnlyFluidState fluidState;
1124 fluidState.setSaturation(waterPhaseIdx, sw);
1125 fluidState.setSaturation(oilPhaseIdx, so);
1126 fluidState.setSaturation(gasPhaseIdx, sg);
1128 MaterialLaw::capillaryPressures(result, matParams, fluidState);
1131 Scalar pressure_()
const
1133 return (*
this)[Indices::pressureSwitchIdx] * this->pressureScale_;
1136 void setScaledPressure_(Scalar pressure)
1138 (*this)[Indices::pressureSwitchIdx] = pressure / (this->pressureScale_);
1146 unsigned short pvtRegionIdx_;
1148 static inline Scalar pressureScale_ = 1.0;
Contains the classes required to extend the black-oil model by brine.
Contains the classes required to extend the black-oil model by energy.
Contains the classes required to extend the black-oil model by solvent component. For details,...
Contains the classes required to extend the black-oil model to include the effects of foam.
Contains the classes required to extend the black-oil model by MICP.
Contains the classes required to extend the black-oil model by polymer.
Declares the properties required by the black oil model.
Contains the classes required to extend the black-oil model by solvents.
Contains the high level supplements required to extend the black oil model by brine.
Definition: blackoilbrinemodules.hh:58
static Scalar saltSol(unsigned regionIdx)
Definition: blackoilbrinemodules.hh:394
static const TabulatedFunction & pcfactTable(unsigned satnumRegionIdx)
Definition: blackoilbrinemodules.hh:342
static bool hasPcfactTables()
Definition: blackoilbrinemodules.hh:386
Contains the high level supplements required to extend the black oil model by energy.
Definition: blackoilenergymodules.hh:52
static void assignPrimaryVars(PrimaryVariables &priVars, Scalar)
Assign the energy specific primary variables to a PrimaryVariables object.
Definition: blackoilenergymodules.hh:247
Contains the high level supplements required to extend the black oil model.
Definition: blackoilextbomodules.hh:69
static Value rs(unsigned pvtRegionIdx, const Value &pressure, const Value &z)
Definition: blackoilextbomodules.hh:518
static Value rv(unsigned pvtRegionIdx, const Value &pressure, const Value &z)
Definition: blackoilextbomodules.hh:523
Contains the high level supplements required to extend the black oil model to include the effects of ...
Definition: blackoilfoammodules.hh:59
Contains the high level supplements required to extend the black oil model by MICP.
Definition: blackoilmicpmodules.hh:56
Contains the high level supplements required to extend the black oil model by polymer.
Definition: blackoilpolymermodules.hh:61
Represents the primary variables used by the black-oil model.
Definition: blackoilprimaryvariables.hh:62
bool operator==(const BlackOilPrimaryVariables &rhs) const
Definition: blackoilprimaryvariables.hh:994
unsigned pvtRegionIndex() const
Return the index of the region which should be used for PVT properties.
Definition: blackoilprimaryvariables.hh:248
WaterMeaning
Definition: blackoilprimaryvariables.hh:125
BlackOilPrimaryVariables & operator=(const BlackOilPrimaryVariables &other)=default
static void registerParameters()
Definition: blackoilprimaryvariables.hh:206
GasMeaning primaryVarsMeaningGas() const
Return the interpretation which should be applied to the switching primary variables.
Definition: blackoilprimaryvariables.hh:283
PressureMeaning primaryVarsMeaningPressure() const
Return the interpretation which should be applied to the switching primary variables.
Definition: blackoilprimaryvariables.hh:269
void serializeOp(Serializer &serializer)
Definition: blackoilprimaryvariables.hh:982
static void init()
Definition: blackoilprimaryvariables.hh:200
void setPrimaryVarsMeaningSolvent(SolventMeaning newMeaning)
Set the interpretation which should be applied to the switching primary variables.
Definition: blackoilprimaryvariables.hh:313
BlackOilPrimaryVariables()
Definition: blackoilprimaryvariables.hh:157
static BlackOilPrimaryVariables serializationTestObject()
Definition: blackoilprimaryvariables.hh:184
SolventMeaning primaryVarsMeaningSolvent() const
Definition: blackoilprimaryvariables.hh:305
bool chopAndNormalizeSaturations()
Definition: blackoilprimaryvariables.hh:911
bool adaptPrimaryVariables(const Problem &problem, unsigned globalDofIdx, Scalar swMaximum, Scalar thresholdWaterFilledCell, Scalar eps=0.0)
Adapt the interpretation of the switching variables to be physically meaningful.
Definition: blackoilprimaryvariables.hh:549
void setPrimaryVarsMeaningPressure(PressureMeaning newMeaning)
Set the interpretation which should be applied to the switching primary variables.
Definition: blackoilprimaryvariables.hh:276
WaterMeaning primaryVarsMeaningWater() const
Return the interpretation which should be applied to the switching primary variables.
Definition: blackoilprimaryvariables.hh:255
PressureMeaning
Definition: blackoilprimaryvariables.hh:132
void setPrimaryVarsMeaningWater(WaterMeaning newMeaning)
Set the interpretation which should be applied to the switching primary variables.
Definition: blackoilprimaryvariables.hh:262
void assignNaive(const FluidState &fluidState)
Directly retrieve the primary variables from an arbitrary fluid state.
Definition: blackoilprimaryvariables.hh:398
Evaluation makeEvaluation(unsigned varIdx, unsigned timeIdx, LinearizationType linearizationType=LinearizationType()) const
Definition: blackoilprimaryvariables.hh:218
void assignMassConservative(const FluidState &fluidState, const MaterialLawParams &matParams, bool isInEquilibrium=false)
Set the primary variables from an arbitrary fluid state in a mass conservative way.
Definition: blackoilprimaryvariables.hh:320
BlackOilPrimaryVariables(Scalar value)
Constructor with assignment from scalar.
Definition: blackoilprimaryvariables.hh:167
void setPrimaryVarsMeaningBrine(BrineMeaning newMeaning)
Set the interpretation which should be applied to the switching primary variables.
Definition: blackoilprimaryvariables.hh:301
BlackOilPrimaryVariables(const BlackOilPrimaryVariables &value)=default
Copy constructor.
SolventMeaning
Definition: blackoilprimaryvariables.hh:151
BrineMeaning primaryVarsMeaningBrine() const
Definition: blackoilprimaryvariables.hh:293
BlackOilPrimaryVariables & operator=(Scalar value)
Definition: blackoilprimaryvariables.hh:948
GasMeaning
Definition: blackoilprimaryvariables.hh:138
BrineMeaning
Definition: blackoilprimaryvariables.hh:145
void setPressureScale(Scalar val)
Definition: blackoilprimaryvariables.hh:212
void setPrimaryVarsMeaningGas(GasMeaning newMeaning)
Set the interpretation which should be applied to the switching primary variables.
Definition: blackoilprimaryvariables.hh:290
void setPvtRegionIndex(unsigned value)
Set the index of the region which should be used for PVT properties.
Definition: blackoilprimaryvariables.hh:242
void checkDefined() const
Instruct valgrind to check the definedness of all attributes of this class.
Definition: blackoilprimaryvariables.hh:963
Contains the high level supplements required to extend the black oil model by solvents.
Definition: blackoilsolventmodules.hh:69
static bool isSolubleInWater()
Definition: blackoilsolventmodules.hh:748
static const Value solubilityLimit(unsigned pvtIdx, const Value &temperature, const Value &pressure, const Value &saltConcentration)
Definition: blackoilsolventmodules.hh:736
Represents the primary variables used by the a model.
Definition: fvbaseprimaryvariables.hh:52
Definition: blackoilnewtonmethodparameters.hh:31
Definition: blackoilboundaryratevector.hh:37
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
Definition: linearizationtype.hh:35
Definition: blackoilprimaryvariables.hh:49
static constexpr Scalar value
Definition: blackoilprimaryvariables.hh:49