Commit ae5f6d47 authored by Katharina Heck's avatar Katharina Heck Committed by Ned Coltman
Browse files

[2p][2pnc][2pncmin][co2] Adapt the 2p models to the new containers

parent 3a0981dd
......@@ -113,7 +113,7 @@ struct TwoPModelTraits
* \tparam SR The class used for reconstruction of
* non-wetting phase saturations in scvs
*/
template<class PV, class FSY, class FST,class SSY, class SST, class PT, class MT, class SR>
template<class PV, class FSY, class FST, class SSY, class SST, class PT, class MT, class SR>
struct TwoPVolumeVariablesTraits
{
using PrimaryVariables = PV;
......@@ -126,34 +126,6 @@ struct TwoPVolumeVariablesTraits
using SaturationReconstruction = SR;
};
/*!
* \ingroup TwoPModel
* \brief Traits class for the two-phase nonisothermal model.
*
* \tparam PV The type used for primary variables
* \tparam FSY The fluid system type
* \tparam FST The fluid state type
* \tparam SSY The solid system type
* \tparam SST The solid state type
* \tparam PT The type used for permeabilities
* \tparam MT The model traits
* \tparam SR The class used for reconstruction of
* non-wetting phase saturations in scvs
*/
template<class PV, class FSY, class FST,class SSY, class SST, class PT, class MT, class SR, class ETCM>
struct TwoPNIVolumeVariablesTraits
{
using PrimaryVariables = PV;
using FluidSystem = FSY;
using FluidState = FST;
using SolidSystem = SSY;
using SolidState = SST;
using PermeabilityType = PT;
using ModelTraits = MT;
using SaturationReconstruction = SR;
using EffectiveThermalConductivityModel = ETCM;
};
// necessary for models derived from 2p
class TwoPIOFields;
......@@ -250,16 +222,19 @@ private:
using SST = GetPropType<TypeTag, Properties::SolidState>;
using MT = GetPropType<TypeTag, Properties::ModelTraits>;
using PT = typename GetPropType<TypeTag, Properties::SpatialParams>::PermeabilityType;
using ETCM = GetPropType< TypeTag, Properties:: ThermalConductivityModel>;
static constexpr auto DM = GetPropType<TypeTag, Properties::FVGridGeometry>::discMethod;
static constexpr auto DM = GetPropType<TypeTag, Properties::GridGeometry>::discMethod;
static constexpr bool enableIS = getPropValue<TypeTag, Properties::EnableBoxInterfaceSolver>();
// class used for scv-wise reconstruction of non-wetting phase saturations
using SR = TwoPScvSaturationReconstruction<DM, enableIS>;
using BaseTraits = TwoPVolumeVariablesTraits<PV, FSY, FST, SSY, SST, PT, MT, SR>;
using ETCM = GetPropType< TypeTag, Properties:: ThermalConductivityModel>;
template<class BaseTraits, class ETCM>
struct NITraits : public BaseTraits { using EffectiveThermalConductivityModel = ETCM; };
using Traits = TwoPNIVolumeVariablesTraits<PV, FSY, FST, SSY, SST, PT, MT, SR, ETCM>;
public:
using type = TwoPVolumeVariables<Traits>;
using type = TwoPVolumeVariables<NITraits<BaseTraits, ETCM>>;
};
//! Set the vtk output fields specific to the non-isothermal twop model
......
......@@ -113,8 +113,8 @@ struct TwoPOneCNIModelTraits
* \tparam PT The type used for permeabilities
* \tparam MT The model traits
*/
template<class PV, class FSY, class FST, class SSY, class SST, class PT, class MT, class ETCM>
struct TwoPOneCNIVolumeVariablesTraits
template<class PV, class FSY, class FST, class SSY, class SST, class PT, class MT>
struct TwoPOneCVolumeVariablesTraits
{
using PrimaryVariables = PV;
using FluidSystem = FSY;
......@@ -123,7 +123,6 @@ struct TwoPOneCNIVolumeVariablesTraits
using SolidState = SST;
using PermeabilityType = PT;
using ModelTraits = MT;
using EffectiveThermalConductivityModel = ETCM;
};
namespace Properties {
......@@ -180,16 +179,17 @@ private:
using FST = GetPropType<TypeTag, Properties::FluidState>;
using SSY = GetPropType<TypeTag, Properties::SolidSystem>;
using SST = GetPropType<TypeTag, Properties::SolidState>;
using MT = GetPropType<TypeTag, Properties::ModelTraits>;
using PT = typename GetPropType<TypeTag, Properties::SpatialParams>::PermeabilityType;
using ETCM = GetPropType< TypeTag, Properties:: ThermalConductivityModel>;
using MT = GetPropType<TypeTag, Properties::ModelTraits>;
static_assert(FSY::numComponents == 1, "Only fluid systems with 1 component are supported by the 2p1cni model!");
static_assert(FSY::numPhases == 2, "Only fluid systems with 2 phases are supported by the 2p1cni model!");
using Traits = TwoPOneCNIVolumeVariablesTraits<PV, FSY, FST, SSY, SST, PT, MT, ETCM>;
using BaseTraits = TwoPOneCVolumeVariablesTraits<PV, FSY, FST, SSY, SST, PT, MT>;
using ETCM = GetPropType< TypeTag, Properties:: ThermalConductivityModel>;
template<class BaseTraits, class ETCM>
struct NITraits : public BaseTraits { using EffectiveThermalConductivityModel = ETCM; };
public:
using type = TwoPOneCVolumeVariables<Traits>;
using type = TwoPOneCVolumeVariables<NITraits<BaseTraits, ETCM>>;
};
//! The primary variables vector for the 2p1cni model.
......
......@@ -143,19 +143,27 @@ private:
using FST = GetPropType<TypeTag, Properties::FluidState>;
using SSY = GetPropType<TypeTag, Properties::SolidSystem>;
using SST = GetPropType<TypeTag, Properties::SolidState>;
using MT = GetPropType<TypeTag, Properties::ModelTraits>;
using PT = typename GetPropType<TypeTag, Properties::SpatialParams>::PermeabilityType;
using DT = GetPropType<TypeTag, Properties::MolecularDiffusionType>;
using EDM = GetPropType<TypeTag, Properties::EffectiveDiffusivityModel>;
using MT = GetPropType<TypeTag, Properties::ModelTraits>;
static constexpr auto DM = GetPropType<TypeTag, Properties::GridGeometry>::discMethod;
static constexpr bool enableIS = getPropValue<TypeTag, Properties::EnableBoxInterfaceSolver>();
static_assert(FSY::numComponents == 2, "Only fluid systems with 2 components are supported by the 2p2c model!");
static_assert(FSY::numPhases == 2, "Only fluid systems with 2 phases are supported by the 2p2c model!");
// class used for scv-wise reconstruction of non-wetting phase saturations
using SR = TwoPScvSaturationReconstruction<DM, enableIS>;
using BaseTraits = TwoPVolumeVariablesTraits<PV, FSY, FST, SSY, SST, PT, MT, SR>;
using DT = GetPropType<TypeTag, Properties::MolecularDiffusionType>;
using EDM = GetPropType<TypeTag, Properties::EffectiveDiffusivityModel>;
template<class BaseTraits, class DT, class EDM>
struct NCTraits : public BaseTraits
{
using DiffusionType = DT;
using EffectiveDiffusivityModel = EDM;
};
static constexpr bool useConstraintSolver = getPropValue<TypeTag, Properties::UseConstraintSolver>();
using Traits = TwoPNCVolumeVariablesTraits<PV, FSY, FST, SSY, SST, PT, MT, DT, EDM>;
public:
using type = TwoPTwoCVolumeVariables<Traits, useConstraintSolver>;
using type = TwoPTwoCVolumeVariables<NCTraits<BaseTraits, DT, EDM>, useConstraintSolver>;
};
//! Determines whether the constraint solver is used
......@@ -186,15 +194,27 @@ private:
using FST = GetPropType<TypeTag, Properties::FluidState>;
using SSY = GetPropType<TypeTag, Properties::SolidSystem>;
using SST = GetPropType<TypeTag, Properties::SolidState>;
using MT = GetPropType<TypeTag, Properties::ModelTraits>;
using PT = typename GetPropType<TypeTag, Properties::SpatialParams>::PermeabilityType;
using MT = GetPropType<TypeTag, Properties::ModelTraits>;
static constexpr auto DM = GetPropType<TypeTag, Properties::GridGeometry>::discMethod;
static constexpr bool enableIS = getPropValue<TypeTag, Properties::EnableBoxInterfaceSolver>();
// class used for scv-wise reconstruction of non-wetting phase saturations
using SR = TwoPScvSaturationReconstruction<DM, enableIS>;
using BaseTraits = TwoPVolumeVariablesTraits<PV, FSY, FST, SSY, SST, PT, MT, SR>;
using DT = GetPropType<TypeTag, Properties::MolecularDiffusionType>;
using EDM = GetPropType<TypeTag, Properties::EffectiveDiffusivityModel>;
using ETCM = GetPropType< TypeTag, Properties:: ThermalConductivityModel>;
using Traits = TwoPNCNIVolumeVariablesTraits<PV, FSY, FST, SSY, SST, PT, MT, DT, EDM, ETCM>;
template<class BaseTraits, class DT, class EDM, class ETCM>
struct NCNITraits : public BaseTraits
{
using DiffusionType = DT;
using EffectiveDiffusivityModel = EDM;
using EffectiveThermalConductivityModel = ETCM;
};
public:
using type = TwoPTwoCVolumeVariables<Traits>;
using type = TwoPTwoCVolumeVariables<NCNITraits<BaseTraits, DT, EDM, ETCM>>;
};
......@@ -281,17 +301,27 @@ private:
using FST = GetPropType<TypeTag, Properties::FluidState>;
using SSY = GetPropType<TypeTag, Properties::SolidSystem>;
using SST = GetPropType<TypeTag, Properties::SolidState>;
using MT = GetPropType<TypeTag, Properties::ModelTraits>;
using PT = typename GetPropType<TypeTag, Properties::SpatialParams>::PermeabilityType;
using MT = GetPropType<TypeTag, Properties::ModelTraits>;
static constexpr auto DM = GetPropType<TypeTag, Properties::GridGeometry>::discMethod;
static constexpr bool enableIS = getPropValue<TypeTag, Properties::EnableBoxInterfaceSolver>();
// class used for scv-wise reconstruction of non-wetting phase saturations
using SR = TwoPScvSaturationReconstruction<DM, enableIS>;
using BaseTraits = TwoPVolumeVariablesTraits<PV, FSY, FST, SSY, SST, PT, MT, SR>;
using DT = GetPropType<TypeTag, Properties::MolecularDiffusionType>;
using EDM = GetPropType<TypeTag, Properties::EffectiveDiffusivityModel>;
template<class BaseTraits, class DT, class EDM>
struct NCTraits : public BaseTraits
{
using DiffusionType = DT;
using EffectiveDiffusivityModel = EDM;
};
static constexpr bool useConstraintSolver = getPropValue<TypeTag, Properties::UseConstraintSolver>();
using Traits = TwoPNCVolumeVariablesTraits<PV, FSY, FST, SSY, SST, PT, MT, DT, EDM>;
using EquilibriumVolVars = TwoPTwoCVolumeVariables<Traits, useConstraintSolver>;
using EquilibriumVolVars = TwoPTwoCVolumeVariables<NCTraits<BaseTraits, DT, EDM>, useConstraintSolver>;
public:
using type = NonEquilibriumVolumeVariables<Traits, EquilibriumVolVars>;
using type = NonEquilibriumVolumeVariables<NCTraits<BaseTraits, DT, EDM>, EquilibriumVolVars>;
};
/////////////////////////////////////////////////
......@@ -343,16 +373,27 @@ private:
using SST = GetPropType<TypeTag, Properties::SolidState>;
using MT = GetPropType<TypeTag, Properties::ModelTraits>;
using PT = typename GetPropType<TypeTag, Properties::SpatialParams>::PermeabilityType;
static constexpr auto DM = GetPropType<TypeTag, Properties::GridGeometry>::discMethod;
static constexpr bool enableIS = getPropValue<TypeTag, Properties::EnableBoxInterfaceSolver>();
// class used for scv-wise reconstruction of non-wetting phase saturations
using SR = TwoPScvSaturationReconstruction<DM, enableIS>;
using BaseTraits = TwoPVolumeVariablesTraits<PV, FSY, FST, SSY, SST, PT, MT, SR>;
using DT = GetPropType<TypeTag, Properties::MolecularDiffusionType>;
using EDM = GetPropType<TypeTag, Properties::EffectiveDiffusivityModel>;
using ETCM = GetPropType< TypeTag, Properties:: ThermalConductivityModel>;
template<class BaseTraits, class DT, class EDM, class ETCM>
struct NCNITraits : public BaseTraits
{
using DiffusionType = DT;
using EffectiveDiffusivityModel = EDM;
using EffectiveThermalConductivityModel = ETCM;
};
static constexpr bool useConstraintSolver = getPropValue<TypeTag, Properties::UseConstraintSolver>();
using Traits = TwoPNCNIVolumeVariablesTraits<PV, FSY, FST, SSY, SST, PT, MT, DT, EDM, ETCM>;
using EquilibriumVolVars = TwoPTwoCVolumeVariables<Traits, useConstraintSolver>;
using EquilibriumVolVars = TwoPTwoCVolumeVariables<NCNITraits<BaseTraits, DT, EDM, ETCM>, useConstraintSolver>;
public:
using type = NonEquilibriumVolumeVariables<Traits, EquilibriumVolVars>;
using type = NonEquilibriumVolumeVariables<NCNITraits<BaseTraits, DT, EDM, ETCM>, EquilibriumVolVars>;
};
//! Somerton is used as default model to compute the effective thermal heat conductivity
......
......@@ -153,17 +153,27 @@ public:
relativePermeability_[wPhaseIdx_] = MaterialLaw::krw(matParams, saturation(wPhaseIdx_));
relativePermeability_[nPhaseIdx] = MaterialLaw::krn(matParams, saturation(wPhaseIdx_));
// binary diffusion coefficients
diffCoeff_(phase0Idx, comp0Idx, comp1Idx) = FluidSystem::binaryDiffusionCoefficient(fluidState_, paramCache, phase0Idx, comp0Idx, comp1Idx);
diffCoeff_(phase1Idx, comp1Idx, comp0Idx) = FluidSystem::binaryDiffusionCoefficient(fluidState_, paramCache, phase1Idx, comp0Idx, comp1Idx);
// porosity & permeabilty
updateSolidVolumeFractions(elemSol, problem, element, scv, solidState_, numFluidComps);
EnergyVolVars::updateSolidEnergyParams(elemSol, problem, element, scv, solidState_);
permeability_ = problem.spatialParams().permeability(element, scv, elemSol);
effectiveDiffCoeff_(phase0Idx, comp0Idx, comp1Idx) = EffDiffModel::effectiveDiffusivity(*this, phase0Idx, comp0Idx, comp1Idx);
effectiveDiffCoeff_(phase1Idx, comp1Idx, comp0Idx) = EffDiffModel::effectiveDiffusivity(*this, phase1Idx, comp1Idx, comp0Idx);
auto getDiffusionCoefficient = [&](int phaseIdx, int compIIdx, int compJIdx)
{
return FluidSystem::binaryDiffusionCoefficient(this->fluidState_,
paramCache,
phaseIdx,
compIIdx,
compJIdx);
};
auto getEffectiveDiffusionCoefficient = [&](int phaseIdx, int compIIdx, int compJIdx)
{
return EffDiffModel::effectiveDiffusionCoefficient(*this, phaseIdx, compIIdx, compJIdx);
};
diffCoeff_.update(getDiffusionCoefficient);
effectiveDiffCoeff_.update(getEffectiveDiffusionCoefficient);
EnergyVolVars::updateEffectiveThermalConductivity();
}
......@@ -379,7 +389,7 @@ public:
*/
[[deprecated("Signature deprecated. Use diffusionCoefficient(phaseIdx, compIIdx, compJIdx)!")]]
Scalar diffusionCoefficient(int phaseIdx, int compIdx) const
{ return diffCoeff_(phaseIdx, 0, 0); }
{ return diffCoeff_(phaseIdx, FluidSystem::getMainComponent(phaseIdx), compIdx); }
/*!
* \brief Returns the binary diffusion coefficients for a phase in \f$[m^2/s]\f$.
......@@ -390,14 +400,7 @@ public:
/*!
* \brief Returns the effective diffusion coefficients for a phase in \f$[m^2/s]\f$.
*/
[[deprecated("Signature deprecated. Use effectiveDiffusivity(phaseIdx, compIIdx, compJIdx)!")]]
Scalar effectiveDiffusivity(int phaseIdx, int compI) const
{ return effectiveDiffCoeff_(phaseIdx, 0, 0); }
/*!
* \brief Returns the effective diffusion coefficients for a phase in \f$[m^2/s]\f$.
*/
Scalar effectiveDiffusivity(int phaseIdx, int compIIdx, int compJIdx) const
Scalar effectiveDiffusionCoefficient(int phaseIdx, int compIIdx, int compJIdx) const
{ return effectiveDiffCoeff_(phaseIdx, compIIdx, compJIdx); }
/*!
......
......@@ -137,51 +137,6 @@ struct TwoPNCModelTraits
static constexpr TwoPFormulation priVarFormulation() { return formulation; }
};
/*!
* \ingroup TwoPNCModel
* \brief Traits class for the volume variables of the single-phase model.
*
* \tparam PV The type used for primary variables
* \tparam FSY The fluid system type
* \tparam FST The fluid state type
* \tparam PT The type used for permeabilities
* \tparam MT The model traits
* \tparam DT The diffusion type
* \tparam EDM The effective diffusivity model
*/
template<class PV, class FSY, class FST, class SSY, class SST, class PT, class MT, class DT, class EDM>
struct TwoPNCVolumeVariablesTraits
{
using PrimaryVariables = PV;
using FluidSystem = FSY;
using FluidState = FST;
using SolidSystem = SSY;
using SolidState = SST;
using PermeabilityType = PT;
using ModelTraits = MT;
using DiffusionType = DT;
using EffectiveDiffusivityModel = EDM;
};
/*!
* \ingroup TwoPNCModel
* \brief Traits class for the volume variables of the single-phase model.
*
* \tparam PV The type used for primary variables
* \tparam FSY The fluid system type
* \tparam FST The fluid state type
* \tparam PT The type used for permeabilities
* \tparam MT The model traits
* \tparam DT The diffusion type
* \tparam EDM The effective diffusivity model
* \tparam ETCM The effective thermal conductivity model
*/
template<class PV, class FSY, class FST, class SSY, class SST, class PT, class MT, class DT, class EDM, class ETCM>
struct TwoPNCNIVolumeVariablesTraits : public TwoPNCVolumeVariablesTraits<PV, FSY, FST, SSY, SST, PT, MT, DT, EDM>
{
using EffectiveThermalConductivityModel = ETCM;
};
namespace Properties {
//////////////////////////////////////////////////////////////////
// Type tags
......@@ -216,14 +171,26 @@ private:
using FST = GetPropType<TypeTag, Properties::FluidState>;
using SSY = GetPropType<TypeTag, Properties::SolidSystem>;
using SST = GetPropType<TypeTag, Properties::SolidState>;
using MT = GetPropType<TypeTag, Properties::ModelTraits>;
using PT = typename GetPropType<TypeTag, Properties::SpatialParams>::PermeabilityType;
using MT = GetPropType<TypeTag, Properties::ModelTraits>;
static constexpr auto DM = GetPropType<TypeTag, Properties::GridGeometry>::discMethod;
static constexpr bool enableIS = getPropValue<TypeTag, Properties::EnableBoxInterfaceSolver>();
// class used for scv-wise reconstruction of non-wetting phase saturations
using SR = TwoPScvSaturationReconstruction<DM, enableIS>;
using BaseTraits = TwoPVolumeVariablesTraits<PV, FSY, FST, SSY, SST, PT, MT, SR>;
using DT = GetPropType<TypeTag, Properties::MolecularDiffusionType>;
using EDM = GetPropType<TypeTag, Properties::EffectiveDiffusivityModel>;
using Traits = TwoPNCVolumeVariablesTraits<PV, FSY, FST, SSY, SST, PT, MT, DT, EDM>;
template<class BaseTraits, class DT, class EDM>
struct NCTraits : public BaseTraits
{
using DiffusionType = DT;
using EffectiveDiffusivityModel = EDM;
};
public:
using type = TwoPNCVolumeVariables<Traits>;
using type = TwoPNCVolumeVariables<NCTraits<BaseTraits, DT, EDM>>;
};
//! Set the base model traits
......@@ -302,15 +269,27 @@ private:
using FST = GetPropType<TypeTag, Properties::FluidState>;
using SSY = GetPropType<TypeTag, Properties::SolidSystem>;
using SST = GetPropType<TypeTag, Properties::SolidState>;
using MT = GetPropType<TypeTag, Properties::ModelTraits>;
using PT = typename GetPropType<TypeTag, Properties::SpatialParams>::PermeabilityType;
using MT = GetPropType<TypeTag, Properties::ModelTraits>;
static constexpr auto DM = GetPropType<TypeTag, Properties::GridGeometry>::discMethod;
static constexpr bool enableIS = getPropValue<TypeTag, Properties::EnableBoxInterfaceSolver>();
// class used for scv-wise reconstruction of non-wetting phase saturations
using SR = TwoPScvSaturationReconstruction<DM, enableIS>;
using BaseTraits = TwoPVolumeVariablesTraits<PV, FSY, FST, SSY, SST, PT, MT, SR>;
using DT = GetPropType<TypeTag, Properties::MolecularDiffusionType>;
using EDM = GetPropType<TypeTag, Properties::EffectiveDiffusivityModel>;
using ETCM = GetPropType< TypeTag, Properties:: ThermalConductivityModel>;
using Traits = TwoPNCNIVolumeVariablesTraits<PV, FSY, FST, SSY, SST, PT, MT, DT, EDM, ETCM>;
template<class BaseTraits, class DT, class EDM, class ETCM>
struct NCNITraits : public BaseTraits
{
using DiffusionType = DT;
using EffectiveDiffusivityModel = EDM;
using EffectiveThermalConductivityModel = ETCM;
};
public:
using type = TwoPNCVolumeVariables<Traits>;
using type = TwoPNCVolumeVariables<NCNITraits<BaseTraits, DT, EDM, ETCM>>;
};
//! Set non-isothermal output fields
......
......@@ -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>;
public:
//! Export fluid state type
......@@ -154,30 +154,22 @@ public:
//update porosity before calculating the effective properties depending on it
updateSolidVolumeFractions(elemSol, problem, element, scv, solidState_, numFluidComps);
// binary diffusion coefficients
for (unsigned int compJIdx = 0; compJIdx < ModelTraits::numFluidComponents(); ++compJIdx)
auto getDiffusionCoefficient = [&](int phaseIdx, int compIIdx, int compJIdx)
{
if(compJIdx != comp0Idx)
{
setDiffusionCoefficient_( phase0Idx, compJIdx,
FluidSystem::binaryDiffusionCoefficient(fluidState_,
paramCache,
phase0Idx,
comp0Idx,
compJIdx) );
setEffectiveDiffusionCoefficient_(phase0Idx, compJIdx);
}
if(compJIdx != comp1Idx)
{
setDiffusionCoefficient_( phase1Idx, compJIdx,
FluidSystem::binaryDiffusionCoefficient(fluidState_,
paramCache,
phase1Idx,
comp1Idx,
compJIdx) );
setEffectiveDiffusionCoefficient_(phase1Idx, compJIdx);
}
}
return FluidSystem::binaryDiffusionCoefficient(this->fluidState_,
paramCache,
phaseIdx,
compIIdx,
compJIdx);
};
auto getEffectiveDiffusionCoefficient = [&](int phaseIdx, int compIIdx, int compJIdx)
{
return EffDiffModel::effectiveDiffusionCoefficient(*this, phaseIdx, compIIdx, compJIdx);
};
diffCoeff_.update(getDiffusionCoefficient);
effectiveDiffCoeff_.update(getEffectiveDiffusionCoefficient);
// calculate the remaining quantities
EnergyVolVars::updateSolidEnergyParams(elemSol, problem, element, scv, solidState_);
......@@ -461,28 +453,26 @@ public:
/*!
* \brief Returns the diffusion coefficient
*/
[[deprecated("Signature deprecated. Use diffusionCoefficient(phaseIdx, compIIdx, compJIdx)!")]]
Scalar diffusionCoefficient(int phaseIdx, int compIdx) const
{
if (compIdx < phaseIdx)
return diffCoefficient_[phaseIdx][compIdx];
else if (compIdx > phaseIdx)
return diffCoefficient_[phaseIdx][compIdx-1];
if (compIdx != phaseIdx)
return diffCoeff_(phaseIdx, FluidSystem::getMainComponent(phaseIdx), compIdx);
else
DUNE_THROW(Dune::InvalidStateException, "Diffusion coefficient called for phaseIdx = compIdx");
}
/*!
* \brief Returns the binary diffusion coefficients for a phase in \f$[m^2/s]\f$.
*/
Scalar diffusionCoefficient(int phaseIdx, int compIIdx, int compJIdx) const
{ return diffCoeff_(phaseIdx, compIIdx, compJIdx); }
/*!
* \brief Returns the effective diffusion coefficients for a phase in \f$[m^2/s]\f$.
*/
Scalar effectiveDiffusivity(int phaseIdx, int compIdx) const
{
if (compIdx < phaseIdx)
return effectiveDiffCoeff_[phaseIdx][compIdx];
else if (compIdx > phaseIdx)
return effectiveDiffCoeff_[phaseIdx][compIdx-1];
else
DUNE_THROW(Dune::InvalidStateException, "Diffusion coefficient called for phaseIdx = compIdx");
}
Scalar effectiveDiffusionCoefficient(int phaseIdx, int compIIdx, int compJIdx) const
{ return effectiveDiffCoeff_(phaseIdx, compIIdx, compJIdx); }
/*!
* \brief Returns the mass fraction of a component in the phase
......@@ -513,32 +503,13 @@ protected:
SolidState solidState_;
private:
void setDiffusionCoefficient_(int phaseIdx, int compIdx, Scalar d)
{
if (compIdx < phaseIdx)
diffCoefficient_[phaseIdx][compIdx] = std::move(d);
else if (compIdx > phaseIdx)
diffCoefficient_[phaseIdx][compIdx-1] = std::move(d);
else
DUNE_THROW(Dune::InvalidStateException, "Diffusion coefficient for phaseIdx = compIdx doesn't exist");
}
void setEffectiveDiffusionCoefficient_(int phaseIdx, int compIdx)
{
if (compIdx < phaseIdx)
effectiveDiffCoeff_[phaseIdx][compIdx] = EffDiffModel::effectiveDiffusivity(*this, diffCoefficient_[phaseIdx][compIdx], phaseIdx);
else if (compIdx > phaseIdx)
effectiveDiffCoeff_[phaseIdx][compIdx-1] = EffDiffModel::effectiveDiffusivity(*this, diffCoefficient_[phaseIdx][compIdx-1], phaseIdx);
else
DUNE_THROW(Dune::InvalidStateException, "Effective diffusion coefficient for phaseIdx = compIdx doesn't exist");
}
Scalar pc_; // The capillary pressure
Scalar porosity_; // Effective porosity within the control volume
PermeabilityType permeability_; // Effective permeability within the control volume
Scalar mobility_[ModelTraits::numFluidPhases()]; // Effective mobility within the control volume
std::array<std::array<Scalar, ModelTraits::numFluidComponents()-1>, ModelTraits::numFluidPhases()> diffCoefficient_;
std::array<std::array<Scalar, ModelTraits::numFluidComponents()-1>, ModelTraits::numFluidPhases()> effectiveDiffCoeff_;
DiffusionCoefficients diffCoeff_;
DiffusionCoefficients effectiveDiffCoeff_;
int wPhaseIdx_;
};
......
......@@ -134,14 +134,27 @@ private:
using FST = GetPropType<TypeTag, Properties::FluidState>;
using SSY = GetPropType<TypeTag, Properties::SolidSystem>;
using SST = GetPropType<TypeTag, Properties::SolidState>;
using MT = GetPropType<TypeTag, Properties::ModelTraits>;
using PT = typename GetPropType<TypeTag, Properties::SpatialParams>::PermeabilityType;
using MT = GetPropType<TypeTag, Properties::ModelTraits>;
static constexpr auto DM = GetPropType<TypeTag, Properties::GridGeometry>::discMethod;
static constexpr bool enableIS = getPropValue<TypeTag, Properties::EnableBoxInterfaceSolver>();
// class used for scv-wise reconstruction of non-wetting phase saturations
using SR = TwoPScvSaturationReconstruction<DM, enableIS>;
using BaseTraits = TwoPVolumeVariablesTraits<PV, FSY, FST, SSY, SST, PT, MT, SR>;
using DT = GetPropType<TypeTag, Properties::MolecularDiffusionType>;
using EDM = GetPropType<TypeTag, Properties::EffectiveDiffusivityModel>;
using Traits = TwoPNCVolumeVariablesTraits<PV, FSY, FST, SSY, SST, PT, MT, EDM>;
using NonMinVolVars = TwoPNCVolumeVariables<Traits>;
template<class BaseTraits, class DT, class EDM>
struct NCTraits : public BaseTraits
{
using DiffusionType = DT;
using EffectiveDiffusivityModel = EDM;
};
using NonMinVolVars = TwoPNCVolumeVariables<NCTraits<BaseTraits, DT, EDM>>;
public:
using type = MineralizationVolumeVariables<Traits, NonMinVolVars>;
using type = MineralizationVolumeVariables<NCTraits<BaseTraits, DT, EDM>, NonMinVolVars>;
};
//! Set the vtk output fields specific to this model
......@@ -197,16 +210,30 @@ private:
using FST = GetPropType<TypeTag, Properties::FluidState>;