Merge pull request #5886 from svenn-t/general_cubic_eos

Compositional simulations with more cubic EOS formulations
This commit is contained in:
Kai Bao 2025-01-21 10:06:01 +01:00 committed by GitHub
commit c1e65aa044
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
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));