24#ifndef EWOMS_BLACK_OIL_PRIMARY_VARIABLES_HH
25#define EWOMS_BLACK_OIL_PRIMARY_VARIABLES_HH
27#include <dune/common/fvector.hh>
28#include <opm/common/OpmLog/OpmLog.hpp>
29#include <opm/common/utility/gpuDecorators.hpp>
31#include <opm/material/common/MathToolbox.hpp>
32#include <opm/material/common/Valgrind.hpp>
33#include <opm/material/fluidsystems/BlackOilFluidSystem.hpp>
34#include <opm/material/fluidstates/SimpleModularFluidState.hpp>
46#include <fmt/format.h>
59{
static constexpr Scalar
value = 1.0; };
70template <
class TypeTag,
template<
class,
int>
class VectorType = Dune::FieldVector>
85 enum { numEq = getPropValue<TypeTag, Properties::NumEq>() };
88 enum { waterSwitchIdx = Indices::waterSwitchIdx };
89 enum { pressureSwitchIdx = Indices::pressureSwitchIdx };
90 enum { compositionSwitchIdx = Indices::compositionSwitchIdx };
91 enum { saltConcentrationIdx = Indices::saltConcentrationIdx };
92 enum { solventSaturationIdx = Indices::solventSaturationIdx };
94 static constexpr bool compositionSwitchEnabled = Indices::compositionSwitchIdx >= 0;
95 static constexpr bool waterEnabled = Indices::waterEnabled;
96 static constexpr bool gasEnabled = Indices::gasEnabled;
97 static constexpr bool oilEnabled = Indices::oilEnabled;
100 enum { numPhases = getPropValue<TypeTag, Properties::NumPhases>() };
101 enum { gasPhaseIdx = FluidSystem::gasPhaseIdx };
102 enum { waterPhaseIdx = FluidSystem::waterPhaseIdx };
103 enum { oilPhaseIdx = FluidSystem::oilPhaseIdx };
106 enum { numComponents = getPropValue<TypeTag, Properties::NumComponents>() };
107 enum { enableSolvent = getPropValue<TypeTag, Properties::EnableSolvent>() };
108 enum { enableExtbo = getPropValue<TypeTag, Properties::EnableExtbo>() };
109 enum { enablePolymer = getPropValue<TypeTag, Properties::EnablePolymer>() };
110 enum { enableFoam = getPropValue<TypeTag, Properties::EnableFoam>() };
111 enum { enableBrine = getPropValue<TypeTag, Properties::EnableBrine>() };
112 enum { enableSaltPrecipitation = getPropValue<TypeTag, Properties::EnableSaltPrecipitation>() };
113 enum { enableVapwat = getPropValue<TypeTag, Properties::EnableVapwat>() };
114 static constexpr EnergyModules energyModuleType = getPropValue<TypeTag, Properties::EnergyModuleType>();
115 enum { enableEnergy = (energyModuleType == EnergyModules::FullyImplicitThermal) };
116 enum { enableTemperature = (energyModuleType == EnergyModules::ConstantTemperature) };
117 enum { enableBioeffects = getPropValue<TypeTag, Properties::EnableBioeffects>() };
118 enum { enableMICP = Indices::enableMICP };
119 enum { gasCompIdx = FluidSystem::gasCompIdx };
120 enum { waterCompIdx = FluidSystem::waterCompIdx };
121 enum { oilCompIdx = FluidSystem::oilCompIdx };
123 using Toolbox = MathToolbox<Evaluation>;
124 using ComponentVector = Dune::FieldVector<Scalar, numComponents>;
131 static_assert(numPhases == 3,
"The black-oil model assumes three phases!");
132 static_assert(numComponents == 3,
"The black-oil model assumes three components!");
145 template<
class OtherTypeTag,
template<
class,
int>
class OtherVectorType>
151 template <
class OtherTypeTag,
template <
class,
int>
class OtherVectorType>
152 explicit OPM_HOST_DEVICE
155 , primaryVarsMeaningWater_(other.primaryVarsMeaningWater_)
156 , primaryVarsMeaningPressure_(other.primaryVarsMeaningPressure_)
157 , primaryVarsMeaningGas_(other.primaryVarsMeaningGas_)
158 , primaryVarsMeaningBrine_(other.primaryVarsMeaningBrine_)
159 , primaryVarsMeaningSolvent_(other.primaryVarsMeaningSolvent_)
160 , pvtRegionIdx_(other.pvtRegionIdx_)
161 , pcFactor_(other.pcFactor_)
167 Valgrind::SetUndefined(*
this);
179 result.pvtRegionIdx_ = 1;
180 result.primaryVarsMeaningBrine_ = BrineMeaning::Sp;
182 result.primaryVarsMeaningPressure_ = PressureMeaning::Pg;
183 result.primaryVarsMeaningWater_ = WaterMeaning::Rsw;
184 result.primaryVarsMeaningSolvent_ = SolventMeaning::Ss;
185 for (std::size_t i = 0; i < result.size(); ++i) {
195 pressureScale_ = Parameters::Get<Parameters::PressureScale<Scalar>>();
203 if (pressureScale_ != Scalar {1.0}) {
204 OpmLog::warning(fmt::format(
205 "Using a pressure scaling different from 1.0 is not supported "
206 "when running with GPU support. We have detected that you are compiling with GPU support, but we can "
207 "not detect whether you are running with GPU support for the assembly or property evaluation. If you "
208 "are doing property evaluation or assembly on the GPU, pressure scaling will be ignored."
209 "Read value of pressure scale: {}",
217 Parameters::Register<Parameters::PressureScale<Scalar>>
218 (
"Scaling of pressure primary variable");
221 OPM_HOST_DEVICE Evaluation
225 const Scalar scale = varIdx == pressureSwitchIdx ? this->getPressureScale() : Scalar{1.0};
226 if (std::is_same_v<Evaluation, Scalar>) {
227 return (*
this)[varIdx] * scale;
231 if (timeIdx == linearizationType.time) {
232 return Toolbox::createVariable((*
this)[varIdx], varIdx) * scale;
235 return Toolbox::createConstant((*
this)[varIdx]) * scale;
248 { pvtRegionIdx_ =
static_cast<unsigned short>(value); }
254 {
return pvtRegionIdx_; }
261 {
return primaryVarsMeaningWater_; }
268 { primaryVarsMeaningWater_ = newMeaning; }
275 {
return primaryVarsMeaningPressure_; }
282 { primaryVarsMeaningPressure_ = newMeaning; }
289 {
return primaryVarsMeaningGas_; }
296 { primaryVarsMeaningGas_ = newMeaning; }
299 {
return primaryVarsMeaningBrine_; }
306 { primaryVarsMeaningBrine_ = newMeaning; }
309 {
return primaryVarsMeaningSolvent_; }
316 { primaryVarsMeaningSolvent_ = newMeaning; }
321 template <
class Flu
idState>
324 using ConstEvaluation = std::remove_reference_t<typename FluidState::Scalar>;
325 using FsEvaluation = std::remove_const_t<ConstEvaluation>;
326 using FsToolbox = MathToolbox<FsEvaluation>;
328 const bool gasPresent =
329 fluidState.fluidSystem().phaseIsActive(gasPhaseIdx)
330 ? fluidState.saturation(gasPhaseIdx) > 0.0
332 const bool oilPresent =
333 fluidState.fluidSystem().phaseIsActive(oilPhaseIdx)
334 ? fluidState.saturation(oilPhaseIdx) > 0.0
336 const bool waterPresent =
337 fluidState.fluidSystem().phaseIsActive(waterPhaseIdx)
338 ? fluidState.saturation(waterPhaseIdx) > 0.0
340 const auto& saltSaturation =
341 BlackOil::getSaltSaturation_<FluidSystem, FluidState, Scalar>(fluidState, pvtRegionIdx_);
342 const bool precipitatedSaltPresent = enableSaltPrecipitation ? saltSaturation > 0.0 :
false;
343 const bool oneActivePhases = fluidState.fluidSystem().numActivePhases() == 1;
350 if (gasPresent && fluidState.fluidSystem().enableVaporizedOil() && !oilPresent) {
351 primaryVarsMeaningPressure_ = PressureMeaning::Pg;
353 else if (fluidState.fluidSystem().phaseIsActive(oilPhaseIdx)) {
354 primaryVarsMeaningPressure_ = PressureMeaning::Po;
356 else if (waterPresent && fluidState.fluidSystem().enableDissolvedGasInWater() && !gasPresent) {
357 primaryVarsMeaningPressure_ = PressureMeaning::Pw;
359 else if (fluidState.fluidSystem().phaseIsActive(gasPhaseIdx)) {
360 primaryVarsMeaningPressure_ = PressureMeaning::Pg;
363 assert(fluidState.fluidSystem().phaseIsActive(waterPhaseIdx));
364 primaryVarsMeaningPressure_ = PressureMeaning::Pw;
371 if (waterPresent && gasPresent) {
374 else if (gasPresent && fluidState.fluidSystem().enableVaporizedWater()) {
375 primaryVarsMeaningWater_ = WaterMeaning::Rvw;
377 else if (waterPresent && fluidState.fluidSystem().enableDissolvedGasInWater()) {
378 primaryVarsMeaningWater_ = WaterMeaning::Rsw;
380 else if (fluidState.fluidSystem().phaseIsActive(waterPhaseIdx) && !oneActivePhases) {
384 primaryVarsMeaningWater_ = WaterMeaning::Disabled;
392 if (gasPresent && oilPresent) {
395 else if (oilPresent && fluidState.fluidSystem().enableDissolvedGas()) {
398 else if (gasPresent && fluidState.fluidSystem().enableVaporizedOil()) {
401 else if (fluidState.fluidSystem().phaseIsActive(gasPhaseIdx) && fluidState.fluidSystem().phaseIsActive(oilPhaseIdx)) {
405 primaryVarsMeaningGas_ = GasMeaning::Disabled;
409 if constexpr (enableSaltPrecipitation) {
410 if (precipitatedSaltPresent) {
411 primaryVarsMeaningBrine_ = BrineMeaning::Sp;
414 primaryVarsMeaningBrine_ = BrineMeaning::Cs;
418 primaryVarsMeaningBrine_ = BrineMeaning::Disabled;
423 case PressureMeaning::Po:
424 this->setScaledPressure_(FsToolbox::value(fluidState.pressure(oilPhaseIdx)));
426 case PressureMeaning::Pg:
427 this->setScaledPressure_(FsToolbox::value(fluidState.pressure(gasPhaseIdx)));
429 case PressureMeaning::Pw:
430 this->setScaledPressure_(FsToolbox::value(fluidState.pressure(waterPhaseIdx)));
433 OPM_THROW(std::logic_error,
"No valid primary variable selected for pressure");
439 (*this)[waterSwitchIdx] = FsToolbox::value(fluidState.saturation(waterPhaseIdx));
442 case WaterMeaning::Rvw:
444 const auto& rvw = BlackOil::getRvw_<FluidSystem, FluidState, Scalar>(fluidState, pvtRegionIdx_);
445 (*this)[waterSwitchIdx] = rvw;
448 case WaterMeaning::Rsw:
450 const auto& Rsw = BlackOil::getRsw_<FluidSystem, FluidState, Scalar>(fluidState, pvtRegionIdx_);
451 (*this)[waterSwitchIdx] = Rsw;
454 case WaterMeaning::Disabled:
457 OPM_THROW(std::logic_error,
"No valid primary variable selected for water");
461 (*this)[compositionSwitchIdx] = FsToolbox::value(fluidState.saturation(gasPhaseIdx));
465 const auto& rs = BlackOil::getRs_<FluidSystem, FluidState, Scalar>(fluidState, pvtRegionIdx_);
466 (*this)[compositionSwitchIdx] = rs;
471 const auto& rv = BlackOil::getRv_<FluidSystem, FluidState, Scalar>(fluidState, pvtRegionIdx_);
472 (*this)[compositionSwitchIdx] = rv;
475 case GasMeaning::Disabled:
478 OPM_THROW(std::logic_error,
"No valid primary variable selected for composision");
494 unsigned globalDofIdx,
495 [[maybe_unused]] Scalar swMaximum,
496 Scalar thresholdWaterFilledCell, Scalar eps = 0.0)
515 Scalar saltConcentration = 0.0;
516 const Scalar& T = asImp_().temperature_(problem, globalDofIdx);
518 sw = (*this)[waterSwitchIdx];
521 sg = (*this)[compositionSwitchIdx];
533 if constexpr (enableSaltPrecipitation) {
536 saltConcentration = saltSolubility;
537 const Scalar saltSat = (*this)[saltConcentrationIdx];
538 if (saltSat < -eps) {
540 (*this)[saltConcentrationIdx] = saltSolubility;
544 saltConcentration = (*this)[saltConcentrationIdx];
545 if (saltConcentration > saltSolubility + eps) {
547 (*this)[saltConcentrationIdx] = 0.0;
555 if constexpr (enableSolvent) {
557 const Scalar p = (*this)[pressureSwitchIdx];
558 const Scalar solLimit =
561 const Scalar solSat = (*this)[solventSaturationIdx];
564 (*this)[solventSaturationIdx] = solLimit;
568 const Scalar rsolw = (*this)[solventSaturationIdx];
569 if (rsolw > solLimit + eps) {
571 (*this)[solventSaturationIdx] = 0.0;
578 bool changed =
false;
586 if (sw >= thresholdWaterFilledCell && !FluidSystem::enableDissolvedGasInWater()) {
588 if constexpr (waterEnabled) {
589 (*this)[Indices::waterSwitchIdx] = std::min(swMaximum, sw);
593 if constexpr (compositionSwitchEnabled) {
594 (*this)[Indices::compositionSwitchIdx] = 0.0;
599 if constexpr (compositionSwitchEnabled) {
609 if constexpr (enableBrine) {
611 unsigned satnumRegionIdx = problem.satnumRegionIndex(globalDofIdx);
612 Scalar Sp = saltConcentration_();
613 Scalar porosityFactor = std::min(1.0 - Sp, 1.0);
615 pcFactor_ = pcfactTable.eval(porosityFactor,
true);
618 else if constexpr (enableBioeffects) {
620 unsigned satnumRegionIdx = problem.satnumRegionIndex(globalDofIdx);
621 Scalar Sb = biofilmVolumeFraction_() /
622 problem.referencePorosity(globalDofIdx, 0);
623 Scalar porosityFactor = std::min(1.0 - Sb, 1.0);
625 pcFactor_ = pcfactTable.eval(porosityFactor,
true);
633 if (sw < -eps && sg > eps && FluidSystem::enableVaporizedWater()) {
634 Scalar p = this->pressure_();
636 std::array<Scalar, numPhases> pC{};
637 const MaterialLawParams& matParams = problem.materialLawParams(globalDofIdx);
638 const Scalar so = 1.0 - sg - solventSaturation_();
639 computeCapillaryPressures_(pC, so, sg + solventSaturation_(), 0.0, matParams);
640 p += pcFactor_ * (pC[gasPhaseIdx] - pC[oilPhaseIdx]);
642 const Scalar rvwSat =
643 FluidSystem::gasPvt().saturatedWaterVaporizationFactor(pvtRegionIdx_,
648 (*this)[Indices::waterSwitchIdx] = rvwSat;
654 if (sg < -eps && sw > eps && FluidSystem::enableDissolvedGasInWater()) {
655 const Scalar pg = this->pressure_();
657 std::array<Scalar, numPhases> pC = { 0.0 };
658 const MaterialLawParams& matParams = problem.materialLawParams(globalDofIdx);
659 const Scalar so = 1.0 - sw - solventSaturation_();
660 computeCapillaryPressures_(pC, so, 0.0, sw, matParams);
661 const Scalar pw = pg + pcFactor_ * (pC[waterPhaseIdx] - pC[gasPhaseIdx]);
662 const Scalar rswSat =
663 FluidSystem::waterPvt().saturatedGasDissolutionFactor(pvtRegionIdx_,
668 const Scalar rswMax = problem.maxGasDissolutionFactor(0, globalDofIdx);
669 (*this)[Indices::waterSwitchIdx] = std::min(rswSat, rswMax);
671 this->setScaledPressure_(pw);
677 case WaterMeaning::Rvw:
679 const Scalar& rvw = (*this)[waterSwitchIdx];
680 Scalar p = this->pressure_();
682 std::array<Scalar, numPhases> pC{};
683 const MaterialLawParams& matParams = problem.materialLawParams(globalDofIdx);
684 const Scalar so = 1.0 - sg - solventSaturation_();
685 computeCapillaryPressures_(pC, so, sg + solventSaturation_(), 0.0, matParams);
686 p += pcFactor_ * (pC[gasPhaseIdx] - pC[oilPhaseIdx]);
688 const Scalar rvwSat =
689 FluidSystem::gasPvt().saturatedWaterVaporizationFactor(pvtRegionIdx_,
694 if (rvw > rvwSat * (1.0 + eps)) {
696 (*this)[Indices::waterSwitchIdx] = 0.0;
701 case WaterMeaning::Rsw:
706 const Scalar& pw = this->pressure_();
708 const Scalar rswSat =
709 FluidSystem::waterPvt().saturatedGasDissolutionFactor(pvtRegionIdx_,
714 const Scalar rsw = (*this)[Indices::waterSwitchIdx];
715 const Scalar rswMax = problem.maxGasDissolutionFactor(0, globalDofIdx);
716 if (rsw > std::min(rswSat, rswMax)) {
719 (*this)[Indices::waterSwitchIdx] = 1.0;
721 std::array<Scalar, numPhases> pC{};
722 const MaterialLawParams& matParams = problem.materialLawParams(globalDofIdx);
723 computeCapillaryPressures_(pC, 0.0, 0.0, 1.0, matParams);
724 const Scalar pg = pw + pcFactor_ * (pC[gasPhaseIdx] - pC[waterPhaseIdx]);
725 this->setScaledPressure_(pg);
730 case WaterMeaning::Disabled:
733 throw std::logic_error(
"No valid primary variable selected for water");
746 const Scalar s = 1.0 - sw - solventSaturation_();
747 if (sg < -eps && s > 0.0 && FluidSystem::enableDissolvedGas()) {
748 const Scalar po = this->pressure_();
750 const Scalar soMax = std::max(s, problem.maxOilSaturation(globalDofIdx));
751 const Scalar rsMax = problem.maxGasDissolutionFactor(0, globalDofIdx);
755 : FluidSystem::oilPvt().saturatedGasDissolutionFactor(pvtRegionIdx_,
760 (*this)[Indices::compositionSwitchIdx] = std::min(rsMax, rsSat);
763 const Scalar so = 1.0 - sw - solventSaturation_() - sg;
764 if (so < -eps && sg > 0.0 && FluidSystem::enableVaporizedOil()) {
769 const Scalar po = this->pressure_();
770 std::array<Scalar, numPhases> pC{};
771 const MaterialLawParams& matParams = problem.materialLawParams(globalDofIdx);
772 computeCapillaryPressures_(pC, 0.0, sg + solventSaturation_(), sw, matParams);
773 const Scalar pg = po + pcFactor_ * (pC[gasPhaseIdx] - pC[oilPhaseIdx]);
778 this->setScaledPressure_(pg);
779 const Scalar soMax = problem.maxOilSaturation(globalDofIdx);
780 const Scalar rvMax = problem.maxOilVaporizationFactor(0, globalDofIdx);
784 : FluidSystem::gasPvt().saturatedOilVaporizationFactor(pvtRegionIdx_,
790 (*this)[Indices::compositionSwitchIdx] = std::min(rvMax, rvSat);
800 const Scalar po = this->pressure_();
801 const Scalar so = 1.0 - sw - solventSaturation_();
802 const Scalar soMax = std::max(so, problem.maxOilSaturation(globalDofIdx));
803 const Scalar rsMax = problem.maxGasDissolutionFactor(0, globalDofIdx);
807 : FluidSystem::oilPvt().saturatedGasDissolutionFactor(pvtRegionIdx_,
813 const Scalar rs = (*this)[Indices::compositionSwitchIdx];
814 if (rs > std::min(rsMax, rsSat * (Scalar{1.0} + eps))) {
817 (*this)[Indices::compositionSwitchIdx] = 0.0;
828 const Scalar pg = this->pressure_();
829 const Scalar soMax = problem.maxOilSaturation(globalDofIdx);
830 const Scalar rvMax = problem.maxOilVaporizationFactor(0, globalDofIdx);
834 : FluidSystem::gasPvt().saturatedOilVaporizationFactor(pvtRegionIdx_,
840 const Scalar rv = (*this)[Indices::compositionSwitchIdx];
841 if (rv > std::min(rvMax, rvSat * (Scalar{1.0} + eps))) {
845 const Scalar sg2 = 1.0 - sw - solventSaturation_();
846 std::array<Scalar, numPhases> pC{};
847 const MaterialLawParams& matParams = problem.materialLawParams(globalDofIdx);
848 computeCapillaryPressures_(pC,
850 sg2 + solventSaturation_(),
853 const Scalar po = pg + pcFactor_ * (pC[oilPhaseIdx] - pC[gasPhaseIdx]);
857 this->setScaledPressure_(po);
858 (*this)[Indices::compositionSwitchIdx] = sg2;
863 case GasMeaning::Disabled:
866 throw std::logic_error(
"No valid primary variable selected for water");
880 sw = (*this)[Indices::waterSwitchIdx];
884 sg = (*this)[Indices::compositionSwitchIdx];
889 ssol =(*this) [Indices::solventSaturationIdx];
892 Scalar so = 1.0 - sw - sg - ssol;
893 sw = std::min(std::max(sw, Scalar{0.0}), Scalar{1.0});
894 so = std::min(std::max(so, Scalar{0.0}), Scalar{1.0});
895 sg = std::min(std::max(sg, Scalar{0.0}), Scalar{1.0});
896 ssol = std::min(std::max(ssol, Scalar{0.0}), Scalar{1.0});
897 const Scalar st = sw + so + sg + ssol;
903 (*this)[Indices::waterSwitchIdx] = sw;
906 (*this)[Indices::compositionSwitchIdx] = sg;
909 (*this) [Indices::solventSaturationIdx] = ssol;
917 using ParentType::operator=;
930 for (
unsigned i = 0; i < this->size(); ++i) {
931 Valgrind::CheckDefined((*
this)[i]);
935 Valgrind::CheckDefined(primaryVarsMeaningWater_);
936 Valgrind::CheckDefined(primaryVarsMeaningGas_);
937 Valgrind::CheckDefined(primaryVarsMeaningPressure_);
938 Valgrind::CheckDefined(primaryVarsMeaningBrine_);
939 Valgrind::CheckDefined(primaryVarsMeaningSolvent_);
941 Valgrind::CheckDefined(pvtRegionIdx_);
945 template<
class Serializer>
948 using FV = Dune::FieldVector<Scalar, getPropValue<TypeTag, Properties::NumEq>()>;
949 serializer(
static_cast<FV&
>(*
this));
950 serializer(primaryVarsMeaningWater_);
951 serializer(primaryVarsMeaningPressure_);
952 serializer(primaryVarsMeaningGas_);
953 serializer(primaryVarsMeaningBrine_);
954 serializer(primaryVarsMeaningSolvent_);
955 serializer(pvtRegionIdx_);
962 && this->primaryVarsMeaningWater_ == rhs.primaryVarsMeaningWater_
963 && this->primaryVarsMeaningPressure_ == rhs.primaryVarsMeaningPressure_
964 && this->primaryVarsMeaningGas_ == rhs.primaryVarsMeaningGas_
965 && this->primaryVarsMeaningBrine_ == rhs.primaryVarsMeaningBrine_
966 && this->primaryVarsMeaningSolvent_ == rhs.primaryVarsMeaningSolvent_
967 && this->pvtRegionIdx_ == rhs.pvtRegionIdx_;
971 OPM_HOST_DEVICE Implementation& asImp_()
972 {
return *
static_cast<Implementation*
>(
this); }
974 OPM_HOST_DEVICE
const Implementation& asImp_()
const
975 {
return *
static_cast<const Implementation*
>(
this); }
977 OPM_HOST_DEVICE Scalar solventSaturation_()
const
979 if constexpr (enableSolvent) {
981 return (*
this)[Indices::solventSaturationIdx];
987 OPM_HOST_DEVICE Scalar zFraction_()
const
989 if constexpr (enableExtbo) {
990 return (*
this)[Indices::zFractionIdx];
997 OPM_HOST_DEVICE Scalar saltConcentration_()
const
999 if constexpr (enableBrine) {
1000 return (*
this)[Indices::saltConcentrationIdx];
1007 Scalar biofilmVolumeFraction_()
const
1009 if constexpr (enableBioeffects)
1010 return (*
this)[Indices::biofilmVolumeFractionIdx];
1015 OPM_HOST_DEVICE Scalar temperature_(
const Problem& problem, [[maybe_unused]]
unsigned globalDofIdx)
const
1017 if constexpr (enableEnergy) {
1018 return (*
this)[Indices::temperatureIdx];
1020 else if constexpr (enableTemperature) {
1021 return problem.temperature(globalDofIdx, 0);
1024 return FluidSystem::reservoirTemperature();
1028 template <
class Container>
1029 OPM_HOST_DEVICE
void computeCapillaryPressures_(Container& result,
1033 const MaterialLawParams& matParams)
const
1048 fluidState.setSaturation(waterPhaseIdx, sw);
1049 fluidState.setSaturation(oilPhaseIdx, so);
1050 fluidState.setSaturation(gasPhaseIdx, sg);
1052 MaterialLaw::capillaryPressures(result, matParams, fluidState);
1055 OPM_HOST_DEVICE Scalar pressure_()
const
1057 return (*
this)[Indices::pressureSwitchIdx] * this->getPressureScale();
1060 OPM_HOST_DEVICE
constexpr Scalar getPressureScale()
const
1064 #if OPM_IS_INSIDE_DEVICE_FUNCTION
1067 return this->pressureScale_;
1071 void setScaledPressure_(Scalar pressure)
1072 { (*this)[Indices::pressureSwitchIdx] = pressure / (this->getPressureScale()); }
1075 WaterMeaning primaryVarsMeaningWater_{WaterMeaning::Disabled};
1077 GasMeaning primaryVarsMeaningGas_{GasMeaning::Disabled};
1078 BrineMeaning primaryVarsMeaningBrine_{BrineMeaning::Disabled};
1079 SolventMeaning primaryVarsMeaningSolvent_{SolventMeaning::Disabled};
1080 unsigned short pvtRegionIdx_;
1082 inline static Scalar pressureScale_ = 1.0;
Contains the classes required to extend the black-oil model by bioeffects.
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,...
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 bioeffects.
Definition: blackoilbioeffectsmodules.hh:93
static bool hasPcfactTables()
Definition: blackoilbioeffectsmodules.hh:481
static const TabulatedFunction & pcfactTable(unsigned satnumRegionIdx)
Definition: blackoilbioeffectsmodules.hh:476
Contains the high level supplements required to extend the black oil model by brine.
Definition: blackoilbrinemodules.hh:56
static Scalar saltSol(unsigned regionIdx)
Definition: blackoilbrinemodules.hh:352
static const TabulatedFunction & pcfactTable(unsigned satnumRegionIdx)
Definition: blackoilbrinemodules.hh:296
static bool hasPcfactTables()
Definition: blackoilbrinemodules.hh:342
Contains the high level supplements required to extend the black oil model by energy.
Definition: blackoilenergymodules.hh:60
static void assignPrimaryVars(PrimaryVariables &priVars, const FluidState &fluidState)
Assign the energy specific primary variables to a PrimaryVariables object.
Definition: blackoilenergymodules.hh:265
Contains the high level supplements required to extend the black oil model.
Definition: blackoilextbomodules.hh:62
static Value rs(unsigned pvtRegionIdx, const Value &pressure, const Value &z)
Definition: blackoilextbomodules.hh:348
static Value rv(unsigned pvtRegionIdx, const Value &pressure, const Value &z)
Definition: blackoilextbomodules.hh:352
Represents the primary variables used by the black-oil model.
Definition: blackoilprimaryvariables.hh:72
::Opm::BlackOil::WaterMeaning WaterMeaning
Definition: blackoilprimaryvariables.hh:138
OPM_HOST_DEVICE void setPrimaryVarsMeaningPressure(PressureMeaning newMeaning)
Set the interpretation which should be applied to the switching primary variables.
Definition: blackoilprimaryvariables.hh:281
OPM_HOST_DEVICE void setPrimaryVarsMeaningBrine(BrineMeaning newMeaning)
Set the interpretation which should be applied to the switching primary variables.
Definition: blackoilprimaryvariables.hh:305
static void init()
Definition: blackoilprimaryvariables.hh:192
OPM_HOST_DEVICE BlackOilPrimaryVariables(const BlackOilPrimaryVariables< OtherTypeTag, OtherVectorType > &other)
Assignment from another primary variables object.
Definition: blackoilprimaryvariables.hh:153
::Opm::BlackOil::SolventMeaning SolventMeaning
Definition: blackoilprimaryvariables.hh:142
OPM_HOST_DEVICE void checkDefined() const
< Import base class assignment operators.
Definition: blackoilprimaryvariables.hh:926
OPM_HOST_DEVICE PressureMeaning primaryVarsMeaningPressure() const
Return the interpretation which should be applied to the switching primary variables.
Definition: blackoilprimaryvariables.hh:274
::Opm::BlackOil::GasMeaning GasMeaning
Definition: blackoilprimaryvariables.hh:140
OPM_HOST_DEVICE BlackOilPrimaryVariables()
Definition: blackoilprimaryvariables.hh:165
OPM_HOST_DEVICE bool chopAndNormalizeSaturations()
Definition: blackoilprimaryvariables.hh:871
OPM_HOST_DEVICE unsigned pvtRegionIndex() const
Return the index of the region which should be used for PVT properties.
Definition: blackoilprimaryvariables.hh:253
OPM_HOST_DEVICE bool operator==(const BlackOilPrimaryVariables &rhs) const
Definition: blackoilprimaryvariables.hh:958
void serializeOp(Serializer &serializer)
Definition: blackoilprimaryvariables.hh:946
OPM_HOST_DEVICE void setPrimaryVarsMeaningWater(WaterMeaning newMeaning)
Set the interpretation which should be applied to the switching primary variables.
Definition: blackoilprimaryvariables.hh:267
OPM_HOST_DEVICE void setPrimaryVarsMeaningGas(GasMeaning newMeaning)
Set the interpretation which should be applied to the switching primary variables.
Definition: blackoilprimaryvariables.hh:295
static void registerParameters()
Definition: blackoilprimaryvariables.hh:215
::Opm::BlackOil::BrineMeaning BrineMeaning
Definition: blackoilprimaryvariables.hh:141
BlackOilPrimaryVariables & operator=(const BlackOilPrimaryVariables &other)=default
BlackOilPrimaryVariables(const BlackOilPrimaryVariables &value)=default
Copy constructor.
::Opm::BlackOil::PressureMeaning PressureMeaning
Definition: blackoilprimaryvariables.hh:139
OPM_HOST_DEVICE GasMeaning primaryVarsMeaningGas() const
Return the interpretation which should be applied to the switching primary variables.
Definition: blackoilprimaryvariables.hh:288
OPM_HOST_DEVICE void setPvtRegionIndex(unsigned value)
Set the index of the region which should be used for PVT properties.
Definition: blackoilprimaryvariables.hh:247
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:493
OPM_HOST_DEVICE void assignNaive(const FluidState &fluidState)
Directly retrieve the primary variables from an arbitrary fluid state.
Definition: blackoilprimaryvariables.hh:322
OPM_HOST_DEVICE BrineMeaning primaryVarsMeaningBrine() const
Definition: blackoilprimaryvariables.hh:298
OPM_HOST_DEVICE void setPrimaryVarsMeaningSolvent(SolventMeaning newMeaning)
Set the interpretation which should be applied to the switching primary variables.
Definition: blackoilprimaryvariables.hh:315
OPM_HOST_DEVICE WaterMeaning primaryVarsMeaningWater() const
Return the interpretation which should be applied to the switching primary variables.
Definition: blackoilprimaryvariables.hh:260
static BlackOilPrimaryVariables serializationTestObject()
Definition: blackoilprimaryvariables.hh:176
OPM_HOST_DEVICE Evaluation makeEvaluation(unsigned varIdx, unsigned timeIdx, LinearizationType linearizationType=LinearizationType()) const
Definition: blackoilprimaryvariables.hh:222
OPM_HOST_DEVICE SolventMeaning primaryVarsMeaningSolvent() const
Definition: blackoilprimaryvariables.hh:308
Contains the high level supplements required to extend the black oil model by solvents.
Definition: blackoilsolventmodules.hh:68
static bool isSolubleInWater()
Definition: blackoilsolventmodules.hh:521
static Value solubilityLimit(unsigned pvtIdx, const Value &temperature, const Value &pressure, const Value &saltConcentration)
Definition: blackoilsolventmodules.hh:503
Represents the primary variables used by the a model.
Definition: fvbaseprimaryvariables.hh:54
BrineMeaning
Definition: blackoilmeanings.hh:42
PressureMeaning
Definition: blackoilmeanings.hh:29
WaterMeaning
Definition: blackoilmeanings.hh:22
SolventMeaning
Definition: blackoilmeanings.hh:48
GasMeaning
Definition: blackoilmeanings.hh:35
SimpleModularFluidState< double, 3, 3, FluidSystemSimple, false, false, false, false, true, false, false, false > SatOnlyFluidState
Definition: EquilibrationHelpers_impl.hpp:53
Definition: blackoilnewtonmethodparams.hpp:31
Definition: blackoilbioeffectsmodules.hh:43
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
Definition: linearizationtype.hh:34
Definition: blackoilprimaryvariables.hh:59
static constexpr Scalar value
Definition: blackoilprimaryvariables.hh:59