Commit a6a42486 authored by Thomas Fetzer's avatar Thomas Fetzer Committed by Timo Koch
Browse files

[2p2c][2pnc][2pncmin] Update phase presence indices and formulation indices -> identical to 2pnc

2p2c updated the reference solutions (changed phase presence indices)
2pnc changed: plSg --> pnsw; pgSl --> pwsn, removed plSg + pgSl from indices
2pncmin changed: plSg --> pnsw; pgSl --> pwsn as for 2pnc
2p2c, 2pnc: added the formulation changes to CHANGELOG.md

(cherry picked from commit b03738a2)
parent 3dcb428a
......@@ -20,6 +20,12 @@ Differences Between DuMuX 2.10 and DuMuX 2.11
- In the ZeroEq models, the properties BBoxMinIsWall and BBoxMaxIsWall have
been replaced by the functions bBoxMaxIsWall() and bBoxMaxIsWall() in the
problem file.
- In the TwoPNC (and, consequently the TwoPNCMin) models, the old formulations
pgSl, plSg as well as pnSw and pwSg have been replaced by the pnsw and pwsn,
to satify the naming convention and be consistent with TwoPTwoC.
- In the TwoPTwoC model, the indices are no longer dependent on the
formulation. Further, the values of "nPhaseOnly" and "bothPhases"
have been harmonized with those in TwoPNC
* Deprecated PROPERTY and PARAMETER NAMES, to be removed after 2.11: BEWARE: The
compiler will not print any warning if a deprecated property or parameter name
......
......@@ -38,8 +38,10 @@ namespace Dumux
*/
struct TwoPTwoCFormulation
{
static const int pwsn = 0; //!< pw and sn as primary variables
static const int pnsw = 1; //!< pn and sw as primary variables
enum {
pnsw,
pwsn
};
};
/*!
......@@ -47,12 +49,9 @@ struct TwoPTwoCFormulation
* \ingroup ImplicitIndices
* \brief The indices for the isothermal two-phase two-component model.
*
* \tparam formulation The formulation, either pwsn or pnsw.
* \tparam PVOffset The first index in a primary variable vector.
*/
template <class TypeTag,
int formulation = TwoPTwoCFormulation::pwsn,
int PVOffset = 0>
template <class TypeTag, int PVOffset = 0>
class TwoPTwoCIndices
{
typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
......@@ -67,9 +66,9 @@ public:
static const int nCompIdx = FluidSystem::nCompIdx; //!< Index of the primary component of the non-wetting phase
// present phases (-> 'pseudo' primary variable)
static const int wPhaseOnly = 1; //!< Only the wetting phase is present
static const int nPhaseOnly = 0; //!< Only the non-wetting phase is present
static const int bothPhases = 2; //!< Both phases are present
static const int wPhaseOnly = 1; //!< Only the non-wetting phase is present
static const int nPhaseOnly = 2; //!< Only the wetting phase is present
static const int bothPhases = 3; //!< Both phases are present
// Primary variable indices
//! Index for wetting/non-wetting phase pressure (depending on the formulation) in a solution vector
......@@ -91,55 +90,6 @@ public:
static const int contiNEqIdx = conti0EqIdx + nCompIdx;
};
/*!
* \ingroup TwoPTwoCModel
* \ingroup ImplicitIndices
* \brief The indices for the isothermal two-phase two-component model in the pn-sw
* formulation.
*
* \tparam PVOffset The first index in a primary variable vector.
*/
template <class TypeTag, int PVOffset>
class TwoPTwoCIndices<TypeTag, TwoPTwoCFormulation::pnsw, PVOffset>
{
typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem;
public:
// Phase indices
static const int wPhaseIdx = FluidSystem::wPhaseIdx; //!< Index of the wetting phase
static const int nPhaseIdx = FluidSystem::nPhaseIdx; //!< Index of the non-wetting phase
// Component indices
static const int wCompIdx = FluidSystem::wCompIdx; //!< Index of the primary component of the wetting phase
static const int nCompIdx = FluidSystem::nCompIdx; //!< Index of the primary component of the non-wetting phase
// present phases (-> 'pseudo' primary variable)
static const int wPhaseOnly = 1; //!< Only the wetting phase is present
static const int nPhaseOnly = 2; //!< Only the non-wetting phase is present
static const int bothPhases = 3; //!< Both phases are present
// Primary variable indices
//! Index for wetting/non-wetting phase pressure (depending on the formulation) in a solution vector
static const int pressureIdx = PVOffset + 0;
//! Index of either the saturation or the mass fraction of the non-wetting/wetting phase
static const int switchIdx = PVOffset + 1;
//! Index for non-wetting phase pressure in a solution vector
static const int pnIdx = pressureIdx;
//! Index of either the saturation of the liquid phase or the mass fraction of the secondary component in the only phase
static const int swOrXIdx = switchIdx;
// Equation indices
//! Index of the mass conservation equation for the first component
static const int conti0EqIdx = PVOffset;
//! Index of the mass conservation equation for the primary component of the wetting phase
static const int contiWEqIdx = conti0EqIdx + wCompIdx;
//! Index of the mass conservation equation for the primary component of the non-wetting phase
static const int contiNEqIdx = conti0EqIdx + nCompIdx;
};
// \}
}
#endif
......@@ -151,12 +151,7 @@ SET_SCALAR_PROP(TwoPTwoC, ImplicitMassUpwindWeight, 1.0);
SET_SCALAR_PROP(TwoPTwoC, ImplicitMobilityUpwindWeight, 1.0);
//! Set the indices required by the isothermal 2p2c
SET_PROP(TwoPTwoC, Indices)
{ private:
enum { Formulation = GET_PROP_VALUE(TypeTag, Formulation) };
public:
typedef TwoPTwoCIndices<TypeTag, Formulation, 0> type;
};
SET_TYPE_PROP(TwoPTwoC, Indices, TwoPTwoCIndices <TypeTag, /*PVOffset=*/0>);
//! Use the ImplicitSpatialParams by default
SET_TYPE_PROP(TwoPTwoC, SpatialParams, ImplicitSpatialParams<TypeTag>);
......@@ -214,13 +209,7 @@ SET_BOOL_PROP(TwoPTwoCNI, NiOutputLevel, 0);
//////////////////////////////////////////////////////////////////
//set isothermal Indices
SET_PROP(TwoPTwoCNI, IsothermalIndices)
{
private:
enum { Formulation = GET_PROP_VALUE(TypeTag, Formulation) };
public:
typedef TwoPTwoCIndices<TypeTag, Formulation, 0> type;
};
SET_TYPE_PROP(TwoPTwoCNI, IsothermalIndices, TwoPTwoCIndices<TypeTag, /*PVOffset=*/0>);
//set isothermal NumEq
SET_INT_PROP(TwoPTwoCNI, IsothermalNumEq, 2);
......
......@@ -36,11 +36,9 @@ namespace Dumux
struct TwoPNCFormulation
{
enum {
plSg,
pgSl,
pnSw = pgSl,
pwSn = plSg
};
pnsw,
pwsn
};
};
/*!
......@@ -59,6 +57,11 @@ public:
// Phase indices
static const int wPhaseIdx = FluidSystem::wPhaseIdx; //!< Index of the wetting phase
static const int nPhaseIdx = FluidSystem::nPhaseIdx; //!< Index of the non-wetting phase
// Component indices
static const int wCompIdx = FluidSystem::wCompIdx; //!< Index of the primary component of the wetting phase
static const int nCompIdx = FluidSystem::nCompIdx; //!< Index of the primary component of the non-wetting phase
// present phases (-> 'pseudo' primary variable)
static const int wPhaseOnly = 1; //!< Only the non-wetting phase is present
static const int nPhaseOnly = 2; //!< Only the wetting phase is present
......@@ -67,6 +70,7 @@ public:
// Primary variable indices
static const int pressureIdx = PVOffset + 0; //!< Index for wetting/non-wetting phase pressure (depending on formulation) in a solution vector
static const int switchIdx = PVOffset + 1; //!< Index of the either the saturation or the mass fraction of the non-wetting/wetting phase
// equation indices
static const int conti0EqIdx = PVOffset + 0; //!< Reference index for mass conservation equations.
static const int contiWEqIdx = conti0EqIdx + FluidSystem::wCompIdx; //!< Index of the mass conservation equation for the wetting phase major component
......
......@@ -140,8 +140,8 @@ class TwoPNCModel: public GET_PROP_TYPE(TypeTag, BaseModel)
bothPhases = Indices::bothPhases
};
enum {
plSg = TwoPNCFormulation::plSg,
pgSl = TwoPNCFormulation::pgSl,
pwsn = TwoPNCFormulation::pwsn,
pnsw = TwoPNCFormulation::pnsw,
formulation = GET_PROP_VALUE(TypeTag, Formulation)
};
......
......@@ -67,8 +67,8 @@ class TwoPNCPrimaryVariableSwitch : public Dumux::PrimaryVariableSwitch<TypeTag>
};
enum {
plSg = TwoPNCFormulation::plSg,
pgSl = TwoPNCFormulation::pgSl,
pwsn = TwoPNCFormulation::pwsn,
pnsw = TwoPNCFormulation::pnsw,
formulation = GET_PROP_VALUE(TypeTag, Formulation)
};
......@@ -147,9 +147,9 @@ protected:
newPhasePresence = bothPhases;
//saturation of the liquid phase set to 0.0001 (if formulation pgSl and vice versa)
if (formulation == pgSl)
if (formulation == pnsw)
priVars[switchIdx] = 0.0001;
else if (formulation == plSg)
else if (formulation == pwsn)
priVars[switchIdx] = 0.9999;
//switch all secondary components back to liquid mole fraction
......@@ -178,9 +178,9 @@ protected:
<< sumxg << std::endl;
newPhasePresence = bothPhases;
//saturation of the liquid phase set to 0.9999 (if formulation pgSl and vice versa)
if (formulation == pgSl)
if (formulation == pnsw)
priVars[switchIdx] = 0.9999;
else if (formulation == plSg)
else if (formulation == pwsn)
priVars[switchIdx] = 0.0001;
}
......
......@@ -129,8 +129,8 @@ SET_PROP(TwoPNC, FluidState)
typedef CompositionalFluidState<Scalar, FluidSystem> type;
};
//! Set the default formulation to pl-Sg: This can be over written in the problem.
SET_INT_PROP(TwoPNC, Formulation, TwoPNCFormulation::plSg);
//! Set the default formulation to pw-Sn: This can be over written in the problem.
SET_INT_PROP(TwoPNC, Formulation, TwoPNCFormulation::pwsn);
//! Set the property for the material parameters by extracting it from the material law.
SET_PROP(TwoPNC, MaterialLawParams)
......
......@@ -74,8 +74,8 @@ class TwoPNCVolumeVariables : public ImplicitVolumeVariables<TypeTag>
// formulations
formulation = GET_PROP_VALUE(TypeTag, Formulation),
plSg = TwoPNCFormulation::plSg,
pgSl = TwoPNCFormulation::pgSl,
pwsn = TwoPNCFormulation::pwsn,
pnsw = TwoPNCFormulation::pnsw,
// phase indices
wPhaseIdx = FluidSystem::wPhaseIdx,
......@@ -194,9 +194,9 @@ public:
}
else if (phasePresence == bothPhases)
{
if (formulation == plSg)
if (formulation == pwsn)
Sg = priVars[switchIdx];
else if (formulation == pgSl)
else if (formulation == pnsw)
Sg = 1.0 - priVars[switchIdx];
else
DUNE_THROW(Dune::InvalidStateException, "Formulation: " << formulation << " is invalid.");
......@@ -218,14 +218,14 @@ public:
auto pc = MaterialLaw::pc(materialParams, 1 - Sg);
// extract the pressures
if (formulation == plSg)
if (formulation == pwsn)
{
fluidState.setPressure(wPhaseIdx, priVars[pressureIdx]);
if (priVars[pressureIdx] + pc < 0.0)
DUNE_THROW(NumericalProblem,"Capillary pressure is too low");
fluidState.setPressure(nPhaseIdx, priVars[pressureIdx] + pc);
}
else if (formulation == pgSl)
else if (formulation == pnsw)
{
fluidState.setPressure(nPhaseIdx, priVars[pressureIdx]);
// Here we check for (p_g - pc) in order to ensure that (p_l > 0)
......
......@@ -131,29 +131,12 @@ class TwoPNCMinModel: public GET_PROP_TYPE(TypeTag, BaseModel)
dim = GridView::dimension,
dimWorld = GridView::dimensionworld,
numEq = GET_PROP_VALUE(TypeTag, NumEq),
numPhases = GET_PROP_VALUE(TypeTag, NumPhases),
numSPhases = GET_PROP_VALUE(TypeTag, NumSPhases),
numComponents = GET_PROP_VALUE(TypeTag, NumComponents),
numSecComponents = GET_PROP_VALUE(TypeTag, NumSecComponents),
numMajorComponents = GET_PROP_VALUE(TypeTag, NumMajorComponents),
pressureIdx = Indices::pressureIdx,
switchIdx = Indices::switchIdx,
wPhaseIdx = Indices::wPhaseIdx,
nPhaseIdx = Indices::nPhaseIdx,
wCompIdx = FluidSystem::wCompIdx,
nCompIdx = FluidSystem::nCompIdx,
wPhaseOnly = Indices::wPhaseOnly,
nPhaseOnly = Indices::nPhaseOnly,
bothPhases = Indices::bothPhases,
plSg = TwoPNCFormulation::plSg,
pgSl = TwoPNCFormulation::pgSl,
formulation = GET_PROP_VALUE(TypeTag, Formulation)
nPhaseIdx = Indices::nPhaseIdx
};
using Vertex = typename GridView::template Codim<dim>::Entity;
......
......@@ -76,8 +76,8 @@ class TwoPNCMinVolumeVariables : public TwoPNCVolumeVariables<TypeTag>
// formulations
formulation = GET_PROP_VALUE(TypeTag, Formulation),
plSg = TwoPNCFormulation::plSg,
pgSl = TwoPNCFormulation::pgSl,
pwsn = TwoPNCFormulation::pwsn,
pnsw = TwoPNCFormulation::pnsw,
// phase indices
wPhaseIdx = FluidSystem::wPhaseIdx,
......@@ -194,9 +194,9 @@ public:
}
else if (phasePresence == bothPhases)
{
if (formulation == plSg)
if (formulation == pwsn)
Sg = priVars[switchIdx];
else if (formulation == pgSl)
else if (formulation == pnsw)
Sg = 1.0 - priVars[switchIdx];
else
DUNE_THROW(Dune::InvalidStateException, "Formulation: " << formulation << " is invalid.");
......@@ -218,14 +218,14 @@ public:
auto pc = MaterialLaw::pc(materialParams, 1 - Sg);
// extract the pressures
if (formulation == plSg)
if (formulation == pwsn)
{
fluidState.setPressure(wPhaseIdx, priVars[pressureIdx]);
if (priVars[pressureIdx] + pc < 0.0)
DUNE_THROW(Dumux::NumericalProblem, "Capillary pressure is too low");
fluidState.setPressure(nPhaseIdx, priVars[pressureIdx] + pc);
}
else if (formulation == pgSl)
else if (formulation == pnsw)
{
fluidState.setPressure(nPhaseIdx, priVars[pressureIdx]);
// Here we check for (p_g - pc) in order to ensure that (p_l > 0)
......
......@@ -50,7 +50,7 @@ SET_TYPE_PROP(FuelCellProblem, Grid, Dune::YaspGrid<2>);
// Set the problem property
SET_TYPE_PROP(FuelCellProblem, Problem, FuelCellProblem<TypeTag>);
// Set the primary variable combination for the 2pnc model
SET_INT_PROP(FuelCellProblem, Formulation, TwoPNCFormulation::pgSl);
SET_INT_PROP(FuelCellProblem, Formulation, TwoPNCFormulation::pnsw);
// Set fluid configuration
SET_PROP(FuelCellProblem, FluidSystem)
......
......@@ -64,7 +64,7 @@ SET_BOOL_PROP(DissolutionProblem, ProblemEnableGravity, true);
//Set properties here to override the default property settings in the model.
SET_INT_PROP(DissolutionProblem, ReplaceCompEqIdx, 1); //! Replace gas balance by total mass balance
SET_INT_PROP(DissolutionProblem, Formulation, TwoPNCFormulation::pgSl);
SET_INT_PROP(DissolutionProblem, Formulation, TwoPNCFormulation::pnsw);
}
/*!
......
......@@ -734,13 +734,13 @@
1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1
1 1 2 2 1 1 1 1 1 1 1 1
1 1 3 3 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 2 2 1 1 1 1 1 1 1
1 1 1 3 3 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 2 2 1 1 1 1 1 1
1 1 1 1 3 3 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 2 1 1 1 1 1
1 1 1 1 1 1 3 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1
1 1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1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1
2 2 2 2 2 2 2 2 2 2 2 2
2 2 2 2 1 1 1 1 1 1 1 1
3 3 3 3 3 3 3 3 3 3 3 3
3 3 3 3 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment