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; };
template<class TypeTag>
struct EnableDispersion<TypeTag, TTag::FlowProblem>
struct EnableDispersion<TypeTag, TTag::FlowProblem>
{ static constexpr bool value = false; };
template<class TypeTag>
struct EnableConvectiveMixing<TypeTag, TTag::FlowProblem>
struct EnableConvectiveMixing<TypeTag, TTag::FlowProblem>
{ static constexpr bool value = true; };
template<class TypeTag>

View File

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

View File

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

View File

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