Commit 483eabae authored by Gabriele Seitz's avatar Gabriele Seitz Committed by Ned Coltman
Browse files

[1p][1pnc][1pncmin] Add effective laws to volumeVariables

parent 71325638
......@@ -86,13 +86,7 @@ struct OnePModelTraits
* \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>
template<class PV, class FSY, class FST, class SSY, class SST, class PT, class MT>
struct OnePVolumeVariablesTraits
{
using PrimaryVariables = PV;
......@@ -104,6 +98,30 @@ struct OnePVolumeVariablesTraits
using ModelTraits = MT;
};
/*!
* \ingroup OnePModel
* \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 ETCM The effective thermal conductivity model
*/
template<class PV, class FSY, class FST, class SSY, class SST, class PT, class MT, class ETCM>
struct OnePNIVolumeVariablesTraits
{
using PrimaryVariables = PV;
using FluidSystem = FSY;
using FluidState = FST;
using SolidSystem = SSY;
using SolidState = SST;
using PermeabilityType = PT;
using ModelTraits = MT;
using EffectiveThermalConductivityModel = ETCM;
};
namespace Properties {
// Create new type tags
namespace TTag {
......@@ -173,6 +191,25 @@ struct IOFields<TypeTag, TTag::OnePNI> { using type = EnergyIOFields<OnePIOField
template<class TypeTag>
struct ModelTraits<TypeTag, TTag::OnePNI> { using type = PorousMediumFlowNIModelTraits<OnePModelTraits>; };
//! Set the volume variables property
template<class TypeTag>
struct VolumeVariables<TypeTag, TTag::OnePNI>
{
private:
using PV = GetPropType<TypeTag, Properties::PrimaryVariables>;
using FSY = GetPropType<TypeTag, Properties::FluidSystem>;
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 Traits = OnePNIVolumeVariablesTraits<PV, FSY, FST, SSY, SST, PT, MT, ETCM>;
public:
using type = OnePVolumeVariables<Traits>;
};
//! Use the average for effective conductivities
template<class TypeTag>
struct ThermalConductivityModel<TypeTag, TTag::OnePNI>
......
......@@ -86,6 +86,7 @@ public:
updateSolidVolumeFractions(elemSol, problem, element, scv, solidState_, numFluidComps);
EnergyVolVars::updateSolidEnergyParams(elemSol, problem, element, scv, solidState_);
permeability_ = problem.spatialParams().permeability(element, scv, elemSol);
EnergyVolVars::updateEffectiveThermalConductivity();
}
/*!
......
......@@ -110,8 +110,9 @@ struct OnePNCModelTraits
* \tparam FST The fluid state type
* \tparam PT The type used for permeabilities
* \tparam MT The model traits
* \tparam EDM The effective diffusivity model
*/
template<class PV, class FSY, class FST, class SSY, class SST, class PT, class MT>
template<class PV, class FSY, class FST, class SSY, class SST, class PT, class MT, class DT, class EDM>
struct OnePNCVolumeVariablesTraits
{
using PrimaryVariables = PV;
......@@ -121,8 +122,29 @@ struct OnePNCVolumeVariablesTraits
using SolidState = SST;
using PermeabilityType = PT;
using ModelTraits = MT;
using DiffusionType = DT;
using EffectiveDiffusivityModel = EDM;
};
/*!
* \ingroup OnePNCModel
* \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 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 OnePNCNIVolumeVariablesTraits : public OnePNCVolumeVariablesTraits<PV, FSY, FST, SSY, SST, PT, MT, DT, EDM>
{
using EffectiveThermalConductivityModel = ETCM;
};
namespace Properties {
//////////////////////////////////////////////////////////////////
......@@ -203,8 +225,9 @@ private:
static_assert(FST::numComponents == MT::numFluidComponents(), "Number of components mismatch between model and fluid state");
static_assert(FSY::numPhases == MT::numFluidPhases(), "Number of phases mismatch between model and fluid system");
static_assert(FST::numPhases == MT::numFluidPhases(), "Number of phases mismatch between model and fluid state");
using Traits = OnePNCVolumeVariablesTraits<PV, FSY, FST, SSY, SST, PT, MT>;
using DT = GetPropType<TypeTag, Properties::MolecularDiffusionType>;
using EDM = GetPropType<TypeTag, Properties::EffectiveDiffusivityModel>;
using Traits = OnePNCVolumeVariablesTraits<PV, FSY, FST, SSY, SST, PT, MT, DT, EDM>;
public:
using type = OnePNCVolumeVariables<Traits>;
};
......@@ -236,6 +259,29 @@ public:
using type = PorousMediumFlowNIModelTraits<IsothermalTraits>;
};
template<class TypeTag>
struct VolumeVariables<TypeTag, TTag::OnePNCNI>
{
private:
using PV = GetPropType<TypeTag, Properties::PrimaryVariables>;
using FSY = GetPropType<TypeTag, Properties::FluidSystem>;
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;
static_assert(FSY::numComponents == MT::numFluidComponents(), "Number of components mismatch between model and fluid system");
static_assert(FST::numComponents == MT::numFluidComponents(), "Number of components mismatch between model and fluid state");
static_assert(FSY::numPhases == MT::numFluidPhases(), "Number of phases mismatch between model and fluid system");
static_assert(FST::numPhases == MT::numFluidPhases(), "Number of phases mismatch between model and fluid state");
using DT = GetPropType<TypeTag, Properties::MolecularDiffusionType>;
using EDM = GetPropType<TypeTag, Properties::EffectiveDiffusivityModel>;
using ETCM = GetPropType< TypeTag, Properties:: ThermalConductivityModel>;
using Traits = OnePNCNIVolumeVariablesTraits<PV, FSY, FST, SSY, SST, PT, MT, DT, EDM, ETCM>;
public:
using type = OnePNCVolumeVariables<Traits>;
};
} // end namespace Properties
template<class OnePNCModelTraits>
......@@ -318,8 +364,11 @@ private:
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 ETCM = GetPropType< TypeTag, Properties:: ThermalConductivityModel>;
using Traits = OnePNCVolumeVariablesTraits<PV, FSY, FST, SSY, SST, PT, MT>;
using Traits = OnePNCNIVolumeVariablesTraits<PV, FSY, FST, SSY, SST, PT, MT, DT, EDM, ETCM>;
using EquilibriumVolVars = OnePNCVolumeVariables<Traits>;
public:
using type = NonEquilibriumVolumeVariables<Traits, EquilibriumVolVars>;
......
......@@ -52,8 +52,10 @@ class OnePNCVolumeVariables
using EnergyVolVars = EnergyVolumeVariables<Traits, OnePNCVolumeVariables<Traits> >;
using Scalar = typename Traits::PrimaryVariables::value_type;
using PermeabilityType = typename Traits::PermeabilityType;
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>;
enum
{
......@@ -99,6 +101,7 @@ public:
updateSolidVolumeFractions(elemSol, problem, element, scv, solidState_, numFluidComps);
EnergyVolVars::updateSolidEnergyParams(elemSol, problem, element, scv, solidState_);
permeability_ = problem.spatialParams().permeability(element, scv, elemSol);
EnergyVolVars::updateEffectiveThermalConductivity();
// Second instance of a parameter cache.
// Could be avoided if diffusion coefficients also
......@@ -111,12 +114,16 @@ public:
{
for (unsigned int compJIdx = 0; compJIdx < numFluidComps; ++compJIdx)
{
if(compIIdx != compJIdx)
diffCoeff_[compIIdx][compJIdx] = FluidSystem::binaryDiffusionCoefficient(fluidState_,
paramCache,
0,
compIIdx,
compJIdx);
if(compIIdx != compJIdx && compIIdx < compJIdx)
{
diffCoeff_(0, compIIdx, compJIdx) = FluidSystem::binaryDiffusionCoefficient(fluidState_,
paramCache,
0,
compIIdx,
compJIdx);
effectiveDiffCoeff_(0, compIIdx, compJIdx) = EffDiffModel::effectiveDiffusivity(*this, 0, compIIdx, compJIdx);
}
}
}
}
......@@ -322,13 +329,30 @@ public:
{ return solidState_.porosity(); }
/*!
* \brief Returns the binary diffusion coefficient \f$\mathrm{[m^2/s]}\f$ in the fluid.
* \brief Returns the binary diffusion coefficients for a phase in \f$[m^2/s]\f$.
*/
[[deprecated("Signature deprecated. Use diffusionCoefficient(phaseIdx, compIIdx, compJIdx)!")]]
Scalar diffusionCoefficient(int phaseIdx, int compIdx) const
{
assert(compIdx < numFluidComps);
return diffCoeff_[phaseIdx][compIdx];
}
{ return diffCoeff_(phaseIdx, 0, 0); }
/*!
* \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$.
*/
[[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
{ return effectiveDiffCoeff_(phaseIdx, compIIdx, compJIdx); }
/*!
* \brief Returns the molarity of a component in the phase.
......@@ -364,7 +388,12 @@ protected:
private:
PermeabilityType permeability_;
std::array<std::array<Scalar, numFluidComps>, numFluidComps> diffCoeff_;
// Binary diffusion coefficient
DiffusionCoefficients diffCoeff_;
// Effective diffusion coefficients for the phases
DiffusionCoefficients effectiveDiffCoeff_;
};
} // end namespace Dumux
......
......@@ -94,7 +94,7 @@ struct OnePNCMinNI { using InheritsFrom = std::tuple<OnePNCMin>; };
} // end namespace TTag
//////////////////////////////////////////////////////////////////
// Property tags for the isothermal 2pncmin model
// Property tags for the isothermal 1pncmin model
//////////////////////////////////////////////////////////////////
//! use the mineralization volume variables together with the 1pnc vol vars
......@@ -114,8 +114,8 @@ private:
static_assert(FST::numComponents == MT::numFluidComponents(), "Number of components mismatch between model and fluid state");
static_assert(FSY::numPhases == MT::numFluidPhases(), "Number of phases mismatch between model and fluid system");
static_assert(FST::numPhases == MT::numFluidPhases(), "Number of phases mismatch between model and fluid state");
using Traits = OnePNCVolumeVariablesTraits<PV, FSY, FST, SSY, SST, PT, MT>;
using EDM = GetPropType<TypeTag, Properties::EffectiveDiffusivityModel>;
using Traits = OnePNCVolumeVariablesTraits<PV, FSY, FST, SSY, SST, PT, MT, EDM>;
using NonMinVolVars = OnePNCVolumeVariables<Traits>;
public:
using type = MineralizationVolumeVariables<Traits, NonMinVolVars>;
......@@ -152,7 +152,7 @@ template<class TypeTag>
struct IOFields<TypeTag, TTag::OnePNCMin> { using type = MineralizationIOFields<OnePNCIOFields>; };
//////////////////////////////////////////////////////////////////
// Properties for the non-isothermal 2pncmin model
// Properties for the non-isothermal 1pncmin model
//////////////////////////////////////////////////////////////////
//! Non-isothermal vtk output
......@@ -175,6 +175,30 @@ public:
using type = PorousMediumFlowNIModelTraits<IsothermalTraits>;
};
//! use the mineralization volume variables together with the 1pnc vol vars
template<class TypeTag>
struct VolumeVariables<TypeTag, TTag::OnePNCMinNI>
{
private:
using PV = GetPropType<TypeTag, Properties::PrimaryVariables>;
using FSY = GetPropType<TypeTag, Properties::FluidSystem>;
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;
static_assert(FSY::numComponents == MT::numFluidComponents(), "Number of components mismatch between model and fluid system");
static_assert(FST::numComponents == MT::numFluidComponents(), "Number of components mismatch between model and fluid state");
static_assert(FSY::numPhases == MT::numFluidPhases(), "Number of phases mismatch between model and fluid system");
static_assert(FST::numPhases == MT::numFluidPhases(), "Number of phases mismatch between model and fluid state");
using EDM = GetPropType<TypeTag, Properties::EffectiveDiffusivityModel>;
using ETCM = GetPropType< TypeTag, Properties:: ThermalConductivityModel>;
using Traits = OnePNCNIVolumeVariablesTraits<PV, FSY, FST, SSY, SST, PT, MT, EDM, ETCM>;
using NonMinVolVars = OnePNCVolumeVariables<Traits>;
public:
using type = MineralizationVolumeVariables<Traits, NonMinVolVars>;
};
//! Use the average for effective conductivities
template<class TypeTag>
struct ThermalConductivityModel<TypeTag, TTag::OnePNCMinNI>
......
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