Commit b7a5f1d8 authored by Bernd Flemisch's avatar Bernd Flemisch Committed by Timo Koch
Browse files

[io][vtk] add primaryVariableName functions to almost all models

Missing: elastic, mpnc, nonequilibrium, mineralization.
parent fa05944b
......@@ -69,6 +69,19 @@ struct KEpsilonNCModelTraits : NavierStokesNCModelTraits<dimension, nComp, useMo
//! the indices
using Indices = KEpsilonIndices<dimension, nComp>;
//! return the names of the primary variables in cells
template <class FluidSystem>
static std::string primaryVariableNameCell(int pvIdx, int state = 0)
{
using ParentType = NavierStokesNCModelTraits<dimension, nComp, useMoles, replaceCompEqIdx>;
if (pvIdx < nComp)
return ParentType::template primaryVariableNameCell<FluidSystem>(pvIdx, state);
else if (pvIdx == nComp)
return "k";
else
return "epsilon";
}
};
//!< states some specifics of the isothermal multi-component low-Reynolds k-epsilon model
......
......@@ -74,6 +74,19 @@ struct KOmegaNCModelTraits : NavierStokesNCModelTraits<dimension, nComp, useMole
//! the indices
using Indices = KOmegaIndices<dimension, nComp>;
//! return the names of the primary variables in cells
template <class FluidSystem>
static std::string primaryVariableNameCell(int pvIdx, int state = 0)
{
using ParentType = NavierStokesNCModelTraits<dimension, nComp, useMoles, replaceCompEqIdx>;
if (pvIdx < nComp)
return ParentType::template primaryVariableNameCell<FluidSystem>(pvIdx, state);
else if (pvIdx == nComp)
return "k";
else
return "omega";
}
};
//!< states some specifics of the isothermal multi-component low-Reynolds k-epsilon model
......
......@@ -74,6 +74,19 @@ struct LowReKEpsilonNCModelTraits : NavierStokesNCModelTraits<dimension, nComp,
//! the indices
using Indices = LowReKEpsilonIndices<dimension, nComp>;
//! return the names of the primary variables in cells
template <class FluidSystem>
static std::string primaryVariableNameCell(int pvIdx, int state = 0)
{
using ParentType = NavierStokesNCModelTraits<dimension, nComp, useMoles, replaceCompEqIdx>;
if (pvIdx < nComp)
return ParentType::template primaryVariableNameCell<FluidSystem>(pvIdx, state);
else if (pvIdx == nComp)
return "k";
else
return "epsilon";
}
};
//!< states some specifics of the isothermal multi-component low-Reynolds k-epsilon model
......
......@@ -102,6 +102,18 @@ struct NavierStokesNCModelTraits : NavierStokesModelTraits<dimension>
//! the indices
using Indices = NavierStokesIndices<dimension>;
//! return the names of the primary variables in cells
template <class FluidSystem>
static std::string primaryVariableNameCell(int pvIdx = 0, int state = 0)
{
const std::string xString = useMoles() ? "x" : "X";
if (pvIdx == 0)
return NavierStokesModelTraits<dimension>::primaryVariableNameCell(pvIdx, state);
else
return xString + "^" + FluidSystem::componentName(pvIdx)
+ "_" + FluidSystem::phaseName(0);
}
};
///////////////////////////////////////////////////////////////////////////
......
......@@ -74,6 +74,17 @@ struct OneEqNCModelTraits : NavierStokesNCModelTraits<dimension, nComp, useMoles
//! the indices
using Indices = OneEqIndices<dimension, nComp>;
//! return the names of the primary variables in cells
template <class FluidSystem>
static std::string primaryVariableNameCell(int pvIdx, int state = 0)
{
using ParentType = NavierStokesNCModelTraits<dimension, nComp, useMoles, replaceCompEqIdx>;
if (pvIdx < nComp)
return ParentType::template primaryVariableNameCell<FluidSystem>(pvIdx, state);
else
return "nu_tilde";
}
};
//!< states some specifics of the isothermal multi-component one-equation model
......
......@@ -62,6 +62,23 @@ struct FreeflowNIModelTraits : public IsothermalTraits
static constexpr bool enableEnergyBalance() { return true; }
//! the indices
using Indices = FreeflowNonIsothermalIndices<typename IsothermalTraits::Indices, numEq()>;
static std::string primaryVariableName(int pvIdx, int state = 0)
{
if (pvIdx < numEq() - 1)
return IsothermalTraits::primaryVariableName(pvIdx, state);
else
return "T";
}
template <class FluidSystem>
static std::string primaryVariableName(int pvIdx, int state = 0)
{
if (pvIdx < numEq() - 1)
return IsothermalTraits::template primaryVariableName<FluidSystem>(pvIdx, state);
else
return "T";
}
};
} // end namespace Dumux
......
......@@ -104,7 +104,7 @@ struct OneEqModelTraits : RANSModelTraits<dimension>
static constexpr int dim() { return dimension; }
//! There are as many momentum balance equations as dimensions,
//! one mass balance equation and two turbulent transport equations
//! one mass balance equation and one turbulent transport equation
static constexpr int numEq() { return dim()+1+1; }
//! The number of components
......@@ -112,6 +112,16 @@ struct OneEqModelTraits : RANSModelTraits<dimension>
//! the indices
using Indices = OneEqIndices<dim(), numComponents()>;
//! return the names of the primary variables in cells
static std::string primaryVariableNameCell(int pvIdx, int state = 0)
{
using ParentType = RANSModelTraits<dimension>;
if (pvIdx == 0)
return ParentType::primaryVariableNameCell(pvIdx, state);
else
return "nu_tilde";
}
};
///////////////////////////////////////////////////////////////////////////
......
......@@ -99,6 +99,20 @@ struct KEpsilonModelTraits : RANSModelTraits<dimension>
//! the indices
using Indices = KEpsilonIndices<dim(), numComponents()>;
//! return the names of the primary variables in cells
static std::string primaryVariableNameCell(int pvIdx, int state = 0)
{
using ParentType = RANSModelTraits<dimension>;
switch (pvIdx) {
case 0:
return ParentType::primaryVariableNameCell(pvIdx, state);
case 1:
return "k";
default:
return "epsilon";
}
}
};
///////////////////////////////////////////////////////////////////////////
......
......@@ -106,6 +106,20 @@ struct KOmegaModelTraits : RANSModelTraits<dimension>
//! The indices
using Indices = KOmegaIndices<dim(), numComponents()>;
//! return the names of the primary variables in cells
static std::string primaryVariableNameCell(int pvIdx, int state = 0)
{
using ParentType = RANSModelTraits<dimension>;
switch (pvIdx) {
case 0:
return ParentType::primaryVariableNameCell(pvIdx, state);
case 1:
return "k";
default:
return "omega";
}
}
};
///////////////////////////////////////////////////////////////////////////
......
......@@ -115,6 +115,20 @@ struct LowReKEpsilonModelTraits : RANSModelTraits<dimension>
//! the indices
using Indices = LowReKEpsilonIndices<dim(), numComponents()>;
//! return the names of the primary variables in cells
static std::string primaryVariableNameCell(int pvIdx, int state = 0)
{
using ParentType = RANSModelTraits<dimension>;
switch (pvIdx) {
case 0:
return ParentType::primaryVariableNameCell(pvIdx, state);
case 1:
return "k";
default:
return "epsilon";
}
}
};
///////////////////////////////////////////////////////////////////////////
......
......@@ -77,7 +77,7 @@ struct OnePModelTraits
static std::string primaryVariableName(int pvIdx = 0, int state = 0)
{
return "pressure";
return "p";
}
};
......
......@@ -97,6 +97,17 @@ struct OnePNCModelTraits
static constexpr bool enableAdvection() { return true; }
static constexpr bool enableMolecularDiffusion() { return true; }
static constexpr bool enableEnergyBalance() { return false; }
template <class FluidSystem>
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);
}
};
/*!
......
......@@ -95,6 +95,17 @@ struct TwoPOneCModelTraits
static constexpr bool enableAdvection() { return true; }
static constexpr bool enableMolecularDiffusion() { return false; }
static constexpr bool enableEnergyBalance() { return false; }
template <class FluidSystem>
static std::string primaryVariableName(int pvIdx, int state)
{
if (pvIdx == 0)
return "p_n";
else if (state == Indices::twoPhases)
return "S_w";
else
return "T";
}
};
/*!
......
......@@ -134,6 +134,39 @@ struct TwoPNCModelTraits
static constexpr bool setMoleFractionsForFirstPhase() { return setMoleFractionForFP; }
static constexpr TwoPFormulation priVarFormulation() { return formulation; }
template <class FluidSystem>
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),
"S_n"};
const std::vector<std::string> p1s0SwitchedPvNames = {
xString + "^" + FluidSystem::componentName(FluidSystem::comp1Idx) + "_" + FluidSystem::phaseName(FluidSystem::phase0Idx),
xString + "^" + FluidSystem::componentName(FluidSystem::comp0Idx) + "_" + FluidSystem::phaseName(FluidSystem::phase1Idx),
"S_w"};
switch (priVarFormulation())
{
case TwoPFormulation::p0s1:
return pvIdx == 0 ? "p_w" : p0s1SwitchedPvNames[state-1];
case TwoPFormulation::p1s0:
return pvIdx == 0 ? "p_n" : p1s0SwitchedPvNames[state-1];
}
}
};
/*!
......
......@@ -89,6 +89,18 @@ struct ThreePModelTraits
static constexpr bool enableAdvection() { return true; }
static constexpr bool enableMolecularDiffusion() { return false; }
static constexpr bool enableEnergyBalance() { return false; }
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,6 +121,43 @@ struct ThreePThreeCModelTraits
static constexpr bool useConstraintSolver() { return useCS; }
static constexpr bool useMoles() { return useMol; }
template <class FluidSystem>
static std::string primaryVariableName(int pvIdx, int state = 0)
{
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,6 +111,43 @@ struct ThreePWaterOilModelTraits
static constexpr bool enableEnergyBalance() { return false; }
static constexpr bool onlyGasPhaseCanDisappear() { return onlyGasPhase; }
template <class FluidSystem>
static std::string primaryVariableName(int pvIdx, int state = 0)
{
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];
}
}
};
/*!
......
......@@ -80,7 +80,16 @@ struct PorousMediumFlowNIModelTraits : public IsothermalTraits
if (pvIdx < numEq() - 1)
return IsothermalTraits::primaryVariableName(pvIdx, state);
else
return "temperature";
return "T";
}
template <class FluidSystem>
static std::string primaryVariableName(int pvIdx, int state = 0)
{
if (pvIdx < numEq() - 1)
return IsothermalTraits::template primaryVariableName<FluidSystem>(pvIdx, state);
else
return "T";
}
};
......
......@@ -135,6 +135,14 @@ struct RichardsModelTraits
static constexpr bool enableAdvection() { return true; }
static constexpr bool enableMolecularDiffusion() { return enableDiff; }
static constexpr bool enableEnergyBalance() { return false; }
static std::string primaryVariableName(int pvIdx, int state)
{
if (state == Indices::gasPhaseOnly)
return "x^w_n";
else
return "p_w";
}
};
/*!
......
......@@ -114,6 +114,17 @@ struct RichardsNCModelTraits
static constexpr bool enableEnergyBalance() { return false; }
static constexpr bool useMoles() { return useMol; }
template <class FluidSystem>
static std::string primaryVariableName(int pvIdx, int state = 0)
{
const std::string xString = useMoles() ? "x" : "X";
if (pvIdx == 0)
return "p_" + FluidSystem::phaseName(0);
else
return xString + "^" + FluidSystem::componentName(pvIdx)
+ "_" + FluidSystem::phaseName(0);
}
};
namespace Properties {
......
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