From 72245590f24473c70f72aa6a1492fc597f6410cc Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Fri, 7 Feb 2025 14:19:00 +0100 Subject: [PATCH] move assignment of mass fractions into ExtboContainer --- opm/simulators/flow/ExtboContainer.cpp | 12 ++++++++++++ opm/simulators/flow/ExtboContainer.hpp | 5 +++++ opm/simulators/flow/OutputBlackoilModule.hpp | 9 ++++----- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/opm/simulators/flow/ExtboContainer.cpp b/opm/simulators/flow/ExtboContainer.cpp index 894596322..dbff11bda 100644 --- a/opm/simulators/flow/ExtboContainer.cpp +++ b/opm/simulators/flow/ExtboContainer.cpp @@ -48,6 +48,18 @@ allocate(const unsigned bufferSize) allocated_ = true; } +template +void ExtboContainer:: +assignMassFractions(const unsigned globalDofIdx, + const Scalar gas, + const Scalar oil, + const Scalar co2) +{ + this->mFracGas_[globalDofIdx] = gas; + this->mFracOil_[globalDofIdx] = oil; + this->mFracCo2_[globalDofIdx] = co2; +} + template void ExtboContainer:: assignVolumes(const unsigned globalDofIdx, diff --git a/opm/simulators/flow/ExtboContainer.hpp b/opm/simulators/flow/ExtboContainer.hpp index 73044b74c..19ce826de 100644 --- a/opm/simulators/flow/ExtboContainer.hpp +++ b/opm/simulators/flow/ExtboContainer.hpp @@ -40,6 +40,11 @@ class ExtboContainer public: void allocate(const unsigned bufferSize); + void assignMassFractions(const unsigned globalDofIdx, + const Scalar gas, + const Scalar oil, + const Scalar co2); + void assignVolumes(const unsigned globalDofIdx, const Scalar xVolume, const Scalar yVolume); diff --git a/opm/simulators/flow/OutputBlackoilModule.hpp b/opm/simulators/flow/OutputBlackoilModule.hpp index 39f72aeb2..650cb8f3e 100644 --- a/opm/simulators/flow/OutputBlackoilModule.hpp +++ b/opm/simulators/flow/OutputBlackoilModule.hpp @@ -449,9 +449,7 @@ public: intQuants.yVolume().value()); this->extboC_.assignZFraction(globalDofIdx, intQuants.zFraction().value()); - } - if (!this->extboC_.mFracCo2_.empty()) { const Scalar stdVolOil = getValue(fs.saturation(oilPhaseIdx)) * getValue(fs.invB(oilPhaseIdx)) + getValue(fs.saturation(gasPhaseIdx)) * getValue(fs.invB(gasPhaseIdx)) * getValue(fs.Rv()); const Scalar stdVolGas = getValue(fs.saturation(gasPhaseIdx)) * getValue(fs.invB(gasPhaseIdx)) @@ -466,9 +464,10 @@ public: const Scalar rhoG = FluidSystem::referenceDensity(gasPhaseIdx, pvtRegionIdx); const Scalar rhoCO2 = intQuants.zRefDensity(); const Scalar stdMassTotal = 1.0e-10 + stdVolOil * rhoO + stdVolGas * rhoG + stdVolCo2 * rhoCO2; - this->extboC_.mFracOil_[globalDofIdx] = stdVolOil * rhoO / stdMassTotal; - this->extboC_.mFracGas_[globalDofIdx] = stdVolGas * rhoG / stdMassTotal; - this->extboC_.mFracCo2_[globalDofIdx] = stdVolCo2 * rhoCO2 / stdMassTotal; + this->extboC_.assignMassFractions(globalDofIdx, + stdVolGas * rhoG / stdMassTotal, + stdVolOil * rhoO / stdMassTotal, + stdVolCo2 * rhoCO2 / stdMassTotal); } if (this->micpC_.allocated()) {