27 #ifndef OPM_BLACK_OIL_FLUID_SYSTEM_HPP 28 #define OPM_BLACK_OIL_FLUID_SYSTEM_HPP 38 #include <opm/common/Valgrind.hpp> 40 #include <opm/common/Exceptions.hpp> 41 #include <opm/common/ErrorMacros.hpp> 52 template <class FluidSystem, class LhsEval, class FluidState>
53 LhsEval getRs_(typename
std::enable_if<!HasMember_Rs<FluidState>::value, const FluidState&>::type fluidState,
57 Opm::decay<LhsEval>(fluidState.massFraction(FluidSystem::oilPhaseIdx,
58 FluidSystem::gasCompIdx));
59 return FluidSystem::convertXoGToRs(XoG, regionIdx);
62 template <
class Flu
idSystem,
class LhsEval,
class Flu
idState>
63 auto getRs_(
typename std::enable_if<HasMember_Rs<FluidState>::value,
const FluidState&>::type fluidState,
64 unsigned regionIdx OPM_UNUSED)
66 ::
template decay<LhsEval>(fluidState.Rs()))
68 return Opm::decay<LhsEval>(fluidState.Rs());
71 template <
class Flu
idSystem,
class LhsEval,
class Flu
idState>
72 LhsEval getRv_(
typename std::enable_if<!HasMember_Rv<FluidState>::value,
const FluidState&>::type fluidState,
76 Opm::decay<LhsEval>(fluidState.massFraction(FluidSystem::gasPhaseIdx,
77 FluidSystem::oilCompIdx));
78 return FluidSystem::convertXgOToRv(XgO, regionIdx);
81 template <
class Flu
idSystem,
class LhsEval,
class Flu
idState>
82 auto getRv_(
typename std::enable_if<HasMember_Rv<FluidState>::value,
const FluidState&>::type fluidState,
83 unsigned regionIdx OPM_UNUSED)
85 ::
template decay<LhsEval>(fluidState.Rv()))
87 return Opm::decay<LhsEval>(fluidState.Rv());
91 namespace FluidSystems {
99 template <
class Scalar>
110 template <
class EvaluationT>
113 typedef EvaluationT Evaluation;
118 maxOilSat_ = maxOilSat;
119 regionIdx_ = regionIdx;
129 template <
class OtherCache>
132 regionIdx_ = other.regionIndex();
133 maxOilSat_ = other.maxOilSat();
144 {
return regionIdx_; }
154 { regionIdx_ = val; }
156 const Scalar maxOilSat()
const 157 {
return maxOilSat_; }
159 void setMaxOilSat(
Scalar val)
160 { maxOilSat_ = val; }
174 static void initFromDeck(
const Deck& deck,
const EclipseState& eclState)
176 auto densityKeyword = deck.getKeyword(
"DENSITY");
180 numActivePhases_ = 0;
181 std::fill(&phaseIsActive_[0], &phaseIsActive_[
numPhases],
false);
183 if (deck.hasKeyword(
"OIL")) {
188 if (deck.hasKeyword(
"GAS")) {
193 if (deck.hasKeyword(
"WATER")) {
203 assert(numActivePhases_ >= 2 && numActivePhases_ <= 3);
209 for (
unsigned regionIdx = 0; regionIdx <
numRegions; ++regionIdx) {
210 const auto& densityRecord = densityKeyword.getRecord(regionIdx);
212 densityRecord.getItem(
"WATER").getSIDouble(0),
213 densityRecord.getItem(
"GAS").getSIDouble(0),
218 gasPvt_ = std::make_shared<GasPvt>();
219 gasPvt_->initFromDeck(deck, eclState);
223 oilPvt_ = std::make_shared<OilPvt>();
224 oilPvt_->initFromDeck(deck, eclState);
228 waterPvt_ = std::make_shared<WaterPvt>();
229 waterPvt_->initFromDeck(deck, eclState);
234 #endif // HAVE_OPM_PARSER 246 enableDissolvedGas_ =
true;
247 enableVaporizedOil_ =
false;
250 std::fill(&phaseIsActive_[0], &phaseIsActive_[
numPhases],
true);
252 resizeArrays_(numPvtRegions);
264 { enableDissolvedGas_ = yesno; }
273 { enableVaporizedOil_ = yesno; }
279 { gasPvt_ = pvtObj; }
285 { oilPvt_ = pvtObj; }
291 { waterPvt_ = pvtObj; }
305 referenceDensity_[regionIdx][
oilPhaseIdx] = rhoOil;
307 referenceDensity_[regionIdx][
gasPhaseIdx] = rhoGas;
317 for (
unsigned regionIdx = 0; regionIdx <
numRegions; ++ regionIdx) {
338 isInitialized_ =
true;
341 static bool isInitialized()
342 {
return isInitialized_; }
367 static const char* name[] = {
"water",
"oil",
"gas" };
369 assert(0 <= phaseIdx && phaseIdx <
numPhases + 1);
370 return name[phaseIdx];
376 assert(0 <= phaseIdx && phaseIdx <
numPhases);
395 static const int phaseToSolventCompIdx_[3];
396 static const int phaseToSoluteCompIdx_[3];
398 static unsigned char numActivePhases_;
404 {
return numActivePhases_; }
410 return phaseIsActive_[phaseIdx];
415 {
return static_cast<unsigned>(phaseToSolventCompIdx_[phaseIdx]); }
419 {
return static_cast<unsigned>(phaseToSoluteCompIdx_[phaseIdx]); }
424 static const char* name[] = {
"Oil",
"Water",
"Gas" };
427 return name[compIdx];
432 {
return molarMass_[regionIdx][compIdx]; }
460 {
return molarMass_.size(); }
469 {
return enableDissolvedGas_; }
478 {
return enableVaporizedOil_; }
486 {
return referenceDensity_[regionIdx][phaseIdx]; }
492 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar,
class ParamCacheEval = LhsEval>
493 static LhsEval
density(
const FluidState& fluidState,
496 {
return density<FluidState, LhsEval>(fluidState, phaseIdx, paramCache.
regionIndex()); }
499 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar,
class ParamCacheEval = LhsEval>
505 return fugacityCoefficient<FluidState, LhsEval>(fluidState,
512 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar,
class ParamCacheEval = LhsEval>
516 {
return viscosity<FluidState, LhsEval>(fluidState, phaseIdx, paramCache.
regionIndex()); }
524 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar>
525 static LhsEval
density(
const FluidState& fluidState,
529 assert(0 <= phaseIdx && phaseIdx <=
numPhases);
530 assert(0 <= regionIdx && regionIdx <=
numRegions());
536 const auto& bo = inverseFormationVolumeFactor<FluidState, LhsEval>(fluidState,
oilPhaseIdx, regionIdx);
541 const auto& bo = inverseFormationVolumeFactor<FluidState, LhsEval>(fluidState,
oilPhaseIdx, regionIdx);
542 const auto& Rs = Opm::BlackOil::template getRs_<ThisType, LhsEval, FluidState>(fluidState, regionIdx);
552 const auto& bg = inverseFormationVolumeFactor<FluidState, LhsEval>(fluidState,
gasPhaseIdx, regionIdx);
557 const auto& bg = inverseFormationVolumeFactor<FluidState, LhsEval>(fluidState,
gasPhaseIdx, regionIdx);
558 const auto& Rv = Opm::BlackOil::template getRv_<ThisType, LhsEval, FluidState>(fluidState, regionIdx);
568 *inverseFormationVolumeFactor<FluidState, LhsEval>(fluidState,
waterPhaseIdx, regionIdx);
571 OPM_THROW(std::logic_error,
"Unhandled phase index " << phaseIdx);
581 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar>
586 assert(0 <= phaseIdx && phaseIdx <=
numPhases);
587 assert(0 <= regionIdx && regionIdx <=
numRegions());
593 const auto& bo = inverseFormationVolumeFactor<FluidState, LhsEval>(fluidState,
oilPhaseIdx, regionIdx);
598 const auto& bo = saturatedInverseFormationVolumeFactor<FluidState, LhsEval>(fluidState,
oilPhaseIdx, regionIdx);
599 const auto& Rs = saturatedDissolutionFactor<FluidState, LhsEval>(fluidState,
oilPhaseIdx, regionIdx);
609 const auto& bg = inverseFormationVolumeFactor<FluidState, LhsEval>(fluidState,
gasPhaseIdx, regionIdx);
614 const auto& bg = saturatedInverseFormationVolumeFactor<FluidState, LhsEval>(fluidState,
gasPhaseIdx, regionIdx);
615 const auto& Rv = saturatedDissolutionFactor<FluidState, LhsEval>(fluidState,
gasPhaseIdx, regionIdx);
625 *saturatedInverseFormationVolumeFactor<FluidState, LhsEval>(fluidState,
waterPhaseIdx, regionIdx);
628 OPM_THROW(std::logic_error,
"Unhandled phase index " << phaseIdx);
639 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar>
644 assert(0 <= phaseIdx && phaseIdx <=
numPhases);
645 assert(0 <= regionIdx && regionIdx <=
numRegions());
647 const auto& p = Opm::decay<LhsEval>(fluidState.pressure(phaseIdx));
648 const auto& T = Opm::decay<LhsEval>(fluidState.temperature(phaseIdx));
658 const auto& Rs = Opm::BlackOil::template getRs_<ThisType, LhsEval, FluidState>(fluidState, regionIdx);
659 const auto& alpha = Opm::decay<LhsEval>(fluidState.saturation(
gasPhaseIdx))/1e-4;
660 const auto& bSat = oilPvt_->saturatedInverseFormationVolumeFactor(regionIdx, T, p);
661 const auto& bUndersat = oilPvt_->inverseFormationVolumeFactor(regionIdx, T, p, Rs);
662 return alpha*bSat + (1.0 - alpha)*bUndersat;
665 return oilPvt_->saturatedInverseFormationVolumeFactor(regionIdx, T, p);
668 const auto& Rs = Opm::BlackOil::template getRs_<ThisType, LhsEval, FluidState>(fluidState, regionIdx);
669 return oilPvt_->inverseFormationVolumeFactor(regionIdx, T, p, Rs);
672 const LhsEval Rs(0.0);
673 return oilPvt_->inverseFormationVolumeFactor(regionIdx, T, p, Rs);
682 const auto& Rv = Opm::BlackOil::template getRv_<ThisType, LhsEval, FluidState>(fluidState, regionIdx);
683 const auto& alpha = Opm::decay<LhsEval>(fluidState.saturation(
oilPhaseIdx))/1e-4;
684 const auto& bSat = gasPvt_->saturatedInverseFormationVolumeFactor(regionIdx, T, p);
685 const auto& bUndersat = gasPvt_->inverseFormationVolumeFactor(regionIdx, T, p, Rv);
686 return alpha*bSat + (1.0 - alpha)*bUndersat;
689 return gasPvt_->saturatedInverseFormationVolumeFactor(regionIdx, T, p);
692 const auto& Rv = Opm::BlackOil::template getRv_<ThisType, LhsEval, FluidState>(fluidState, regionIdx);
693 return gasPvt_->inverseFormationVolumeFactor(regionIdx, T, p, Rv);
696 const LhsEval Rv(0.0);
697 return gasPvt_->inverseFormationVolumeFactor(regionIdx, T, p, Rv);
700 return waterPvt_->inverseFormationVolumeFactor(regionIdx, T, p);
701 default: OPM_THROW(std::logic_error,
"Unhandled phase index " << phaseIdx);
712 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar>
717 assert(0 <= phaseIdx && phaseIdx <=
numPhases);
718 assert(0 <= regionIdx && regionIdx <=
numRegions());
720 const auto& p = Opm::decay<LhsEval>(fluidState.pressure(phaseIdx));
721 const auto& T = Opm::decay<LhsEval>(fluidState.temperature(phaseIdx));
724 case oilPhaseIdx:
return oilPvt_->saturatedInverseFormationVolumeFactor(regionIdx, T, p);
725 case gasPhaseIdx:
return gasPvt_->saturatedInverseFormationVolumeFactor(regionIdx, T, p);
726 case waterPhaseIdx:
return waterPvt_->inverseFormationVolumeFactor(regionIdx, T, p);
727 default: OPM_THROW(std::logic_error,
"Unhandled phase index " << phaseIdx);
732 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar>
738 assert(0 <= phaseIdx && phaseIdx <=
numPhases);
740 assert(0 <= regionIdx && regionIdx <=
numRegions());
742 const auto& p = Opm::decay<LhsEval>(fluidState.pressure(phaseIdx));
743 const auto& T = Opm::decay<LhsEval>(fluidState.temperature(phaseIdx));
748 const LhsEval phi_oO = 20e3/p;
751 const Scalar phi_gG = 1.0;
755 const LhsEval phi_wW = 30e3/p;
773 const auto& R_vSat = gasPvt_->saturatedOilVaporizationFactor(regionIdx, T, p);
777 const auto& R_sSat = oilPvt_->saturatedGasDissolutionFactor(regionIdx, T, p);
780 const auto& x_oOSat = 1.0 - x_oGSat;
782 const auto& p_o = Opm::decay<LhsEval>(fluidState.pressure(
oilPhaseIdx));
783 const auto& p_g = Opm::decay<LhsEval>(fluidState.pressure(
gasPhaseIdx));
785 return phi_oO*p_o*x_oOSat / (p_g*x_gOSat);
793 OPM_THROW(std::logic_error,
794 "Invalid component index " << compIdx);
810 const auto& R_vSat = gasPvt_->saturatedOilVaporizationFactor(regionIdx, T, p);
813 const auto& x_gGSat = 1.0 - x_gOSat;
815 const auto& R_sSat = oilPvt_->saturatedGasDissolutionFactor(regionIdx, T, p);
819 const auto& p_o = Opm::decay<LhsEval>(fluidState.pressure(
oilPhaseIdx));
820 const auto& p_g = Opm::decay<LhsEval>(fluidState.pressure(
gasPhaseIdx));
822 return phi_gG*p_g*x_gGSat / (p_o*x_oGSat);
829 OPM_THROW(std::logic_error,
830 "Invalid component index " << compIdx);
845 OPM_THROW(std::logic_error,
846 "Invalid component index " << compIdx);
850 OPM_THROW(std::logic_error,
851 "Invalid phase index " << phaseIdx);
854 OPM_THROW(std::logic_error,
"Unhandled phase or component index");
858 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar>
863 assert(0 <= phaseIdx && phaseIdx <=
numPhases);
864 assert(0 <= regionIdx && regionIdx <=
numRegions());
866 const auto& p = Opm::decay<LhsEval>(fluidState.pressure(phaseIdx));
867 const auto& T = Opm::decay<LhsEval>(fluidState.temperature(phaseIdx));
877 const auto& Rs = Opm::BlackOil::template getRs_<ThisType, LhsEval, FluidState>(fluidState, regionIdx);
878 const auto& alpha = Opm::decay<LhsEval>(fluidState.saturation(
gasPhaseIdx))/1e-4;
879 const auto& muSat = oilPvt_->saturatedViscosity(regionIdx, T, p);
880 const auto& muUndersat = oilPvt_->viscosity(regionIdx, T, p, Rs);
881 return alpha*muSat + (1.0 - alpha)*muUndersat;
884 return oilPvt_->saturatedViscosity(regionIdx, T, p);
887 const auto& Rs = Opm::BlackOil::template getRs_<ThisType, LhsEval, FluidState>(fluidState, regionIdx);
888 return oilPvt_->viscosity(regionIdx, T, p, Rs);
891 const LhsEval Rs(0.0);
892 return oilPvt_->viscosity(regionIdx, T, p, Rs);
902 const auto& Rv = Opm::BlackOil::template getRv_<ThisType, LhsEval, FluidState>(fluidState, regionIdx);
903 const auto& alpha = Opm::decay<LhsEval>(fluidState.saturation(
oilPhaseIdx))/1e-4;
904 const auto& muSat = gasPvt_->saturatedViscosity(regionIdx, T, p);
905 const auto& muUndersat = gasPvt_->viscosity(regionIdx, T, p, Rv);
906 return alpha*muSat + (1.0 - alpha)*muUndersat;
909 return gasPvt_->saturatedViscosity(regionIdx, T, p);
912 const auto& Rv = Opm::BlackOil::template getRv_<ThisType, LhsEval, FluidState>(fluidState, regionIdx);
913 return gasPvt_->viscosity(regionIdx, T, p, Rv);
916 const LhsEval Rv(0.0);
917 return gasPvt_->viscosity(regionIdx, T, p, Rv);
923 return waterPvt_->viscosity(regionIdx, T, p);
926 OPM_THROW(std::logic_error,
"Unhandled phase index " << phaseIdx);
935 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar>
941 assert(0 <= phaseIdx && phaseIdx <=
numPhases);
942 assert(0 <= regionIdx && regionIdx <=
numRegions());
944 const auto& p = Opm::decay<LhsEval>(fluidState.pressure(phaseIdx));
945 const auto& T = Opm::decay<LhsEval>(fluidState.temperature(phaseIdx));
946 const auto& So = Opm::decay<LhsEval>(fluidState.saturation(
oilPhaseIdx));
949 case oilPhaseIdx:
return oilPvt_->saturatedGasDissolutionFactor(regionIdx, T, p, So, maxOilSaturation);
950 case gasPhaseIdx:
return gasPvt_->saturatedOilVaporizationFactor(regionIdx, T, p, So, maxOilSaturation);
952 default: OPM_THROW(std::logic_error,
"Unhandled phase index " << phaseIdx);
964 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar>
969 assert(0 <= phaseIdx && phaseIdx <=
numPhases);
970 assert(0 <= regionIdx && regionIdx <=
numRegions());
972 const auto& p = Opm::decay<LhsEval>(fluidState.pressure(phaseIdx));
973 const auto& T = Opm::decay<LhsEval>(fluidState.temperature(phaseIdx));
976 case oilPhaseIdx:
return oilPvt_->saturatedGasDissolutionFactor(regionIdx, T, p);
977 case gasPhaseIdx:
return gasPvt_->saturatedOilVaporizationFactor(regionIdx, T, p);
979 default: OPM_THROW(std::logic_error,
"Unhandled phase index " << phaseIdx);
986 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar>
997 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar>
1014 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar>
1019 assert(0 <= phaseIdx && phaseIdx <=
numPhases);
1020 assert(0 <= regionIdx && regionIdx <=
numRegions());
1022 const auto& T = Opm::decay<LhsEval>(fluidState.temperature(phaseIdx));
1025 case oilPhaseIdx:
return oilPvt_->saturationPressure(regionIdx, T, Opm::BlackOil::template getRs_<ThisType, LhsEval, FluidState>(fluidState, regionIdx));
1026 case gasPhaseIdx:
return gasPvt_->saturationPressure(regionIdx, T, Opm::BlackOil::template getRv_<ThisType, LhsEval, FluidState>(fluidState, regionIdx));
1028 default: OPM_THROW(std::logic_error,
"Unhandled phase index " << phaseIdx);
1039 template <
class LhsEval>
1045 return XoG/(1.0 - XoG)*(rho_oRef/rho_gRef);
1052 template <
class LhsEval>
1058 return XgO/(1.0 - XgO)*(rho_gRef/rho_oRef);
1065 template <
class LhsEval>
1071 const LhsEval& rho_oG = Rs*rho_gRef;
1072 return rho_oG/(rho_oRef + rho_oG);
1079 template <
class LhsEval>
1085 const LhsEval& rho_gO = Rv*rho_oRef;
1086 return rho_gO/(rho_gRef + rho_gO);
1092 template <
class LhsEval>
1098 return XoG*MO / (MG*(1 - XoG) + XoG*MO);
1104 template <
class LhsEval>
1110 return xoG*MG / (xoG*(MG - MO) + MO);
1116 template <
class LhsEval>
1122 return XgO*MG / (MO*(1 - XgO) + XgO*MG);
1128 template <
class LhsEval>
1134 return xgO*MO / (xgO*(MO - MG) + MG);
1145 {
return *gasPvt_; }
1155 {
return *oilPvt_; }
1165 {
return *waterPvt_; }
1173 {
return reservoirTemperature_; }
1181 { reservoirTemperature_ = value; }
1190 static Scalar reservoirTemperature_;
1192 static std::shared_ptr<GasPvt> gasPvt_;
1193 static std::shared_ptr<OilPvt> oilPvt_;
1194 static std::shared_ptr<WaterPvt> waterPvt_;
1196 static bool enableDissolvedGas_;
1197 static bool enableVaporizedOil_;
1202 static std::vector<std::array<
Scalar, 3> > referenceDensity_;
1203 static std::vector<std::array<
Scalar, 3> > molarMass_;
1205 static bool isInitialized_;
1208 template <
class Scalar>
1209 const int BlackOil<Scalar>::phaseToSolventCompIdx_[3] =
1217 template <
class Scalar>
1218 const int BlackOil<Scalar>::phaseToSoluteCompIdx_[3] =
1225 template <
class Scalar>
1226 unsigned char BlackOil<Scalar>::numActivePhases_;
1228 template <
class Scalar>
1229 bool BlackOil<Scalar>::phaseIsActive_[numPhases];
1231 template <
class Scalar>
1235 template <
class Scalar>
1239 template <
class Scalar>
1241 BlackOil<Scalar>::reservoirTemperature_;
1243 template <
class Scalar>
1244 bool BlackOil<Scalar>::enableDissolvedGas_;
1246 template <
class Scalar>
1247 bool BlackOil<Scalar>::enableVaporizedOil_;
1249 template <
class Scalar>
1250 std::shared_ptr<OilPvtMultiplexer<Scalar> >
1251 BlackOil<Scalar>::oilPvt_;
1253 template <
class Scalar>
1254 std::shared_ptr<Opm::GasPvtMultiplexer<Scalar> >
1255 BlackOil<Scalar>::gasPvt_;
1257 template <
class Scalar>
1258 std::shared_ptr<WaterPvtMultiplexer<Scalar> >
1259 BlackOil<Scalar>::waterPvt_;
1261 template <
class Scalar>
1262 std::vector<std::array<Scalar, 3> >
1263 BlackOil<Scalar>::referenceDensity_;
1265 template <
class Scalar>
1266 std::vector<std::array<Scalar, 3> >
1267 BlackOil<Scalar>::molarMass_;
1269 template <
class Scalar>
1270 bool BlackOil<Scalar>::isInitialized_ =
false;
static LhsEval saturatedDissolutionFactor(const FluidState &fluidState, unsigned phaseIdx, unsigned regionIdx, Scalar maxOilSaturation)
Returns the dissolution factor of a saturated fluid phase.
Definition: BlackOilFluidSystem.hpp:936
static const OilPvt & oilPvt()
Return a reference to the low-level object which calculates the oil phase quantities.
Definition: BlackOilFluidSystem.hpp:1154
unsigned regionIndex() const
Return the index of the region which should be used to determine the thermodynamic properties...
Definition: BlackOilFluidSystem.hpp:143
static void setReferenceDensities(Scalar rhoOil, Scalar rhoWater, Scalar rhoGas, unsigned regionIdx)
Initialize the values of the reference densities.
Definition: BlackOilFluidSystem.hpp:300
static void setReservoirTemperature(Scalar value)
Return the temperature of the reservoir.
Definition: BlackOilFluidSystem.hpp:1180
static void setEnableDissolvedGas(bool yesno)
Specify whether the fluid system should consider that the gas component can dissolve in the oil phase...
Definition: BlackOilFluidSystem.hpp:263
static LhsEval convertXgOToxgO(const LhsEval &XgO, unsigned regionIdx)
Convert a oil mass fraction in the gas phase the corresponding mole fraction.
Definition: BlackOilFluidSystem.hpp:1117
static LhsEval inverseFormationVolumeFactor(const FluidState &fluidState, unsigned phaseIdx, unsigned regionIdx)
Returns the formation volume factor of an "undersaturated" fluid phase.
Definition: BlackOilFluidSystem.hpp:640
static LhsEval bubblePointPressure(const FluidState &fluidState, unsigned regionIdx)
Returns the bubble point pressure $P_b$ using the current Rs.
Definition: BlackOilFluidSystem.hpp:987
static const char * phaseName(unsigned phaseIdx)
Return the human readable name of a fluid phase.
Definition: BlackOilFluidSystem.hpp:365
static bool enableDissolvedGas()
Returns whether the fluid system should consider that the gas component can dissolve in the oil phase...
Definition: BlackOilFluidSystem.hpp:468
void assignPersistentData(const OtherCache &other)
Copy the data which is not dependent on the type of the Scalars from another parameter cache...
Definition: BlackOilFluidSystem.hpp:130
void setRegionIndex(unsigned val)
Set the index of the region which should be used to determine the thermodynamic properties.
Definition: BlackOilFluidSystem.hpp:153
static LhsEval viscosity(const FluidState &fluidState, unsigned phaseIdx, unsigned regionIdx)
Calculate the dynamic viscosity of a fluid phase [Pa*s].
Definition: BlackOilFluidSystem.hpp:859
static bool isLiquid(unsigned phaseIdx)
Return whether a phase is liquid.
Definition: BlackOilFluidSystem.hpp:374
static const Scalar surfaceTemperature
The temperature at the surface.
Definition: BlackOilFluidSystem.hpp:362
static unsigned numActivePhases()
Returns the number of active fluid phases (i.e., usually three)
Definition: BlackOilFluidSystem.hpp:403
static LhsEval density(const FluidState &fluidState, const ParameterCache< ParamCacheEval > ¶mCache, unsigned phaseIdx)
Calculate the density [kg/m^3] of a fluid phase.
Definition: BlackOilFluidSystem.hpp:493
Definition: Evaluation.hpp:531
static unsigned phaseIsActive(unsigned phaseIdx)
Returns whether a fluid phase is active.
Definition: BlackOilFluidSystem.hpp:407
#define OPM_GENERATE_HAS_MEMBER(MEMBER_NAME,...)
This macro generates a class HasMember_${MEMBER_NAME} which can be used for template specialization...
Definition: HasMemberGeneratorMacros.hpp:49
This class represents the Pressure-Volume-Temperature relations of the water phase in the black-oil m...
static void setEnableVaporizedOil(bool yesno)
Specify whether the fluid system should consider that the oil component can dissolve in the gas phase...
Definition: BlackOilFluidSystem.hpp:272
Definition: Air_Mesitylene.hpp:33
static LhsEval convertxoGToXoG(const LhsEval &xoG, unsigned regionIdx)
Convert a gas mole fraction in the oil phase the corresponding mass fraction.
Definition: BlackOilFluidSystem.hpp:1105
This class represents the Pressure-Volume-Temperature relations of the gas phase in the black-oil mod...
Definition: GasPvtMultiplexer.hpp:75
static const unsigned gasCompIdx
Index of the gas component.
Definition: BlackOilFluidSystem.hpp:392
static LhsEval viscosity(const FluidState &fluidState, const ParameterCache< ParamCacheEval > ¶mCache, unsigned phaseIdx)
Calculate the dynamic viscosity of a fluid phase [Pa*s].
Definition: BlackOilFluidSystem.hpp:513
static constexpr unsigned solventComponentIndex(unsigned phaseIdx)
returns the index of "primary" component of a phase (solvent)
Definition: BlackOilFluidSystem.hpp:414
static bool enableVaporizedOil()
Returns whether the fluid system should consider that the oil component can dissolve in the gas phase...
Definition: BlackOilFluidSystem.hpp:477
static LhsEval convertXoGToRs(const LhsEval &XoG, unsigned regionIdx)
Convert the mass fraction of the gas component in the oil phase to the corresponding gas dissolution ...
Definition: BlackOilFluidSystem.hpp:1040
static const unsigned oilCompIdx
Index of the oil component.
Definition: BlackOilFluidSystem.hpp:388
A central place for various physical constants occuring in some equations.
Definition: Constants.hpp:40
This macro generates a class HasMember_${MEMBER_NAME} which can be used for template specialization...
static LhsEval convertXoGToxoG(const LhsEval &XoG, unsigned regionIdx)
Convert a gas mass fraction in the oil phase the corresponding mole fraction.
Definition: BlackOilFluidSystem.hpp:1093
static const unsigned gasPhaseIdx
Index of the gas phase.
Definition: BlackOilFluidSystem.hpp:356
static Scalar molarMass(unsigned compIdx, unsigned regionIdx=0)
Return the molar mass of a component in [kg/mol].
Definition: BlackOilFluidSystem.hpp:431
static Scalar referenceDensity(unsigned phaseIdx, unsigned regionIdx)
Returns the density of a fluid phase at surface pressure [kg/m^3].
Definition: BlackOilFluidSystem.hpp:485
static const unsigned waterPhaseIdx
Index of the water phase.
Definition: BlackOilFluidSystem.hpp:352
static const unsigned numComponents
Number of chemical species in the fluid system.
Definition: BlackOilFluidSystem.hpp:385
static LhsEval density(const FluidState &fluidState, unsigned phaseIdx, unsigned regionIdx)
Calculate the density [kg/m^3] of a fluid phase.
Definition: BlackOilFluidSystem.hpp:525
A fluid system which uses the black-oil model assumptions to calculate termodynamically meaningful qu...
Definition: BlackOilFluidSystem.hpp:100
static LhsEval saturatedDensity(const FluidState &fluidState, unsigned phaseIdx, unsigned regionIdx)
Compute the density of a saturated fluid phase.
Definition: BlackOilFluidSystem.hpp:582
static Scalar reservoirTemperature(unsigned pvtRegionIdx OPM_UNUSED=0)
Set the temperature of the reservoir.
Definition: BlackOilFluidSystem.hpp:1172
static size_t numRegions()
Returns the number of PVT regions which are considered.
Definition: BlackOilFluidSystem.hpp:459
static LhsEval convertxgOToXgO(const LhsEval &xgO, unsigned regionIdx)
Convert a oil mole fraction in the gas phase the corresponding mass fraction.
Definition: BlackOilFluidSystem.hpp:1129
static LhsEval convertXgOToRv(const LhsEval &XgO, unsigned regionIdx)
Convert the mass fraction of the oil component in the gas phase to the corresponding oil vaporization...
Definition: BlackOilFluidSystem.hpp:1053
static LhsEval convertRsToXoG(const LhsEval &Rs, unsigned regionIdx)
Convert a gas dissolution factor to the the corresponding mass fraction of the gas component in the o...
Definition: BlackOilFluidSystem.hpp:1066
This class represents the Pressure-Volume-Temperature relations of the oil phase in the black-oil mod...
Definition: OilPvtMultiplexer.hpp:75
static void setOilPvt(std::shared_ptr< OilPvt > pvtObj)
Set the pressure-volume-saturation (PVT) relations for the oil phase.
Definition: BlackOilFluidSystem.hpp:284
This class represents the Pressure-Volume-Temperature relations of the water phase in the black-oil m...
Definition: WaterPvtMultiplexer.hpp:55
The type of the fluid system's parameter cache.
Definition: BlackOilFluidSystem.hpp:111
The base class for all fluid systems.
Definition: BaseFluidSystem.hpp:43
A central place for various physical constants occuring in some equations.
static const GasPvt & gasPvt()
Return a reference to the low-level object which calculates the gas phase quantities.
Definition: BlackOilFluidSystem.hpp:1144
static void initBegin(size_t numPvtRegions)
Begin the initialization of the black oil fluid system.
Definition: BlackOilFluidSystem.hpp:244
static void setWaterPvt(std::shared_ptr< WaterPvt > pvtObj)
Set the pressure-volume-saturation (PVT) relations for the water phase.
Definition: BlackOilFluidSystem.hpp:290
This class represents the Pressure-Volume-Temperature relations of the oil phase in the black-oil mod...
static LhsEval saturatedInverseFormationVolumeFactor(const FluidState &fluidState, unsigned phaseIdx, unsigned regionIdx)
Returns the formation volume factor of a "saturated" fluid phase.
Definition: BlackOilFluidSystem.hpp:713
static void initEnd()
Finish initializing the black oil fluid system.
Definition: BlackOilFluidSystem.hpp:313
static constexpr unsigned soluteComponentIndex(unsigned phaseIdx)
returns the index of "secondary" component of a phase (solute)
Definition: BlackOilFluidSystem.hpp:418
static const unsigned oilPhaseIdx
Index of the oil phase.
Definition: BlackOilFluidSystem.hpp:354
static const Scalar surfacePressure
The pressure at the surface.
Definition: BlackOilFluidSystem.hpp:359
static const WaterPvt & waterPvt()
Return a reference to the low-level object which calculates the water phase quantities.
Definition: BlackOilFluidSystem.hpp:1164
A parameter cache which does nothing.
Definition: NullParameterCache.hpp:39
static bool isIdealMixture(unsigned)
Returns true if and only if a fluid phase is assumed to be an ideal mixture.
Definition: BlackOilFluidSystem.hpp:435
static LhsEval saturationPressure(const FluidState &fluidState, unsigned phaseIdx, unsigned regionIdx)
Returns the saturation pressure of a given phase [Pa] depending on its composition.
Definition: BlackOilFluidSystem.hpp:1015
Scalar Scalar
The type used for scalar quantities.
Definition: BaseFluidSystem.hpp:49
static LhsEval convertRvToXgO(const LhsEval &Rv, unsigned regionIdx)
Convert an oil vaporization factor to the corresponding mass fraction of the oil component in the gas...
Definition: BlackOilFluidSystem.hpp:1080
static LhsEval fugacityCoefficient(const FluidState &fluidState, unsigned phaseIdx, unsigned compIdx, unsigned regionIdx)
Calculate the fugacity coefficient [Pa] of an individual component in a fluid phase.
Definition: BlackOilFluidSystem.hpp:733
static const unsigned numPhases
Number of fluid phases in the fluid system.
Definition: BlackOilFluidSystem.hpp:349
This class represents the Pressure-Volume-Temperature relations of the gas phase in the black-oil mod...
static void setGasPvt(std::shared_ptr< GasPvt > pvtObj)
Set the pressure-volume-saturation (PVT) relations for the gas phase.
Definition: BlackOilFluidSystem.hpp:278
static LhsEval saturatedDissolutionFactor(const FluidState &fluidState, unsigned phaseIdx, unsigned regionIdx)
Returns the dissolution factor of a saturated fluid phase.
Definition: BlackOilFluidSystem.hpp:965
static bool isIdealGas(unsigned)
Returns true if and only if a fluid phase is assumed to be an ideal gas.
Definition: BlackOilFluidSystem.hpp:447
static LhsEval fugacityCoefficient(const FluidState &fluidState, const ParameterCache< ParamCacheEval > ¶mCache, unsigned phaseIdx, unsigned compIdx)
Calculate the fugacity coefficient [Pa] of an individual component in a fluid phase.
Definition: BlackOilFluidSystem.hpp:500
static bool isCompressible(unsigned)
Returns true if and only if a fluid phase is assumed to be compressible.
Definition: BlackOilFluidSystem.hpp:443
The base class for all fluid systems.
static const unsigned waterCompIdx
Index of the water component.
Definition: BlackOilFluidSystem.hpp:390
static const char * componentName(unsigned compIdx)
Return the human readable name of a component.
Definition: BlackOilFluidSystem.hpp:422
static LhsEval dewPointPressure(const FluidState &fluidState, unsigned regionIdx)
Returns the dew point pressure $P_d$ using the current Rv.
Definition: BlackOilFluidSystem.hpp:998