Move modification of density to convectiveMixingModule

This commit is contained in:
Tor Harald Sandve 2024-07-30 07:28:53 +02:00
parent f10c44279f
commit 0a63fc8e24
4 changed files with 19 additions and 7 deletions

View File

@ -127,10 +127,11 @@ struct EnableMICP<TypeTag, TTag::FlowProblem>
{ static constexpr bool value = false; }; { static constexpr bool value = false; };
template<class TypeTag> template<class TypeTag>
struct EnableDispersion<TypeTag, TTag::FlowProblem> struct EnableDispersion<TypeTag, TTag::FlowProblem>
{ static constexpr bool value = false; }; { static constexpr bool value = false; };
template<class TypeTag> template<class TypeTag>
struct EnableConvectiveMixing<TypeTag, TTag::FlowProblem> struct EnableConvectiveMixing<TypeTag, TTag::FlowProblem>
{ static constexpr bool value = true; }; { static constexpr bool value = true; };
template<class TypeTag> template<class TypeTag>

View File

@ -2896,7 +2896,7 @@ private:
bool explicitRockCompaction_ = false; bool explicitRockCompaction_ = false;
ModuleParams moduleParams_; ModuleParams moduleParams_;
}; };

View File

@ -203,7 +203,7 @@ template<class TypeTag>
struct EnableConvectiveMixing<TypeTag, TTag::FlowBaseProblem> struct EnableConvectiveMixing<TypeTag, TTag::FlowBaseProblem>
{ static constexpr bool value = true; }; { static constexpr bool value = true; };
// only write the solutions for the report steps to disk // disable API tracking
template<class TypeTag> template<class TypeTag>
struct EnableApiTracking<TypeTag, TTag::FlowBaseProblem> struct EnableApiTracking<TypeTag, TTag::FlowBaseProblem>
{ static constexpr bool value = false; }; { static constexpr bool value = false; };

View File

@ -44,6 +44,7 @@
#include <opm/models/discretization/common/fvbaseproperties.hh> #include <opm/models/discretization/common/fvbaseproperties.hh>
#include <opm/models/blackoil/blackoilproperties.hh> #include <opm/models/blackoil/blackoilproperties.hh>
#include <opm/models/utils/signum.hh> #include <opm/models/utils/signum.hh>
#include <opm/models/blackoil/blackoillocalresidualtpfa.hh>
#include <array> #include <array>
@ -122,11 +123,16 @@ class NewTranExtensiveQuantities
enum { enableExtbo = getPropValue<TypeTag, Properties::EnableExtbo>() }; enum { enableExtbo = getPropValue<TypeTag, Properties::EnableExtbo>() };
enum { enableEnergy = getPropValue<TypeTag, Properties::EnableEnergy>() }; enum { enableEnergy = getPropValue<TypeTag, Properties::EnableEnergy>() };
static constexpr bool enableConvectiveMixing = getPropValue<TypeTag, Properties::EnableConvectiveMixing>();
using Toolbox = MathToolbox<Evaluation>; using Toolbox = MathToolbox<Evaluation>;
using DimVector = Dune::FieldVector<Scalar, dimWorld>; using DimVector = Dune::FieldVector<Scalar, dimWorld>;
using EvalDimVector = Dune::FieldVector<Evaluation, dimWorld>; using EvalDimVector = Dune::FieldVector<Evaluation, dimWorld>;
using DimMatrix = Dune::FieldMatrix<Scalar, dimWorld, dimWorld>; using DimMatrix = Dune::FieldMatrix<Scalar, dimWorld, dimWorld>;
using ConvectiveMixingModule = BlackOilConvectiveMixingModule<TypeTag, enableConvectiveMixing>;
using ModuleParams = typename BlackOilLocalResidualTPFA<TypeTag>::ModuleParams;
public: public:
/*! /*!
* \brief Return the intrinsic permeability tensor at a face [m^2] * \brief Return the intrinsic permeability tensor at a face [m^2]
@ -277,7 +283,8 @@ public:
I, I,
J, J,
distZ*g, distZ*g,
thpres); thpres,
problem.moduleParams());
if (pressureDifferences[phaseIdx] == 0) { if (pressureDifferences[phaseIdx] == 0) {
volumeFlux[phaseIdx] = 0.0; volumeFlux[phaseIdx] = 0.0;
continue; continue;
@ -317,8 +324,8 @@ public:
const unsigned globalIndexIn, const unsigned globalIndexIn,
const unsigned globalIndexEx, const unsigned globalIndexEx,
const Scalar distZg, const Scalar distZg,
const Scalar thpres const Scalar thpres,
) const ModuleParams& moduleParams)
{ {
// check shortcut: if the mobility of the phase is zero in the interior as // check shortcut: if the mobility of the phase is zero in the interior as
@ -338,6 +345,10 @@ public:
Scalar rhoEx = Toolbox::value(intQuantsEx.fluidState().density(phaseIdx)); Scalar rhoEx = Toolbox::value(intQuantsEx.fluidState().density(phaseIdx));
Evaluation rhoAvg = (rhoIn + rhoEx)/2; Evaluation rhoAvg = (rhoIn + rhoEx)/2;
if constexpr(enableConvectiveMixing) {
ConvectiveMixingModule::modifyAvgDensity(rhoAvg, intQuantsIn, intQuantsEx, phaseIdx, moduleParams.convectiveMixingModuleParam);
}
const Evaluation& pressureInterior = intQuantsIn.fluidState().pressure(phaseIdx); const Evaluation& pressureInterior = intQuantsIn.fluidState().pressure(phaseIdx);
Evaluation pressureExterior = Toolbox::value(intQuantsEx.fluidState().pressure(phaseIdx)); Evaluation pressureExterior = Toolbox::value(intQuantsEx.fluidState().pressure(phaseIdx));
if (enableExtbo) // added stability; particulary useful for solvent migrating in pure water if (enableExtbo) // added stability; particulary useful for solvent migrating in pure water