Skip to content
Snippets Groups Projects
Commit f3d5fd83 authored by Timo Koch's avatar Timo Koch
Browse files

[navierstokes] Make indices independent of TypeTag

parent 6c4b87b6
1 merge request!818[navierstokes] Free indices from TypeTag
......@@ -26,16 +26,18 @@
#include <dumux/common/properties.hh>
namespace Dumux
{
namespace Dumux {
// \{
/*!
* \ingroup NavierStokesModel
* \brief The common indices for the isothermal Navier-Stokes model.
*
* \tparam dimension The dimension of the problem
* \tparam numEquations the number of model equations
* \tparam PVOffset The first index in a primary variable vector.
*/
template <class TypeTag, int PVOffset = 0>
template <int dimension, int numEquations, int PVOffset = 0>
struct NavierStokesIndices
{
......@@ -47,10 +49,9 @@ struct NavierStokesIndices
static constexpr int conti0EqIdx = massBalanceIdx; //!< Index of the mass balance equation
static constexpr int pressureIdx = massBalanceIdx; //!< Index of the pressure in a solution vector
using GridView = typename GET_PROP_TYPE(TypeTag, GridView);
static constexpr auto dim = GridView::dimension;
static constexpr auto numEq = GET_PROP_VALUE(TypeTag, NumEq);
static constexpr auto momentumBalanceOffset = GET_PROP_VALUE(TypeTag, NumEq) - dim;
static constexpr auto dim = dimension;
static constexpr auto numEq = numEquations;
static constexpr auto momentumBalanceOffset = numEquations - dim;
static constexpr int momentumBalanceIdx = PVOffset + momentumBalanceOffset; //!< Index of the momentum balance equation
static constexpr int momentumXBalanceIdx = momentumBalanceIdx; //!< Index of the momentum balance equation
......
......@@ -135,7 +135,14 @@ SET_TYPE_PROP(NavierStokes, FluxVariables, NavierStokesFluxVariables<TypeTag>);
SET_TYPE_PROP(NavierStokes, FluxVariablesCache, FreeFlowFluxVariablesCache<TypeTag>);
//! The indices required by the isothermal single-phase model
SET_TYPE_PROP(NavierStokes, Indices, NavierStokesIndices<TypeTag>);
SET_PROP(NavierStokes, Indices)
{
private:
static constexpr int numEq = GET_PROP_VALUE(TypeTag, NumEq);
static constexpr int dim = GET_PROP_TYPE(TypeTag, GridView)::dimension;
public:
using type = NavierStokesIndices<dim, numEq>;
};
//! The specific vtk output fields
SET_TYPE_PROP(NavierStokes, VtkOutputFields, NavierStokesVtkOutputFields<TypeTag>);
......@@ -144,7 +151,14 @@ SET_TYPE_PROP(NavierStokes, VtkOutputFields, NavierStokesVtkOutputFields<TypeTag
// Property values for isothermal model required for the general non-isothermal model
//////////////////////////////////////////////////////////////////
//! The indices required by the isothermal single-phase model
SET_TYPE_PROP(NavierStokesNI, IsothermalIndices, NavierStokesIndices<TypeTag>);
SET_PROP(NavierStokesNI, IsothermalIndices)
{
private:
static constexpr int numEq = GET_PROP_VALUE(TypeTag, NumEq);
static constexpr int dim = GET_PROP_TYPE(TypeTag, GridView)::dimension;
public:
using type = NavierStokesIndices<dim, numEq>;
};
//! The specific isothermal vtk output fields
SET_TYPE_PROP(NavierStokesNI, IsothermalVtkOutputFields, NavierStokesVtkOutputFields<TypeTag>);
......
......@@ -27,8 +27,8 @@
#include <dumux/freeflow/navierstokes/indices.hh>
#include <dumux/common/properties.hh>
namespace Dumux
{
namespace Dumux {
// \{
/*!
* \ingroup NavierStokesNCModel
......@@ -36,19 +36,21 @@ namespace Dumux
*
* \tparam PVOffset The first index in a primary variable vector.
*/
template <class TypeTag, int PVOffset = 0>
struct NavierStokesNCIndices : public NavierStokesIndices<TypeTag, PVOffset>
template <int dimension, int numEquations,
int thePhaseIdx, int theReplaceCompEqIdx,
int PVOffset = 0>
struct NavierStokesNCIndices : public NavierStokesIndices<dimension, numEquations, PVOffset>
{
private:
using ParentType = NavierStokesIndices<TypeTag, PVOffset>;
using ParentType = NavierStokesIndices<dimension, numEquations, PVOffset>;
public:
static constexpr int phaseIdx = GET_PROP_VALUE(TypeTag, PhaseIdx); //!< The phase index
static constexpr int phaseIdx = thePhaseIdx; //!< The phase index
static constexpr int mainCompIdx = phaseIdx; //!< The index of the main component
//! The index of the component whose mass balance will be replaced by the total one
static constexpr int replaceCompEqIdx = GET_PROP_VALUE(TypeTag, ReplaceCompEqIdx);
static constexpr int replaceCompEqIdx = theReplaceCompEqIdx;
};
// \}
......
......@@ -144,7 +144,16 @@ SET_TYPE_PROP(NavierStokesNC, VolumeVariables, NavierStokesNCVolumeVariables<Typ
SET_TYPE_PROP(NavierStokesNC, FluxVariables, NavierStokesNCFluxVariables<TypeTag>);
//! The indices
SET_TYPE_PROP(NavierStokesNC, Indices, NavierStokesNCIndices<TypeTag>);
SET_PROP(NavierStokesNC, Indices)
{
private:
static constexpr int numEq = GET_PROP_VALUE(TypeTag, NumEq);
static constexpr int dim = GET_PROP_TYPE(TypeTag, GridView)::dimension;
static constexpr int phaseIdx = GET_PROP_VALUE(TypeTag, PhaseIdx);
static constexpr int replaceCompEqIdx = GET_PROP_VALUE(TypeTag, ReplaceCompEqIdx);
public:
using type = NavierStokesNCIndices<dim, numEq, phaseIdx, replaceCompEqIdx>;
};
//! The vtk output fields
SET_TYPE_PROP(NavierStokesNC, VtkOutputFields, NavierStokesNCVtkOutputFields<TypeTag>);
......@@ -171,7 +180,16 @@ SET_TYPE_PROP(NavierStokesNC, MolecularDiffusionType, FicksLaw<TypeTag>);
// Property values for isothermal model required for the general non-isothermal model
//////////////////////////////////////////////////////////////////
//! The isothermal indices
SET_TYPE_PROP(NavierStokesNCNI, IsothermalIndices, NavierStokesNCIndices<TypeTag>);
SET_PROP(NavierStokesNCNI, IsothermalIndices)
{
private:
static constexpr int numEq = GET_PROP_VALUE(TypeTag, NumEq);
static constexpr int dim = GET_PROP_TYPE(TypeTag, GridView)::dimension;
static constexpr int phaseIdx = GET_PROP_VALUE(TypeTag, PhaseIdx);
static constexpr int replaceCompEqIdx = GET_PROP_VALUE(TypeTag, ReplaceCompEqIdx);
public:
using type = NavierStokesNCIndices<dim, numEq, phaseIdx, replaceCompEqIdx>;
};
//! The isothermal vtk output fields
SET_TYPE_PROP(NavierStokesNCNI, IsothermalVtkOutputFields, NavierStokesNCVtkOutputFields<TypeTag>);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment