Commit f8ad7006 authored by Ned Coltman's avatar Ned Coltman
Browse files

[DiffusionCoeffcientContainers] Replace template arguments with bool onlyTracers

parent 55c16e86
......@@ -74,12 +74,11 @@ class FicksLawImplementation<TypeTag, DiscretizationMethod::box, referenceSystem
using ComponentFluxVector = Dune::FieldVector<Scalar, numComponents>;
public:
template<int numPhases, int numComponents>
template <bool onlyTracers = false>
using DiffusionCoefficientsContainer = FickianDiffusionCoefficients<Scalar,
numPhases,
numComponents,
FluidSystem::isTracerFluidSystem()>;
onlyTracers>;
//return the reference system
static constexpr ReferenceSystemFormulation referenceSystemFormulation()
......
......@@ -71,9 +71,11 @@ class MaxwellStefansLawImplementation<TypeTag, DiscretizationMethod::box, refere
static_assert(referenceSystem == ReferenceSystemFormulation::massAveraged, "only the mass averaged reference system is supported for the Maxwell-Stefan formulation");
public:
template<int numFluidPhases, int numComponents>
using DiffusionCoefficientsContainer = MaxwellStefanDiffusionCoefficients<Scalar, numFluidPhases, numComponents>;
template <bool onlyTracers = false>
using DiffusionCoefficientsContainer = MaxwellStefanDiffusionCoefficients<Scalar,
numFluidPhases,
numComponents,
onlyTracers>;
//return the reference system
static constexpr ReferenceSystemFormulation referenceSystemFormulation()
......
......@@ -62,6 +62,7 @@ class FicksLawImplementation<TypeTag, DiscretizationMethod::ccmpfa, referenceSys
using BalanceEqOpts = GetPropType<TypeTag, Properties::BalanceEqOpts>;
static constexpr int numComponents = GetPropType<TypeTag, Properties::ModelTraits>::numFluidComponents();
static constexpr int numPhases = GetPropType<TypeTag, Properties::ModelTraits>::numFluidPhases();
using ComponentFluxVector = Dune::FieldVector<Scalar, numComponents>;
//! Class that fills the cache corresponding to mpfa Fick's Law
......@@ -163,17 +164,20 @@ class FicksLawImplementation<TypeTag, DiscretizationMethod::ccmpfa, referenceSys
public:
// state the discretization method this implementation belongs to
static const DiscretizationMethod discMethod = DiscretizationMethod::ccmpfa;
//return the reference system
static constexpr ReferenceSystemFormulation referenceSystemFormulation()
{ return referenceSystem; }
// state the type for the corresponding cache and its filler
using Cache = MpfaFicksLawCache;
//export the diffusion container
template<int numPhases, int numComponents>
template <bool onlyTracers = false>
using DiffusionCoefficientsContainer = FickianDiffusionCoefficients<Scalar,
numPhases,
numComponents,
FluidSystem::isTracerFluidSystem()>;
onlyTracers>;
//! Compute the diffusive flux across an scvf
static ComponentFluxVector flux(const Problem& problem,
......
......@@ -127,11 +127,11 @@ public:
//! state the type for the corresponding cache and its filler
using Cache = TpfaFicksLawCache;
template<int numPhases, int numComponents>
template<bool onlyTracers = false>
using DiffusionCoefficientsContainer = FickianDiffusionCoefficients<Scalar,
numPhases,
numComponents,
FluidSystem::isTracerFluidSystem()>;
onlyTracers>;
//! return diffusive fluxes for all components in a phase
static ComponentFluxVector flux(const Problem& problem,
......
......@@ -80,8 +80,8 @@ public:
static constexpr ReferenceSystemFormulation referenceSystemFormulation()
{ return referenceSystem; }
template<int numFluidPhases, int numComponents>
using DiffusionCoefficientsContainer = MaxwellStefanDiffusionCoefficients<Scalar, numFluidPhases, numComponents>;
template<bool onlyTracers = false>
using DiffusionCoefficientsContainer = MaxwellStefanDiffusionCoefficients<Scalar, numPhases, numComponents, onlyTracers>;
//! state the type for the corresponding cache and its filler
//! We don't cache anything for this law
......
......@@ -36,20 +36,20 @@ namespace Dumux {
* \tparam Scalar The type used for scalar values
* \tparam numPhases Number of phases in the fluid composition
* \tparam numComponents Number of components in the fluid composition
* \tparam allTracerComponents If false, this means that the main component of
* a phase is part of the components. In this case,
* the storage container is optimized with respect to
* memory consumption as diffusion coefficients of the
* main component of a phase in itself are not stored.
* If true, all diffusion coefficients of all components
* are stored
* \tparam onlyTracers If false, this means that the main component of
* a phase is part of the components. In this case,
* the storage container is optimized with respect to
* memory consumption as diffusion coefficients of the
* main component of a phase in itself are not stored.
* If true, all diffusion coefficients of all components
* are stored
*/
template <class Scalar, int numPhases, int numComponents, bool allTracerComponents>
template <class Scalar, int numPhases, int numComponents, bool onlyTracers = false>
class FickianDiffusionCoefficients;
//! General case (mpnc), for compositions containing the phases' main components
template <class Scalar, int numPhases, int numComponents>
class FickianDiffusionCoefficients<Scalar, numPhases, numComponents, false>
class FickianDiffusionCoefficients<Scalar, numPhases, numComponents>
{
public:
template<class DiffCoeffFunc>
......@@ -83,7 +83,7 @@ private:
//! Specialization for 1pnc & compositions containing the phases' main components
template <class Scalar, int numComponents>
class FickianDiffusionCoefficients<Scalar, 1, numComponents, false>
class FickianDiffusionCoefficients<Scalar, 1, numComponents>
{
public:
template<class DiffCoeffFunc>
......@@ -114,7 +114,7 @@ private:
//! Specialization for 2p2c & compositions containing the phases' main components
template <class Scalar>
class FickianDiffusionCoefficients<Scalar, 2, 2, false>
class FickianDiffusionCoefficients<Scalar, 2, 2>
{
public:
template<class DiffCoeffFunc>
......@@ -138,7 +138,7 @@ private:
//! Specialization for 3p2c & compositions containing the phases' main components
template <class Scalar>
class FickianDiffusionCoefficients<Scalar, 3, 2, false>
class FickianDiffusionCoefficients<Scalar, 3, 2>
{
public:
template<class DiffCoeffFunc>
......
......@@ -38,8 +38,15 @@ namespace Dumux {
* \tparam Scalar The type used for scalar values
* \tparam numPhases Number of phases in the fluid composition
* \tparam numComponents Number of components in the fluid composition
* \tparam onlyTracers If false, this means that the main component of
* a phase is part of the components. In this case,
* the storage container is optimized with respect to
* memory consumption as diffusion coefficients of the
* main component of a phase in itself are not stored.
* If true, all diffusion coefficients of all components
* are stored
*/
template <class Scalar, int numPhases, int numComponents>
template <class Scalar, int numPhases, int numComponents, bool onlyTracers = false>
class MaxwellStefanDiffusionCoefficients
{
public:
......
......@@ -63,6 +63,8 @@ class FicksLawImplementation<TypeTag, DiscretizationMethod::staggered, reference
using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>;
static constexpr int numComponents = ModelTraits::numFluidComponents();
static constexpr int numPhases = ModelTraits::numFluidPhases();
using NumEqVector = Dune::FieldVector<Scalar, numComponents>;
static_assert(ModelTraits::numFluidPhases() == 1, "Only one phase supported!");
......@@ -78,11 +80,11 @@ public:
//! We don't cache anything for this law
using Cache = FluxVariablesCaching::EmptyDiffusionCache;
template<int numPhases, int numComponents>
template <bool onlyTracers = false>
using DiffusionCoefficientsContainer = FickianDiffusionCoefficients<Scalar,
numPhases,
numComponents,
FluidSystem::isTracerFluidSystem()>;
onlyTracers>;
template<class Problem, class ElementVolumeVariables>
static NumEqVector flux(const Problem& problem,
......
......@@ -62,6 +62,7 @@ class MaxwellStefansLawImplementation<TypeTag, DiscretizationMethod::staggered,
using ModelTraits = GetPropType<TypeTag, Properties::ModelTraits>;
static const int numComponents = ModelTraits::numFluidComponents();
static const int numPhases = ModelTraits::numFluidPhases();
static constexpr bool useMoles = getPropValue<TypeTag, Properties::UseMoles>();
using ReducedComponentVector = Dune::FieldVector<Scalar, numComponents-1>;
......@@ -83,8 +84,8 @@ public:
using Cache = FluxVariablesCaching::EmptyDiffusionCache;
using CacheFiller = FluxVariablesCaching::EmptyCacheFiller;
template<int numPhases, int numComponents>
using DiffusionCoefficientsContainer = MaxwellStefanDiffusionCoefficients<Scalar, numPhases, numComponents>;
template <bool onlyTracers = false>
using DiffusionCoefficientsContainer = MaxwellStefanDiffusionCoefficients<Scalar, numPhases, numComponents, onlyTracers>;
template<class ElementVolumeVariables>
static CellCenterPrimaryVariables flux(const Problem& problem,
......
......@@ -45,7 +45,7 @@ class FreeflowNCVolumeVariables : public FreeFlowVolumeVariables< Traits, Freefl
static constexpr bool useMoles = Traits::ModelTraits::useMoles();
static constexpr int numFluidComps = ParentType::numFluidComponents();
using DiffusionCoefficients = typename Traits::DiffusionType::template DiffusionCoefficientsContainer<1, numFluidComps>;
using DiffusionCoefficients = typename Traits::DiffusionType::template DiffusionCoefficientsContainer<>;
public:
//! export the underlying fluid system
......
......@@ -55,7 +55,7 @@ class OnePNCVolumeVariables
using EffDiffModel = typename Traits::EffectiveDiffusivityModel;
using Idx = typename Traits::ModelTraits::Indices;
static constexpr int numFluidComps = ParentType::numFluidComponents();
using DiffusionCoefficients = typename Traits::DiffusionType::template DiffusionCoefficientsContainer<1, numFluidComps>;
using DiffusionCoefficients = typename Traits::DiffusionType::template DiffusionCoefficientsContainer<>;
enum
{
......
......@@ -101,7 +101,7 @@ class TwoPTwoCVolumeVariablesBase
using ComputeFromReferencePhase = Dumux::ComputeFromReferencePhase<Scalar, typename Traits::FluidSystem>;
using MiscibleMultiPhaseComposition = Dumux::MiscibleMultiPhaseComposition< Scalar, typename Traits::FluidSystem >;
using EffDiffModel = typename Traits::EffectiveDiffusivityModel;
using DiffusionCoefficients = typename Traits::DiffusionType::template DiffusionCoefficientsContainer<2, 2>;
using DiffusionCoefficients = typename Traits::DiffusionType::template DiffusionCoefficientsContainer<>;
public:
//! The type of the object returned by the fluidState() method
using FluidState = typename Traits::FluidState;
......
......@@ -91,7 +91,7 @@ class TwoPNCVolumeVariables
using MiscibleMultiPhaseComposition = Dumux::MiscibleMultiPhaseComposition<Scalar, FS>;
using ComputeFromReferencePhase = Dumux::ComputeFromReferencePhase<Scalar, FS>;
using EffDiffModel = typename Traits::EffectiveDiffusivityModel;
using DiffusionCoefficients = typename Traits::DiffusionType::template DiffusionCoefficientsContainer<2, numFluidComps>;
using DiffusionCoefficients = typename Traits::DiffusionType::template DiffusionCoefficientsContainer<>;
public:
//! Export fluid state type
......
......@@ -86,7 +86,7 @@ class ThreePThreeCVolumeVariables
};
using EffDiffModel = typename Traits::EffectiveDiffusivityModel;
using DiffusionCoefficients = typename Traits::DiffusionType::template DiffusionCoefficientsContainer<3, 3>;
using DiffusionCoefficients = typename Traits::DiffusionType::template DiffusionCoefficientsContainer<>;
public:
//! export fluid state type
......
......@@ -87,7 +87,7 @@ class ThreePWaterOilVolumeVariables
};
using EffDiffModel = typename Traits::EffectiveDiffusivityModel;
using DiffusionCoefficients = typename Traits::DiffusionType::template DiffusionCoefficientsContainer<3, 2>;
using DiffusionCoefficients = typename Traits::DiffusionType::template DiffusionCoefficientsContainer<>;
public:
//! The type of the object returned by the fluidState() method
......
......@@ -88,7 +88,7 @@ class TwoPTwoCCO2VolumeVariables
// type used for the diffusion coefficients
using EffDiffModel = typename Traits::EffectiveDiffusivityModel;
using DiffusionCoefficients = typename Traits::DiffusionType::template DiffusionCoefficientsContainer<2, 2>;
using DiffusionCoefficients = typename Traits::DiffusionType::template DiffusionCoefficientsContainer<>;
public:
//! The type of the object returned by the fluidState() method
......
......@@ -70,7 +70,7 @@ class MPNCVolumeVariablesImplementation<Traits, false>
using ComponentVector = Dune::FieldVector<Scalar, ModelTraits::numFluidComponents()>;
using CompositionFromFugacities = Dumux::CompositionFromFugacities<Scalar, typename Traits::FluidSystem>;
using EffDiffModel = typename Traits::EffectiveDiffusivityModel;
using DiffusionCoefficients = typename Traits::DiffusionType::template DiffusionCoefficientsContainer<ModelTraits::numFluidPhases(), ParentType::numFluidComponents()>;
using DiffusionCoefficients = typename Traits::DiffusionType::template DiffusionCoefficientsContainer<>;
public:
//! Export the type encapsulating primary variable indices
......@@ -535,7 +535,7 @@ class MPNCVolumeVariablesImplementation<Traits, true>
using CompositionFromFugacities = Dumux::CompositionFromFugacities<Scalar, typename Traits::FluidSystem>;
using ParameterCache = typename Traits::FluidSystem::ParameterCache;
using EffDiffModel = typename Traits::EffectiveDiffusivityModel;
using DiffusionCoefficients = typename Traits::DiffusionType::template DiffusionCoefficientsContainer<ModelTraits::numFluidPhases(), ParentType::numFluidComponents()>;
using DiffusionCoefficients = typename Traits::DiffusionType::template DiffusionCoefficientsContainer<>;
public:
//! Export the underlying fluid system
......
......@@ -55,7 +55,7 @@ class RichardsNCVolumeVariables
static constexpr bool useMoles = Traits::ModelTraits::useMoles();
using EffDiffModel = typename Traits::EffectiveDiffusivityModel;
using DiffusionCoefficients = typename Traits::DiffusionType::template DiffusionCoefficientsContainer<2, numFluidComps>;
using DiffusionCoefficients = typename Traits::DiffusionType::template DiffusionCoefficientsContainer<>;
public:
//! Export type of the fluid system
......
......@@ -59,7 +59,9 @@ class TracerVolumeVariables
static constexpr bool useMoles = Traits::ModelTraits::useMoles();
using EffDiffModel = typename Traits::EffectiveDiffusivityModel;
static constexpr int numFluidComps = ParentType::numFluidComponents();
using DiffusionCoefficients = typename Traits::DiffusionType::template DiffusionCoefficientsContainer<1, numFluidComps>;
static constexpr bool onlyTracerComponents = true;
using DiffusionCoefficients = typename Traits::DiffusionType::template DiffusionCoefficientsContainer<onlyTracerComponents>;
public:
//! Export fluid system type
......@@ -100,11 +102,11 @@ public:
// Update the binary diffusion and effective diffusion coefficients.
auto getDiffusionCoefficient = [&](int phaseIdx, int compIIdx, int compJIdx)
{
return FluidSystem::binaryDiffusionCoefficient( compIIdx,
compJIdx,
problem,
element,
scv);
return FluidSystem::binaryDiffusionCoefficient(compIIdx,
compJIdx,
problem,
element,
scv);
};
auto getEffectiveDiffusionCoefficient = [&](int phaseIdx, int compIIdx, int compJIdx)
......
......@@ -133,7 +133,8 @@ public:
// We set the value for the binary diffusion coefficient. This
// might depend on spatial parameters like pressure / temperature.
// But, in this case we neglect diffusion and return 0.0:
static Scalar binaryDiffusionCoefficient(unsigned int compIdx,
static Scalar binaryDiffusionCoefficient(unsigned int compIdxI,
unsigned int compIdxJ,
const Problem& problem,
const Element& element,
const SubControlVolume& scv)
......
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