Commit db5132ff authored by Lukas Riedel's avatar Lukas Riedel

Remove static water content function. Add water_content_f to interface

parent 40b4d8fc
......@@ -142,6 +142,19 @@ public:
};
}
/// Return the water content function. Cast to Rangefield
std::function<RF(RF)> water_content_f () const
{
verify_cache();
auto& par = std::get<std::shared_ptr<Parameterization>>(_cache.second);
auto wc_f = par->water_content_f();
using Saturation = typename Parameterization::Saturation;
return [wc_f](const RF saturation) {
return wc_f(Saturation{saturation}).value;
};
}
template <class Param>
void copy_from_old_parameters (const Param& p_base)
{
......
......@@ -83,36 +83,6 @@ public:
SaturatedWaterContent _theta_s;
SaturatedConductivity _k0;
protected:
/// Functional relation for Saturation depending on water content
/** \param WaterContent Volumetric water content
* \return Saturation
*/
inline static std::function<Saturation(const WaterContent,
const ResidualWaterContent,
const SaturatedWaterContent)>
_saturation_f = [](const WaterContent _wc,
const ResidualWaterContent _theta_r,
const SaturatedWaterContent _theta_s) {
return Saturation{
(_wc.value - _theta_r.value) / (_theta_s.value - _theta_r.value)
};
};
/// Functional relation for Saturation depending on water content
/** \param WaterContent Volumetric water content
* \return Saturation
*/
inline static std::function<
WaterContent(const Saturation, const ResidualWaterContent, const SaturatedWaterContent)>
_water_content_f = [](const Saturation _sat,
const ResidualWaterContent _theta_r,
const SaturatedWaterContent _theta_s) {
return WaterContent{
_sat.value * (_theta_s.value - _theta_r.value) + _theta_r.value
};
};
public:
RichardsParameterization (
......@@ -130,12 +100,13 @@ public:
/// Return a bound version of the water content function
/** \return Function: Saturation -> Water content
*/
std::function<WaterContent(const Saturation)> water_content_f() const
std::function<WaterContent(const Saturation)> water_content_f () const
{
return std::bind(_water_content_f,
std::placeholders::_1,
std::cref(_theta_r), std::cref(_theta_s)
);
return [this](const Saturation sat) {
return WaterContent{
sat.value * (_theta_s.value - _theta_r.value) + _theta_r.value
};
};
}
/// Return a bound version of the saturation function
......
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