Accommodate for implemnetation of generic cubic EOS

Which EOS formulation to use is set in the deck and passed to the flash solver and parameter cache
This commit is contained in:
Svenn Tveit
2025-01-15 12:50:07 +01:00
parent 635d7d77dd
commit 96ccc8cb96
3 changed files with 20 additions and 4 deletions

View File

@@ -30,6 +30,8 @@
#include <opm/common/Exceptions.hpp>
#include <opm/input/eclipse/EclipseState/Compositional/CompositionalConfig.hpp>
#include <opm/material/components/SimpleCO2.hpp>
#include <opm/material/components/C10.hpp>
#include <opm/material/components/C1.hpp>
@@ -249,6 +251,11 @@ public:
return gravity_;
}
Opm::CompositionalConfig::EOSType getEosType() const
{
return Opm::CompositionalConfig::EOSType::PR;
}
/*!
* \copydoc FvBaseProblem::finishInit
*/

View File

@@ -178,7 +178,8 @@ public:
const int spatialIdx = elemCtx.globalSpaceIndex(dofIdx, timeIdx);
std::cout << " updating the intensive quantities for Cell " << spatialIdx << std::endl;
}
FlashSolver::solve(fluidState_, flashTwoPhaseMethod, flashTolerance, flashVerbosity);
const auto& eos_type = problem.getEosType();
FlashSolver::solve(fluidState_, flashTwoPhaseMethod, flashTolerance, eos_type, flashVerbosity);
if (flashVerbosity >= 5) {
// printing of flash result after solve
@@ -203,7 +204,7 @@ public:
// Update phases
typename FluidSystem::template ParameterCache<Evaluation> paramCache;
typename FluidSystem::template ParameterCache<Evaluation> paramCache(eos_type);
paramCache.updatePhase(fluidState_, FluidSystem::oilPhaseIdx);
const Scalar R = Opm::Constants<Scalar>::R;

View File

@@ -39,6 +39,7 @@
#include <opm/material/thermal/EclThermalLawManager.hpp>
#include <opm/input/eclipse/EclipseState/Compositional/CompositionalConfig.hpp>
#include <algorithm>
#include <functional>
@@ -103,7 +104,13 @@ public:
// tighter tolerance is needed for compositional modeling here
Parameters::SetDefault<Parameters::NewtonTolerance<Scalar>>(1e-7);
}
Opm::CompositionalConfig::EOSType getEosType() const
{
auto& simulator = this->simulator();
const auto& eclState = simulator.vanguard().eclState();
return eclState.compositionalConfig().eosType(0);
}
/*!
* \copydoc Doxygen::defaultProblemConstructor
@@ -344,7 +351,8 @@ public:
}
{
typename FluidSystem::template ParameterCache<Scalar> paramCache;
const auto& eos_type = getEosType();
typename FluidSystem::template ParameterCache<Scalar> paramCache(eos_type);
paramCache.updatePhase(fs, FluidSystem::oilPhaseIdx);
paramCache.updatePhase(fs, FluidSystem::gasPhaseIdx);
fs.setDensity(FluidSystem::oilPhaseIdx, FluidSystem::density(fs, paramCache, FluidSystem::oilPhaseIdx));