Commit a6f2202f authored by Lukas Riedel's avatar Lukas Riedel

Update parameter definitions

* Move base parameters into RichardsParameterization
* Make SaturatedConductivitiy a base parameter
* Rename SaturatedConductivitiy to "k0"
* Make parameters protected instead of private
parent 8869601f
......@@ -31,6 +31,9 @@ private:
typename ParameterStorage::mapped_type
>;
/// Typedef for accessing parameters
using RP = typename Dune::Dorie::RichardsParameterization<Traits>;
/// Configuration file tree
const Dune::ParameterTree& _config;
/// Grid view of the coarsest grid configuration (level 0)
......@@ -83,8 +86,9 @@ public:
{
verify_cache();
auto& par = _cache.second;
using Saturation = typename RP::Saturation;
return [&par](const RF saturation){
return par->conductivity_f()(Saturation<RF>{saturation}).value;
return par->conductivity_f()(Saturation{saturation}).value;
};
}
......@@ -93,8 +97,9 @@ public:
{
verify_cache();
auto& par = _cache.second;
using MatricHead = typename RP::MatricHead;
return [&par](const RF matric_head){
return par->saturation_f()(MatricHead<RF>{matric_head}).value;
return par->saturation_f()(MatricHead{matric_head}).value;
};
}
......@@ -116,14 +121,13 @@ public:
);
// read parameter values
using R = RichardsParameterization<Traits>;
using MvG = MualemVanGenuchtenParameterization<Traits>;
typename R::ResidualWaterContent theta_r{p_values.at(0)};
typename R::SaturatedWaterContent theta_s{p_values.at(1)};
typename RP::ResidualWaterContent theta_r{p_values.at(0)};
typename RP::SaturatedWaterContent theta_s{p_values.at(1)};
typename MvG::Alpha alpha{p_values.at(2)};
typename MvG::N n{p_values.at(3)};
typename MvG::Tau tau{p_values.at(4)};
typename MvG::SaturatedConductivity k0{p_values.at(5)};
typename RP::SaturatedConductivity k0{p_values.at(5)};
auto mvg =
std::make_shared<MualemVanGenuchtenParameterization<Traits>>
......
......@@ -19,20 +19,14 @@ private:
public:
using Saturation = Saturation<RF>;
using Conductivity = Conductivity<RF>;
using MatricHead = MatricHead<RF>;
using Saturation = typename Base::Saturation;
using Conductivity = typename Base::Conductivity;
using MatricHead = typename Base::MatricHead;
using SaturatedConductivity = typename Base::SaturatedConductivity;
using ResidualWaterContent = typename Base::ResidualWaterContent;
using SaturatedWaterContent = typename Base::SaturatedWaterContent;
/// Parameter defining the saturated hydraulic conductivity
struct SaturatedConductivity
{
RF value;
inline static const std::string name = "k_0";
};
/// Parameter defining the value of alpha (air-entry value)
struct Alpha
{
......@@ -54,7 +48,7 @@ public:
inline static const std::string name = "tau";
};
private:
protected:
std::function<Conductivity(const Saturation,
const SaturatedConductivity,
......@@ -89,7 +83,6 @@ private:
Alpha _alpha;
Tau _tau;
N _n;
SaturatedConductivity _k0;
public:
MualemVanGenuchtenParameterization (
......@@ -100,11 +93,10 @@ public:
const N n,
const SaturatedConductivity k0
):
RichardsParameterization<Traits>(theta_r, theta_s),
RichardsParameterization<Traits>(theta_r, theta_s, k0),
_alpha(alpha),
_tau(tau),
_n(n),
_k0(k0)
_n(n)
{ }
std::function<Conductivity(const Saturation)> conductivity_f () const
......@@ -112,7 +104,7 @@ public:
{
return std::bind(_conductivity_f,
std::placeholders::_1,
std::cref(_k0), std::cref(_n), std::cref(_tau)
std::cref(this->_k0), std::cref(_n), std::cref(_tau)
);
}
......
......@@ -9,34 +9,6 @@ namespace Dorie {
// --- Strong types for parameterization --- //
// These are standard types for all parameterizations of Richards Equation
/// Type of water saturation
template <typename T>
struct Saturation
{
T value;
};
/// Type of volumetric water content
template <typename T>
struct WaterContent
{
T value;
};
/// Type of hydraulic conductivity
template <typename T>
struct Conductivity
{
T value;
};
/// Type of matric head
template <typename T>
struct MatricHead
{
T value;
};
/// Class defining the interface for parameterizations of Richards equation
template <typename Traits>
class RichardsParameterization
......@@ -45,10 +17,36 @@ private:
using RF = typename Traits::RF;
public:
using Saturation = Saturation<RF>;
using WaterContent = WaterContent<RF>;
using Conductivity = Conductivity<RF>;
using MatricHead = MatricHead<RF>;
/// Type of water saturation
struct Saturation
{
RF value;
};
/// Type of volumetric water content
struct WaterContent
{
RF value;
};
/// Type of hydraulic conductivity
struct Conductivity
{
RF value;
};
/// Type of matric head
struct MatricHead
{
RF value;
};
/// Parameter defining the saturated hydraulic conductivity
struct SaturatedConductivity
{
RF value;
inline static const std::string name = "k0";
};
/// Parameter defining the residual water content
struct ResidualWaterContent
......@@ -64,10 +62,11 @@ public:
inline static const std::string name = "theta_s";
};
private:
protected:
ResidualWaterContent _theta_r;
SaturatedWaterContent _theta_s;
SaturatedConductivity _k0;
/// Functional relation for Saturation depending on water content
/** \param WaterContent Volumetric water content
......@@ -101,10 +100,12 @@ public:
RichardsParameterization (
const ResidualWaterContent theta_r,
const SaturatedWaterContent theta_s
const SaturatedWaterContent theta_s,
const SaturatedConductivity k0
):
_theta_r(theta_r),
_theta_s(theta_s)
_theta_s(theta_s),
_k0(k0)
{ }
virtual ~RichardsParameterization () = default;
......
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