Commit 68328b23 authored by Kilian Weishaupt's avatar Kilian Weishaupt
Browse files

[porousmediumflow] Remove superfluous primaryVariableName() function from model traits

* used outdated names
* now implemented in IOFields
parent cba2f91b
......@@ -74,12 +74,6 @@ struct OnePModelTraits
static constexpr bool enableAdvection() { return true; }
static constexpr bool enableMolecularDiffusion() { return false; }
static constexpr bool enableEnergyBalance() { return false; }
template <class FluidSystem = void, class SolidSystem = void>
static std::string primaryVariableName(int pvIdx = 0, int state = 0)
{
return "p";
}
};
/*!
......
......@@ -99,17 +99,6 @@ struct OnePNCModelTraits
static constexpr bool enableAdvection() { return true; }
static constexpr bool enableMolecularDiffusion() { return true; }
static constexpr bool enableEnergyBalance() { return false; }
template <class FluidSystem, class SolidSystem = void>
static std::string primaryVariableName(int pvIdx, int state = 0)
{
const std::string xString = useMoles() ? "x" : "X";
if (pvIdx == 0)
return "p";
else
return xString + "^" + FluidSystem::componentName(pvIdx)
+ "_" + FluidSystem::phaseName(0);
}
};
/*!
......
......@@ -98,17 +98,6 @@ struct TwoPModelTraits
static constexpr bool enableAdvection() { return true; }
static constexpr bool enableMolecularDiffusion() { return false; }
static constexpr bool enableEnergyBalance() { return false; }
template <class FluidSystem, class SolidSystem = void>
static std::string primaryVariableName(int pvIdx, int state = 0)
{
if (priVarFormulation() == TwoPFormulation::p0s1)
return pvIdx == 0 ? IOName::pressure<FluidSystem>(FluidSystem::phase0Idx)
: IOName::saturation<FluidSystem>(FluidSystem::phase1Idx) ;
else
return pvIdx == 0 ? IOName::pressure<FluidSystem>(FluidSystem::phase1Idx)
: IOName::saturation<FluidSystem>(FluidSystem::phase0Idx);
}
};
/*!
......
......@@ -102,17 +102,6 @@ struct TwoPOneCNIModelTraits
static constexpr bool enableEnergyBalance() { return true; }
static constexpr TwoPFormulation priVarFormulation() { return f; }
template <class FluidSystem = void, class SolidSystem = void>
static std::string primaryVariableName(int pvIdx, int state)
{
if (priVarFormulation() == TwoPFormulation::p0s1)
return (pvIdx == 0) ? "p_w" :
(state == Indices::twoPhases) ? "S_n" : "T";
else
return (pvIdx == 0) ? "p_n" :
(state == Indices::twoPhases) ? "S_w" : "T";
}
};
/*!
......
......@@ -92,40 +92,6 @@
namespace Dumux {
/*!
* \ingroup TwoPTwoCModel
* \brief Specifies a number properties of two-phase two-component models.
*
* \tparam f The two-phase formulation used
* \tparam useM Boolean to specify if moles or masses are balanced
* \tparam replCompEqIdx the equation which is replaced by the total mass balance (none if replCompEqIdx >= numComponents)
*/
template<TwoPFormulation formulation, bool useMol, int replCompEqIdx = 2>
struct TwoPTwoCModelTraits : public TwoPNCModelTraits</*numComps=*/2, useMol, /*setMFracForFirstPhase=*/true, formulation, replCompEqIdx>
{
template <class FluidSystem, class SolidSystem = void>
static std::string primaryVariableName(int pvIdx, int state)
{
static const std::string xString = useMol ? "x" : "X";
static const std::array<std::string, 3> p0s1SwitchedPvNames = {{
xString + "^" + FluidSystem::componentName(1) + "_" + FluidSystem::phaseName(0),
xString + "^" + FluidSystem::componentName(0) + "_" + FluidSystem::phaseName(1),
"S_n"}};
static const std::array<std::string, 3> p1s0SwitchedPvNames = {{
xString + "^" + FluidSystem::componentName(1) + "_" + FluidSystem::phaseName(0),
xString + "^" + FluidSystem::componentName(0) + "_" + FluidSystem::phaseName(1),
"S_w"}};
switch (formulation)
{
case TwoPFormulation::p0s1:
return pvIdx == 0 ? "p_w" : p0s1SwitchedPvNames[state-1];
case TwoPFormulation::p1s0:
return pvIdx == 0 ? "p_n" : p1s0SwitchedPvNames[state-1];
}
}
};
namespace Properties {
//////////////////////////////////////////////////////////////////
......@@ -153,9 +119,11 @@ private:
static_assert(FluidSystem::numPhases == 2, "Only fluid systems with 2 phases are supported by the 2p-2c model!");
public:
using type = TwoPTwoCModelTraits< getPropValue<TypeTag, Properties::Formulation>(),
getPropValue<TypeTag, Properties::UseMoles>(),
getPropValue<TypeTag, Properties::ReplaceCompEqIdx>() >;
using type = TwoPNCModelTraits<FluidSystem::numComponents,
getPropValue<TypeTag, Properties::UseMoles>(),
/*setMFracForFirstPhase=*/true,
getPropValue<TypeTag, Properties::Formulation>(),
getPropValue<TypeTag, Properties::ReplaceCompEqIdx>()>;
};
template<class TypeTag>
struct ModelTraits<TypeTag, TTag::TwoPTwoC> { using type = GetPropType<TypeTag, Properties::BaseModelTraits>; };
......
......@@ -134,42 +134,6 @@ struct TwoPNCModelTraits
static constexpr bool setMoleFractionsForFirstPhase() { return setMoleFractionForFP; }
static constexpr TwoPFormulation priVarFormulation() { return formulation; }
template <class FluidSystem, class SolidSystem = void>
static std::string primaryVariableName(int pvIdx, int state)
{
const std::string xString = useMoles() ? "x" : "X";
std::string phaseNameSecComps;
if (state == Indices::firstPhaseOnly
|| (state == Indices::bothPhases && setMoleFractionsForFirstPhase()))
phaseNameSecComps = FluidSystem::phaseName(FluidSystem::phase0Idx);
else
phaseNameSecComps = FluidSystem::phaseName(FluidSystem::phase1Idx);
if (pvIdx > 1)
return xString + "^" + FluidSystem::componentName(pvIdx) + "_" + phaseNameSecComps;
const std::vector<std::string> p0s1SwitchedPvNames = {
xString + "^" + FluidSystem::componentName(FluidSystem::comp1Idx) + "_" + FluidSystem::phaseName(FluidSystem::phase0Idx),
xString + "^" + FluidSystem::componentName(FluidSystem::comp0Idx) + "_" + FluidSystem::phaseName(FluidSystem::phase1Idx),
IOName::saturation<FluidSystem>(FluidSystem::phase1Idx)};
const std::vector<std::string> p1s0SwitchedPvNames = {
xString + "^" + FluidSystem::componentName(FluidSystem::comp1Idx) + "_" + FluidSystem::phaseName(FluidSystem::phase0Idx),
xString + "^" + FluidSystem::componentName(FluidSystem::comp0Idx) + "_" + FluidSystem::phaseName(FluidSystem::phase1Idx),
IOName::saturation<FluidSystem>(FluidSystem::phase0Idx)};
switch (priVarFormulation())
{
case TwoPFormulation::p0s1:
return pvIdx == 0 ? IOName::pressure<FluidSystem>(FluidSystem::phase0Idx)
: p0s1SwitchedPvNames[state-1];
case TwoPFormulation::p1s0:
return pvIdx == 0 ? IOName::pressure<FluidSystem>(FluidSystem::phase1Idx)
: p1s0SwitchedPvNames[state-1];
default: DUNE_THROW(Dune::InvalidStateException, "Invalid formulation ");
}
}
};
/*!
......
......@@ -89,17 +89,6 @@ struct ThreePModelTraits
static constexpr bool enableAdvection() { return true; }
static constexpr bool enableMolecularDiffusion() { return false; }
static constexpr bool enableEnergyBalance() { return false; }
template <class FluidSystem = void, class SolidSystem = void>
static std::string primaryVariableName(int pvIdx, int state = 0)
{
switch (pvIdx)
{
case 0: return "p_g";
case 1: return "S_w";
default: return "S_n";
}
}
};
/*!
......
......@@ -121,56 +121,6 @@ struct ThreePThreeCModelTraits
static constexpr bool useConstraintSolver() { return useCS; }
static constexpr bool useMoles() { return useMol; }
template <class FluidSystem, class SolidSystem = void>
static std::string primaryVariableName(int pvIdx, int state)
{
switch (state)
{
case Indices::threePhases:
{
const std::vector<std::string> s1 = {"p_g",
"S_w",
"S_n"};
return s1[pvIdx];
}
case Indices::wPhaseOnly:
{
const std::vector<std::string> s2 = {"p_g",
"x^" + FluidSystem::componentName(FluidSystem::gCompIdx) + "_" + FluidSystem::phaseName(FluidSystem::wPhaseIdx),
"x^" + FluidSystem::componentName(FluidSystem::nCompIdx) + "_" + FluidSystem::phaseName(FluidSystem::wPhaseIdx)};
return s2[pvIdx];
}
case Indices::gnPhaseOnly:
{
const std::vector<std::string> s3 = {"p_g",
"x^" + FluidSystem::componentName(FluidSystem::wCompIdx) + "_" + FluidSystem::phaseName(FluidSystem::gPhaseIdx),
"S_n"};
return s3[pvIdx];
}
case Indices::wnPhaseOnly:
{
const std::vector<std::string> s4 = {"p_g",
"x^" + FluidSystem::componentName(FluidSystem::gCompIdx) + "_" + FluidSystem::phaseName(FluidSystem::wPhaseIdx),
"S_n"};
return s4[pvIdx];
}
case Indices::gPhaseOnly:
{
const std::vector<std::string> s5 = {"p_g",
"x^" + FluidSystem::componentName(FluidSystem::wCompIdx) + "_" + FluidSystem::phaseName(FluidSystem::gPhaseIdx),
"x^" + FluidSystem::componentName(FluidSystem::nCompIdx) + "_" + FluidSystem::phaseName(FluidSystem::gPhaseIdx)};
return s5[pvIdx];
}
case Indices::wgPhaseOnly:
{
const std::vector<std::string> s6 = {"p_g",
"S_w",
"x^" + FluidSystem::componentName(FluidSystem::nCompIdx) + "_" + FluidSystem::phaseName(FluidSystem::gPhaseIdx)};
return s6[pvIdx];
}
}
}
};
/*!
......
......@@ -111,56 +111,6 @@ struct ThreePWaterOilModelTraits
static constexpr bool enableEnergyBalance() { return false; }
static constexpr bool onlyGasPhaseCanDisappear() { return onlyGasPhase; }
template <class FluidSystem, class SolidSystem = void>
static std::string primaryVariableName(int pvIdx, int state)
{
switch (state)
{
case Indices::threePhases:
{
const std::vector<std::string> s1 = {"p_g",
"S_w",
"S_n"};
return s1[pvIdx];
}
case Indices::wPhaseOnly:
{
const std::vector<std::string> s2 = {"p_w",
"T",
"x^" + FluidSystem::componentName(FluidSystem::nCompIdx) + "_" + FluidSystem::phaseName(FluidSystem::wPhaseIdx)};
return s2[pvIdx];
}
case Indices::gnPhaseOnly:
{
const std::vector<std::string> s3 = {"p_g",
"S_n",
"x^" + FluidSystem::componentName(FluidSystem::wCompIdx) + "_" + FluidSystem::phaseName(FluidSystem::nPhaseIdx)};
return s3[pvIdx];
}
case Indices::wnPhaseOnly:
{
const std::vector<std::string> s4 = {"p_w",
"T",
"S_n"};
return s4[pvIdx];
}
case Indices::gPhaseOnly:
{
const std::vector<std::string> s5 = {"p_g",
"T",
"x^" + FluidSystem::componentName(FluidSystem::nCompIdx) + "_" + FluidSystem::phaseName(FluidSystem::gPhaseIdx)};
return s5[pvIdx];
}
case Indices::wgPhaseOnly:
{
const std::vector<std::string> s6 = {"p_g",
"S_w",
"x^" + FluidSystem::componentName(FluidSystem::nCompIdx) + "_" + FluidSystem::phaseName(FluidSystem::gPhaseIdx)};
return s6[pvIdx];
}
}
}
};
/*!
......
......@@ -53,15 +53,6 @@ struct MineralizationModelTraits : public NonMinTraits
static constexpr int numInertSolidComps() { return numInertSC; }
//! we additionally solve one equation per precipitating mineral phase
static constexpr int numEq() { return NonMinTraits::numEq() + numSC - numInertSC; }
template <class FluidSystem, class SolidSystem>
static std::string primaryVariableName(int pvIdx, int state = 0)
{
if (pvIdx < NonMinTraits::numEq())
return NonMinTraits::template primaryVariableName<FluidSystem, SolidSystem>(pvIdx, state);
else
return "precipitateVolumeFraction^" + SolidSystem::componentName(pvIdx -NonMinTraits::numEq());
}
};
} // end namespace Dumux
......
......@@ -153,26 +153,6 @@ struct MPNCModelTraits
//! Per default, we use the indices without offset
using Indices = MPNCIndices< numPhases(), numEq() >;
template <class FluidSystem, class SolidSystem = void>
static std::string primaryVariableName(int pvIdx, int state=0)
{
if (pvIdx < numComponents())
return "fugacity^"+ FluidSystem::componentName(pvIdx);
else if (pvIdx < numEq()-1)
return "S_"+ FluidSystem::phaseName(pvIdx - numComponents());
else
{
switch (pressureFormulation())
{
case MpNcPressureFormulation::mostWettingFirst :
return "p_"+ FluidSystem::phaseName(0);
case MpNcPressureFormulation::leastWettingFirst :
return "p_"+ FluidSystem::phaseName(numPhases()-1);
default: DUNE_THROW(Dune::InvalidStateException, "Invalid formulation ");
}
}
}
};
/*!
......
......@@ -78,15 +78,6 @@ struct PorousMediumFlowNIModelTraits : public IsothermalT
static constexpr bool enableEnergyBalance() { return true; }
//! The indices related to the non-isothermal model
using Indices = EnergyIndices< typename IsothermalTraits::Indices, numEq()>;
template <class FluidSystem = void, class SolidSystem = void>
static std::string primaryVariableName(int pvIdx, int state = 0)
{
if (pvIdx < numEq() - 1)
return IsothermalTraits::template primaryVariableName<FluidSystem, SolidSystem>(pvIdx, state);
else
return "T";
}
};
} // end namespace Dumux
......
......@@ -135,16 +135,6 @@ struct RichardsModelTraits
static constexpr bool enableAdvection() { return true; }
static constexpr bool enableMolecularDiffusion() { return enableDiff; }
static constexpr bool enableEnergyBalance() { return false; }
template<class FluidSystem, class SolidSystem = void>
static std::string primaryVariableName(int pvIdx, int state)
{
if (state == Indices::gasPhaseOnly)
return "x^" + FluidSystem::componentName(FluidSystem::comp0Idx)
+ "_" + FluidSystem::phaseName(FluidSystem::phase1Idx);
else
return IOName::pressure<FluidSystem>(FluidSystem::phase0Idx);
}
};
/*!
......
......@@ -114,17 +114,6 @@ struct RichardsNCModelTraits
static constexpr bool enableEnergyBalance() { return false; }
static constexpr bool useMoles() { return useMol; }
template <class FluidSystem, class SolidSystem = void>
static std::string primaryVariableName(int pvIdx, int state = 0)
{
const std::string xString = useMoles() ? "x" : "X";
if (pvIdx == 0)
return IOName::pressure<FluidSystem>(0);
else
return xString + "^" + FluidSystem::componentName(pvIdx)
+ "_" + FluidSystem::phaseName(0);
}
};
namespace Properties {
......
......@@ -85,13 +85,6 @@ struct TracerModelTraits
static constexpr bool enableEnergyBalance() { return false; }
static constexpr bool useMoles() { return useMol; }
template <class FluidSystem, class SolidSystem = void>
static std::string primaryVariableName(int pvIdx, int state = 0)
{
const std::string xString = useMoles() ? "x" : "X";
return xString + "^" + FluidSystem::componentName(pvIdx);
}
};
/*!
......
Supports Markdown
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