Merge pull request #665 from plgbrts/gw1

adjustments needed for gas-water system
This commit is contained in:
Tor Harald Sandve 2021-08-03 12:00:43 +02:00 committed by GitHub
commit 288c46e10d
5 changed files with 21 additions and 7 deletions

View File

@ -96,8 +96,10 @@ class BlackOilIntensiveQuantities
enum { dimWorld = GridView::dimensionworld };
enum { compositionSwitchIdx = Indices::compositionSwitchIdx };
static const bool compositionSwitchEnabled = Indices::gasEnabled;
static const bool compositionSwitchEnabled = Indices::compositionSwitchIdx >= 0;
static const bool waterEnabled = Indices::waterEnabled;
static const bool gasEnabled = Indices::gasEnabled;
static const bool oilEnabled = Indices::oilEnabled;
using Toolbox = MathToolbox<Evaluation>;
using DimMatrix = Dune::FieldMatrix<Scalar, dimWorld, dimWorld>;
@ -167,6 +169,9 @@ public:
Sg = 0.0;
}
}
if (gasEnabled && waterEnabled && !oilEnabled) {
Sg = 1.0 - Sw;
}
Valgrind::CheckDefined(Sg);
Valgrind::CheckDefined(Sw);

View File

@ -279,7 +279,7 @@ class BlackOilModel
enum { numEq = getPropValue<TypeTag, Properties::NumEq>() };
enum { enableDiffusion = getPropValue<TypeTag, Properties::EnableDiffusion>() };
static const bool compositionSwitchEnabled = Indices::gasEnabled;
static const bool compositionSwitchEnabled = Indices::compositionSwitchIdx >= 0;
static const bool waterEnabled = Indices::waterEnabled;
using SolventModule = BlackOilSolventModule<TypeTag>;

View File

@ -247,6 +247,7 @@ protected:
static constexpr bool enableEnergy = Indices::temperatureIdx >= 0;
static constexpr bool enableFoam = Indices::foamConcentrationIdx >= 0;
static constexpr bool enableBrine = Indices::saltConcentrationIdx >= 0;
static constexpr bool compositionSwitchEnabled = Indices::compositionSwitchIdx >= 0;
currentValue.checkDefined();
Valgrind::CheckDefined(update);
@ -263,7 +264,7 @@ protected:
deltaSo = -deltaSw;
}
if (Indices::gasEnabled && currentValue.primaryVarsMeaning() == PrimaryVariables::Sw_po_Sg) {
if (compositionSwitchEnabled && currentValue.primaryVarsMeaning() == PrimaryVariables::Sw_po_Sg) {
deltaSg = update[Indices::compositionSwitchIdx];
deltaSo -= deltaSg;
}

View File

@ -86,8 +86,10 @@ class BlackOilPrimaryVariables : public FvBasePrimaryVariables<TypeTag>
enum { pressureSwitchIdx = Indices::pressureSwitchIdx };
enum { compositionSwitchIdx = Indices::compositionSwitchIdx };
static const bool compositionSwitchEnabled = Indices::gasEnabled;
static const bool compositionSwitchEnabled = Indices::compositionSwitchIdx >= 0;
static const bool waterEnabled = Indices::waterEnabled;
static const bool gasEnabled = Indices::gasEnabled;
static const bool oilEnabled = Indices::oilEnabled;
// phase indices from the fluid system
enum { numPhases = getPropValue<TypeTag, Properties::NumPhases>() };
@ -315,7 +317,13 @@ public:
else if (primaryVarsMeaning() == Sw_po_Sg) {
if (waterEnabled)
(*this)[waterSaturationIdx] = FsToolbox::value(fluidState.saturation(waterPhaseIdx));
(*this)[pressureSwitchIdx] = FsToolbox::value(fluidState.pressure(oilPhaseIdx));
if (gasEnabled && waterEnabled && !oilEnabled) {
//-> water-gas system
(*this)[pressureSwitchIdx] = FsToolbox::value(fluidState.pressure(gasPhaseIdx));
}
else if (oilEnabled) {
(*this)[pressureSwitchIdx] = FsToolbox::value(fluidState.pressure(oilPhaseIdx));
}
if( compositionSwitchEnabled )
(*this)[compositionSwitchIdx] = FsToolbox::value(fluidState.saturation(gasPhaseIdx));
}

View File

@ -95,9 +95,9 @@ struct BlackOilTwoPhaseIndices
* \brief Index of the switching variable which determines the composition of the
* hydrocarbon phases.
*
* \note For two-phase water oil models this is disabled.
* \note For two-phase water oil and water gas models this is disabled.
*/
static const int compositionSwitchIdx = gasEnabled ? PVOffset + 1 : -10000;
static const int compositionSwitchIdx = (gasEnabled && oilEnabled) ? PVOffset + 1 : -10000;
//! Index of the primary variable for the first solvent
static const int solventSaturationIdx =