adressed minor comments by reviewer, added enableConvectiveMixing flag to drsdtcon

This commit is contained in:
Trine Mykkeltvedt 2024-06-12 12:23:26 +02:00 committed by Tor Harald Sandve
parent 2b5825e0e5
commit 3d943770a5
6 changed files with 88 additions and 19 deletions

View File

@ -23,7 +23,7 @@
/*!
* \file
*
* \brief Classes required for molecular diffusion.
* \brief Classes required for dynamic convective mixing.
*/
#ifndef EWOMS_CONVECTIVEMIXING_MODULE_HH
#define EWOMS_CONVECTIVEMIXING_MODULE_HH
@ -42,10 +42,70 @@ namespace Opm {
/*!
* \copydoc Opm::BlackOilConvectiveMixingModule
* \brief Provides the requiered methods for dynamic convective mixing.
* \brief Provides the convective term in the transport flux for the brine
* when convective mixing (enhanced dissolution of CO2 in brine) occurs.
* Controlled by the regimes for a controlvolume:
* i) initial phase (CO2 dissolves in brine due to diffusion)
* ii) linear phase (Convective fingers of CO2-rich brine propagate downwards)
* iii) steady-state-phase (fingers have passed through the bottom of a control
* -volume but the larger scale convective process is still active)
* iv) decline phase (Convection ceases at the large-scale when the CO2
* has been completely dissolved)
*/
template <class TypeTag, bool enableConvectiveMixing>
class BlackOilConvectiveMixingModule;
/*!
* \copydoc Opm::BlackOilConvectiveMixingModule
*/
template <class TypeTag>
class BlackOilConvectiveMixingModule
class BlackOilConvectiveMixingModule<TypeTag, /*enableConvectiveMixing=*/false>
{
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>;
using RateVector = GetPropType<TypeTag, Properties::RateVector>;
using Evaluation = GetPropType<TypeTag, Properties::Evaluation>;
using Indices = GetPropType<TypeTag, Properties::Indices>;
using IntensiveQuantities = GetPropType<TypeTag, Properties::IntensiveQuantities>;
using GridView = GetPropType<TypeTag, Properties::GridView>;
enum { conti0EqIdx = Indices::conti0EqIdx };
enum { dimWorld = GridView::dimensionworld };
public:
struct ConvectiveMixingModuleParam
{};
#if HAVE_ECL_INPUT
static void beginEpisode(const EclipseState& eclState, const Schedule& schedule, const int episodeIdx, ConvectiveMixingModuleParam& info)
{}
#endif
template <class Context>
static void addConvectiveMixingFlux(RateVector& flux,
const Context& elemCtx,
unsigned scvfIdx,
unsigned timeIdx)
{}
/*!
* \brief Adds the convective mixing mass flux flux to the flux vector over a flux
* integration point.
*/
static void addConvectiveMixingFlux(RateVector& flux,
const IntensiveQuantities& intQuantsIn,
const IntensiveQuantities& intQuantsEx,
const unsigned globalIndexIn,
const unsigned globalIndexEx,
const Scalar distZg,
const Scalar trans,
const Scalar faceArea,
const ConvectiveMixingModuleParam& info)
{}
};
template <class TypeTag>
class BlackOilConvectiveMixingModule<TypeTag, /*enableConvectiveMixing=*/true>
{
using Scalar = GetPropType<TypeTag, Properties::Scalar>;
using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>;
@ -73,6 +133,7 @@ public:
// check that Xhi and Psi didn't change
std::size_t numRegions = eclState.runspec().tabdims().getNumPVTTables();
const auto& control = schedule[episodeIdx].oilvap();
info.active_ = control.drsdtConvective();
if (!info.active_) {
return;
}
@ -129,7 +190,7 @@ public:
/*!
* \brief Adds the diffusive mass flux flux to the flux vector over a flux
* \brief Adds the convective mixing mass flux flux to the flux vector over a flux
* integration point.
*/
static void addConvectiveMixingFlux(RateVector& flux,

View File

@ -106,6 +106,7 @@ class BlackOilIntensiveQuantities
enum { enableEnergy = getPropValue<TypeTag, Properties::EnableEnergy>() };
enum { enableDiffusion = getPropValue<TypeTag, Properties::EnableDiffusion>() };
enum { enableDispersion = getPropValue<TypeTag, Properties::EnableDispersion>() };
enum { enableConvectiveMixing = getPropValue<TypeTag, Properties::EnableConvectiveMixing>() };
enum { enableMICP = getPropValue<TypeTag, Properties::EnableMICP>() };
enum { numPhases = getPropValue<TypeTag, Properties::NumPhases>() };
enum { numComponents = getPropValue<TypeTag, Properties::NumComponents>() };
@ -405,8 +406,7 @@ public:
rho = fluidState_.invB(waterPhaseIdx);
rho *= FluidSystem::referenceDensity(waterPhaseIdx, pvtRegionIdx);
if (FluidSystem::enableDissolvedGasInWater()) {
const auto& oilVaporizationControl = problem.simulator().vanguard().schedule()[problem.episodeIndex()].oilvap();
if(!oilVaporizationControl.drsdtConvective()) {
if(!enableConvectiveMixing) {
rho +=
fluidState_.invB(waterPhaseIdx) *
fluidState_.Rsw() *
@ -438,8 +438,7 @@ public:
rho = fluidState_.invB(oilPhaseIdx);
rho *= FluidSystem::referenceDensity(oilPhaseIdx, pvtRegionIdx);
if (FluidSystem::enableDissolvedGas()) {
const auto& oilVaporizationControl = problem.simulator().vanguard().schedule()[problem.episodeIndex()].oilvap();
if(!oilVaporizationControl.drsdtConvective()) {
if(!enableConvectiveMixing) {
rho +=
fluidState_.invB(oilPhaseIdx) *
fluidState_.Rs() *

View File

@ -81,6 +81,7 @@ class BlackOilLocalResidual : public GetPropType<TypeTag, Properties::DiscLocalR
static constexpr bool blackoilConserveSurfaceVolume = getPropValue<TypeTag, Properties::BlackoilConserveSurfaceVolume>();
static constexpr bool enableEnergy = getPropValue<TypeTag, Properties::EnableEnergy>();
static constexpr bool enableDiffusion = getPropValue<TypeTag, Properties::EnableDiffusion>();
static constexpr bool enableConvectiveMixing = getPropValue<TypeTag, Properties::EnableConvectiveMixing>();
using Toolbox = MathToolbox<Evaluation>;
using SolventModule = BlackOilSolventModule<TypeTag>;
@ -91,7 +92,7 @@ class BlackOilLocalResidual : public GetPropType<TypeTag, Properties::DiscLocalR
using BrineModule = BlackOilBrineModule<TypeTag>;
using DiffusionModule = BlackOilDiffusionModule<TypeTag, enableDiffusion>;
using MICPModule = BlackOilMICPModule<TypeTag>;
using ConvectiveMixingModule = BlackOilConvectiveMixingModule<TypeTag>;
using ConvectiveMixingModule = BlackOilConvectiveMixingModule<TypeTag, enableConvectiveMixing>;
public:

View File

@ -95,6 +95,7 @@ class BlackOilLocalResidualTPFA : public GetPropType<TypeTag, Properties::DiscLo
static constexpr bool enableBrine = getPropValue<TypeTag, Properties::EnableBrine>();
static constexpr bool enableDiffusion = getPropValue<TypeTag, Properties::EnableDiffusion>();
static constexpr bool enableDispersion = getPropValue<TypeTag, Properties::EnableDispersion>();
static constexpr bool enableConvectiveMixing = getPropValue<TypeTag, Properties::EnableConvectiveMixing>();
static constexpr bool enableMICP = getPropValue<TypeTag, Properties::EnableMICP>();
using SolventModule = BlackOilSolventModule<TypeTag>;
@ -104,7 +105,7 @@ class BlackOilLocalResidualTPFA : public GetPropType<TypeTag, Properties::DiscLo
using FoamModule = BlackOilFoamModule<TypeTag>;
using BrineModule = BlackOilBrineModule<TypeTag>;
using DiffusionModule = BlackOilDiffusionModule<TypeTag, enableDiffusion>;
using ConvectiveMixingModule = BlackOilConvectiveMixingModule<TypeTag>;
using ConvectiveMixingModule = BlackOilConvectiveMixingModule<TypeTag, enableConvectiveMixing>;
using ConvectiveMixingModuleParam = typename ConvectiveMixingModule::ConvectiveMixingModuleParam;
using DispersionModule = BlackOilDispersionModule<TypeTag, enableDispersion>;
@ -457,15 +458,17 @@ public:
// BrineModule::computeFlux(flux, elemCtx, scvfIdx, timeIdx);
// deal with convective mixing
ConvectiveMixingModule::addConvectiveMixingFlux(flux,
intQuantsIn,
intQuantsEx,
globalIndexIn,
globalIndexEx,
nbInfo.dZg,
nbInfo.trans,
nbInfo.faceArea,
moduleParams.convectiveMixingModuleParam);
if constexpr(enableConvectiveMixing){
ConvectiveMixingModule::addConvectiveMixingFlux(flux,
intQuantsIn,
intQuantsEx,
globalIndexIn,
globalIndexEx,
nbInfo.dZg,
nbInfo.trans,
nbInfo.faceArea,
moduleParams.convectiveMixingModuleParam);
}
// deal with diffusion (if present). opm-models expects per area flux (added in the tmpdiffusivity).

View File

@ -181,6 +181,8 @@ struct EnableDiffusion<TypeTag, TTag::BlackOilModel> { static constexpr bool val
//! disable disperison by default
template<class TypeTag>
struct EnableDispersion<TypeTag, TTag::BlackOilModel> { static constexpr bool value = false; };
template<class TypeTag>
struct EnableConvectiveMixing<TypeTag, TTag::BlackOilModel> { static constexpr bool value = false; };
//! by default, scale the energy equation by the inverse of the energy required to heat
//! up one kg of water by 30 Kelvin. If we conserve surface volumes, this must be divided

View File

@ -80,6 +80,9 @@ struct EnableDiffusion { using type = UndefinedProperty; };
//! Enable dispersive fluxes?
template<class TypeTag, class MyTypeTag>
struct EnableDispersion { using type = UndefinedProperty; };
//! Enable convective mixing?
template<class TypeTag, class MyTypeTag>
struct EnableConvectiveMixing { using type = UndefinedProperty; };
} // namespace Opm::Properties