Commit 42c9292a authored by Kilian Weishaupt's avatar Kilian Weishaupt Committed by Thomas Fetzer
Browse files

[freeflow] Remove PhaseIdx and fluidsystemPhaseIdx

* remove now obsolete NavierStokesNCIndices
parent cbc39ecb
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
/*****************************************************************************
* See the file COPYING for full copying permissions. *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
*****************************************************************************/
/*!
* \file
* \ingroup FreeflowNCModel
* \copydoc Dumux::FreeflowNCIndices
*/
#ifndef DUMUX_FREEFLOW_NC_INDICES_HH
#define DUMUX_FREEFLOW_NC_INDICES_HH
#include <dumux/freeflow/navierstokes/indices.hh>
namespace Dumux {
/*!
* \ingroup FreeflowNCModel
* \brief The common indices for the isothermal multi-component free-flow model.
*/
template <int dimension, int numEquations,
int phaseIdx, int theReplaceCompEqIdx,
class FreeflowIndices>
struct FreeflowNCIndices : public FreeflowIndices
{
public:
//! The index of the fluid phase in the fluid system
static constexpr int fluidSystemPhaseIdx = phaseIdx;
//! The index of the main component
static constexpr int mainCompIdx = fluidSystemPhaseIdx;
//! Index of the pressure has to equal the one of the main component
static constexpr int pressureIdx = FreeflowIndices::conti0EqIdx + mainCompIdx;
//! The index of the component whose mass balance will be replaced by the total one
static constexpr int replaceCompEqIdx = theReplaceCompEqIdx;
};
} // end namespace Dumux
#endif
......@@ -57,8 +57,8 @@ NEW_TYPE_TAG(KEpsilonNC, INHERITS_FROM(NavierStokesNC));
* \ingroup FreeflowNCModel
* \brief Traits for the low-Reynolds k-epsilon multi-component model
*/
template<int dimension, int nComp, int phaseIdx, int replaceCompEqIdx, bool useMoles>
struct KEpsilonNCModelTraits : NavierStokesNCModelTraits<dimension, nComp, phaseIdx, replaceCompEqIdx, useMoles>
template<int dimension, int nComp, bool useMoles, int replaceCompEqIdx>
struct KEpsilonNCModelTraits : NavierStokesNCModelTraits<dimension, nComp, useMoles, replaceCompEqIdx>
{
//! There are as many momentum balance equations as dimensions
//! and as many balance equations as components.
......@@ -68,7 +68,7 @@ struct KEpsilonNCModelTraits : NavierStokesNCModelTraits<dimension, nComp, phase
static constexpr bool usesTurbulenceModel() { return true; }
//! the indices
using Indices = FreeflowNCIndices<dimension, numEq(), phaseIdx, replaceCompEqIdx, KEpsilonIndices<dimension, nComp, phaseIdx>>;
using Indices = KEpsilonIndices<dimension, nComp>;
};
//!< states some specifics of the isothermal multi-component low-Reynolds k-epsilon model
......@@ -79,11 +79,10 @@ private:
static constexpr int dimension = GridView::dimension;
using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem);
static constexpr int numComponents = FluidSystem::numComponents;
static constexpr int phaseIdx = GET_PROP_VALUE(TypeTag, PhaseIdx);
static constexpr int replaceCompEqIdx = GET_PROP_VALUE(TypeTag, ReplaceCompEqIdx);
static constexpr bool useMoles = GET_PROP_VALUE(TypeTag, UseMoles);
static constexpr int replaceCompEqIdx = GET_PROP_VALUE(TypeTag, ReplaceCompEqIdx);
public:
using type = KEpsilonNCModelTraits<dimension, numComponents, phaseIdx, replaceCompEqIdx, useMoles>;
using type = KEpsilonNCModelTraits<dimension, numComponents, useMoles, replaceCompEqIdx>;
};
//! Set the volume variables property
......@@ -126,10 +125,9 @@ private:
using ModelTraits = typename GET_PROP_TYPE(TypeTag, ModelTraits);
using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry);
using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem);
static constexpr int phaseIdx = GET_PROP_VALUE(TypeTag, PhaseIdx);
using SinglePhaseVtkOutputFields = KEpsilonVtkOutputFields<FVGridGeometry>;
public:
using type = FreeflowNCVtkOutputFields<SinglePhaseVtkOutputFields, ModelTraits, FVGridGeometry, FluidSystem, phaseIdx>;
using type = FreeflowNCVtkOutputFields<SinglePhaseVtkOutputFields, ModelTraits, FVGridGeometry, FluidSystem>;
};
//////////////////////////////////////////////////////////////////////////
......@@ -147,10 +145,9 @@ private:
static constexpr int dim = GridView::dimension;
using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem);
static constexpr int numComponents = FluidSystem::numComponents;
static constexpr int phaseIdx = GET_PROP_VALUE(TypeTag, PhaseIdx);
static constexpr int replaceCompEqIdx = GET_PROP_VALUE(TypeTag, ReplaceCompEqIdx);
static constexpr bool useMoles = GET_PROP_VALUE(TypeTag, UseMoles);
using IsothermalModelTraits = KEpsilonNCModelTraits<dim, numComponents, phaseIdx, replaceCompEqIdx, useMoles>;
static constexpr int replaceCompEqIdx = GET_PROP_VALUE(TypeTag, ReplaceCompEqIdx);
using IsothermalModelTraits = KEpsilonNCModelTraits<dim, numComponents, useMoles, replaceCompEqIdx>;
public:
using type = FreeflowNIModelTraits<IsothermalModelTraits>;
};
......@@ -195,11 +192,10 @@ private:
using ModelTraits = typename GET_PROP_TYPE(TypeTag, ModelTraits);
using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry);
using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem);
static constexpr int phaseIdx = GET_PROP_VALUE(TypeTag, PhaseIdx);
using BaseVtkOutputFields = KEpsilonVtkOutputFields<FVGridGeometry>;
using NonIsothermalFields = FreeflowNonIsothermalVtkOutputFields<BaseVtkOutputFields, ModelTraits>;
public:
using type = FreeflowNCVtkOutputFields<NonIsothermalFields, ModelTraits, FVGridGeometry, FluidSystem, phaseIdx>;
using type = FreeflowNCVtkOutputFields<NonIsothermalFields, ModelTraits, FVGridGeometry, FluidSystem>;
};
// \}
......
......@@ -59,12 +59,11 @@ NEW_TYPE_TAG(KOmegaNC, INHERITS_FROM(NavierStokesNC));
*
* \tparam dimension The dimension of the problem
* \tparam nComp The number of components to be considered
* \tparam fluidSystemPhaseIdx The the index of the phase used for the fluid system
* \tparam replaceCompEqIdx The index of the component balance equation that should be replaced by a total mass/mole balance
* \tparam useM Use molar or mass balances
* \tparam replaceCompEqIdx The index of the component balance equation that should be replaced by a total mass/mole balance
*/
template<int dimension, int nComp, int fluidSystemPhaseIdx, int replaceCompEqIdx, bool useMoles>
struct KOmegaNCModelTraits : NavierStokesNCModelTraits<dimension, nComp, fluidSystemPhaseIdx, replaceCompEqIdx, useMoles>
template<int dimension, int nComp, bool useMoles, int replaceCompEqIdx>
struct KOmegaNCModelTraits : NavierStokesNCModelTraits<dimension, nComp, useMoles, replaceCompEqIdx>
{
//! There are as many momentum balance equations as dimensions
//! and as many balance equations as components.
......@@ -74,7 +73,7 @@ struct KOmegaNCModelTraits : NavierStokesNCModelTraits<dimension, nComp, fluidSy
static constexpr bool usesTurbulenceModel() { return true; }
//! the indices
using Indices = FreeflowNCIndices<dimension, numEq(), fluidSystemPhaseIdx, replaceCompEqIdx, KOmegaIndices<dimension, nComp, fluidSystemPhaseIdx>>;
using Indices = KOmegaIndices<dimension, nComp>;
};
//!< states some specifics of the isothermal multi-component low-Reynolds k-epsilon model
......@@ -85,11 +84,10 @@ private:
static constexpr int dimension = GridView::dimension;
using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem);
static constexpr int numComponents = FluidSystem::numComponents;
static constexpr int phaseIdx = GET_PROP_VALUE(TypeTag, PhaseIdx);
static constexpr int replaceCompEqIdx = GET_PROP_VALUE(TypeTag, ReplaceCompEqIdx);
static constexpr bool useMoles = GET_PROP_VALUE(TypeTag, UseMoles);
static constexpr int replaceCompEqIdx = GET_PROP_VALUE(TypeTag, ReplaceCompEqIdx);
public:
using type = KOmegaNCModelTraits<dimension, numComponents, phaseIdx, replaceCompEqIdx, useMoles>;
using type = KOmegaNCModelTraits<dimension, numComponents, useMoles, replaceCompEqIdx>;
};
//! Set the volume variables property
......@@ -132,10 +130,9 @@ private:
using ModelTraits = typename GET_PROP_TYPE(TypeTag, ModelTraits);
using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry);
using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem);
static constexpr int phaseIdx = GET_PROP_VALUE(TypeTag, PhaseIdx);
using SinglePhaseVtkOutputFields = KOmegaVtkOutputFields<FVGridGeometry>;
public:
using type = FreeflowNCVtkOutputFields<SinglePhaseVtkOutputFields, ModelTraits, FVGridGeometry, FluidSystem, phaseIdx>;
using type = FreeflowNCVtkOutputFields<SinglePhaseVtkOutputFields, ModelTraits, FVGridGeometry, FluidSystem>;
};
//////////////////////////////////////////////////////////////////////////
......@@ -153,10 +150,9 @@ private:
static constexpr int dim = GridView::dimension;
using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem);
static constexpr int numComponents = FluidSystem::numComponents;
static constexpr int phaseIdx = GET_PROP_VALUE(TypeTag, PhaseIdx);
static constexpr int replaceCompEqIdx = GET_PROP_VALUE(TypeTag, ReplaceCompEqIdx);
static constexpr bool useMoles = GET_PROP_VALUE(TypeTag, UseMoles);
using IsothermalModelTraits = KOmegaNCModelTraits<dim, numComponents, phaseIdx, replaceCompEqIdx, useMoles>;
static constexpr int replaceCompEqIdx = GET_PROP_VALUE(TypeTag, ReplaceCompEqIdx);
using IsothermalModelTraits = KOmegaNCModelTraits<dim, numComponents, useMoles, replaceCompEqIdx>;
public:
using type = FreeflowNIModelTraits<IsothermalModelTraits>;
};
......@@ -201,11 +197,10 @@ private:
using ModelTraits = typename GET_PROP_TYPE(TypeTag, ModelTraits);
using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry);
using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem);
static constexpr int phaseIdx = GET_PROP_VALUE(TypeTag, PhaseIdx);
using BaseVtkOutputFields = KOmegaVtkOutputFields<FVGridGeometry>;
using NonIsothermalFields = FreeflowNonIsothermalVtkOutputFields<BaseVtkOutputFields, ModelTraits>;
public:
using type = FreeflowNCVtkOutputFields<NonIsothermalFields, ModelTraits, FVGridGeometry, FluidSystem, phaseIdx>;
using type = FreeflowNCVtkOutputFields<NonIsothermalFields, ModelTraits, FVGridGeometry, FluidSystem>;
};
// \}
......
......@@ -59,12 +59,11 @@ NEW_TYPE_TAG(LowReKEpsilonNC, INHERITS_FROM(NavierStokesNC));
*
* \tparam dimension The dimension of the problem
* \tparam nComp The number of components to be considered
* \tparam fluidSystemPhaseIdx The the index of the phase used for the fluid system
* \tparam replaceCompEqIdx The index of the component balance equation that should be replaced by a total mass/mole balance
* \tparam useM Use molar or mass balances
* \tparam replaceCompEqIdx The index of the component balance equation that should be replaced by a total mass/mole balance
*/
template<int dimension, int nComp, int fluidSystemPhaseIdx, int replaceCompEqIdx, bool useMoles>
struct LowReKEpsilonNCModelTraits : NavierStokesNCModelTraits<dimension, nComp, fluidSystemPhaseIdx, replaceCompEqIdx, useMoles>
template<int dimension, int nComp, bool useMoles, int replaceCompEqIdx>
struct LowReKEpsilonNCModelTraits : NavierStokesNCModelTraits<dimension, nComp, useMoles, replaceCompEqIdx>
{
//! There are as many momentum balance equations as dimensions
//! and as many balance equations as components.
......@@ -74,7 +73,7 @@ struct LowReKEpsilonNCModelTraits : NavierStokesNCModelTraits<dimension, nComp,
static constexpr bool usesTurbulenceModel() { return true; }
//! the indices
using Indices = FreeflowNCIndices<dimension, numEq(), fluidSystemPhaseIdx, replaceCompEqIdx, LowReKEpsilonIndices<dimension, nComp, fluidSystemPhaseIdx>>;
using Indices = LowReKEpsilonIndices<dimension, nComp>;
};
//!< states some specifics of the isothermal multi-component low-Reynolds k-epsilon model
......@@ -85,11 +84,10 @@ private:
static constexpr int dimension = GridView::dimension;
using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem);
static constexpr int numComponents = FluidSystem::numComponents;
static constexpr int phaseIdx = GET_PROP_VALUE(TypeTag, PhaseIdx);
static constexpr int replaceCompEqIdx = GET_PROP_VALUE(TypeTag, ReplaceCompEqIdx);
static constexpr bool useMoles = GET_PROP_VALUE(TypeTag, UseMoles);
static constexpr int replaceCompEqIdx = GET_PROP_VALUE(TypeTag, ReplaceCompEqIdx);
public:
using type = LowReKEpsilonNCModelTraits<dimension, numComponents, phaseIdx, replaceCompEqIdx, useMoles>;
using type = LowReKEpsilonNCModelTraits<dimension, numComponents, useMoles, replaceCompEqIdx>;
};
//! Set the volume variables property
......@@ -132,10 +130,9 @@ private:
using ModelTraits = typename GET_PROP_TYPE(TypeTag, ModelTraits);
using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry);
using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem);
static constexpr int phaseIdx = GET_PROP_VALUE(TypeTag, PhaseIdx);
using SinglePhaseVtkOutputFields = LowReKEpsilonVtkOutputFields<FVGridGeometry>;
public:
using type = FreeflowNCVtkOutputFields<SinglePhaseVtkOutputFields, ModelTraits, FVGridGeometry, FluidSystem, phaseIdx>;
using type = FreeflowNCVtkOutputFields<SinglePhaseVtkOutputFields, ModelTraits, FVGridGeometry, FluidSystem>;
};
//////////////////////////////////////////////////////////////////////////
......@@ -153,10 +150,9 @@ private:
static constexpr int dim = GridView::dimension;
using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem);
static constexpr int numComponents = FluidSystem::numComponents;
static constexpr int phaseIdx = GET_PROP_VALUE(TypeTag, PhaseIdx);
static constexpr int replaceCompEqIdx = GET_PROP_VALUE(TypeTag, ReplaceCompEqIdx);
static constexpr bool useMoles = GET_PROP_VALUE(TypeTag, UseMoles);
using IsothermalModelTraits = LowReKEpsilonNCModelTraits<dim, numComponents, phaseIdx, replaceCompEqIdx, useMoles>;
static constexpr int replaceCompEqIdx = GET_PROP_VALUE(TypeTag, ReplaceCompEqIdx);
using IsothermalModelTraits = LowReKEpsilonNCModelTraits<dim, numComponents, useMoles, replaceCompEqIdx>;
public:
using type = FreeflowNIModelTraits<IsothermalModelTraits>;
};
......@@ -201,11 +197,10 @@ private:
using ModelTraits = typename GET_PROP_TYPE(TypeTag, ModelTraits);
using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry);
using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem);
static constexpr int phaseIdx = GET_PROP_VALUE(TypeTag, PhaseIdx);
using BaseVtkOutputFields = LowReKEpsilonVtkOutputFields<FVGridGeometry>;
using NonIsothermalFields = FreeflowNonIsothermalVtkOutputFields<BaseVtkOutputFields, ModelTraits>;
public:
using type = FreeflowNCVtkOutputFields<NonIsothermalFields, ModelTraits, FVGridGeometry, FluidSystem, phaseIdx>;
using type = FreeflowNCVtkOutputFields<NonIsothermalFields, ModelTraits, FVGridGeometry, FluidSystem>;
};
// \}
......
......@@ -60,7 +60,6 @@
#include <dumux/discretization/fourierslaw.hh>
#include "volumevariables.hh"
#include "indices.hh"
#include "localresidual.hh"
#include "fluxvariables.hh"
#include "vtkoutputfields.hh"
......@@ -79,12 +78,11 @@ namespace Dumux {
*
* \tparam dimension The dimension of the problem
* \tparam nComp The number of components to be considered
* \tparam fluidSystemPhaseIdx The the index of the phase used for the fluid system
* \tparam replaceCompEqIdx The index of the component balance equation that should be replaced by a total mass/mole balance
* \tparam useM Use molar or mass balances
* \tparam repCompEqIdx The index of the component balance equation that should be replaced by a total mass/mole balance
*/
template<int dimension, int nComp, int fluidSystemPhaseIdx, int replaceCompEqIdx, bool useM>
struct NavierStokesNCModelTraits : NavierStokesModelTraits<dimension, fluidSystemPhaseIdx>
template<int dimension, int nComp, bool useM, int repCompEqIdx = nComp>
struct NavierStokesNCModelTraits : NavierStokesModelTraits<dimension>
{
//! There are as many momentum balance equations as dimensions
//! and as many balance equations as components.
......@@ -99,8 +97,11 @@ struct NavierStokesNCModelTraits : NavierStokesModelTraits<dimension, fluidSyste
//! The one-phase model has no molecular diffusion
static constexpr bool enableMolecularDiffusion() { return true; }
//! Index of of a component balance eq. to be replaced by a total mass/mole balance
static constexpr int replaceCompEqIdx() { return repCompEqIdx; }
//! the indices
using Indices = FreeflowNCIndices<dimension, numEq(), fluidSystemPhaseIdx, replaceCompEqIdx, NavierStokesIndices<dimension, fluidSystemPhaseIdx>>;
using Indices = NavierStokesIndices<dimension>;
};
///////////////////////////////////////////////////////////////////////////
......@@ -130,18 +131,13 @@ private:
static constexpr int dim = GridView::dimension;
using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem);
static constexpr int numComponents = FluidSystem::numComponents;
static constexpr int phaseIdx = GET_PROP_VALUE(TypeTag, PhaseIdx);
static constexpr int replaceCompEqIdx = GET_PROP_VALUE(TypeTag, ReplaceCompEqIdx);
static constexpr bool useMoles = GET_PROP_VALUE(TypeTag, UseMoles);
static_assert(phaseIdx >= 0 && phaseIdx < FluidSystem::numPhases,
"PhaseIdx must be non-negative and smaller than the number of phases");
static constexpr int replaceCompEqIdx = GET_PROP_VALUE(TypeTag, ReplaceCompEqIdx);
public:
using type = NavierStokesNCModelTraits<dim, numComponents, phaseIdx, replaceCompEqIdx, useMoles>;
using type = NavierStokesNCModelTraits<dim, numComponents, useMoles, replaceCompEqIdx>;
};
SET_INT_PROP(NavierStokesNC, PhaseIdx, 0); //!< Defines the phaseIdx
SET_BOOL_PROP(NavierStokesNC, UseMoles, false); //!< Defines whether molar (true) or mass (false) density is used
SET_INT_PROP(NavierStokesNC, ReplaceCompEqIdx, 0); //<! Set the ReplaceCompEqIdx to 0 by default
SET_BOOL_PROP(NavierStokesNC, EnableInertiaTerms, true); //!< Consider inertia terms by default
......@@ -177,10 +173,9 @@ private:
using ModelTraits = typename GET_PROP_TYPE(TypeTag, ModelTraits);
using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry);
using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem);
static constexpr int phaseIdx = GET_PROP_VALUE(TypeTag, PhaseIdx);
using BaseVtkOutputFields = NavierStokesVtkOutputFields<FVGridGeometry>;
public:
using type = FreeflowNCVtkOutputFields<BaseVtkOutputFields, ModelTraits, FVGridGeometry, FluidSystem, phaseIdx>;
using type = FreeflowNCVtkOutputFields<BaseVtkOutputFields, ModelTraits, FVGridGeometry, FluidSystem>;
};
/*!
......@@ -213,10 +208,9 @@ private:
static constexpr int dim = GridView::dimension;
using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem);
static constexpr int numComponents = FluidSystem::numComponents;
static constexpr int phaseIdx = GET_PROP_VALUE(TypeTag, PhaseIdx);
static constexpr int replaceCompEqIdx = GET_PROP_VALUE(TypeTag, ReplaceCompEqIdx);
static constexpr bool useMoles = GET_PROP_VALUE(TypeTag, UseMoles);
using IsothermalModelTraits = NavierStokesNCModelTraits<dim, numComponents, phaseIdx, replaceCompEqIdx, useMoles>;
static constexpr int replaceCompEqIdx = GET_PROP_VALUE(TypeTag, ReplaceCompEqIdx);
using IsothermalModelTraits = NavierStokesNCModelTraits<dim, numComponents, useMoles, replaceCompEqIdx>;
public:
using type = FreeflowNIModelTraits<IsothermalModelTraits>;
};
......@@ -228,11 +222,10 @@ private:
using ModelTraits = typename GET_PROP_TYPE(TypeTag, ModelTraits);
using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry);
using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem);
static constexpr int phaseIdx = GET_PROP_VALUE(TypeTag, PhaseIdx);
using BaseVtkOutputFields = NavierStokesVtkOutputFields<FVGridGeometry>;
using NonIsothermalFields = FreeflowNonIsothermalVtkOutputFields<BaseVtkOutputFields, ModelTraits>;
public:
using type = FreeflowNCVtkOutputFields<NonIsothermalFields, ModelTraits, FVGridGeometry, FluidSystem, phaseIdx>;
using type = FreeflowNCVtkOutputFields<NonIsothermalFields, ModelTraits, FVGridGeometry, FluidSystem>;
};
//! Use Fourier's Law as default heat conduction type
......
......@@ -59,12 +59,11 @@ NEW_TYPE_TAG(OneEqNC, INHERITS_FROM(NavierStokesNC));
*
* \tparam dimension The dimension of the problem
* \tparam nComp The number of components to be considered
* \tparam fluidSystemPhaseIdx The the index of the phase used for the fluid system
* \tparam replaceCompEqIdx The index of the component balance equation that should be replaced by a total mass/mole balance
* \tparam useM Use molar or mass balances
* \tparam replaceCompEqIdx The index of the component balance equation that should be replaced by a total mass/mole balance
*/
template<int dimension, int nComp, int fluidSystemPhaseIdx, int replaceCompEqIdx, bool useMoles>
struct OneEqNCModelTraits : NavierStokesNCModelTraits<dimension, nComp, fluidSystemPhaseIdx, replaceCompEqIdx, useMoles>
template<int dimension, int nComp, bool useMoles, int replaceCompEqIdx>
struct OneEqNCModelTraits : NavierStokesNCModelTraits<dimension, nComp, useMoles, replaceCompEqIdx>
{
//! There are as many momentum balance equations as dimensions
//! and as many balance equations as components.
......@@ -74,7 +73,7 @@ struct OneEqNCModelTraits : NavierStokesNCModelTraits<dimension, nComp, fluidSys
static constexpr bool usesTurbulenceModel() { return true; }
//! the indices
using Indices = FreeflowNCIndices<dimension, numEq(), fluidSystemPhaseIdx, replaceCompEqIdx, OneEqIndices<dimension, nComp, fluidSystemPhaseIdx>>;
using Indices = OneEqIndices<dimension, nComp>;
};
//!< states some specifics of the isothermal multi-component one-equation model
......@@ -85,11 +84,10 @@ private:
static constexpr int dimension = GridView::dimension;
using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem);
static constexpr int numComponents = FluidSystem::numComponents;
static constexpr int phaseIdx = GET_PROP_VALUE(TypeTag, PhaseIdx);
static constexpr int replaceCompEqIdx = GET_PROP_VALUE(TypeTag, ReplaceCompEqIdx);
static constexpr bool useMoles = GET_PROP_VALUE(TypeTag, UseMoles);
static constexpr int replaceCompEqIdx = GET_PROP_VALUE(TypeTag, ReplaceCompEqIdx);
public:
using type = OneEqNCModelTraits<dimension, numComponents, phaseIdx, replaceCompEqIdx, useMoles>;
using type = OneEqNCModelTraits<dimension, numComponents, useMoles, replaceCompEqIdx>;
};
//! Set the volume variables property
......@@ -132,10 +130,9 @@ private:
using ModelTraits = typename GET_PROP_TYPE(TypeTag, ModelTraits);
using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry);
using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem);
static constexpr int phaseIdx = GET_PROP_VALUE(TypeTag, PhaseIdx);
using SinglePhaseVtkOutputFields = OneEqVtkOutputFields<FVGridGeometry>;
public:
using type = FreeflowNCVtkOutputFields<SinglePhaseVtkOutputFields, ModelTraits, FVGridGeometry, FluidSystem, phaseIdx>;
using type = FreeflowNCVtkOutputFields<SinglePhaseVtkOutputFields, ModelTraits, FVGridGeometry, FluidSystem>;
};
//////////////////////////////////////////////////////////////////////////
......@@ -153,10 +150,9 @@ private:
static constexpr int dim = GridView::dimension;
using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem);
static constexpr int numComponents = FluidSystem::numComponents;
static constexpr int phaseIdx = GET_PROP_VALUE(TypeTag, PhaseIdx);
static constexpr int replaceCompEqIdx = GET_PROP_VALUE(TypeTag, ReplaceCompEqIdx);
static constexpr bool useMoles = GET_PROP_VALUE(TypeTag, UseMoles);
using IsothermalModelTraits = OneEqNCModelTraits<dim, numComponents, phaseIdx, replaceCompEqIdx, useMoles>;
static constexpr int replaceCompEqIdx = GET_PROP_VALUE(TypeTag, ReplaceCompEqIdx);
using IsothermalModelTraits = OneEqNCModelTraits<dim, numComponents, useMoles, replaceCompEqIdx>;
public:
using type = FreeflowNIModelTraits<IsothermalModelTraits>;
};
......@@ -201,11 +197,10 @@ private:
using ModelTraits = typename GET_PROP_TYPE(TypeTag, ModelTraits);
using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry);
using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem);
static constexpr int phaseIdx = GET_PROP_VALUE(TypeTag, PhaseIdx);
using BaseVtkOutputFields = OneEqVtkOutputFields<FVGridGeometry>;
using NonIsothermalFields = FreeflowNonIsothermalVtkOutputFields<BaseVtkOutputFields, ModelTraits>;
public:
using type = FreeflowNCVtkOutputFields<NonIsothermalFields, ModelTraits, FVGridGeometry, FluidSystem, phaseIdx>;
using type = FreeflowNCVtkOutputFields<NonIsothermalFields, ModelTraits, FVGridGeometry, FluidSystem>;
};
// \}
......
......@@ -52,11 +52,11 @@ class FreeflowNCFluxVariablesImpl<TypeTag, DiscretizationMethod::staggered>
using Element = typename FVGridGeometry::GridView::template Codim<0>::Entity;
using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace;
using CellCenterPrimaryVariables = typename GET_PROP_TYPE(TypeTag, CellCenterPrimaryVariables);
using Indices = typename GET_PROP_TYPE(TypeTag, ModelTraits)::Indices;
using ModelTraits = typename GET_PROP_TYPE(TypeTag, ModelTraits);
public:
static constexpr auto numComponents = GET_PROP_TYPE(TypeTag, ModelTraits)::numComponents();
static constexpr bool useMoles = GET_PROP_VALUE(TypeTag, UseMoles);
static constexpr auto numComponents = ModelTraits::numComponents();
static constexpr bool useMoles = ModelTraits::useMoles();
using MolecularDiffusionType = typename GET_PROP_TYPE(TypeTag, MolecularDiffusionType);
/*!
......@@ -88,9 +88,9 @@ public:
flux += MolecularDiffusionType::flux(problem, element, fvGeometry, elemVolVars, scvf);
// in case one balance is substituted by the total mass balance
if (Indices::replaceCompEqIdx < numComponents)
if (ModelTraits::replaceCompEqIdx() < numComponents)
{
flux[Indices::replaceCompEqIdx] = std::accumulate(flux.begin(), flux.end(), 0.0);
flux[ModelTraits::replaceCompEqIdx()] = std::accumulate(flux.begin(), flux.end(), 0.0);
}
return flux;
......
......@@ -52,11 +52,11 @@ class FreeflowNCResidualImpl<TypeTag, DiscretizationMethod::staggered>
using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView;
using SubControlVolume = typename FVElementGeometry::SubControlVolume;
using CellCenterPrimaryVariables = typename GET_PROP_TYPE(TypeTag, CellCenterPrimaryVariables);
using Indices = typename GET_PROP_TYPE(TypeTag, ModelTraits)::Indices;
using ModelTraits = typename GET_PROP_TYPE(TypeTag, ModelTraits);
using Indices = typename ModelTraits::Indices;
using CellCenterResidual = CellCenterPrimaryVariables;
using ModelTraits = typename GET_PROP_TYPE(TypeTag, ModelTraits);
static constexpr int numComponents =ModelTraits::numComponents();
static constexpr bool useMoles = GET_PROP_VALUE(TypeTag, UseMoles);
......@@ -85,13 +85,13 @@ public:
const Scalar massOrMoleFraction = useMoles ? volVars.moleFraction(compIdx) : volVars.massFraction(compIdx);
const Scalar s = density * massOrMoleFraction;
if (eqIdx != Indices::replaceCompEqIdx)
if (eqIdx != ModelTraits::replaceCompEqIdx())
storage[eqIdx] += s;
}
// in case one balance is substituted by the total mass balance
if(Indices::replaceCompEqIdx < numComponents)
storage[Indices::replaceCompEqIdx] = density;
if(ModelTraits::replaceCompEqIdx() < numComponents)
storage[ModelTraits::replaceCompEqIdx()] = density;
EnergyLocalResidual::fluidPhaseStorage(storage, volVars);
......
......@@ -33,7 +33,7 @@ namespace Dumux
* \ingroup FreeflowNCModel
* \brief Adds vtk output fields specific to the FreeflowNC model
*/
template<class BaseVtkOutputFields, class ModelTraits, class FVGridGeometry, class FluidSystem, int phaseIdx>
template<class BaseVtkOutputFields, class ModelTraits, class FVGridGeometry, class FluidSystem>
class FreeflowNCVtkOutputFields
{
......@@ -52,15 +52,16 @@ public:
{
for (int j = 0; j < FluidSystem::numComponents; ++j)
{
vtk.addVolumeVariable([j](const auto& v){ return v.massFraction(j); }, "X^" + FluidSystem::componentName(j) + "_" + FluidSystem::phaseName(phaseIdx));
vtk.addVolumeVariable([j](const auto& v){ return v.moleFraction(j); }, "x^" + FluidSystem::componentName(j) + "_" + FluidSystem::phaseName(phaseIdx));
if (j != phaseIdx)
vtk.addVolumeVariable([j](const auto& v){ return v.massFraction(j); }, "X^" + FluidSystem::componentName(j) + "_" + FluidSystem::phaseName(0));
vtk.addVolumeVariable([j](const auto& v){ return v.moleFraction(j); }, "x^" + FluidSystem::componentName(j) + "_" + FluidSystem::phaseName(0));
if (j != FluidSystem::getMainComponent(0))
{
vtk.addVolumeVariable([j](const auto& v){ return v.diffusionCoefficient(0, j); }, "D^" + FluidSystem::componentName(j) + "_" + FluidSystem::phaseName(phaseIdx));
vtk.addVolumeVariable([j](const auto& v){ return v.diffusionCoefficient(0, j); }, "D^" + FluidSystem::componentName(j) + "_" + FluidSystem::phaseName(0));
if (ModelTraits::usesTurbulenceModel())
// the eddy diffusivity is recalculated for an arbitrary component which is not the phase component
vtk.addVolumeVariable([j](const auto& v){ return v.effectiveDiffusivity(0, j) - v.diffusionCoefficient(0, j); }, "D_t");
if (ModelTraits::usesTurbulenceModel())
vtk.addVolumeVariable([j](const auto& v){ return v.effectiveDiffusivity(0, j) - v.diffusionCoefficient(0, j); }, "D_t");
}
}
}
......
......@@ -57,8 +57,8 @@ NEW_TYPE_TAG(ZeroEqNC, INHERITS_FROM(NavierStokesNC));
* \ingroup ZeroEqModel
* \brief Traits for the Reynolds-averaged Navier-Stokes 0-Eq. model
*/
template<int dimension, int nComp, int phaseIdx, int replaceCompEqIdx, bool useM>
struct ZeroEqNCModelTraits : NavierStokesNCModelTraits<dimension, nComp, phaseIdx, replaceCompEqIdx, useM>
template<int dimension, int nComp, bool useM, int replaceCompEqIdx>
struct ZeroEqNCModelTraits : NavierStokesNCModelTraits<dimension, nComp, useM, replaceCompEqIdx>
{
//! The model does include a turbulence model
static constexpr bool usesTurbulenceModel() { return true; }
......@@ -72,11 +72,10 @@ private:
static constexpr int dim = GridView::dimension;
using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem);
static constexpr int numComponents = FluidSystem::numComponents;
static constexpr int phaseIdx = GET_PROP_VALUE(TypeTag, PhaseIdx);
static constexpr int replaceCompEqIdx = GET_PROP_VALUE(TypeTag, ReplaceCompEqIdx);
static constexpr bool useMoles = GET_PROP_VALUE(TypeTag, UseMoles);
static constexpr int replaceCompEqIdx = GET_PROP_VALUE(TypeTag, ReplaceCompEqIdx);
public:
using type = ZeroEqNCModelTraits<dim, numComponents, phaseIdx, replaceCompEqIdx, useMoles>;
using type = ZeroEqNCModelTraits<dim, numComponents, useMoles, replaceCompEqIdx>;
};
//! Set the volume variables property
......@@ -101,10 +100,9 @@ private:
using ModelTraits = typename GET_PROP_TYPE(TypeTag, ModelTraits);
using FVGridGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry);
using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem);
static constexpr int phaseIdx = GET_PROP_VALUE(TypeTag, PhaseIdx);
using BaseVtkOutputFields = RANSVtkOutputFields<FVGridGeometry>;
public:
using type = FreeflowNCVtkOutputFields<BaseVtkOutputFields, ModelTraits, FVGridGeometry, FluidSystem, phaseIdx>;
using type = FreeflowNCVtkOutputFields</