mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-12-01 21:39:09 -06:00
Merge pull request #5114 from totto82/addMassCo2Output
Add co2 mass in place summary vectors
This commit is contained in:
commit
3cb254f3ae
@ -115,6 +115,21 @@ std::string EclString(const Opm::Inplace::Phase phase)
|
||||
case Opm::Inplace::Phase::WaterInWaterPhase:
|
||||
return "WIPL";
|
||||
|
||||
case Opm::Inplace::Phase::CO2Mass:
|
||||
return "GMIP";
|
||||
|
||||
case Opm::Inplace::Phase::CO2MassInWaterPhase:
|
||||
return "GMGP";
|
||||
|
||||
case Opm::Inplace::Phase::CO2MassInGasPhase:
|
||||
return "GMDS";
|
||||
|
||||
case Opm::Inplace::Phase::CO2MassInGasPhaseInMob:
|
||||
return "GMTR";
|
||||
|
||||
case Opm::Inplace::Phase::CO2MassInGasPhaseMob:
|
||||
return "GMMO";
|
||||
|
||||
default:
|
||||
throw std::logic_error {
|
||||
fmt::format("Phase enum with integer value: "
|
||||
|
@ -1315,20 +1315,21 @@ private:
|
||||
|
||||
if (FluidSystem::phaseIsActive(gasPhaseIdx) &&
|
||||
(!this->fip_[Inplace::Phase::CO2InGasPhaseInMob].empty() ||
|
||||
!this->fip_[Inplace::Phase::CO2InGasPhaseMob].empty()))
|
||||
!this->fip_[Inplace::Phase::CO2InGasPhaseMob].empty() ||
|
||||
!this->fip_[Inplace::Phase::CO2MassInGasPhaseInMob].empty() ||
|
||||
!this->fip_[Inplace::Phase::CO2MassInGasPhaseMob].empty() ||
|
||||
!this->fip_[Inplace::Phase::CO2Mass].empty()))
|
||||
{
|
||||
this->updateCO2InGas(globalDofIdx, pv, fs);
|
||||
}
|
||||
|
||||
if (!this->fip_[Inplace::Phase::CO2InWaterPhase].empty() &&
|
||||
|
||||
if ((!this->fip_[Inplace::Phase::CO2InWaterPhase].empty() ||
|
||||
!this->fip_[Inplace::Phase::CO2MassInWaterPhase].empty() ||
|
||||
!this->fip_[Inplace::Phase::CO2Mass].empty()) &&
|
||||
(FluidSystem::phaseIsActive(waterPhaseIdx) ||
|
||||
FluidSystem::phaseIsActive(oilPhaseIdx)))
|
||||
{
|
||||
const auto co2InWater = FluidSystem::phaseIsActive(oilPhaseIdx)
|
||||
? this->co2InWaterFromOil(fs, pv)
|
||||
: this->co2InWaterFromWater(fs, pv);
|
||||
|
||||
this->fip_[Inplace::Phase::CO2InWaterPhase][globalDofIdx] = co2InWater;
|
||||
this->updateCO2InWater(globalDofIdx, pv, fs);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1480,16 +1481,51 @@ private:
|
||||
: FluidSystem::convertRvToXgO(getValue(fs.Rv()), fs.pvtRegionIndex());
|
||||
|
||||
const Scalar mM = FluidSystem::molarMass(gasCompIdx, fs.pvtRegionIndex());
|
||||
const Scalar massGas = (1 - xgW) * pv * rhog;
|
||||
if (!this->fip_[Inplace::Phase::CO2Mass].empty()) {
|
||||
this->fip_[Inplace::Phase::CO2Mass][globalDofIdx] = massGas;
|
||||
}
|
||||
|
||||
if (!this->fip_[Inplace::Phase::CO2InGasPhaseInMob].empty()) {
|
||||
const Scalar imMobileGas = (1 - xgW) * pv * rhog / mM * std::min(sgcr , sg);
|
||||
const Scalar imMobileGas = massGas / mM * std::min(sgcr , sg);
|
||||
this->fip_[Inplace::Phase::CO2InGasPhaseInMob][globalDofIdx] = imMobileGas;
|
||||
}
|
||||
|
||||
if (!this->fip_[Inplace::Phase::CO2InGasPhaseMob].empty()) {
|
||||
const Scalar mobileGas = (1 - xgW) * pv * rhog / mM * std::max(0.0, sg - sgcr);
|
||||
const Scalar mobileGas = massGas / mM * std::max(0.0, sg - sgcr);
|
||||
this->fip_[Inplace::Phase::CO2InGasPhaseMob][globalDofIdx] = mobileGas;
|
||||
}
|
||||
|
||||
if (!this->fip_[Inplace::Phase::CO2MassInGasPhaseInMob].empty()) {
|
||||
const Scalar imMobileMassGas = massGas * std::min(sgcr , sg);
|
||||
this->fip_[Inplace::Phase::CO2MassInGasPhaseInMob][globalDofIdx] = imMobileMassGas;
|
||||
}
|
||||
|
||||
if (!this->fip_[Inplace::Phase::CO2MassInGasPhaseMob].empty()) {
|
||||
const Scalar mobileMassGas = massGas * std::max(0.0, sg - sgcr);
|
||||
this->fip_[Inplace::Phase::CO2MassInGasPhaseMob][globalDofIdx] = mobileMassGas;
|
||||
}
|
||||
}
|
||||
|
||||
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>
|
||||
|
@ -966,6 +966,11 @@ fipUnitConvert_(std::unordered_map<Inplace::Phase, Scalar>& fip) const
|
||||
{Inplace::Phase::CO2InGasPhaseMob, M::moles},
|
||||
{Inplace::Phase::WaterInWaterPhase, M::liquid_surface_volume},
|
||||
{Inplace::Phase::WaterInGasPhase, M::liquid_surface_volume},
|
||||
{Inplace::Phase::CO2Mass, M::mass},
|
||||
{Inplace::Phase::CO2MassInWaterPhase, M::mass},
|
||||
{Inplace::Phase::CO2MassInGasPhase, M::mass},
|
||||
{Inplace::Phase::CO2MassInGasPhaseInMob,M::mass},
|
||||
{Inplace::Phase::CO2MassInGasPhaseMob, M::mass},
|
||||
};
|
||||
|
||||
for (auto& [phase, value] : fip) {
|
||||
|
@ -257,14 +257,15 @@ BOOST_AUTO_TEST_CASE(Fip)
|
||||
Opm::LogOutputHelper<double> helper(eclState, schedule, st);
|
||||
Opm::Inplace initial, current;
|
||||
const auto& phases = current.phases();
|
||||
int offset = 17;
|
||||
double j = 1.0;
|
||||
for (const auto& phase : phases) {
|
||||
initial.add(phase, j);
|
||||
initial.add("FIPNUM", phase, 0, j + 2*phases.size());
|
||||
initial.add("FIPNUM", phase, 1, j + 2*phases.size());
|
||||
current.add(phase, j + phases.size());
|
||||
current.add("FIPNUM", phase, 0, j + 3*phases.size());
|
||||
current.add("FIPNUM", phase, 1, j + 3*phases.size());
|
||||
initial.add("FIPNUM", phase, 0, j + 2*offset);
|
||||
initial.add("FIPNUM", phase, 1, j + 2*offset);
|
||||
current.add(phase, j + offset);
|
||||
current.add("FIPNUM", phase, 0, j + 3*offset);
|
||||
current.add("FIPNUM", phase, 1, j + 3*offset);
|
||||
++j;
|
||||
}
|
||||
|
||||
@ -323,10 +324,11 @@ BOOST_AUTO_TEST_CASE(FipResv)
|
||||
Opm::LogOutputHelper<double> helper(eclState, schedule, st);
|
||||
Opm::Inplace current;
|
||||
const auto& phases = current.phases();
|
||||
int offset = 17;
|
||||
double j = 1.0;
|
||||
for (const auto& phase : phases) {
|
||||
current.add(phase, phases.size());
|
||||
current.add("FIPNUM", phase, 1, j + phases.size());
|
||||
current.add(phase, offset);
|
||||
current.add("FIPNUM", phase, 1, j + offset);
|
||||
++j;
|
||||
}
|
||||
|
||||
@ -334,7 +336,7 @@ BOOST_AUTO_TEST_CASE(FipResv)
|
||||
current.add(Opm::Inplace::Phase::OilResVolume, 2.0);
|
||||
current.add(Opm::Inplace::Phase::WaterResVolume, 3.0);
|
||||
current.add(Opm::Inplace::Phase::GasResVolume, 4.0);
|
||||
current.add("FIPNUM", Opm::Inplace::Phase::DynamicPoreVolume, 1, 11.0 + phases.size());
|
||||
current.add("FIPNUM", Opm::Inplace::Phase::DynamicPoreVolume, 1, 11.0 + offset);
|
||||
|
||||
helper.fipResv(current, "FIPNUM");
|
||||
BOOST_CHECK_EQUAL(str.str(), reference);
|
||||
|
Loading…
Reference in New Issue
Block a user