mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
fix for flag when DRSDTCON is active, adressed warnings and fixed initialization
This commit is contained in:
parent
3d943770a5
commit
9696ff0824
@ -84,25 +84,32 @@ public:
|
||||
#endif
|
||||
|
||||
template <class Context>
|
||||
static void addConvectiveMixingFlux(RateVector& flux,
|
||||
const Context& elemCtx,
|
||||
unsigned scvfIdx,
|
||||
unsigned timeIdx)
|
||||
static bool active(const Context&) {
|
||||
return false;
|
||||
}
|
||||
|
||||
template <class Context>
|
||||
static void addConvectiveMixingFlux(RateVector&,
|
||||
const Context&,
|
||||
unsigned,
|
||||
unsigned)
|
||||
{}
|
||||
|
||||
/*!
|
||||
* \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)
|
||||
static void addConvectiveMixingFlux(RateVector&,
|
||||
const IntensiveQuantities&,
|
||||
const IntensiveQuantities&,
|
||||
const unsigned,
|
||||
const unsigned,
|
||||
const Scalar,
|
||||
const Scalar,
|
||||
const Scalar,
|
||||
const ConvectiveMixingModuleParam&)
|
||||
{}
|
||||
|
||||
};
|
||||
template <class TypeTag>
|
||||
class BlackOilConvectiveMixingModule<TypeTag, /*enableConvectiveMixing=*/true>
|
||||
@ -122,7 +129,7 @@ public:
|
||||
|
||||
struct ConvectiveMixingModuleParam
|
||||
{
|
||||
bool active_;
|
||||
bool active_{false};
|
||||
std::vector<Scalar> Xhi_;
|
||||
std::vector<Scalar> Psi_;
|
||||
};
|
||||
@ -148,13 +155,18 @@ public:
|
||||
}
|
||||
#endif
|
||||
|
||||
template <class Context>
|
||||
static bool active(const Context& elemCtx) {
|
||||
const auto& problem = elemCtx.problem();
|
||||
return problem.moduleParams().convectiveMixingModuleParam.active_;
|
||||
}
|
||||
|
||||
template <class Context>
|
||||
static void addConvectiveMixingFlux(RateVector& flux,
|
||||
const Context& elemCtx,
|
||||
unsigned scvfIdx,
|
||||
unsigned timeIdx)
|
||||
{
|
||||
|
||||
// need for dary flux calculation
|
||||
const auto& problem = elemCtx.problem();
|
||||
const auto& stencil = elemCtx.stencil(timeIdx);
|
||||
@ -185,10 +197,6 @@ public:
|
||||
problem.moduleParams().convectiveMixingModuleParam);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Adds the convective mixing mass flux flux to the flux vector over a flux
|
||||
* integration point.
|
||||
@ -203,8 +211,6 @@ public:
|
||||
const Scalar faceArea,
|
||||
const ConvectiveMixingModuleParam& info)
|
||||
{
|
||||
|
||||
|
||||
if (!info.active_) {
|
||||
return;
|
||||
}
|
||||
@ -250,7 +256,6 @@ public:
|
||||
intQuantsEx.pvtRegionIndex(),
|
||||
SoMax);
|
||||
const auto& salt_ex = Opm::getValue(intQuantsEx.fluidState().saltSaturation());
|
||||
|
||||
const auto& bLiquidEx = (FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx)) ?
|
||||
FluidSystem::waterPvt().inverseFormationVolumeFactor(intQuantsIn.pvtRegionIndex(), t_ex, p_ex, rs_zero_ex, salt_ex) :
|
||||
FluidSystem::oilPvt().inverseFormationVolumeFactor(intQuantsIn.pvtRegionIndex(), t_ex, p_ex, rs_zero_ex);
|
||||
@ -263,11 +268,9 @@ public:
|
||||
FluidSystem::waterPvt().waterReferenceDensity(intQuantsEx.pvtRegionIndex()) :
|
||||
FluidSystem::oilPvt().oilReferenceDensity(intQuantsEx.pvtRegionIndex());
|
||||
|
||||
|
||||
const auto rho_ex = bLiquidEx * densityLiquidEx;
|
||||
const auto rho_sat_ex = bLiquidSatEx
|
||||
* (densityLiquidEx + rssat_ex * FluidSystem::referenceDensity(FluidSystem::gasPhaseIdx, intQuantsEx.pvtRegionIndex()));
|
||||
|
||||
//rho difference approximation
|
||||
const auto delta_rho = (rho_sat_ex + rho_sat_in - rho_in -rho_ex)/2;
|
||||
const auto pressure_difference_convective_mixing = delta_rho * distZg;
|
||||
@ -290,7 +293,6 @@ public:
|
||||
unsigned globalUpIndex = (upIdx == interiorDofIdx) ? globalIndexIn : globalIndexEx;
|
||||
|
||||
const auto& down = (downIdx == interiorDofIdx) ? intQuantsIn : intQuantsEx;
|
||||
unsigned globalDownIndex = (downIdx == interiorDofIdx) ? globalIndexIn : globalIndexEx;
|
||||
|
||||
const auto& Rsup = (FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx)) ?
|
||||
up.fluidState().Rsw() :
|
||||
@ -298,13 +300,11 @@ public:
|
||||
const auto& Rsdown = (FluidSystem::phaseIsActive(FluidSystem::waterPhaseIdx)) ?
|
||||
down.fluidState().Rsw() :
|
||||
down.fluidState().Rs();
|
||||
|
||||
const auto& RsSat = FluidSystem::saturatedDissolutionFactor(up.fluidState(),
|
||||
liquidPhaseIdx,
|
||||
up.pvtRegionIndex(),
|
||||
SoMax);
|
||||
const Evaluation& transMult = up.rockCompTransMultiplier();
|
||||
|
||||
Evaluation sg = up.fluidState().saturation(FluidSystem::gasPhaseIdx);
|
||||
Evaluation X = (Rsup - RsSat * sg) / (RsSat * ( 1.0 - sg));
|
||||
if ( (X > info.Psi_[up.pvtRegionIndex()] || Rsdown > 0) ) {
|
||||
|
@ -38,6 +38,7 @@
|
||||
#include "blackoildiffusionmodule.hh"
|
||||
#include "blackoildispersionmodule.hh"
|
||||
#include "blackoilmicpmodules.hh"
|
||||
#include "blackoilconvectivemixingmodule.hh"
|
||||
|
||||
#include <opm/common/TimingMacros.hpp>
|
||||
#include <opm/common/OpmLog/OpmLog.hpp>
|
||||
@ -132,6 +133,7 @@ class BlackOilIntensiveQuantities
|
||||
|
||||
using DirectionalMobilityPtr = Opm::Utility::CopyablePtr<DirectionalMobility<TypeTag, Evaluation>>;
|
||||
using BrineModule = BlackOilBrineModule<TypeTag>;
|
||||
using ConvectiveMixingModule = BlackOilConvectiveMixingModule<TypeTag, enableConvectiveMixing>;
|
||||
|
||||
|
||||
public:
|
||||
@ -304,8 +306,7 @@ public:
|
||||
if (FluidSystem::phaseIsActive(FluidSystem::oilPhaseIdx)) {
|
||||
SoMax = max(fluidState_.saturation(oilPhaseIdx),
|
||||
problem.maxOilSaturation(globalSpaceIdx));
|
||||
|
||||
|
||||
}
|
||||
// take the meaning of the switching primary variable into account for the gas
|
||||
// and oil phase compositions
|
||||
if (priVars.primaryVarsMeaningGas() == PrimaryVariables::GasMeaning::Rs) {
|
||||
@ -323,7 +324,6 @@ public:
|
||||
else if constexpr (compositionSwitchEnabled)
|
||||
fluidState_.setRs(0.0);
|
||||
}
|
||||
}
|
||||
if (priVars.primaryVarsMeaningGas() == PrimaryVariables::GasMeaning::Rv) {
|
||||
const auto& Rv = priVars.makeEvaluation(Indices::compositionSwitchIdx, timeIdx);
|
||||
fluidState_.setRv(Rv);
|
||||
@ -406,7 +406,8 @@ public:
|
||||
rho = fluidState_.invB(waterPhaseIdx);
|
||||
rho *= FluidSystem::referenceDensity(waterPhaseIdx, pvtRegionIdx);
|
||||
if (FluidSystem::enableDissolvedGasInWater()) {
|
||||
if(!enableConvectiveMixing) {
|
||||
bool ConvectiveMixingActive = ConvectiveMixingModule::active(elemCtx);
|
||||
if(!ConvectiveMixingActive) {
|
||||
rho +=
|
||||
fluidState_.invB(waterPhaseIdx) *
|
||||
fluidState_.Rsw() *
|
||||
@ -438,7 +439,8 @@ public:
|
||||
rho = fluidState_.invB(oilPhaseIdx);
|
||||
rho *= FluidSystem::referenceDensity(oilPhaseIdx, pvtRegionIdx);
|
||||
if (FluidSystem::enableDissolvedGas()) {
|
||||
if(!enableConvectiveMixing) {
|
||||
bool ConvectiveMixingActive = ConvectiveMixingModule::active(elemCtx);
|
||||
if(!ConvectiveMixingActive) {
|
||||
rho +=
|
||||
fluidState_.invB(oilPhaseIdx) *
|
||||
fluidState_.Rs() *
|
||||
|
@ -94,7 +94,6 @@ class BlackOilLocalResidual : public GetPropType<TypeTag, Properties::DiscLocalR
|
||||
using MICPModule = BlackOilMICPModule<TypeTag>;
|
||||
using ConvectiveMixingModule = BlackOilConvectiveMixingModule<TypeTag, enableConvectiveMixing>;
|
||||
|
||||
|
||||
public:
|
||||
/*!
|
||||
* \copydoc FvBaseLocalResidual::computeStorage
|
||||
@ -214,7 +213,6 @@ public:
|
||||
else
|
||||
evalPhaseFluxes_<Scalar>(flux, phaseIdx, pvtRegionIdx, extQuants, up.fluidState());
|
||||
}
|
||||
|
||||
// deal with solvents (if present)
|
||||
SolventModule::computeFlux(flux, elemCtx, scvfIdx, timeIdx);
|
||||
|
||||
@ -238,7 +236,7 @@ public:
|
||||
|
||||
DiffusionModule::addDiffusiveFlux(flux, elemCtx, scvfIdx, timeIdx);
|
||||
|
||||
// deal with convective mixing (if present)
|
||||
// deal with convective mixing (if enabled)
|
||||
ConvectiveMixingModule::addConvectiveMixingFlux(flux,elemCtx, scvfIdx, timeIdx);
|
||||
}
|
||||
|
||||
|
@ -470,7 +470,6 @@ public:
|
||||
moduleParams.convectiveMixingModuleParam);
|
||||
}
|
||||
|
||||
|
||||
// deal with diffusion (if present). opm-models expects per area flux (added in the tmpdiffusivity).
|
||||
if constexpr(enableDiffusion){
|
||||
typename DiffusionModule::ExtensiveQuantities::EvaluationArray effectiveDiffusionCoefficient;
|
||||
@ -645,7 +644,7 @@ public:
|
||||
RateVector& bdyFlux,
|
||||
const BoundaryConditionData& bdyInfo,
|
||||
const IntensiveQuantities& insideIntQuants,
|
||||
unsigned globalSpaceIdx)
|
||||
[[maybe_unused]] unsigned globalSpaceIdx)
|
||||
{
|
||||
OPM_TIMEBLOCK_LOCAL(computeBoundaryThermal);
|
||||
// only heat is allowed to flow through this boundary
|
||||
|
@ -650,7 +650,6 @@ public:
|
||||
return;
|
||||
}
|
||||
const unsigned int numCells = model_().numTotalDof();
|
||||
|
||||
#ifdef _OPENMP
|
||||
#pragma omp parallel for
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user