add the PVT region index as a parameter for getInvB_()
this is only relevant for the generic-fluidstate version. In most cases, 0 should be passed as the PVT region index.
This commit is contained in:
@@ -55,24 +55,24 @@ OPM_GENERATE_HAS_MEMBER(invB, ) // Creates 'HasMember_invB<T>'.
|
||||
template <class FluidState, class FluidSystem, class LhsEval>
|
||||
LhsEval getInvB_(typename std::enable_if<HasMember_invB<FluidState>::value,
|
||||
const FluidState&>::type fluidState,
|
||||
unsigned phaseIdx)
|
||||
unsigned phaseIdx,
|
||||
unsigned pvtRegionIdx OPM_UNUSED)
|
||||
{ return Opm::decay<LhsEval>(fluidState.invB(phaseIdx)); }
|
||||
|
||||
template <class FluidState, class FluidSystem, class LhsEval>
|
||||
LhsEval getInvB_(typename std::enable_if<!HasMember_invB<FluidState>::value,
|
||||
const FluidState&>::type fluidState,
|
||||
unsigned phaseIdx)
|
||||
unsigned phaseIdx,
|
||||
unsigned pvtRegionIdx)
|
||||
{
|
||||
const auto& rho = fluidState.density(phaseIdx);
|
||||
const auto& Xsolvent =
|
||||
fluidState.massFraction(phaseIdx, FluidSystem::solventComponentIndex(phaseIdx));
|
||||
|
||||
unsigned pvtRegionIdx = getPvtRegionIndex_(fluidState);
|
||||
return
|
||||
Opm::decay<LhsEval>(rho)
|
||||
*Opm::decay<LhsEval>(Xsolvent)
|
||||
/FluidSystem::referenceDensity(phaseIdx, pvtRegionIdx);
|
||||
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -142,9 +142,10 @@ public:
|
||||
if (enableTemperature || enableEnergy)
|
||||
setTemperature(fs.temperature(/*phaseIdx=*/0));
|
||||
|
||||
setPvtRegionIndex(getPvtRegionIndex_<FluidState>(fs));
|
||||
setRs(Opm::BlackOil::getRs_<FluidSystem, Scalar, FluidState>(fs, /*regionIdx=*/0));
|
||||
setRv(Opm::BlackOil::getRv_<FluidSystem, Scalar, FluidState>(fs, /*regionIdx=*/0));
|
||||
unsigned pvtRegionIdx = getPvtRegionIndex_<FluidState>(fs);
|
||||
setPvtRegionIndex(pvtRegionIdx);
|
||||
setRs(Opm::BlackOil::getRs_<FluidSystem, Scalar, FluidState>(fs, pvtRegionIdx));
|
||||
setRv(Opm::BlackOil::getRv_<FluidSystem, Scalar, FluidState>(fs, pvtRegionIdx));
|
||||
|
||||
for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
|
||||
setSaturation(phaseIdx, fs.saturation(phaseIdx));
|
||||
@@ -154,7 +155,7 @@ public:
|
||||
if (enableEnergy)
|
||||
setEnthalpy(phaseIdx, fs.enthalpy(phaseIdx));
|
||||
|
||||
setInvB(phaseIdx, getInvB_<FluidState, FluidSystem, Scalar>(fs, phaseIdx));
|
||||
setInvB(phaseIdx, getInvB_<FluidState, FluidSystem, Scalar>(fs, phaseIdx, pvtRegionIdx));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user