diff --git a/ebos/ecloutputblackoilmodule.hh b/ebos/ecloutputblackoilmodule.hh index 41402e7ea..c751b582c 100644 --- a/ebos/ecloutputblackoilmodule.hh +++ b/ebos/ecloutputblackoilmodule.hh @@ -1329,20 +1329,7 @@ private: (FluidSystem::phaseIsActive(waterPhaseIdx) || FluidSystem::phaseIsActive(oilPhaseIdx))) { - const auto co2InWater = FluidSystem::phaseIsActive(oilPhaseIdx) - ? this->co2InWaterFromOil(fs, pv) - : this->co2InWaterFromWater(fs, pv); - - const Scalar mM = FluidSystem::molarMass(gasCompIdx, fs.pvtRegionIndex()); - if (!this->fip_[Inplace::Phase::CO2Mass].empty()) { - this->fip_[Inplace::Phase::CO2Mass][globalDofIdx] += co2InWater * mM; - } - if (!this->fip_[Inplace::Phase::CO2MassInWaterPhase].empty()) { - this->fip_[Inplace::Phase::CO2MassInWaterPhase][globalDofIdx] = co2InWater * mM; - } - if (!this->fip_[Inplace::Phase::CO2InWaterPhase].empty()) { - this->fip_[Inplace::Phase::CO2InWaterPhase][globalDofIdx] = co2InWater; - } + this->updateCO2InWater(globalDofIdx, pv, fs); } } @@ -1520,6 +1507,27 @@ private: } } + template + void updateCO2InWater(const unsigned globalDofIdx, + const double pv, + const FluidState& fs) + { + const auto co2InWater = FluidSystem::phaseIsActive(oilPhaseIdx) + ? this->co2InWaterFromOil(fs, pv) + : this->co2InWaterFromWater(fs, pv); + + const Scalar mM = FluidSystem::molarMass(gasCompIdx, fs.pvtRegionIndex()); + if (!this->fip_[Inplace::Phase::CO2Mass].empty()) { + this->fip_[Inplace::Phase::CO2Mass][globalDofIdx] += co2InWater * mM; + } + if (!this->fip_[Inplace::Phase::CO2MassInWaterPhase].empty()) { + this->fip_[Inplace::Phase::CO2MassInWaterPhase][globalDofIdx] = co2InWater * mM; + } + if (!this->fip_[Inplace::Phase::CO2InWaterPhase].empty()) { + this->fip_[Inplace::Phase::CO2InWaterPhase][globalDofIdx] = co2InWater; + } + } + template Scalar co2InWaterFromWater(const FluidState& fs, const double pv) const {