From 96ccc8cb967c26b24ed46fed9151f99bcc9e92bb Mon Sep 17 00:00:00 2001 From: Svenn Tveit Date: Wed, 15 Jan 2025 12:50:07 +0100 Subject: [PATCH 1/3] 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 --- examples/problems/co2ptflashproblem.hh | 7 +++++++ opm/models/ptflash/flashintensivequantities.hh | 5 +++-- opm/simulators/flow/FlowProblemComp.hpp | 12 ++++++++++-- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/examples/problems/co2ptflashproblem.hh b/examples/problems/co2ptflashproblem.hh index 59fc620cd..789e2c40a 100644 --- a/examples/problems/co2ptflashproblem.hh +++ b/examples/problems/co2ptflashproblem.hh @@ -30,6 +30,8 @@ #include +#include + #include #include #include @@ -249,6 +251,11 @@ public: return gravity_; } + Opm::CompositionalConfig::EOSType getEosType() const + { + return Opm::CompositionalConfig::EOSType::PR; + } + /*! * \copydoc FvBaseProblem::finishInit */ diff --git a/opm/models/ptflash/flashintensivequantities.hh b/opm/models/ptflash/flashintensivequantities.hh index 08686075b..868844876 100644 --- a/opm/models/ptflash/flashintensivequantities.hh +++ b/opm/models/ptflash/flashintensivequantities.hh @@ -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 paramCache; + typename FluidSystem::template ParameterCache paramCache(eos_type); paramCache.updatePhase(fluidState_, FluidSystem::oilPhaseIdx); const Scalar R = Opm::Constants::R; diff --git a/opm/simulators/flow/FlowProblemComp.hpp b/opm/simulators/flow/FlowProblemComp.hpp index 520879739..535f4b69a 100644 --- a/opm/simulators/flow/FlowProblemComp.hpp +++ b/opm/simulators/flow/FlowProblemComp.hpp @@ -39,6 +39,7 @@ #include +#include #include #include @@ -103,7 +104,13 @@ public: // tighter tolerance is needed for compositional modeling here Parameters::SetDefault>(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 paramCache; + const auto& eos_type = getEosType(); + typename FluidSystem::template ParameterCache paramCache(eos_type); paramCache.updatePhase(fs, FluidSystem::oilPhaseIdx); paramCache.updatePhase(fs, FluidSystem::gasPhaseIdx); fs.setDensity(FluidSystem::oilPhaseIdx, FluidSystem::density(fs, paramCache, FluidSystem::oilPhaseIdx)); From db18a9b4ea891f206e25aa5697d63191933dacf5 Mon Sep 17 00:00:00 2001 From: Svenn Tveit Date: Thu, 16 Jan 2025 13:49:45 +0100 Subject: [PATCH 2/3] Fix whitespace after rebase --- opm/simulators/flow/FlowProblemComp.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opm/simulators/flow/FlowProblemComp.hpp b/opm/simulators/flow/FlowProblemComp.hpp index 535f4b69a..e5c6e1a88 100644 --- a/opm/simulators/flow/FlowProblemComp.hpp +++ b/opm/simulators/flow/FlowProblemComp.hpp @@ -351,7 +351,7 @@ public: } { - const auto& eos_type = getEosType(); + const auto& eos_type = getEosType(); typename FluidSystem::template ParameterCache paramCache(eos_type); paramCache.updatePhase(fs, FluidSystem::oilPhaseIdx); paramCache.updatePhase(fs, FluidSystem::gasPhaseIdx); From b0dcf0feb3ed4831f1957fedcbd7e0a721fc432f Mon Sep 17 00:00:00 2001 From: Svenn Tveit Date: Mon, 20 Jan 2025 14:57:24 +0100 Subject: [PATCH 3/3] Fix indentation --- opm/simulators/flow/FlowProblemComp.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opm/simulators/flow/FlowProblemComp.hpp b/opm/simulators/flow/FlowProblemComp.hpp index e5c6e1a88..be6a2616b 100644 --- a/opm/simulators/flow/FlowProblemComp.hpp +++ b/opm/simulators/flow/FlowProblemComp.hpp @@ -351,7 +351,7 @@ public: } { - const auto& eos_type = getEosType(); + const auto& eos_type = getEosType(); typename FluidSystem::template ParameterCache paramCache(eos_type); paramCache.updatePhase(fs, FluidSystem::oilPhaseIdx); paramCache.updatePhase(fs, FluidSystem::gasPhaseIdx);