33#include "opm/material/fluidsystems/blackoilpvt/NullOilPvt.hpp"
35#include <opm/common/TimingMacros.hpp>
36#include <opm/common/utility/VectorWithDefaultAllocator.hpp>
37#include <opm/common/utility/gpuDecorators.hpp>
48#include <opm/material/fluidsystems/PhaseUsageInfo.hpp>
76 template<
typename>
typename Storage = VectorWithDefaultAllocator>
86 using GasPvt = std::conditional_t<std::is_same_v<Storage<Scalar>, VectorWithDefaultAllocator<Scalar>>,
89 using OilPvt = std::conditional_t<std::is_same_v<Storage<Scalar>, VectorWithDefaultAllocator<Scalar>>,
92 using WaterPvt = std::conditional_t<std::is_same_v<Storage<Scalar>, VectorWithDefaultAllocator<Scalar>>,
95 using IndexTraitsType = IndexTraits;
97 #ifdef COMPILING_STATIC_FLUID_SYSTEM
99 template <
class EvaluationT>
102 using Evaluation = EvaluationT;
105 explicit ParameterCache(
unsigned regionIdx = 0)
106 : regionIdx_(regionIdx)
117 template <
class OtherCache>
118 void assignPersistentData(
const OtherCache& other)
120 regionIdx_ = other.regionIndex();
130 unsigned regionIndex()
const
131 {
return regionIdx_; }
140 void setRegionIndex(
unsigned val)
141 { regionIdx_ = val; }
150 template<
class EvaluationT>
151 using ParameterCache =
152 typename FLUIDSYSTEM_CLASSNAME_STATIC<
Scalar,
154 Storage>::template ParameterCache<EvaluationT>;
157 #ifndef COMPILING_STATIC_FLUID_SYSTEM
163 template<
template<
typename>
typename StorageT>
167 , reservoirTemperature_(other.reservoirTemperature_)
168 , gasPvt_(other.gasPvt_)
169 , oilPvt_(other.oilPvt_)
170 , waterPvt_(other.waterPvt_)
171 , enableDissolvedGas_(other.enableDissolvedGas_)
172 , enableDissolvedGasInWater_(other.enableDissolvedGasInWater_)
173 , enableVaporizedOil_(other.enableVaporizedOil_)
174 , enableVaporizedWater_(other.enableVaporizedWater_)
175 , enableDiffusion_(other.enableDiffusion_)
176 , referenceDensity_(StorageT<typename decltype(referenceDensity_)::value_type>(other.referenceDensity_))
177 , molarMass_(StorageT<typename decltype(molarMass_)::value_type>(other.molarMass_))
178 , diffusionCoefficients_(StorageT<typename decltype(diffusionCoefficients_)::value_type>(other.diffusionCoefficients_))
179 , phaseUsageInfo_(other.phaseUsageInfo_)
180 , isInitialized_(other.isInitialized_)
181 , useSaturatedTables_(other.useSaturatedTables_)
182 , enthalpy_eq_energy_(other.enthalpy_eq_energy_)
187 Scalar _surfaceTemperature_,
188 Scalar _reservoirTemperature_,
189 const GasPvt& _gasPvt_,
190 const OilPvt& _oilPvt_,
191 const WaterPvt& _waterPvt_,
192 bool _enableDissolvedGas_,
193 bool _enableDissolvedGasInWater_,
194 bool _enableVaporizedOil_,
195 bool _enableVaporizedWater_,
196 bool _enableDiffusion_,
197 Storage<std::array<Scalar, 3>>&& _referenceDensity_,
198 Storage<std::array<Scalar, 3>>&& _molarMass_,
199 Storage<std::array<Scalar, 3 * 3>>&& _diffusionCoefficients_,
201 bool _isInitialized_,
202 bool _useSaturatedTables_,
203 bool _enthalpy_eq_energy_)
206 , reservoirTemperature_(_reservoirTemperature_)
209 , waterPvt_(_waterPvt_)
210 , enableDissolvedGas_(_enableDissolvedGas_)
211 , enableDissolvedGasInWater_(_enableDissolvedGasInWater_)
212 , enableVaporizedOil_(_enableVaporizedOil_)
213 , enableVaporizedWater_(_enableVaporizedWater_)
214 , enableDiffusion_(_enableDiffusion_)
215 , referenceDensity_(std::move(_referenceDensity_))
216 , molarMass_(std::move(_molarMass_))
217 , diffusionCoefficients_(std::move(_diffusionCoefficients_))
218 , phaseUsageInfo_(_phaseUsageInfo_)
219 , isInitialized_(_isInitialized_)
220 , useSaturatedTables_(_useSaturatedTables_)
221 , enthalpy_eq_energy_(_enthalpy_eq_energy_)
226 template <
class ScalarT,
class IndexTraitsT>
227 friend FLUIDSYSTEM_CLASSNAME<ScalarT, IndexTraitsT, gpuistl::GpuBuffer>
228 gpuistl::copy_to_gpu(
const FLUIDSYSTEM_CLASSNAME<ScalarT, IndexTraitsT>& oldFluidSystem);
230 template <
class ScalarT,
class IndexTraitsT>
231 friend FLUIDSYSTEM_CLASSNAME<ScalarT, IndexTraitsT, gpuistl::GpuView>
232 gpuistl::make_view(FLUIDSYSTEM_CLASSNAME<ScalarT, IndexTraitsT, gpuistl::GpuBuffer>& oldFluidSystem);
237 #ifdef COMPILING_STATIC_FLUID_SYSTEM
245 template<
template<
typename>
typename StorageT = VectorWithDefaultAllocator>
246 static FLUIDSYSTEM_CLASSNAME_NONSTATIC<Scalar, IndexTraits, StorageT>& getNonStaticInstance()
261 STATIC_OR_NOTHING
void initFromState(
const EclipseState& eclState,
const Schedule& schedule);
272 STATIC_OR_NOTHING
void initBegin(std::size_t numPvtRegions);
281 { enableDissolvedGas_ = yesno; }
290 { enableVaporizedOil_ = yesno; }
299 { enableVaporizedWater_ = yesno; }
308 { enableDissolvedGasInWater_ = yesno; }
315 { enableDiffusion_ = yesno; }
323 { useSaturatedTables_ = yesno; }
328 STATIC_OR_DEVICE
void setGasPvt(std::shared_ptr<GasPvt> pvtObj)
329 { gasPvt_ = *pvtObj; }
334 STATIC_OR_DEVICE
void setOilPvt(std::shared_ptr<OilPvt> pvtObj)
335 { oilPvt_ = *pvtObj; }
340 STATIC_OR_DEVICE
void setWaterPvt(std::shared_ptr<WaterPvt> pvtObj)
341 { waterPvt_ = *pvtObj; }
343 STATIC_OR_DEVICE
void setVapPars(
const Scalar par1,
const Scalar par2)
345 if (gasPvt_.isActive()) {
346 gasPvt_.setVapPars(par1, par2);
348 if (oilPvt_.isActive()) {
349 oilPvt_.setVapPars(par1, par2);
351 if (waterPvt_.isActive()) {
352 waterPvt_.setVapPars(par1, par2);
372 STATIC_OR_DEVICE
void initEnd();
374 STATIC_OR_DEVICE
bool isInitialized() NOTHING_OR_CONST
375 {
return isInitialized_; }
382 static constexpr unsigned numPhases = IndexTraits::numPhases;
398 STATIC_OR_NOTHING std::string_view
phaseName(
unsigned phaseIdx) NOTHING_OR_CONST;
401 STATIC_OR_DEVICE
bool isLiquid(
unsigned phaseIdx) NOTHING_OR_CONST
425 {
return phaseUsageInfo_; }
429 {
return phaseUsageInfo_.numActivePhases(); }
434 return phaseUsageInfo_.phaseIsActive(phaseIdx);
444 STATIC_OR_NOTHING std::string_view
componentName(
unsigned compIdx) NOTHING_OR_CONST;
447 STATIC_OR_DEVICE
Scalar molarMass(
unsigned compIdx,
unsigned regionIdx = 0) NOTHING_OR_CONST
448 {
return molarMass_[regionIdx][compIdx]; }
476 {
return molarMass_.size(); }
485 {
return enableDissolvedGas_; }
495 {
return enableDissolvedGasInWater_; }
504 {
return enableVaporizedOil_; }
513 {
return enableVaporizedWater_; }
521 {
return enableDiffusion_; }
529 {
return useSaturatedTables_; }
537 {
return referenceDensity_[regionIdx][phaseIdx]; }
543 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar,
class ParamCacheEval = LhsEval>
544 STATIC_OR_DEVICE LhsEval
density(
const FluidState& fluidState,
545 const ParameterCache<ParamCacheEval>& paramCache,
546 unsigned phaseIdx) NOTHING_OR_CONST
550 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar,
class ParamCacheEval = LhsEval>
552 const ParameterCache<ParamCacheEval>& paramCache,
554 unsigned compIdx) NOTHING_OR_CONST
559 paramCache.regionIndex());
563 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar,
class ParamCacheEval = LhsEval>
564 STATIC_OR_DEVICE LhsEval
viscosity(
const FluidState& fluidState,
565 const ParameterCache<ParamCacheEval>& paramCache,
566 unsigned phaseIdx) NOTHING_OR_CONST
570 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar,
class ParamCacheEval = LhsEval>
571 STATIC_OR_DEVICE LhsEval
enthalpy(
const FluidState& fluidState,
572 const ParameterCache<ParamCacheEval>& paramCache,
576 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar,
class ParamCacheEval = LhsEval>
577 STATIC_OR_DEVICE LhsEval internalEnergy(
const FluidState& fluidState,
578 const ParameterCache<ParamCacheEval>& paramCache,
579 unsigned phaseIdx) NOTHING_OR_CONST
580 {
return internalEnergy<FluidState, LhsEval>(fluidState, phaseIdx, paramCache.regionIndex()); }
587 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar>
588 STATIC_OR_DEVICE LhsEval
density(
const FluidState& fluidState,
590 unsigned regionIdx) NOTHING_OR_CONST
595 const LhsEval& p = decay<LhsEval>(fluidState.pressure(phaseIdx));
596 const LhsEval& T = decay<LhsEval>(fluidState.temperature(phaseIdx));
597 const LhsEval& saltConcentration = BlackOil::template getSaltConcentration_<FluidState, LhsEval>(fluidState, regionIdx);
603 const LhsEval& Rs = BlackOil::template getRs_<ThisType, FluidState, LhsEval>(fluidState, regionIdx);
604 const LhsEval& bo = oilPvt_.inverseFormationVolumeFactor(regionIdx, T, p, Rs);
612 const LhsEval Rs(0.0);
613 const auto& bo = oilPvt_.inverseFormationVolumeFactor(regionIdx, T, p, Rs);
621 const LhsEval& Rv = BlackOil::template getRv_<ThisType, FluidState, LhsEval>(fluidState, regionIdx);
622 const LhsEval& Rvw = BlackOil::template getRvw_<ThisType, FluidState, LhsEval>(fluidState, regionIdx);
623 const LhsEval& bg = gasPvt_.inverseFormationVolumeFactor(regionIdx, T, p, Rv, Rvw);
632 const LhsEval Rvw(0.0);
633 const LhsEval& Rv = BlackOil::template getRv_<ThisType, FluidState, LhsEval>(fluidState, regionIdx);
634 const LhsEval& bg = gasPvt_.inverseFormationVolumeFactor(regionIdx, T, p, Rv, Rvw);
642 const LhsEval Rv(0.0);
643 const LhsEval& Rvw = BlackOil::template getRvw_<ThisType, FluidState, LhsEval>(fluidState, regionIdx);
644 const LhsEval& bg = gasPvt_.inverseFormationVolumeFactor(regionIdx, T, p, Rv, Rvw);
652 const LhsEval Rv(0.0);
653 const LhsEval Rvw(0.0);
654 const auto& bg = gasPvt_.inverseFormationVolumeFactor(regionIdx, T, p, Rv, Rvw);
661 const LhsEval& Rsw =BlackOil::template getRsw_<ThisType, FluidState, LhsEval>(fluidState, regionIdx);
662 const LhsEval& bw = waterPvt_.inverseFormationVolumeFactor(regionIdx, T, p, Rsw, saltConcentration);
667 const LhsEval Rsw(0.0);
670 * waterPvt_.inverseFormationVolumeFactor(regionIdx, T, p, Rsw, saltConcentration);
673 throw std::logic_error(
"Unhandled phase index " + std::to_string(phaseIdx));
685 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar>
688 unsigned regionIdx) NOTHING_OR_CONST
693 const auto& p = fluidState.pressure(phaseIdx);
694 const auto& T = fluidState.temperature(phaseIdx);
701 const LhsEval& bo = oilPvt_.inverseFormationVolumeFactor(regionIdx, T, p, Rs);
709 const LhsEval Rs(0.0);
710 const LhsEval& bo = oilPvt_.inverseFormationVolumeFactor(regionIdx, T, p, Rs);
719 const LhsEval& bg = gasPvt_.inverseFormationVolumeFactor(regionIdx, T, p, Rv, Rvw);
729 const LhsEval Rvw(0.0);
731 const LhsEval& bg = gasPvt_.inverseFormationVolumeFactor(regionIdx, T, p, Rv, Rvw);
740 const LhsEval Rv(0.0);
742 const LhsEval& bg = gasPvt_.inverseFormationVolumeFactor(regionIdx, T, p, Rv, Rvw);
750 const LhsEval Rv(0.0);
751 const LhsEval Rvw(0.0);
752 const LhsEval& bg = gasPvt_.inverseFormationVolumeFactor(regionIdx, T, p, Rv, Rvw);
762 const auto& saltConcentration = decay<LhsEval>(fluidState.saltConcentration());
764 const LhsEval& bw = waterPvt_.inverseFormationVolumeFactor(regionIdx, T, p, Rsw, saltConcentration);
775 throw std::logic_error(
"Unhandled phase index "+std::to_string(phaseIdx));
786 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar>
789 unsigned regionIdx) NOTHING_OR_CONST
795 const auto& p = decay<LhsEval>(fluidState.pressure(phaseIdx));
796 const auto& T = decay<LhsEval>(fluidState.temperature(phaseIdx));
801 const auto& Rs = BlackOil::template getRs_<ThisType, FluidState, LhsEval>(fluidState, regionIdx);
803 && Rs >= (1.0 - 1e-10)*oilPvt_.saturatedGasDissolutionFactor(regionIdx, scalarValue(T), scalarValue(p)))
805 return oilPvt_.saturatedInverseFormationVolumeFactor(regionIdx, T, p);
807 return oilPvt_.inverseFormationVolumeFactor(regionIdx, T, p, Rs);
811 const LhsEval Rs(0.0);
812 return oilPvt_.inverseFormationVolumeFactor(regionIdx, T, p, Rs);
816 const auto& Rvw = BlackOil::template getRvw_<ThisType, FluidState, LhsEval>(fluidState, regionIdx);
817 const auto& Rv = BlackOil::template getRv_<ThisType, FluidState, LhsEval>(fluidState, regionIdx);
819 && Rvw >= (1.0 - 1e-10)*gasPvt_.saturatedWaterVaporizationFactor(regionIdx, scalarValue(T), scalarValue(p))
821 && Rv >= (1.0 - 1e-10)*gasPvt_.saturatedOilVaporizationFactor(regionIdx, scalarValue(T), scalarValue(p)))
823 return gasPvt_.saturatedInverseFormationVolumeFactor(regionIdx, T, p);
825 return gasPvt_.inverseFormationVolumeFactor(regionIdx, T, p, Rv, Rvw);
830 const auto& Rv = BlackOil::template getRv_<ThisType, FluidState, LhsEval>(fluidState, regionIdx);
832 && Rv >= (1.0 - 1e-10)*gasPvt_.saturatedOilVaporizationFactor(regionIdx, scalarValue(T), scalarValue(p)))
834 return gasPvt_.saturatedInverseFormationVolumeFactor(regionIdx, T, p);
836 const LhsEval Rvw(0.0);
837 return gasPvt_.inverseFormationVolumeFactor(regionIdx, T, p, Rv, Rvw);
842 const auto& Rvw = BlackOil::template getRvw_<ThisType, FluidState, LhsEval>(fluidState, regionIdx);
844 && Rvw >= (1.0 - 1e-10)*gasPvt_.saturatedWaterVaporizationFactor(regionIdx, scalarValue(T), scalarValue(p)))
846 return gasPvt_.saturatedInverseFormationVolumeFactor(regionIdx, T, p);
848 const LhsEval Rv(0.0);
849 return gasPvt_.inverseFormationVolumeFactor(regionIdx, T, p, Rv, Rvw);
853 const LhsEval Rv(0.0);
854 const LhsEval Rvw(0.0);
855 return gasPvt_.inverseFormationVolumeFactor(regionIdx, T, p, Rv, Rvw);
859 const auto& saltConcentration = BlackOil::template getSaltConcentration_<FluidState, LhsEval>(fluidState, regionIdx);
861 const auto& Rsw = BlackOil::template getRsw_<ThisType, FluidState, LhsEval>(fluidState, regionIdx);
863 && Rsw >= (1.0 - 1e-10)*waterPvt_.saturatedGasDissolutionFactor(regionIdx, scalarValue(T), scalarValue(p), scalarValue(saltConcentration)))
865 return waterPvt_.saturatedInverseFormationVolumeFactor(regionIdx, T, p, saltConcentration);
867 return waterPvt_.inverseFormationVolumeFactor(regionIdx, T, p, Rsw, saltConcentration);
870 const LhsEval Rsw(0.0);
871 return waterPvt_.inverseFormationVolumeFactor(regionIdx, T, p, Rsw, saltConcentration);
873 default:
throw std::logic_error(
"Unhandled phase index "+std::to_string(phaseIdx));
877 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar>
878 STATIC_OR_DEVICE std::pair<LhsEval, LhsEval>
879 inverseFormationVolumeFactorAndViscosity(
const FluidState& fluidState,
885 return oilPvt_.inverseFormationVolumeFactorAndViscosity(fluidState, regionIdx);
887 return gasPvt_.inverseFormationVolumeFactorAndViscosity(fluidState, regionIdx);
889 return waterPvt_.inverseFormationVolumeFactorAndViscosity(fluidState, regionIdx);
891 throw std::logic_error(
"Unhandled phase index "+std::to_string(phaseIdx));
904 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar>
907 unsigned regionIdx) NOTHING_OR_CONST
913 const auto& p = decay<LhsEval>(fluidState.pressure(phaseIdx));
914 const auto& T = decay<LhsEval>(fluidState.temperature(phaseIdx));
915 const auto& saltConcentration = BlackOil::template getSaltConcentration_<FluidState, LhsEval>(fluidState, regionIdx);
918 case oilPhaseIdx:
return oilPvt_.saturatedInverseFormationVolumeFactor(regionIdx, T, p);
919 case gasPhaseIdx:
return gasPvt_.saturatedInverseFormationVolumeFactor(regionIdx, T, p);
920 case waterPhaseIdx:
return waterPvt_.saturatedInverseFormationVolumeFactor(regionIdx, T, p, saltConcentration);
921 default:
throw std::logic_error(
"Unhandled phase index "+std::to_string(phaseIdx));
926 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar>
930 unsigned regionIdx) NOTHING_OR_CONST
936 const auto& p = decay<LhsEval>(fluidState.pressure(phaseIdx));
937 const auto& T = decay<LhsEval>(fluidState.temperature(phaseIdx));
942 const LhsEval phi_oO = 20e3/p;
945 constexpr const Scalar phi_gG = 1.0;
949 const LhsEval phi_wW = 30e3/p;
967 const auto& R_vSat = gasPvt_.saturatedOilVaporizationFactor(regionIdx, T, p);
971 const auto& R_sSat = oilPvt_.saturatedGasDissolutionFactor(regionIdx, T, p);
974 const auto& x_oOSat = 1.0 - x_oGSat;
976 const auto& p_o = decay<LhsEval>(fluidState.pressure(
oilPhaseIdx));
977 const auto& p_g = decay<LhsEval>(fluidState.pressure(
gasPhaseIdx));
979 return phi_oO*p_o*x_oOSat / (p_g*x_gOSat);
987 throw std::logic_error(
"Invalid component index "+std::to_string(compIdx));
1003 const auto& R_vSat = gasPvt_.saturatedOilVaporizationFactor(regionIdx, T, p);
1006 const auto& x_gGSat = 1.0 - x_gOSat;
1008 const auto& R_sSat = oilPvt_.saturatedGasDissolutionFactor(regionIdx, T, p);
1012 const auto& p_o = decay<LhsEval>(fluidState.pressure(
oilPhaseIdx));
1013 const auto& p_g = decay<LhsEval>(fluidState.pressure(
gasPhaseIdx));
1015 return phi_gG*p_g*x_gGSat / (p_o*x_oGSat);
1022 throw std::logic_error(
"Invalid component index "+std::to_string(compIdx));
1037 throw std::logic_error(
"Invalid component index "+std::to_string(compIdx));
1041 throw std::logic_error(
"Invalid phase index "+std::to_string(phaseIdx));
1044 throw std::logic_error(
"Unhandled phase or component index");
1048 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar>
1049 STATIC_OR_DEVICE LhsEval
viscosity(
const FluidState& fluidState,
1051 unsigned regionIdx) NOTHING_OR_CONST
1053 OPM_TIMEBLOCK_LOCAL(
viscosity, Subsystem::PvtProps);
1057 const LhsEval& p = decay<LhsEval>(fluidState.pressure(phaseIdx));
1058 const LhsEval& T = decay<LhsEval>(fluidState.temperature(phaseIdx));
1063 const auto& Rs = BlackOil::template getRs_<ThisType, FluidState, LhsEval>(fluidState, regionIdx);
1065 && Rs >= (1.0 - 1e-10)*oilPvt_.saturatedGasDissolutionFactor(regionIdx, scalarValue(T), scalarValue(p)))
1067 return oilPvt_.saturatedViscosity(regionIdx, T, p);
1069 return oilPvt_.viscosity(regionIdx, T, p, Rs);
1073 const LhsEval Rs(0.0);
1074 return oilPvt_.viscosity(regionIdx, T, p, Rs);
1079 const auto& Rvw = BlackOil::template getRvw_<ThisType, FluidState, LhsEval>(fluidState, regionIdx);
1080 const auto& Rv = BlackOil::template getRv_<ThisType, FluidState, LhsEval>(fluidState, regionIdx);
1082 && Rvw >= (1.0 - 1e-10)*gasPvt_.saturatedWaterVaporizationFactor(regionIdx, scalarValue(T), scalarValue(p))
1084 && Rv >= (1.0 - 1e-10)*gasPvt_.saturatedOilVaporizationFactor(regionIdx, scalarValue(T), scalarValue(p)))
1086 return gasPvt_.saturatedViscosity(regionIdx, T, p);
1088 return gasPvt_.viscosity(regionIdx, T, p, Rv, Rvw);
1092 const auto& Rv = BlackOil::template getRv_<ThisType, FluidState, LhsEval>(fluidState, regionIdx);
1094 && Rv >= (1.0 - 1e-10)*gasPvt_.saturatedOilVaporizationFactor(regionIdx, scalarValue(T), scalarValue(p)))
1096 return gasPvt_.saturatedViscosity(regionIdx, T, p);
1098 const LhsEval Rvw(0.0);
1099 return gasPvt_.viscosity(regionIdx, T, p, Rv, Rvw);
1103 const auto& Rvw = BlackOil::template getRvw_<ThisType, FluidState, LhsEval>(fluidState, regionIdx);
1105 && Rvw >= (1.0 - 1e-10)*gasPvt_.saturatedWaterVaporizationFactor(regionIdx, scalarValue(T), scalarValue(p)))
1107 return gasPvt_.saturatedViscosity(regionIdx, T, p);
1109 const LhsEval Rv(0.0);
1110 return gasPvt_.viscosity(regionIdx, T, p, Rv, Rvw);
1114 const LhsEval Rv(0.0);
1115 const LhsEval Rvw(0.0);
1116 return gasPvt_.viscosity(regionIdx, T, p, Rv, Rvw);
1121 const LhsEval& saltConcentration = BlackOil::template getSaltConcentration_<FluidState, LhsEval>(fluidState, regionIdx);
1123 const auto& Rsw = BlackOil::template getRsw_<ThisType, FluidState, LhsEval>(fluidState, regionIdx);
1125 && Rsw >= (1.0 - 1e-10)*waterPvt_.saturatedGasDissolutionFactor(regionIdx, scalarValue(T), scalarValue(p), scalarValue(saltConcentration)))
1127 return waterPvt_.saturatedViscosity(regionIdx, T, p, saltConcentration);
1129 return waterPvt_.viscosity(regionIdx, T, p, Rsw, saltConcentration);
1132 const LhsEval Rsw(0.0);
1133 return waterPvt_.viscosity(regionIdx, T, p, Rsw, saltConcentration);
1137 throw std::logic_error(
"Unhandled phase index "+std::to_string(phaseIdx));
1140 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar>
1141 STATIC_OR_DEVICE LhsEval internalEnergy(
const FluidState& fluidState,
1142 const unsigned phaseIdx,
1143 const unsigned regionIdx) NOTHING_OR_CONST
1145 const auto p = decay<LhsEval>(fluidState.pressure(phaseIdx));
1146 const auto T = decay<LhsEval>(fluidState.temperature(phaseIdx));
1150 if (!oilPvt_.mixingEnergy()) {
1151 return oilPvt_.internalEnergy
1153 BlackOil::template getRs_<ThisType, FluidState, LhsEval>(fluidState, regionIdx));
1158 if (!waterPvt_.mixingEnergy()) {
1159 return waterPvt_.internalEnergy
1161 BlackOil::template getRsw_<ThisType, FluidState, LhsEval>(fluidState, regionIdx),
1162 BlackOil::template getSaltConcentration_<FluidState, LhsEval>(fluidState, regionIdx));
1167 if (!gasPvt_.mixingEnergy()) {
1168 return gasPvt_.internalEnergy
1170 BlackOil::template getRv_<ThisType, FluidState, LhsEval>(fluidState, regionIdx),
1171 BlackOil::template getRvw_<ThisType, FluidState, LhsEval>(fluidState, regionIdx));
1176 throw std::logic_error {
1177 "Phase index " + std::to_string(phaseIdx) +
" does not support internal energy"
1181 return internalMixingTotalEnergy<FluidState,LhsEval>(fluidState, phaseIdx, regionIdx)
1186 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar>
1187 STATIC_OR_DEVICE LhsEval internalMixingTotalEnergy(
const FluidState& fluidState,
1189 unsigned regionIdx) NOTHING_OR_CONST
1193 const LhsEval& p = decay<LhsEval>(fluidState.pressure(phaseIdx));
1194 const LhsEval& T = decay<LhsEval>(fluidState.temperature(phaseIdx));
1195 const LhsEval& saltConcentration = BlackOil::template getSaltConcentration_<FluidState, LhsEval>(fluidState, regionIdx);
1199 auto oilEnergy = oilPvt_.internalEnergy(regionIdx, T, p,
1200 BlackOil::template getRs_<ThisType, FluidState, LhsEval>(fluidState, regionIdx));
1201 assert(oilPvt_.mixingEnergy());
1205 const LhsEval& Rs = BlackOil::template getRs_<ThisType, FluidState, LhsEval>(fluidState, regionIdx);
1206 const LhsEval& bo = oilPvt_.inverseFormationVolumeFactor(regionIdx, T, p, Rs);
1207 const auto& gasEnergy =
1208 gasPvt_.internalEnergy(regionIdx, T, p,
1209 BlackOil::template getRv_<ThisType, FluidState, LhsEval>(fluidState, regionIdx),
1210 BlackOil::template getRvw_<ThisType, FluidState, LhsEval>(fluidState, regionIdx));
1211 const auto hVapG = gasPvt_.hVap(regionIdx);
1218 const LhsEval Rs(0.0);
1219 const auto& bo = oilPvt_.inverseFormationVolumeFactor(regionIdx, T, p, Rs);
1225 const auto& gasEnergy =
1226 gasPvt_.internalEnergy(regionIdx, T, p,
1227 BlackOil::template getRv_<ThisType, FluidState, LhsEval>(fluidState, regionIdx),
1228 BlackOil::template getRvw_<ThisType, FluidState, LhsEval>(fluidState, regionIdx));
1229 assert(gasPvt_.mixingEnergy());
1231 const auto& oilEnergy =
1232 oilPvt_.internalEnergy(regionIdx, T, p,
1233 BlackOil::template getRs_<ThisType, FluidState, LhsEval>(fluidState, regionIdx));
1234 const auto waterEnergy =
1235 waterPvt_.internalEnergy(regionIdx, T, p,
1236 BlackOil::template getRsw_<ThisType, FluidState, LhsEval>(fluidState, regionIdx),
1237 BlackOil::template getSaltConcentration_<FluidState, LhsEval>(fluidState, regionIdx));
1239 const LhsEval& Rv = BlackOil::template getRv_<ThisType, FluidState, LhsEval>(fluidState, regionIdx);
1240 const LhsEval& Rvw = BlackOil::template getRvw_<ThisType, FluidState, LhsEval>(fluidState, regionIdx);
1241 const LhsEval& bg = gasPvt_.inverseFormationVolumeFactor(regionIdx, T, p, Rv, Rvw);
1242 const auto hVapO = oilPvt_.hVap(regionIdx);
1243 const auto hVapW = waterPvt_.hVap(regionIdx);
1250 const auto& oilEnergy =
1251 oilPvt_.internalEnergy(regionIdx, T, p,
1252 BlackOil::template getRs_<ThisType, FluidState, LhsEval>(fluidState, regionIdx));
1254 const LhsEval Rvw(0.0);
1255 const LhsEval& Rv = BlackOil::template getRv_<ThisType, FluidState, LhsEval>(fluidState, regionIdx);
1256 const LhsEval& bg = gasPvt_.inverseFormationVolumeFactor(regionIdx, T, p, Rv, Rvw);
1257 const auto hVapO = oilPvt_.hVap(regionIdx);
1264 const LhsEval Rv(0.0);
1265 const LhsEval& Rvw = BlackOil::template getRvw_<ThisType, FluidState, LhsEval>(fluidState, regionIdx);
1266 const LhsEval& bg = gasPvt_.inverseFormationVolumeFactor(regionIdx, T, p, Rv, Rvw);
1267 const auto waterEnergy =
1268 waterPvt_.internalEnergy(regionIdx, T, p,
1269 BlackOil::template getRsw_<ThisType, FluidState, LhsEval>(fluidState, regionIdx),
1270 BlackOil::template getSaltConcentration_<FluidState, LhsEval>(fluidState, regionIdx));
1271 const auto hVapW = waterPvt_.hVap(regionIdx);
1278 const LhsEval Rv(0.0);
1279 const LhsEval Rvw(0.0);
1280 const auto& bg = gasPvt_.inverseFormationVolumeFactor(regionIdx, T, p, Rv, Rvw);
1285 const auto waterEnergy =
1286 waterPvt_.internalEnergy(regionIdx, T, p,
1287 BlackOil::template getRsw_<ThisType, FluidState, LhsEval>(fluidState, regionIdx),
1288 BlackOil::template getSaltConcentration_<FluidState, LhsEval>(fluidState, regionIdx));
1289 assert(waterPvt_.mixingEnergy());
1291 const auto& gasEnergy =
1292 gasPvt_.internalEnergy(regionIdx, T, p,
1293 BlackOil::template getRv_<ThisType, FluidState, LhsEval>(fluidState, regionIdx),
1294 BlackOil::template getRvw_<ThisType, FluidState, LhsEval>(fluidState, regionIdx));
1297 const LhsEval& bw = waterPvt_.inverseFormationVolumeFactor(regionIdx, T, p, Rsw, saltConcentration);
1302 const LhsEval Rsw(0.0);
1305 * waterPvt_.inverseFormationVolumeFactor(regionIdx, T, p, Rsw, saltConcentration);
1307 throw std::logic_error(
"Unhandled phase index " + std::to_string(phaseIdx));
1313 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar>
1314 STATIC_OR_DEVICE LhsEval
enthalpy(
const FluidState& fluidState,
1316 unsigned regionIdx) NOTHING_OR_CONST
1319 const auto& p = decay<LhsEval>(fluidState.pressure(phaseIdx));
1320 auto energy = internalEnergy<FluidState, LhsEval>(fluidState, phaseIdx, regionIdx);
1321 if(!enthalpy_eq_energy_){
1334 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar>
1337 unsigned regionIdx) NOTHING_OR_CONST
1342 const auto& p = decay<LhsEval>(fluidState.pressure(phaseIdx));
1343 const auto& T = decay<LhsEval>(fluidState.temperature(phaseIdx));
1344 const auto& saltConcentration = decay<LhsEval>(fluidState.saltConcentration());
1348 case gasPhaseIdx:
return gasPvt_.saturatedWaterVaporizationFactor(regionIdx, T, p, saltConcentration);
1350 default:
throw std::logic_error(
"Unhandled phase index "+std::to_string(phaseIdx));
1360 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar>
1364 const LhsEval& maxOilSaturation) NOTHING_OR_CONST
1370 const auto& p = decay<LhsEval>(fluidState.pressure(phaseIdx));
1371 const auto& T = decay<LhsEval>(fluidState.temperature(phaseIdx));
1375 case oilPhaseIdx:
return oilPvt_.saturatedGasDissolutionFactor(regionIdx, T, p, So, maxOilSaturation);
1376 case gasPhaseIdx:
return gasPvt_.saturatedOilVaporizationFactor(regionIdx, T, p, So, maxOilSaturation);
1377 case waterPhaseIdx:
return waterPvt_.saturatedGasDissolutionFactor(regionIdx, T, p,
1378 BlackOil::template getSaltConcentration_<FluidState, LhsEval>(fluidState, regionIdx));
1379 default:
throw std::logic_error(
"Unhandled phase index "+std::to_string(phaseIdx));
1391 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar>
1394 unsigned regionIdx) NOTHING_OR_CONST
1400 const auto& p = decay<LhsEval>(fluidState.pressure(phaseIdx));
1401 const auto& T = decay<LhsEval>(fluidState.temperature(phaseIdx));
1404 case oilPhaseIdx:
return oilPvt_.saturatedGasDissolutionFactor(regionIdx, T, p);
1405 case gasPhaseIdx:
return gasPvt_.saturatedOilVaporizationFactor(regionIdx, T, p);
1406 case waterPhaseIdx:
return waterPvt_.saturatedGasDissolutionFactor(regionIdx, T, p,
1407 BlackOil::template getSaltConcentration_<FluidState, LhsEval>(fluidState, regionIdx));
1408 default:
throw std::logic_error(
"Unhandled phase index "+std::to_string(phaseIdx));
1415 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar>
1417 unsigned regionIdx) NOTHING_OR_CONST
1426 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar>
1428 unsigned regionIdx) NOTHING_OR_CONST
1443 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar>
1446 unsigned regionIdx) NOTHING_OR_CONST
1451 const auto& T = decay<LhsEval>(fluidState.temperature(phaseIdx));
1454 case oilPhaseIdx:
return oilPvt_.saturationPressure(regionIdx, T, BlackOil::template getRs_<ThisType, FluidState, LhsEval>(fluidState, regionIdx));
1455 case gasPhaseIdx:
return gasPvt_.saturationPressure(regionIdx, T, BlackOil::template getRv_<ThisType, FluidState, LhsEval>(fluidState, regionIdx));
1456 case waterPhaseIdx:
return waterPvt_.saturationPressure(regionIdx, T,
1457 BlackOil::template getRsw_<ThisType, FluidState, LhsEval>(fluidState, regionIdx),
1458 BlackOil::template getSaltConcentration_<FluidState, LhsEval>(fluidState, regionIdx));
1459 default:
throw std::logic_error(
"Unhandled phase index "+std::to_string(phaseIdx));
1470 template <
class LhsEval>
1471 STATIC_OR_DEVICE LhsEval
convertXoGToRs(
const LhsEval& XoG,
unsigned regionIdx) NOTHING_OR_CONST
1476 return XoG/(1.0 - XoG)*(rho_oRef/rho_gRef);
1483 template <
class LhsEval>
1484 STATIC_OR_DEVICE LhsEval
convertXwGToRsw(
const LhsEval& XwG,
unsigned regionIdx) NOTHING_OR_CONST
1489 return XwG/(1.0 - XwG)*(rho_wRef/rho_gRef);
1496 template <
class LhsEval>
1497 STATIC_OR_DEVICE LhsEval
convertXgOToRv(
const LhsEval& XgO,
unsigned regionIdx) NOTHING_OR_CONST
1502 return XgO/(1.0 - XgO)*(rho_gRef/rho_oRef);
1509 template <
class LhsEval>
1510 STATIC_OR_DEVICE LhsEval
convertXgWToRvw(
const LhsEval& XgW,
unsigned regionIdx) NOTHING_OR_CONST
1515 return XgW/(1.0 - XgW)*(rho_gRef/rho_wRef);
1523 template <
class LhsEval>
1524 STATIC_OR_DEVICE LhsEval
convertRsToXoG(
const LhsEval& Rs,
unsigned regionIdx) NOTHING_OR_CONST
1529 const LhsEval& rho_oG = Rs*rho_gRef;
1530 return rho_oG/(rho_oRef + rho_oG);
1537 template <
class LhsEval>
1538 STATIC_OR_DEVICE LhsEval
convertRswToXwG(
const LhsEval& Rsw,
unsigned regionIdx) NOTHING_OR_CONST
1543 const LhsEval& rho_wG = Rsw*rho_gRef;
1544 return rho_wG/(rho_wRef + rho_wG);
1551 template <
class LhsEval>
1552 STATIC_OR_DEVICE LhsEval
convertRvToXgO(
const LhsEval& Rv,
unsigned regionIdx) NOTHING_OR_CONST
1557 const LhsEval& rho_gO = Rv*rho_oRef;
1558 return rho_gO/(rho_gRef + rho_gO);
1565 template <
class LhsEval>
1566 STATIC_OR_DEVICE LhsEval
convertRvwToXgW(
const LhsEval& Rvw,
unsigned regionIdx) NOTHING_OR_CONST
1571 const LhsEval& rho_gW = Rvw*rho_wRef;
1572 return rho_gW/(rho_gRef + rho_gW);
1578 template <
class LhsEval>
1579 STATIC_OR_DEVICE LhsEval
convertXgWToxgW(
const LhsEval& XgW,
unsigned regionIdx) NOTHING_OR_CONST
1584 return XgW*MG / (MW*(1 - XgW) + XgW*MG);
1590 template <
class LhsEval>
1591 STATIC_OR_DEVICE LhsEval
convertXwGToxwG(
const LhsEval& XwG,
unsigned regionIdx) NOTHING_OR_CONST
1596 return XwG*MW / (MG*(1 - XwG) + XwG*MW);
1602 template <
class LhsEval>
1603 STATIC_OR_DEVICE LhsEval
convertXoGToxoG(
const LhsEval& XoG,
unsigned regionIdx) NOTHING_OR_CONST
1608 return XoG*MO / (MG*(1 - XoG) + XoG*MO);
1614 template <
class LhsEval>
1615 STATIC_OR_DEVICE LhsEval
convertxoGToXoG(
const LhsEval& xoG,
unsigned regionIdx) NOTHING_OR_CONST
1620 return xoG*MG / (xoG*(MG - MO) + MO);
1626 template <
class LhsEval>
1627 STATIC_OR_DEVICE LhsEval
convertXgOToxgO(
const LhsEval& XgO,
unsigned regionIdx) NOTHING_OR_CONST
1632 return XgO*MG / (MO*(1 - XgO) + XgO*MG);
1638 template <
class LhsEval>
1639 STATIC_OR_DEVICE LhsEval
convertxgOToXgO(
const LhsEval& xgO,
unsigned regionIdx) NOTHING_OR_CONST
1644 return xgO*MO / (xgO*(MO - MG) + MG);
1654 STATIC_OR_DEVICE
const GasPvt&
gasPvt() NOTHING_OR_CONST
1664 STATIC_OR_DEVICE
const OilPvt&
oilPvt() NOTHING_OR_CONST
1674 STATIC_OR_DEVICE
const WaterPvt&
waterPvt() NOTHING_OR_CONST
1675 {
return waterPvt_; }
1683 {
return reservoirTemperature_; }
1691 { reservoirTemperature_ = value; }
1693 STATIC_OR_DEVICE
short activeToCanonicalPhaseIdx(
unsigned activePhaseIdx) NOTHING_OR_CONST;
1695 STATIC_OR_DEVICE
short canonicalToActivePhaseIdx(
unsigned phaseIdx) NOTHING_OR_CONST;
1697 STATIC_OR_DEVICE
short activeToCanonicalCompIdx(
unsigned activeCompIdx) NOTHING_OR_CONST;
1699 STATIC_OR_DEVICE
short canonicalToActiveCompIdx(
unsigned compIdx) NOTHING_OR_CONST;
1701 STATIC_OR_DEVICE
short activePhaseToActiveCompIdx(
unsigned activePhaseIdx) NOTHING_OR_CONST;
1703 STATIC_OR_DEVICE
short activeCompToActivePhaseIdx(
unsigned activeCompIdx) NOTHING_OR_CONST;
1707 {
return diffusionCoefficients_[regionIdx][
numPhases*compIdx + phaseIdx]; }
1711 { diffusionCoefficients_[regionIdx][
numPhases*compIdx + phaseIdx] = coefficient ; }
1716 template <
class Flu
idState,
class LhsEval =
typename Flu
idState::Scalar,
class ParamCacheEval = LhsEval>
1718 const ParameterCache<ParamCacheEval>& paramCache,
1720 unsigned compIdx) NOTHING_OR_CONST
1727 if(!diffusionCoefficients_.empty()) {
1731 const auto& p = decay<LhsEval>(fluidState.pressure(phaseIdx));
1732 const auto& T = decay<LhsEval>(fluidState.temperature(phaseIdx));
1738 default:
throw std::logic_error(
"Unhandled phase index "+std::to_string(phaseIdx));
1741 STATIC_OR_DEVICE
void setEnergyEqualEnthalpy(
bool enthalpy_eq_energy){
1742 enthalpy_eq_energy_ = enthalpy_eq_energy;
1745 STATIC_OR_DEVICE
bool enthalpyEqualEnergy(){
1746 return enthalpy_eq_energy_;
1750 STATIC_OR_NOTHING
void resizeArrays_(std::size_t
numRegions);
1752 STATIC_OR_NOTHING
Scalar reservoirTemperature_;
1754 STATIC_OR_NOTHING GasPvt gasPvt_;
1755 STATIC_OR_NOTHING OilPvt oilPvt_;
1756 STATIC_OR_NOTHING WaterPvt waterPvt_;
1758 STATIC_OR_NOTHING
bool enableDissolvedGas_;
1759 STATIC_OR_NOTHING
bool enableDissolvedGasInWater_;
1760 STATIC_OR_NOTHING
bool enableVaporizedOil_;
1761 STATIC_OR_NOTHING
bool enableVaporizedWater_;
1762 STATIC_OR_NOTHING
bool enableDiffusion_;
1767 STATIC_OR_NOTHING Storage<std::array<
Scalar, 3> > referenceDensity_;
1768 STATIC_OR_NOTHING Storage<std::array<
Scalar, 3> > molarMass_;
1769 STATIC_OR_NOTHING Storage<std::array<
Scalar, 3 * 3> > diffusionCoefficients_;
1771 STATIC_OR_NOTHING PhaseUsageInfo<IndexTraits> phaseUsageInfo_;
1773 STATIC_OR_NOTHING
bool isInitialized_;
1774 STATIC_OR_NOTHING
bool useSaturatedTables_;
1775 STATIC_OR_NOTHING
bool enthalpy_eq_energy_;
1777 #ifndef COMPILING_STATIC_FLUID_SYSTEM
1778 template<
template<
typename>
typename StorageT>
1779 explicit FLUIDSYSTEM_CLASSNAME(
const FLUIDSYSTEM_CLASSNAME_STATIC<Scalar, IndexTraits, StorageT>& other)
1782 , reservoirTemperature_(other.reservoirTemperature_)
1783 , gasPvt_(other.gasPvt_)
1784 , oilPvt_(other.oilPvt_)
1785 , waterPvt_(other.waterPvt_)
1786 , enableDissolvedGas_(other.enableDissolvedGas_)
1787 , enableDissolvedGasInWater_(other.enableDissolvedGasInWater_)
1788 , enableVaporizedOil_(other.enableVaporizedOil_)
1789 , enableVaporizedWater_(other.enableVaporizedWater_)
1790 , enableDiffusion_(other.enableDiffusion_)
1791 , referenceDensity_(StorageT<typename decltype(referenceDensity_)::value_type>(other.referenceDensity_))
1792 , molarMass_(StorageT<typename decltype(molarMass_)::value_type>(other.molarMass_))
1793 , diffusionCoefficients_(StorageT<typename decltype(diffusionCoefficients_)::value_type>(other.diffusionCoefficients_))
1794 , phaseUsageInfo_(other.phaseUsageInfo_)
1795 , isInitialized_(other.isInitialized_)
1796 , useSaturatedTables_(other.useSaturatedTables_)
1797 , enthalpy_eq_energy_(other.enthalpy_eq_energy_)
1799 OPM_ERROR_IF(!other.isInitialized(),
"The fluid system must be initialized before it can be copied.");
1802 template<
class ScalarT,
class IndexTraitsT,
template<
typename>
typename StorageT>
1803 friend class FLUIDSYSTEM_CLASSNAME_STATIC;
1805 template<
class ScalarT,
class IndexTraitsT,
template<
typename>
typename StorageT>
1806 friend class FLUIDSYSTEM_CLASSNAME_NONSTATIC;
1810template <
class Scalar,
class IndexTraits,
template<
typename>
typename Storage>
1814 isInitialized_ =
false;
1815 useSaturatedTables_ =
true;
1817 enableDissolvedGas_ =
true;
1818 enableDissolvedGasInWater_ =
false;
1819 enableVaporizedOil_ =
false;
1820 enableVaporizedWater_ =
false;
1821 enableDiffusion_ =
false;
1827 phaseUsageInfo_.initFromPhases(
Phases{
true,
true,
true});
1829 resizeArrays_(numPvtRegions);
1832template <
class Scalar,
class IndexTraits,
template<
typename>
typename Storage>
1839 referenceDensity_[regionIdx][
oilPhaseIdx] = rhoOil;
1841 referenceDensity_[regionIdx][
gasPhaseIdx] = rhoGas;
1844template <
class Scalar,
class IndexTraits,
template<
typename>
typename Storage>
1848 const std::size_t num_regions = molarMass_.size();
1849 for (
unsigned regionIdx = 0; regionIdx < num_regions; ++regionIdx) {
1870 isInitialized_ =
true;
1873template <
class Scalar,
class IndexTraits,
template<
typename>
typename Storage>
1875phaseName(
unsigned phaseIdx) NOTHING_OR_CONST
1886 throw std::logic_error(std::string(
"Phase index ") + std::to_string(phaseIdx) +
" is unknown");
1890template <
class Scalar,
class IndexTraits,
template<
typename>
typename Storage>
1903 throw std::logic_error(std::string(
"Phase index ") + std::to_string(phaseIdx) +
" is unknown");
1907template <
class Scalar,
class IndexTraits,
template<
typename>
typename Storage>
1915 throw std::logic_error(
"The water phase does not have any solutes in the black oil model!");
1925 throw std::logic_error(std::string(
"Phase index ") + std::to_string(phaseIdx) +
" is unknown");
1929template <
class Scalar,
class IndexTraits,
template<
typename>
typename Storage>
1942 throw std::logic_error(std::string(
"Component index ") + std::to_string(compIdx) +
" is unknown");
1946template <
class Scalar,
class IndexTraits,
template<
typename>
typename Storage>
1950 return phaseUsageInfo_.activeToCanonicalPhaseIdx(activePhaseIdx);
1953template <
class Scalar,
class IndexTraits,
template<
typename>
typename Storage>
1954NOTHING_OR_DEVICE
short FLUIDSYSTEM_CLASSNAME<Scalar,IndexTraits, Storage>::
1955canonicalToActivePhaseIdx(
unsigned phaseIdx) NOTHING_OR_CONST
1957 return phaseUsageInfo_.canonicalToActivePhaseIdx(phaseIdx);
1960template <
class Scalar,
class IndexTraits,
template<
typename>
typename Storage>
1964 return phaseUsageInfo_.activeToCanonicalCompIdx(activeCompIdx);
1967template <
class Scalar,
class IndexTraits,
template<
typename>
typename Storage>
1971 return phaseUsageInfo_.canonicalToActiveCompIdx(compIdx);
1974template <
class Scalar,
class IndexTraits,
template<
typename>
typename Storage>
1978 return phaseUsageInfo_.activePhaseToActiveCompIdx(activePhaseIdx);
1981template <
class Scalar,
class IndexTraits,
template<
typename>
typename Storage>
1985 return phaseUsageInfo_.activeCompToActivePhaseIdx(activeCompIdx);
1988template <
class Scalar,
class IndexTraits,
template<
typename>
typename Storage>
1992 molarMass_.resize(numRegions);
1993 referenceDensity_.resize(numRegions);
1996#ifdef COMPILING_STATIC_FLUID_SYSTEM
1999#define DECLARE_INSTANCE(T) \
2000template<> PhaseUsageInfo<BlackOilDefaultFluidSystemIndices> BOFS<T>::phaseUsageInfo_;\
2001template<> T BOFS<T>::surfaceTemperature; \
2002template<> T BOFS<T>::surfacePressure; \
2003template<> T BOFS<T>::reservoirTemperature_; \
2004template<> bool BOFS<T>::enableDissolvedGas_; \
2005template<> bool BOFS<T>::enableDissolvedGasInWater_; \
2006template<> bool BOFS<T>::enableVaporizedOil_; \
2007template<> bool BOFS<T>::enableVaporizedWater_; \
2008template<> bool BOFS<T>::enableDiffusion_; \
2009template<> BOFS<T>::OilPvt BOFS<T>::oilPvt_; \
2010template<> BOFS<T>::GasPvt BOFS<T>::gasPvt_; \
2011template<> BOFS<T>::WaterPvt BOFS<T>::waterPvt_; \
2012template<> std::vector<std::array<T, 3>> BOFS<T>::referenceDensity_; \
2013template<> std::vector<std::array<T, 3>> BOFS<T>::molarMass_; \
2014template<> std::vector<std::array<T, 9>> BOFS<T>::diffusionCoefficients_; \
2015template<> bool BOFS<T>::isInitialized_; \
2016template<> bool BOFS<T>::useSaturatedTables_; \
2017template<> bool BOFS<T>::enthalpy_eq_energy_;
2019DECLARE_INSTANCE(
float)
2020DECLARE_INSTANCE(
double)
2022#undef DECLARE_INSTANCE
2025#ifndef COMPILING_STATIC_FLUID_SYSTEM
2030template <
class Scalar,
class IndexTraits>
2031FLUIDSYSTEM_CLASSNAME<Scalar, IndexTraits, GpuBuffer>
2032copy_to_gpu(
const FLUIDSYSTEM_CLASSNAME<Scalar, IndexTraits>& oldFluidSystem) {
2034 using GpuBuffer3Array = GpuBuffer<std::array<Scalar, 3>>;
2035 using GpuBuffer9Array = GpuBuffer<std::array<Scalar, 9>>;
2037 OPM_ERROR_IF(oldFluidSystem.gasPvt_.approach() != GasPvtApproach::Co2Gas,
2038 fmt::format(
"Incompatible gas PVT approach. Given {}, expected {} (GasPvtApproach::Co2Gas).",
2039 int(oldFluidSystem.gasPvt_.approach()),
int(GasPvtApproach::Co2Gas)));
2041 OPM_ERROR_IF(oldFluidSystem.waterPvt_.approach() != WaterPvtApproach::BrineCo2,
2042 fmt::format(
"Incompatible water PVT approach. Given {}, expected {} (WaterPvtApproach::BrineCo2).",
2043 int(oldFluidSystem.waterPvt_.approach()),
int(WaterPvtApproach::BrineCo2)));
2045 OPM_ERROR_IF(oldFluidSystem.oilPvt_.isActive(),
2046 "We currently do not support an active oil phase for the FluidSystem on GPU.");
2048 auto newGasPvt =
copy_to_gpu(oldFluidSystem.gasPvt_.template getRealPvt<GasPvtApproach::Co2Gas>());
2050 auto newOilPvt = NullOilPvt<Scalar>();
2052 auto newWaterPvt =
copy_to_gpu(oldFluidSystem.waterPvt_.template getRealPvt<WaterPvtApproach::BrineCo2>());
2054 auto newReferenceDensity = GpuBuffer3Array(oldFluidSystem.referenceDensity_);
2055 auto newMolarMass = GpuBuffer3Array(oldFluidSystem.molarMass_);
2056 auto newDiffusionCoefficients = GpuBuffer9Array(oldFluidSystem.diffusionCoefficients_);
2058 return FLUIDSYSTEM_CLASSNAME<Scalar, IndexTraits, GpuBuffer>(
2059 oldFluidSystem.surfacePressure,
2060 oldFluidSystem.surfaceTemperature,
2061 oldFluidSystem.reservoirTemperature_,
2065 oldFluidSystem.enableDissolvedGas_,
2066 oldFluidSystem.enableDissolvedGasInWater_,
2067 oldFluidSystem.enableVaporizedOil_,
2068 oldFluidSystem.enableVaporizedWater_,
2069 oldFluidSystem.enableDiffusion_,
2070 std::move(newReferenceDensity),
2071 std::move(newMolarMass),
2072 std::move(newDiffusionCoefficients),
2073 oldFluidSystem.phaseUsageInfo_,
2074 oldFluidSystem.isInitialized_,
2075 oldFluidSystem.useSaturatedTables_,
2076 oldFluidSystem.enthalpy_eq_energy_
2080template <
class Scalar,
class IndexTraits>
2081FLUIDSYSTEM_CLASSNAME<Scalar, IndexTraits, GpuView>
2082make_view(FLUIDSYSTEM_CLASSNAME<Scalar, IndexTraits, GpuBuffer>& oldFluidSystem)
2084 using Array3 = std::array<Scalar, 3>;
2085 using Array9 = std::array<Scalar, 9>;
2087 auto newGasPvt =
make_view(oldFluidSystem.gasPvt_);
2088 auto newOilPvt = NullOilPvt<Scalar>();
2089 auto newWaterPvt =
make_view(oldFluidSystem.waterPvt_);
2093 auto newDiffusionCoefficients =
make_view<Array9>(oldFluidSystem.diffusionCoefficients_);
2095 return FLUIDSYSTEM_CLASSNAME<Scalar, IndexTraits, GpuView>(
2096 oldFluidSystem.surfacePressure,
2097 oldFluidSystem.surfaceTemperature,
2098 oldFluidSystem.reservoirTemperature_,
2102 oldFluidSystem.enableDissolvedGas_,
2103 oldFluidSystem.enableDissolvedGasInWater_,
2104 oldFluidSystem.enableVaporizedOil_,
2105 oldFluidSystem.enableVaporizedWater_,
2106 oldFluidSystem.enableDiffusion_,
2107 std::move(newReferenceDensity),
2108 std::move(newMolarMass),
2109 std::move(newDiffusionCoefficients),
2110 oldFluidSystem.phaseUsageInfo_,
2111 oldFluidSystem.isInitialized_,
2112 oldFluidSystem.useSaturatedTables_,
2113 oldFluidSystem.enthalpy_eq_energy_
The base class for all fluid systems.
The class which specifies the default phase and component indices for the black-oil fluid system.
This class represents the Pressure-Volume-Temperature relations of the liquid phase for a CO2-Brine s...
This class represents the Pressure-Volume-Temperature relations of the gas phase in the black-oil mod...
This macro generates a class HasMember_${MEMBER_NAME} which can be used for template specialization.
A parameter cache which does nothing.
This class represents the Pressure-Volume-Temperature relations of the oil phase in the black-oil mod...
PiecewiseLinearTwoPhaseMaterialParams< TraitsT, GPUContainerType > copy_to_gpu(const PiecewiseLinearTwoPhaseMaterialParams< TraitsT > ¶ms)
Move a PiecewiseLinearTwoPhaseMaterialParams-object to the GPU.
Definition PiecewiseLinearTwoPhaseMaterialParams.hpp:285
PiecewiseLinearTwoPhaseMaterialParams< TraitsT, ViewType > make_view(PiecewiseLinearTwoPhaseMaterialParams< TraitsT, ContainerType > ¶ms)
this function is intented to make a GPU friendly view of the PiecewiseLinearTwoPhaseMaterialParams
Definition PiecewiseLinearTwoPhaseMaterialParams.hpp:312
Some templates to wrap the valgrind client request macros.
This class represents the Pressure-Volume-Temperature relations of the water phase in the black-oil m...
The base class for all fluid systems.
Definition BaseFluidSystem.hpp:43
Scalar Scalar
Definition BaseFluidSystem.hpp:48
The class which specifies the default phase and component indices for the black-oil fluid system.
Definition BlackOilDefaultFluidSystemIndices.hpp:39
This class represents the Pressure-Volume-Temperature relations of the liquid phase for a CO2-Brine s...
Definition BrineCo2Pvt.hpp:80
This class represents the Pressure-Volume-Temperature relations of the gas phase for CO2.
Definition Co2GasPvt.hpp:75
static constexpr Scalar R
The ideal gas constant [J/(mol K)].
Definition Constants.hpp:45
Definition EclipseState.hpp:62
A fluid system which uses the black-oil model assumptions to calculate termodynamically meaningful qu...
Definition BlackOilFluidSystem_macrotemplate.hpp:78
STATIC_OR_DEVICE Scalar diffusionCoefficient(unsigned compIdx, unsigned phaseIdx, unsigned regionIdx=0) NOTHING_OR_CONST
Calculate the binary molecular diffusion coefficient for a component in a fluid phase [mol^2 * s / (k...
Definition BlackOilFluidSystem_macrotemplate.hpp:1706
STATIC_OR_DEVICE unsigned numActivePhases() NOTHING_OR_CONST
Returns the number of active fluid phases (i.e., usually three).
Definition BlackOilFluidSystem_macrotemplate.hpp:428
STATIC_OR_DEVICE LhsEval convertRvwToXgW(const LhsEval &Rvw, unsigned regionIdx) NOTHING_OR_CONST
Convert an water vaporization factor to the corresponding mass fraction of the water component in the...
Definition BlackOilFluidSystem_macrotemplate.hpp:1566
STATIC_OR_DEVICE bool useSaturatedTables() NOTHING_OR_CONST
Returns whether the saturated tables should be used.
Definition BlackOilFluidSystem_macrotemplate.hpp:528
STATIC_OR_NOTHING void initBegin(std::size_t numPvtRegions)
Begin the initialization of the black oil fluid system.
Definition BlackOilFluidSystem_macrotemplate.hpp:1812
STATIC_OR_DEVICE LhsEval saturatedDensity(const FluidState &fluidState, unsigned phaseIdx, unsigned regionIdx) NOTHING_OR_CONST
Compute the density of a saturated fluid phase.
Definition BlackOilFluidSystem_macrotemplate.hpp:686
STATIC_OR_DEVICE LhsEval convertRvToXgO(const LhsEval &Rv, unsigned regionIdx) NOTHING_OR_CONST
Convert an oil vaporization factor to the corresponding mass fraction of the oil component in the gas...
Definition BlackOilFluidSystem_macrotemplate.hpp:1552
STATIC_OR_DEVICE void initEnd()
Finish initializing the black oil fluid system.
Definition BlackOilFluidSystem_macrotemplate.hpp:1845
STATIC_OR_DEVICE LhsEval dewPointPressure(const FluidState &fluidState, unsigned regionIdx) NOTHING_OR_CONST
Returns the dew point pressure $P_d$ using the current Rv.
Definition BlackOilFluidSystem_macrotemplate.hpp:1427
STATIC_OR_DEVICE LhsEval convertXgOToRv(const LhsEval &XgO, unsigned regionIdx) NOTHING_OR_CONST
Convert the mass fraction of the oil component in the gas phase to the corresponding oil vaporization...
Definition BlackOilFluidSystem_macrotemplate.hpp:1497
STATIC_OR_DEVICE LhsEval enthalpy(const FluidState &fluidState, const ParameterCache< ParamCacheEval > ¶mCache, unsigned phaseIdx)
Given a phase's composition, temperature, pressure and density, calculate its specific enthalpy [J/kg...
Definition BlackOilFluidSystem_macrotemplate.hpp:571
STATIC_OR_DEVICE const OilPvt & oilPvt() NOTHING_OR_CONST
Return a reference to the low-level object which calculates the oil phase quantities.
Definition BlackOilFluidSystem_macrotemplate.hpp:1664
STATIC_OR_DEVICE bool isIdealMixture(unsigned)
Returns true if and only if a fluid phase is assumed to be an ideal mixture.
Definition BlackOilFluidSystem_macrotemplate.hpp:451
STATIC_OR_DEVICE void setEnableVaporizedOil(bool yesno)
Specify whether the fluid system should consider that the oil component can dissolve in the gas phase...
Definition BlackOilFluidSystem_macrotemplate.hpp:289
STATIC_OR_DEVICE LhsEval saturatedDissolutionFactor(const FluidState &fluidState, unsigned phaseIdx, unsigned regionIdx, const LhsEval &maxOilSaturation) NOTHING_OR_CONST
Returns the dissolution factor of a saturated fluid phase.
Definition BlackOilFluidSystem_macrotemplate.hpp:1361
STATIC_OR_DEVICE bool enableVaporizedOil() NOTHING_OR_CONST
Returns whether the fluid system should consider that the oil component can dissolve in the gas phase...
Definition BlackOilFluidSystem_macrotemplate.hpp:503
STATIC_OR_DEVICE Scalar reservoirTemperature(unsigned=0) NOTHING_OR_CONST
Set the temperature of the reservoir.
Definition BlackOilFluidSystem_macrotemplate.hpp:1682
STATIC_OR_DEVICE LhsEval saturatedVaporizationFactor(const FluidState &fluidState, unsigned phaseIdx, unsigned regionIdx) NOTHING_OR_CONST
Returns the water vaporization factor of saturated phase.
Definition BlackOilFluidSystem_macrotemplate.hpp:1335
STATIC_OR_DEVICE LhsEval convertXoGToRs(const LhsEval &XoG, unsigned regionIdx) NOTHING_OR_CONST
Convert the mass fraction of the gas component in the oil phase to the corresponding gas dissolution ...
Definition BlackOilFluidSystem_macrotemplate.hpp:1471
STATIC_OR_DEVICE LhsEval viscosity(const FluidState &fluidState, const ParameterCache< ParamCacheEval > ¶mCache, unsigned phaseIdx) NOTHING_OR_CONST
Calculate the dynamic viscosity of a fluid phase [Pa*s].
Definition BlackOilFluidSystem_macrotemplate.hpp:564
STATIC_OR_DEVICE LhsEval convertXgWToxgW(const LhsEval &XgW, unsigned regionIdx) NOTHING_OR_CONST
Convert a water mass fraction in the gas phase the corresponding mole fraction.
Definition BlackOilFluidSystem_macrotemplate.hpp:1579
STATIC_OR_DEVICE void setWaterPvt(std::shared_ptr< WaterPvt > pvtObj)
Set the pressure-volume-saturation (PVT) relations for the water phase.
Definition BlackOilFluidSystem_macrotemplate.hpp:340
STATIC_OR_DEVICE LhsEval convertXgWToRvw(const LhsEval &XgW, unsigned regionIdx) NOTHING_OR_CONST
Convert the mass fraction of the water component in the gas phase to the corresponding water vaporiza...
Definition BlackOilFluidSystem_macrotemplate.hpp:1510
static constexpr unsigned gasPhaseIdx
Index of the gas phase.
Definition BlackOilFluidSystem_macrotemplate.hpp:389
static constexpr int oilCompIdx
Index of the oil component.
Definition BlackOilFluidSystem_macrotemplate.hpp:415
FLUIDSYSTEM_CLASSNAME(const FLUIDSYSTEM_CLASSNAME< Scalar, IndexTraits, StorageT > &other)
Default copy constructor.
Definition BlackOilFluidSystem_macrotemplate.hpp:164
STATIC_OR_DEVICE LhsEval fugacityCoefficient(const FluidState &fluidState, unsigned phaseIdx, unsigned compIdx, unsigned regionIdx) NOTHING_OR_CONST
Calculate the fugacity coefficient [Pa] of an individual component in a fluid phase.
Definition BlackOilFluidSystem_macrotemplate.hpp:927
STATIC_OR_DEVICE void setEnableVaporizedWater(bool yesno)
Specify whether the fluid system should consider that the water component can dissolve in the gas pha...
Definition BlackOilFluidSystem_macrotemplate.hpp:298
STATIC_OR_DEVICE LhsEval convertXoGToxoG(const LhsEval &XoG, unsigned regionIdx) NOTHING_OR_CONST
Convert a gas mass fraction in the oil phase the corresponding mole fraction.
Definition BlackOilFluidSystem_macrotemplate.hpp:1603
STATIC_OR_DEVICE LhsEval density(const FluidState &fluidState, unsigned phaseIdx, unsigned regionIdx) NOTHING_OR_CONST
Calculate the density [kg/m^3] of a fluid phase.
Definition BlackOilFluidSystem_macrotemplate.hpp:588
STATIC_OR_DEVICE void setUseSaturatedTables(bool yesno)
Specify whether the saturated tables should be used.
Definition BlackOilFluidSystem_macrotemplate.hpp:322
STATIC_OR_DEVICE bool phaseIsActive(unsigned phaseIdx) NOTHING_OR_CONST
Returns whether a fluid phase is active.
Definition BlackOilFluidSystem_macrotemplate.hpp:432
STATIC_OR_DEVICE LhsEval convertxgOToXgO(const LhsEval &xgO, unsigned regionIdx) NOTHING_OR_CONST
Convert a oil mole fraction in the gas phase the corresponding mass fraction.
Definition BlackOilFluidSystem_macrotemplate.hpp:1639
STATIC_OR_DEVICE LhsEval saturationPressure(const FluidState &fluidState, unsigned phaseIdx, unsigned regionIdx) NOTHING_OR_CONST
Returns the saturation pressure of a given phase [Pa] depending on its composition.
Definition BlackOilFluidSystem_macrotemplate.hpp:1444
STATIC_OR_DEVICE LhsEval saturatedDissolutionFactor(const FluidState &fluidState, unsigned phaseIdx, unsigned regionIdx) NOTHING_OR_CONST
Returns the dissolution factor of a saturated fluid phase.
Definition BlackOilFluidSystem_macrotemplate.hpp:1392
STATIC_OR_DEVICE LhsEval inverseFormationVolumeFactor(const FluidState &fluidState, unsigned phaseIdx, unsigned regionIdx) NOTHING_OR_CONST
Returns the formation volume factor of an "undersaturated" fluid phase.
Definition BlackOilFluidSystem_macrotemplate.hpp:787
STATIC_OR_DEVICE bool enableDiffusion() NOTHING_OR_CONST
Returns whether the fluid system should consider diffusion.
Definition BlackOilFluidSystem_macrotemplate.hpp:520
static constexpr unsigned numComponents
Number of chemical species in the fluid system.
Definition BlackOilFluidSystem_macrotemplate.hpp:412
STATIC_OR_DEVICE bool isCompressible(unsigned) NOTHING_OR_CONST
Returns true if and only if a fluid phase is assumed to be compressible.
Definition BlackOilFluidSystem_macrotemplate.hpp:459
STATIC_OR_DEVICE LhsEval convertXgOToxgO(const LhsEval &XgO, unsigned regionIdx) NOTHING_OR_CONST
Convert a oil mass fraction in the gas phase the corresponding mole fraction.
Definition BlackOilFluidSystem_macrotemplate.hpp:1627
STATIC_OR_DEVICE LhsEval convertxoGToXoG(const LhsEval &xoG, unsigned regionIdx) NOTHING_OR_CONST
Convert a gas mole fraction in the oil phase the corresponding mass fraction.
Definition BlackOilFluidSystem_macrotemplate.hpp:1615
STATIC_OR_DEVICE Scalar referenceDensity(unsigned phaseIdx, unsigned regionIdx) NOTHING_OR_CONST
Returns the density of a fluid phase at surface pressure [kg/m^3].
Definition BlackOilFluidSystem_macrotemplate.hpp:536
STATIC_OR_DEVICE LhsEval convertXwGToxwG(const LhsEval &XwG, unsigned regionIdx) NOTHING_OR_CONST
Convert a gas mass fraction in the water phase the corresponding mole fraction.
Definition BlackOilFluidSystem_macrotemplate.hpp:1591
STATIC_OR_DEVICE void setEnableDiffusion(bool yesno)
Specify whether the fluid system should consider diffusion.
Definition BlackOilFluidSystem_macrotemplate.hpp:314
STATIC_OR_DEVICE void setOilPvt(std::shared_ptr< OilPvt > pvtObj)
Set the pressure-volume-saturation (PVT) relations for the oil phase.
Definition BlackOilFluidSystem_macrotemplate.hpp:334
STATIC_OR_DEVICE std::size_t numRegions() NOTHING_OR_CONST
Returns the number of PVT regions which are considered.
Definition BlackOilFluidSystem_macrotemplate.hpp:475
STATIC_OR_NOTHING std::string_view phaseName(unsigned phaseIdx) NOTHING_OR_CONST
Return the human readable name of a fluid phase.
Definition BlackOilFluidSystem_macrotemplate.hpp:1875
STATIC_OR_DEVICE const PhaseUsageInfo< IndexTraits > & phaseUsage() NOTHING_OR_CONST
Returns a const reference to PhaseUsageInfo.
Definition BlackOilFluidSystem_macrotemplate.hpp:424
STATIC_OR_DEVICE bool enableDissolvedGasInWater() NOTHING_OR_CONST
Returns whether the fluid system should consider that the gas component can dissolve in the water pha...
Definition BlackOilFluidSystem_macrotemplate.hpp:494
STATIC_OR_DEVICE LhsEval bubblePointPressure(const FluidState &fluidState, unsigned regionIdx) NOTHING_OR_CONST
Returns the bubble point pressure $P_b$ using the current Rs.
Definition BlackOilFluidSystem_macrotemplate.hpp:1416
STATIC_OR_DEVICE LhsEval density(const FluidState &fluidState, const ParameterCache< ParamCacheEval > ¶mCache, unsigned phaseIdx) NOTHING_OR_CONST
Calculate the density [kg/m^3] of a fluid phase.
Definition BlackOilFluidSystem_macrotemplate.hpp:544
STATIC_OR_DEVICE const GasPvt & gasPvt() NOTHING_OR_CONST
Return a reference to the low-level object which calculates the gas phase quantities.
Definition BlackOilFluidSystem_macrotemplate.hpp:1654
static constexpr unsigned numPhases
Number of fluid phases in the fluid system.
Definition BlackOilFluidSystem_macrotemplate.hpp:382
STATIC_OR_DEVICE LhsEval viscosity(const FluidState &fluidState, unsigned phaseIdx, unsigned regionIdx) NOTHING_OR_CONST
Calculate the dynamic viscosity of a fluid phase [Pa*s].
Definition BlackOilFluidSystem_macrotemplate.hpp:1049
STATIC_OR_DEVICE unsigned solventComponentIndex(unsigned phaseIdx) NOTHING_OR_CONST
returns the index of "primary" component of a phase (solvent)
Definition BlackOilFluidSystem_macrotemplate.hpp:1892
static constexpr unsigned waterPhaseIdx
Index of the water phase.
Definition BlackOilFluidSystem_macrotemplate.hpp:385
static constexpr int gasCompIdx
Index of the gas component.
Definition BlackOilFluidSystem_macrotemplate.hpp:419
STATIC_OR_DEVICE bool enableDissolvedGas() NOTHING_OR_CONST
Returns whether the fluid system should consider that the gas component can dissolve in the oil phase...
Definition BlackOilFluidSystem_macrotemplate.hpp:484
STATIC_OR_DEVICE void setReservoirTemperature(Scalar value) NOTHING_OR_CONST
Return the temperature of the reservoir.
Definition BlackOilFluidSystem_macrotemplate.hpp:1690
STATIC_OR_DEVICE unsigned soluteComponentIndex(unsigned phaseIdx) NOTHING_OR_CONST
returns the index of "secondary" component of a phase (solute)
Definition BlackOilFluidSystem_macrotemplate.hpp:1909
static constexpr unsigned oilPhaseIdx
Index of the oil phase.
Definition BlackOilFluidSystem_macrotemplate.hpp:387
STATIC_OR_DEVICE LhsEval enthalpy(const FluidState &fluidState, unsigned phaseIdx, unsigned regionIdx) NOTHING_OR_CONST
Given a phase's composition, temperature, pressure and density, calculate its specific enthalpy [J/kg...
Definition BlackOilFluidSystem_macrotemplate.hpp:1314
STATIC_OR_NOTHING std::string_view componentName(unsigned compIdx) NOTHING_OR_CONST
Return the human readable name of a component.
Definition BlackOilFluidSystem_macrotemplate.hpp:1931
STATIC_OR_DEVICE const WaterPvt & waterPvt() NOTHING_OR_CONST
Return a reference to the low-level object which calculates the water phase quantities.
Definition BlackOilFluidSystem_macrotemplate.hpp:1674
STATIC_OR_NOTHING Scalar surfaceTemperature
The temperature at the surface.
Definition BlackOilFluidSystem_macrotemplate.hpp:395
STATIC_OR_DEVICE bool isIdealGas(unsigned) NOTHING_OR_CONST
Returns true if and only if a fluid phase is assumed to be an ideal gas.
Definition BlackOilFluidSystem_macrotemplate.hpp:463
STATIC_OR_DEVICE LhsEval convertRsToXoG(const LhsEval &Rs, unsigned regionIdx) NOTHING_OR_CONST
Convert a gas dissolution factor to the the corresponding mass fraction of the gas component in the o...
Definition BlackOilFluidSystem_macrotemplate.hpp:1524
STATIC_OR_DEVICE void setGasPvt(std::shared_ptr< GasPvt > pvtObj)
Set the pressure-volume-saturation (PVT) relations for the gas phase.
Definition BlackOilFluidSystem_macrotemplate.hpp:328
STATIC_OR_DEVICE void setEnableDissolvedGasInWater(bool yesno)
Specify whether the fluid system should consider that the gas component can dissolve in the water pha...
Definition BlackOilFluidSystem_macrotemplate.hpp:307
STATIC_OR_DEVICE void setReferenceDensities(Scalar rhoOil, Scalar rhoWater, Scalar rhoGas, unsigned regionIdx)
Initialize the values of the reference densities.
Definition BlackOilFluidSystem_macrotemplate.hpp:1834
STATIC_OR_DEVICE bool enableVaporizedWater() NOTHING_OR_CONST
Returns whether the fluid system should consider that the water component can dissolve in the gas pha...
Definition BlackOilFluidSystem_macrotemplate.hpp:512
STATIC_OR_DEVICE LhsEval diffusionCoefficient(const FluidState &fluidState, const ParameterCache< ParamCacheEval > ¶mCache, unsigned phaseIdx, unsigned compIdx) NOTHING_OR_CONST
Calculate the binary molecular diffusion coefficient for a component in a fluid phase [mol^2 * s / (k...
Definition BlackOilFluidSystem_macrotemplate.hpp:1717
STATIC_OR_DEVICE LhsEval convertRswToXwG(const LhsEval &Rsw, unsigned regionIdx) NOTHING_OR_CONST
Convert a gas dissolution factor to the the corresponding mass fraction of the gas component in the w...
Definition BlackOilFluidSystem_macrotemplate.hpp:1538
STATIC_OR_DEVICE Scalar molarMass(unsigned compIdx, unsigned regionIdx=0) NOTHING_OR_CONST
Return the molar mass of a component in [kg/mol].
Definition BlackOilFluidSystem_macrotemplate.hpp:447
STATIC_OR_NOTHING Scalar surfacePressure
The pressure at the surface.
Definition BlackOilFluidSystem_macrotemplate.hpp:392
STATIC_OR_DEVICE void setDiffusionCoefficient(Scalar coefficient, unsigned compIdx, unsigned phaseIdx, unsigned regionIdx=0) NOTHING_OR_CONST
Definition BlackOilFluidSystem_macrotemplate.hpp:1710
STATIC_OR_DEVICE void setEnableDissolvedGas(bool yesno)
Specify whether the fluid system should consider that the gas component can dissolve in the oil phase...
Definition BlackOilFluidSystem_macrotemplate.hpp:280
STATIC_OR_DEVICE bool isLiquid(unsigned phaseIdx) NOTHING_OR_CONST
Return whether a phase is liquid.
Definition BlackOilFluidSystem_macrotemplate.hpp:401
STATIC_OR_DEVICE LhsEval saturatedInverseFormationVolumeFactor(const FluidState &fluidState, unsigned phaseIdx, unsigned regionIdx) NOTHING_OR_CONST
Returns the formation volume factor of a "saturated" fluid phase.
Definition BlackOilFluidSystem_macrotemplate.hpp:905
STATIC_OR_DEVICE LhsEval convertXwGToRsw(const LhsEval &XwG, unsigned regionIdx) NOTHING_OR_CONST
Convert the mass fraction of the gas component in the water phase to the corresponding gas dissolutio...
Definition BlackOilFluidSystem_macrotemplate.hpp:1484
STATIC_OR_DEVICE LhsEval fugacityCoefficient(const FluidState &fluidState, const ParameterCache< ParamCacheEval > ¶mCache, unsigned phaseIdx, unsigned compIdx) NOTHING_OR_CONST
Calculate the fugacity coefficient [Pa] of an individual component in a fluid phase.
Definition BlackOilFluidSystem_macrotemplate.hpp:551
static constexpr int waterCompIdx
Index of the water component.
Definition BlackOilFluidSystem_macrotemplate.hpp:417
This class represents the Pressure-Volume-Temperature relations of the gas phase in the black-oil mod...
Definition GasPvtMultiplexer.hpp:111
Null object for oil PVT calculations.
Definition NullOilPvt.hpp:33
A parameter cache which does nothing.
Definition NullParameterCache.hpp:40
This class represents the Pressure-Volume-Temperature relations of the oil phase in the black-oil mod...
Definition OilPvtMultiplexer.hpp:105
Definition PhaseUsageInfo.hpp:42
Definition Runspec.hpp:46
Definition Schedule.hpp:101
This class represents the Pressure-Volume-Temperature relations of the water phase in the black-oil m...
Definition WaterPvtMultiplexer.hpp:90
Convience header to include the gpuistl headers if HAVE_CUDA is defined.
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30