[Doc] Add code documentation for transport parameterization

parent 66d3bce6
...@@ -158,6 +158,9 @@ public: ...@@ -158,6 +158,9 @@ public:
}; };
} }
/// Clone the plymorphic class
/** \return unique pointer to the cloned object
*/
std::unique_ptr<Richards<Traits>> clone () const override std::unique_ptr<Richards<Traits>> clone () const override
{ {
using ThisType = MualemVanGenuchten<Traits>; using ThisType = MualemVanGenuchten<Traits>;
......
...@@ -11,6 +11,15 @@ namespace Dune { ...@@ -11,6 +11,15 @@ namespace Dune {
namespace Dorie { namespace Dorie {
namespace Parameterization { namespace Parameterization {
/*-------------------------------------------------------------------------*//**
* @brief Class for constant hydrodynamic dispersion.
*
* @ingroup TransportParam
* @author Santiago Ospina
* @date 2019
*
* @tparam Traits the base traits
*/
template <class Traits> template <class Traits>
class ConstHydrodynamicDispersion : class ConstHydrodynamicDispersion :
public Transport<Traits> public Transport<Traits>
...@@ -24,6 +33,7 @@ public: ...@@ -24,6 +33,7 @@ public:
using WaterFluxType = typename Base::WaterFluxType; using WaterFluxType = typename Base::WaterFluxType;
using WaterContentType = typename Base::WaterContentType; using WaterContentType = typename Base::WaterContentType;
/// Parameter defining the constant hydrodynamic dispersion tensor
struct ConstHydrodynamicDispersionType struct ConstHydrodynamicDispersionType
{ {
Tensor value; Tensor value;
...@@ -35,10 +45,19 @@ public: ...@@ -35,10 +45,19 @@ public:
ConstHydrodynamicDispersionType _const_hydrodynamic_dispersion; ConstHydrodynamicDispersionType _const_hydrodynamic_dispersion;
public:
/// Construct with default-initialized parameters
/** \param name The name associated with this soil layer
*/
ConstHydrodynamicDispersion (const std::string name) : ConstHydrodynamicDispersion (const std::string name) :
Transport<Traits>(name) Transport<Traits>(name)
{ } { }
/// Construct from a tuple of parameters
/** \param name The name associated with this soil layer
* \param parameters Tuple of parameters to use in this parameterization
*/
template<typename... Args> template<typename... Args>
ConstHydrodynamicDispersion ( ConstHydrodynamicDispersion (
const std::string name, const std::string name,
...@@ -50,8 +69,9 @@ public: ...@@ -50,8 +69,9 @@ public:
/// Add default destructor to clarify override /// Add default destructor to clarify override
~ConstHydrodynamicDispersion () override = default; ~ConstHydrodynamicDispersion () override = default;
public: /// Return the hydrodynamic dispersion
/** {WaterFlux,WaterContent} -> HydrodynamicDispersion
*/
std::function<HydrodynamicDispersionType(const WaterFluxType, const WaterContentType)> std::function<HydrodynamicDispersionType(const WaterFluxType, const WaterContentType)>
hydrodynamic_dispersion_f () const override hydrodynamic_dispersion_f () const override
{ {
...@@ -60,6 +80,9 @@ public: ...@@ -60,6 +80,9 @@ public:
}; };
} }
/// Return a map of parameter names and values for manipulation
/** \return Map: Parameter name, parameter value in this object
*/
std::multimap<std::string, double&> parameters () override std::multimap<std::string, double&> parameters () override
{ {
using Map = std::multimap<std::string, double&>; using Map = std::multimap<std::string, double&>;
...@@ -99,6 +122,9 @@ public: ...@@ -99,6 +122,9 @@ public:
return compsite_map; return compsite_map;
} }
/// Return a map of parameter names and values for manipulation
/** \return Map: Parameter name, parameter value in this object
*/
std::multimap<std::string, const double&> parameters () const override std::multimap<std::string, const double&> parameters () const override
{ {
using Map = std::multimap<std::string, const double&>; using Map = std::multimap<std::string, const double&>;
...@@ -138,6 +164,9 @@ public: ...@@ -138,6 +164,9 @@ public:
return compsite_map; return compsite_map;
} }
/// Clone the plymorphic class
/** \return unique pointer to the cloned object
*/
std::unique_ptr<Transport<Traits>> clone () const override std::unique_ptr<Transport<Traits>> clone () const override
{ {
using ThisType = ConstHydrodynamicDispersion<Traits>; using ThisType = ConstHydrodynamicDispersion<Traits>;
......
...@@ -11,6 +11,16 @@ namespace Dune { ...@@ -11,6 +11,16 @@ namespace Dune {
namespace Dorie { namespace Dorie {
namespace Parameterization { namespace Parameterization {
/*-------------------------------------------------------------------------*//**
* @brief Class for constant effective diffusion.
*
* @ingroup TransportParam
* @author Santiago Ospina
* @date 2019
*
* @tparam Traits the base traits
*/
template <class Traits> template <class Traits>
class ConstEffectiveDiffusion class ConstEffectiveDiffusion
: public EffectiveDiffusion<Traits> : public EffectiveDiffusion<Traits>
...@@ -24,6 +34,7 @@ public: ...@@ -24,6 +34,7 @@ public:
using WaterFluxType = typename Base::WaterFluxType; using WaterFluxType = typename Base::WaterFluxType;
using WaterContentType = typename Base::WaterContentType; using WaterContentType = typename Base::WaterContentType;
/// Parameter defining the constant effective diffusion
struct ConstEffectiveDiffusionType struct ConstEffectiveDiffusionType
{ {
RangeField value; RangeField value;
...@@ -35,11 +46,19 @@ public: ...@@ -35,11 +46,19 @@ public:
ConstEffectiveDiffusionType _const_eff_diff; ConstEffectiveDiffusionType _const_eff_diff;
public:
/// Construct with default-initialized parameters
/** \param name The name associated with this soil layer
*/
ConstEffectiveDiffusion (const std::string name) : ConstEffectiveDiffusion (const std::string name) :
EffectiveDiffusion<Traits>(name) EffectiveDiffusion<Traits>(name)
{ } { }
/// Construct from a tuple of parameters
/** \param name The name associated with this soil layer
* \param parameters Tuple of parameters to use in this parameterization
*/
template<typename... Args> template<typename... Args>
ConstEffectiveDiffusion ( ConstEffectiveDiffusion (
const std::string name, const std::string name,
...@@ -53,6 +72,9 @@ public: ...@@ -53,6 +72,9 @@ public:
public: public:
/// Return the effective diffusion
/** {WaterFlux,WaterContent} -> EffectiveDiffusion
*/
std::function<EffectiveDiffusionType(const WaterFluxType, const WaterContentType)> std::function<EffectiveDiffusionType(const WaterFluxType, const WaterContentType)>
effective_diffusion_f () const override effective_diffusion_f () const override
{ {
...@@ -61,18 +83,27 @@ public: ...@@ -61,18 +83,27 @@ public:
}; };
} }
/// Return a map of parameter names and values for manipulation
/** \return Map: Parameter name, parameter value in this object
*/
std::multimap<std::string, double&> parameters () override std::multimap<std::string, double&> parameters () override
{ {
const std::string _const_eff_diff_name = ConstEffectiveDiffusionType::name; const std::string _const_eff_diff_name = ConstEffectiveDiffusionType::name;
return {{_const_eff_diff_name, _const_eff_diff.value}}; return {{_const_eff_diff_name, _const_eff_diff.value}};
} }
/// Return a map of parameter names and values for manipulation
/** \return Map: Parameter name, parameter value in this object
*/
std::multimap<std::string, const double&> parameters () const override std::multimap<std::string, const double&> parameters () const override
{ {
const std::string _const_eff_diff_name = ConstEffectiveDiffusionType::name; const std::string _const_eff_diff_name = ConstEffectiveDiffusionType::name;
return {{_const_eff_diff_name, _const_eff_diff.value}}; return {{_const_eff_diff_name, _const_eff_diff.value}};
} }
/// Clone the plymorphic class
/** \return unique pointer to the cloned object
*/
std::unique_ptr<EffectiveDiffusion<Traits>> clone () const override std::unique_ptr<EffectiveDiffusion<Traits>> clone () const override
{ {
using ThisType = ConstEffectiveDiffusion<Traits>; using ThisType = ConstEffectiveDiffusion<Traits>;
......
...@@ -11,6 +11,15 @@ namespace Dune { ...@@ -11,6 +11,15 @@ namespace Dune {
namespace Dorie { namespace Dorie {
namespace Parameterization { namespace Parameterization {
/*-------------------------------------------------------------------------*//**
* @brief Class for effective diffusion.
*
* @ingroup TransportParam
* @author Santiago Ospina
* @date 2019
*
* @tparam Traits the base traits
*/
template <class Traits> template <class Traits>
class EffectiveDiffusion class EffectiveDiffusion
{ {
...@@ -19,15 +28,8 @@ private: ...@@ -19,15 +28,8 @@ private:
using BaseP = Transport<Traits>; using BaseP = Transport<Traits>;
public: public:
EffectiveDiffusion (const std::string name)
: _name(name)
{ }
virtual ~EffectiveDiffusion () = default;
const std::string& get_name() const { return _name; }
/// Type of the hydrodynamic dispersion /// Type of the effective diffusion
struct EffectiveDiffusionType struct EffectiveDiffusionType
{ {
RangeField value; RangeField value;
...@@ -36,20 +38,58 @@ public: ...@@ -36,20 +38,58 @@ public:
using WaterFluxType = typename BaseP::WaterFluxType; using WaterFluxType = typename BaseP::WaterFluxType;
using WaterContentType = typename BaseP::WaterContentType; using WaterContentType = typename BaseP::WaterContentType;
//! The name of this parameterization instance, associated with the layer.
const std::string _name;
public:
/// Construct with default-initialized parameters
/** \param name The name associated with this soil layer
*/
EffectiveDiffusion (const std::string name)
: _name(name)
{ }
/// Construct from a tuple of parameters
/** \param name The name associated with this soil layer
* \param parameters Tuple of parameters to use in this parameterization
*/
template<typename... Args>
EffectiveDiffusion (
const std::string name,
const std::tuple<Args...> parameters)
: _name(name)
{ }
/// Default constructor (virtual).
virtual ~EffectiveDiffusion () = default;
/// Return the name of this parameterization instance.
const std::string& get_name() const { return _name; }
/// Return a bound version of the effective diffusion
/** \return Function: {Water Flux, Water Content} -> Effective Diff.
*/
virtual std::function< virtual std::function<
EffectiveDiffusionType(const WaterFluxType, const WaterContentType)> EffectiveDiffusionType(const WaterFluxType, const WaterContentType)>
effective_diffusion_f () const = 0; effective_diffusion_f () const = 0;
/// Return a map referecing all parameters by their names.
/** \return Map. Key: Name of parameter (string).
* Value: Value of parameter (double&)
*/
virtual std::multimap<std::string, double&> parameters () = 0; virtual std::multimap<std::string, double&> parameters () = 0;
/// Return a map referecing all parameters by their names.
/** \return Map. Key: Name of parameter (string).
* Value: Value of parameter (const double&)
*/
virtual std::multimap<std::string, const double&> parameters () const = 0; virtual std::multimap<std::string, const double&> parameters () const = 0;
/// Return a clone of this object /// Clone the plymorphic class
/** \return a unique pointer with a copy of this object. /** \return unique pointer to the cloned object
*/ */
virtual std::unique_ptr<EffectiveDiffusion<Traits>> clone () const = 0; virtual std::unique_ptr<EffectiveDiffusion<Traits>> clone () const = 0;
private:
const std::string _name;
}; };
} // namespace Parameterization } // namespace Parameterization
......
...@@ -11,6 +11,20 @@ namespace Dune { ...@@ -11,6 +11,20 @@ namespace Dune {
namespace Dorie { namespace Dorie {
namespace Parameterization { namespace Parameterization {
/*-------------------------------------------------------------------------*//**
* @brief Class for effective diffusion with Milington Quirk I.
* @details Implements the relation @f$ \mathsf{D}^\mathsf{eff}
* =\frac{\theta_w^{7/3}\mathsf{D}_\mathsf{m}}{\phi^2} @f$
* where @f$ \theta_w @f$ is the water content,
* @f$ \mathsf{D}_\mathsf{m} @f$ the molecular diffusion, and
* @f$ \phi @f$ the porosity of the medium.
*
* @ingroup TransportParam
* @author Santiago Ospina
* @date 2019
*
* @tparam Traits the base traits
*/
template <class Traits> template <class Traits>
class MillingtonQuirk1 class MillingtonQuirk1
: public EffectiveDiffusion<Traits> : public EffectiveDiffusion<Traits>
...@@ -24,12 +38,14 @@ public: ...@@ -24,12 +38,14 @@ public:
using WaterFluxType = typename Base::WaterFluxType; using WaterFluxType = typename Base::WaterFluxType;
using WaterContentType = typename Base::WaterContentType; using WaterContentType = typename Base::WaterContentType;
/// Parameter defining molecular diffusion
struct ModelcularDiffusionType struct ModelcularDiffusionType
{ {
RangeField value; RangeField value;
inline static const std::string name = "mol_diff"; inline static const std::string name = "mol_diff";
}; };
/// Parameter defining porosity
struct PorosityType struct PorosityType
{ {
RangeField value; RangeField value;
...@@ -42,11 +58,19 @@ public: ...@@ -42,11 +58,19 @@ public:
ModelcularDiffusionType _mol_diff; ModelcularDiffusionType _mol_diff;
PorosityType _porosity; PorosityType _porosity;
public:
/// Construct with default-initialized parameters
/** \param name The name associated with this soil layer
*/
MillingtonQuirk1 (const std::string name) : MillingtonQuirk1 (const std::string name) :
Base(name) Base(name)
{ } { }
/// Construct from a tuple of parameters
/** \param name The name associated with this soil layer
* \param parameters Tuple of parameters to use in this parameterization
*/
template<typename... Args> template<typename... Args>
MillingtonQuirk1 ( MillingtonQuirk1 (
const std::string name, const std::string name,
...@@ -59,9 +83,9 @@ public: ...@@ -59,9 +83,9 @@ public:
/// Add default destructor to clarify override /// Add default destructor to clarify override
~MillingtonQuirk1 () override = default; ~MillingtonQuirk1 () override = default;
/// Return the effective diffusion
public: /** {WaterFlux,WaterContent} -> EffectiveDiffusion
*/
std::function<EffectiveDiffusionType(const WaterFluxType, const WaterContentType)> std::function<EffectiveDiffusionType(const WaterFluxType, const WaterContentType)>
effective_diffusion_f () const override effective_diffusion_f () const override
{ {
...@@ -71,6 +95,9 @@ public: ...@@ -71,6 +95,9 @@ public:
}; };
} }
/// Return a map of parameter names and values for manipulation
/** \return Map: Parameter name, parameter value in this object
*/
std::multimap<std::string, double&> parameters () override std::multimap<std::string, double&> parameters () override
{ {
return { return {
...@@ -79,6 +106,9 @@ public: ...@@ -79,6 +106,9 @@ public:
}; };
} }
/// Return a map of parameter names and values for manipulation
/** \return Map: Parameter name, parameter value in this object
*/
std::multimap<std::string, const double&> parameters () const override std::multimap<std::string, const double&> parameters () const override
{ {
return { return {
...@@ -87,6 +117,9 @@ public: ...@@ -87,6 +117,9 @@ public:
}; };
} }
/// Return a map of parameter names and values for manipulation
/** \return Map: Parameter name, parameter value in this object
*/
std::unique_ptr<EffectiveDiffusion<Traits>> clone () const override std::unique_ptr<EffectiveDiffusion<Traits>> clone () const override
{ {
using ThisType = MillingtonQuirk1<Traits>; using ThisType = MillingtonQuirk1<Traits>;
......
...@@ -11,6 +11,20 @@ namespace Dune { ...@@ -11,6 +11,20 @@ namespace Dune {
namespace Dorie { namespace Dorie {
namespace Parameterization { namespace Parameterization {
/*-------------------------------------------------------------------------*//**
* @brief Class for effective diffusion with Milington Quirk II.
* @details Implements the relation @f$ \mathsf{D}^\mathsf{eff}
* =\frac{\theta_w\mathsf{D}_\mathsf{m}}{\phi^{2/3}} @f$
* where @f$ \theta_w @f$ is the water content,
* @f$ \mathsf{D}_\mathsf{m} @f$ the molecular diffusion, and
* @f$ \phi @f$ the porosity of the medium.
*
* @ingroup TransportParam
* @author Santiago Ospina
* @date 2019
*
* @tparam Traits the base traits
*/
template <class Traits> template <class Traits>
class MillingtonQuirk2 class MillingtonQuirk2
: public EffectiveDiffusion<Traits> : public EffectiveDiffusion<Traits>
...@@ -24,12 +38,14 @@ public: ...@@ -24,12 +38,14 @@ public:
using WaterFluxType = typename Base::WaterFluxType; using WaterFluxType = typename Base::WaterFluxType;
using WaterContentType = typename Base::WaterContentType; using WaterContentType = typename Base::WaterContentType;
/// Parameter defining molecular diffusion
struct ModelcularDiffusionType struct ModelcularDiffusionType
{ {
RangeField value; RangeField value;
inline static const std::string name = "mol_diff"; inline static const std::string name = "mol_diff";
}; };
/// Parameter defining porosity
struct PorosityType struct PorosityType
{ {
RangeField value; RangeField value;
...@@ -42,11 +58,19 @@ public: ...@@ -42,11 +58,19 @@ public:
ModelcularDiffusionType _mol_diff; ModelcularDiffusionType _mol_diff;
PorosityType _porosity; PorosityType _porosity;
public:
/// Construct with default-initialized parameters
/** \param name The name associated with this soil layer
*/
MillingtonQuirk2 (const std::string name) : MillingtonQuirk2 (const std::string name) :
Base(name) Base(name)
{ } { }
/// Construct from a tuple of parameters
/** \param name The name associated with this soil layer
* \param parameters Tuple of parameters to use in this parameterization
*/
template<typename... Args> template<typename... Args>
MillingtonQuirk2 ( MillingtonQuirk2 (
const std::string name, const std::string name,
...@@ -59,9 +83,9 @@ public: ...@@ -59,9 +83,9 @@ public:
/// Add default destructor to clarify override /// Add default destructor to clarify override
~MillingtonQuirk2 () override = default; ~MillingtonQuirk2 () override = default;
/// Return the effective diffusion
public: /** {WaterFlux,WaterContent} -> EffectiveDiffusion