mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
refactor updateCO2InWater
This commit is contained in:
parent
343f1201eb
commit
2fce942a5c
@ -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 <typename FluidState>
|
||||
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 <typename FluidState>
|
||||
Scalar co2InWaterFromWater(const FluidState& fs, const double pv) const
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user