Add output of GMST/GMUS

Rename GMTR to GMMO as ending with TR are used for tracers
[FR]GMTR output maximum trapped CO2 in the gas phase
This commit is contained in:
Tor Harald Sandve 2024-05-06 08:49:38 +02:00
parent 633728b590
commit b42a8cbcc3
3 changed files with 70 additions and 7 deletions

View File

@ -128,10 +128,10 @@ std::string EclString(const Opm::Inplace::Phase phase)
return "GMDS";
case Opm::Inplace::Phase::CO2MassInGasPhaseInMob:
return "GMTR";
return "GCDI_KG"; //Not used
case Opm::Inplace::Phase::CO2MassInGasPhaseMob:
return "GMMO";
return "GKDM_KG"; //Not used
case Opm::Inplace::Phase::CO2MassInGasPhaseInMobKrg:
return "GKTR";
@ -139,6 +139,18 @@ std::string EclString(const Opm::Inplace::Phase phase)
case Opm::Inplace::Phase::CO2MassInGasPhaseMobKrg:
return "GKMO";
case Opm::Inplace::Phase::CO2MassInGasPhaseMaximumTrapped:
return "GMIM";
case Opm::Inplace::Phase::CO2MassInGasPhaseMaximumUnTrapped:
return "GMMO";
case Opm::Inplace::Phase::CO2MassInGasPhaseEffectiveTrapped:
return "GMST";
case Opm::Inplace::Phase::CO2MassInGasPhaseEffectiveUnTrapped:
return "GMUS";
default:
throw std::logic_error {
fmt::format("Phase enum with integer value: "

View File

@ -975,6 +975,11 @@ fipUnitConvert_(std::unordered_map<Inplace::Phase, Scalar>& fip) const
{Inplace::Phase::CO2MassInGasPhaseMob, M::mass},
{Inplace::Phase::CO2MassInGasPhaseInMobKrg, M::mass},
{Inplace::Phase::CO2MassInGasPhaseMobKrg, M::mass},
{Inplace::Phase::CO2MassInGasPhaseEffectiveTrapped, M::mass},
{Inplace::Phase::CO2MassInGasPhaseEffectiveUnTrapped, M::mass},
{Inplace::Phase::CO2MassInGasPhaseMaximumTrapped, M::mass},
{Inplace::Phase::CO2MassInGasPhaseMaximumUnTrapped, M::mass},
};
for (auto& [phase, value] : fip) {

View File

@ -1442,12 +1442,17 @@ private:
!this->fip_[Inplace::Phase::CO2MassInGasPhaseInMob].empty() ||
!this->fip_[Inplace::Phase::CO2MassInGasPhaseMob].empty() ||
!this->fip_[Inplace::Phase::CO2Mass].empty() ||
!this->fip_[Inplace::Phase::CO2MassInGasPhase].empty() ||
!this->fip_[Inplace::Phase::CO2InGasPhaseInMobKrg].empty() ||
!this->fip_[Inplace::Phase::CO2InGasPhaseMobKrg].empty() ||
!this->fip_[Inplace::Phase::CO2MassInGasPhaseInMobKrg].empty() ||
!this->fip_[Inplace::Phase::CO2MassInGasPhaseMobKrg].empty()))
!this->fip_[Inplace::Phase::CO2MassInGasPhaseMobKrg].empty() ||
!this->fip_[Inplace::Phase::CO2MassInGasPhaseEffectiveTrapped].empty() ||
!this->fip_[Inplace::Phase::CO2MassInGasPhaseEffectiveUnTrapped].empty() ||
!this->fip_[Inplace::Phase::CO2MassInGasPhaseMaximumTrapped].empty() ||
!this->fip_[Inplace::Phase::CO2MassInGasPhaseMaximumUnTrapped].empty()))
{
this->updateCO2InGas(globalDofIdx, pv, fs);
this->updateCO2InGas(globalDofIdx, pv, intQuants);
}
if ((!this->fip_[Inplace::Phase::CO2InWaterPhase].empty() ||
@ -1587,18 +1592,19 @@ private:
}
}
template <typename FluidState>
template <typename IntensiveQuantities>
void updateCO2InGas(const unsigned globalDofIdx,
const double pv,
const FluidState& fs)
const IntensiveQuantities& intQuants)
{
const auto& scaledDrainageInfo = this->simulator_.problem().materialLawManager()
->oilWaterScaledEpsInfoDrainage(globalDofIdx);
const auto& fs = intQuants.fluidState();
Scalar sgcr = scaledDrainageInfo.Sgcr;
if (this->simulator_.problem().materialLawManager()->enableHysteresis()) {
const auto& matParams = simulator_.problem().materialLawParams(globalDofIdx);
sgcr = MaterialLaw::trappedGasSaturation(matParams);
sgcr = MaterialLaw::trappedGasSaturation(matParams, /*maximumTrapping*/false);
}
const double sg = getValue(fs.saturation(gasPhaseIdx));
@ -1613,6 +1619,10 @@ private:
this->fip_[Inplace::Phase::CO2Mass][globalDofIdx] = massGas * sg;
}
if (!this->fip_[Inplace::Phase::CO2MassInGasPhase].empty()) {
this->fip_[Inplace::Phase::CO2MassInGasPhase][globalDofIdx] = massGas * sg;
}
if (!this->fip_[Inplace::Phase::CO2InGasPhaseInMob].empty()) {
const Scalar imMobileGas = massGas / mM * std::min(sgcr , sg);
this->fip_[Inplace::Phase::CO2InGasPhaseInMob][globalDofIdx] = imMobileGas;
@ -1668,6 +1678,42 @@ private:
this->fip_[Inplace::Phase::CO2MassInGasPhaseMobKrg][globalDofIdx] = 0;
}
}
if (!this->fip_[Inplace::Phase::CO2MassInGasPhaseMaximumTrapped].empty() ||
!this->fip_[Inplace::Phase::CO2MassInGasPhaseMaximumUnTrapped].empty() ) {
Scalar trappedGasSaturation = scaledDrainageInfo.Sgcr;
if (this->simulator_.problem().materialLawManager()->enableHysteresis()) {
const auto& matParams = simulator_.problem().materialLawParams(globalDofIdx);
// Get the maximum trapped gas saturation
trappedGasSaturation = MaterialLaw::trappedGasSaturation(matParams, /*maximumTrapping*/true);
}
if (!this->fip_[Inplace::Phase::CO2MassInGasPhaseMaximumTrapped].empty()) {
const Scalar imMobileMassGas = massGas * std::min(trappedGasSaturation , sg);
this->fip_[Inplace::Phase::CO2MassInGasPhaseMaximumTrapped][globalDofIdx] = imMobileMassGas;
}
if (!this->fip_[Inplace::Phase::CO2MassInGasPhaseMaximumUnTrapped].empty()) {
const Scalar mobileMassGas = massGas * std::max(0.0, sg - trappedGasSaturation);
this->fip_[Inplace::Phase::CO2MassInGasPhaseMaximumUnTrapped][globalDofIdx] = mobileMassGas;
}
}
if (!this->fip_[Inplace::Phase::CO2MassInGasPhaseEffectiveTrapped].empty() ||
!this->fip_[Inplace::Phase::CO2MassInGasPhaseEffectiveUnTrapped].empty()) {
Scalar trappedGasSaturation = scaledDrainageInfo.Sgcr;
if (this->simulator_.problem().materialLawManager()->enableHysteresis()) {
const auto& matParams = simulator_.problem().materialLawParams(globalDofIdx);
const double krg = getValue(intQuants.relativePermeability(gasPhaseIdx));
trappedGasSaturation = MaterialLaw::strandedGasSaturation(matParams, sg, krg);
}
if (!this->fip_[Inplace::Phase::CO2MassInGasPhaseEffectiveTrapped].empty()) {
const Scalar imMobileMassGas = massGas * std::min(trappedGasSaturation , sg);
this->fip_[Inplace::Phase::CO2MassInGasPhaseEffectiveTrapped][globalDofIdx] = imMobileMassGas;
}
if (!this->fip_[Inplace::Phase::CO2MassInGasPhaseEffectiveUnTrapped].empty()) {
const Scalar mobileMassGas = massGas * std::max(0.0, sg - trappedGasSaturation);
this->fip_[Inplace::Phase::CO2MassInGasPhaseEffectiveUnTrapped][globalDofIdx] = mobileMassGas;
}
}
}
template <typename FluidState>