Commit 135dd12b authored by Santiago Ospina De Los Ríos's avatar Santiago Ospina De Los Ríos

Merge branch...

Merge branch '142-add-parameterization-for-the-effective-hydrodynamic-dispersion-tensor' into 111-add-dg-local-operator-to-the-simulationtransport-class
parents f35fd900 ec89d0ea
......@@ -64,11 +64,16 @@ Output Files
.. object:: Transport
- ``solute``: Solute concentration in water phase
:math:`c_w \, [\mathrm{kg}/\mathrm{m}^3]`
:math:`c_w \, [\mathrm{kg}\mathrm{m}^{-3}]`
- ``solute_total``: Total solute concentration
:math:`c_t \, [\mathrm{kg}/\mathrm{m}^3]`
:math:`c_t \, [\mathrm{kg}\mathrm{m}^{-3}]`
- ``micro_peclet``: Microscopic peclet number
:math:`\mathsf{pe_\mu} \, [-]`
- ``flux_RT<k-1>``: Reconstructed solute flux
:math:`\mathbf{j}_{s, \mathrm{rc}} \, [\mathrm{kg}/\mathrm{m}^{-2}\mathrm{s}^{-1}]`
:math:`\mathbf{j}_{s, \mathrm{rc}} \, [\mathrm{kg}\,\mathrm{m}^{-2}\mathrm{s}^{-1}]`
(if enabled!)
- ``eff_hd_dispersion``: Hydrodynamic dispersion tensor
:math:`\mathsf{D}_\mathsf{hd} \, [\mathrm{m}^2\mathrm{s}^{-1}]`
(if enabled!)
* VTK Parallel Collection Files (``.pvtu``): Merging multiple VTK files in case
......
......@@ -20,7 +20,7 @@ namespace Dorie {
* @brief Class for analytic initial conditions.
*
* @ingroup InitialConditions
* @author Santiago Ospina
* @author Santiago Ospina De Los Ríos
* @date 2019
*
* @tparam T BaseTraits
......
......@@ -17,7 +17,7 @@ namespace Dorie{
* @brief Abstract Base Class for initial conditions.
*
* @ingroup InitialConditions
* @author Santiago Ospina
* @author Santiago Ospina De Los Ríos
* @date 2019
*
* @tparam T BaseTraits
......
......@@ -18,7 +18,7 @@ namespace Dorie{
* @brief Class for initial conditions from hdf5 data files.
*
* @ingroup InitialConditions
* @author Santiago Ospina
* @author Santiago Ospina De Los Ríos
* @date 2019
*
* @tparam T BaseTraits
......
......@@ -13,7 +13,7 @@ namespace Dorie{
* @brief Abstract Base Class for initial conditions.
*
* @ingroup InitialConditions
* @author Santiago Ospina
* @author Santiago Ospina De Los Ríos
* @date 2019
*
* @tparam T BaseTraits
......
......@@ -9,7 +9,8 @@ namespace Dune{
/*---------------------------------------------------------------------*//**
* @brief Converts a parametrization P that contains conductivity
* information into a grid function (in PDELab sense)
*
* @ingroup RichardsParam
*
* @tparam T BasicTraits with information about the function domain
* @tparam P Parametrization class with saturated conductivity
* information
......
......@@ -10,7 +10,8 @@ namespace Dune{
* @brief Converts a parametrization P that contains saturation
* information and a matric head grid function GF into a grid
* function (in PDELab sense) of saturation.
*
* @ingroup RichardsParam
*
* @tparam T BasicTraits with information about the function domain
* @tparam P Parametrization class with saturation information
* @tparam GF Grid function of the matric head
......
......@@ -10,7 +10,8 @@ namespace Dune{
* @brief Converts a parametrization P that contains conductivity
* information and a matric head grid function GF into a grid
* function (in PDELab sense) of water content.
*
* @ingroup RichardsParam
*
* @tparam T BasicTraits with information about the function domain
* @tparam P Parametrization class with conductivity information
* @tparam GF Grid function of the matric head
......
......@@ -11,7 +11,8 @@ namespace Dune{
* @brief Converts an grid function space GFS and some particular
* coefficients for such space X to match the water flux
* equation with a GridFunctionInterface.
*
* @ingroup RichardsParam
*
* @tparam GFS Grid Function Space
* @tparam X Coefficients for the GFS
* @tparam P Parameters
......
......@@ -158,6 +158,9 @@ public:
};
}
/// Clone the plymorphic class
/** \return unique pointer to the cloned object
*/
std::unique_ptr<Richards<Traits>> clone () const override
{
using ThisType = MualemVanGenuchten<Traits>;
......
......@@ -11,7 +11,8 @@ namespace Dorie{
* @details For a given paramaterization, water flux and water content, this
* class returns the hydrodynamic dispersion tensor (od dimension
* dimRange) in an aliased vector.
*
* @ingroup TransportParam
*
* @tparam T The base traits
* @tparam Parameter The transport parameter class
* @tparam GFWaterFlux The water flux grid function class
......
......@@ -8,6 +8,7 @@ namespace Dorie{
/**
* @brief Converts an interface to match a microscopic peclet number.
* @ingroup TransportParam
*
* @tparam T The base traits
* @tparam Parameter The transport parameter class
......
......@@ -43,13 +43,82 @@
## Overview
...
The parameterization condenses the subscale physics from below the
REV scale and represents the effective dispersion process in the far-field
regimme of the transport process. The main task of the parameterization in DORiE
is to estimate the hydrodynamic dispersion tensor. However, it also estimates
the microscopic péclet number. Several options (and their combinations) are
available.
### Parameterization
The microscopic peclet number is directly implemented in the base class of the
parameterization Dune::Dorie::Parameterization::Transport::peclet_f().
The hydrodynamic dispersion tensor is implemented as a polyphormic object in
Dune::Dorie::Parameterization::Transport. It can take the form of three
different parameterizations:
1. **Constant hydrodynamic dispersion tensor**
As the name reveals, it simply requires a constant tensor
Dune::Dorie::Parameterization::ConstHydrodynamicDispersion.
2. **Power Law**
In this case, the diagonal of the tensor depends on the microscopic peclet
number, the molecular diffusion, and two user-dependent parameters
Dune::Dorie::Parameterization::PowerLawDispersion.
3. **Superposition**
The superposition case assumes that the linear combination of different
dispersion processes lead to the desired hydrodynamic dispersion tensor.
Since the concept is not tied to any particular parameterization, the
individual processes are implemented as well as polyphormic objects.
In this case, there are implemented the two most fundamental processes at
pore scale
Dune::Dorie::Parameterization::HydrodynamicDispersionSuperposition:
a. *Effective diffusion coefficient*
Dune::Dorie::Parameterization::EffectiveDiffusion
+ Constant coefficient
Dune::Dorie::Parameterization::ConstEffectiveDiffusion
+ Milligtong Quirk I
Dune::Dorie::Parameterization::MillingtonQuirk1
+ Milligtong Quirk II
Dune::Dorie::Parameterization::MillingtonQuirk2
b. *Effective hydromechanic dispersion tensor*
Dune::Dorie::Parameterization::EffectiveHydromechanicDispersion
+ Constant effective hydromechanic dispersion tensor
Dune::Dorie::Parameterization::ConstEffectiveHydromechanicDispersion
+ Hydromechanic dispersion for isotropic media
Dune::Dorie::Parameterization::IsotropicEffectiveHydromechanicDispersion
Storing this data, providing grid-to-data mappings, and access to this data
are tasks of the Dune::Dorie::TransportParameters interface, that is directly
used in the @ref LocalOperators.
Special care has to be taken when modifying repeated parameters (e.g. molecular
diffusion) or when storing shared pointers in polyhpromic objects. If not
treated carefully, some parameters may be not reachable anymore with the
parameters() methods or be doubly created when using the method clone().
@todo Add scaling factors to porosity values
### Adapters
The adapter for the hydrodynamic dispersion tensor is rather specific:
+ Visualization of glyph tensors in Paraview is only avaiable for 9 component
data (3D tensor).
+ The VTK writer of dune-grid can only write data that is indexable once. H
Hence, the 3x3 tensor has to be flattened.
+ The usual Grid Function to VTK Function adapter in dune-pdelab does not allow
to write more than 3 components of data. Hence we write our own Grid Function
to dune-function adapter (Dune::Dorie::VTKGridFunctionAdapter) which is
natively accepted by the current vtk writers.
@}
**/
......@@ -4,7 +4,6 @@
#include <dune/dorie/common/logging.hh>
#include <dune/dorie/common/parameterization_factory.hh>
#include <dune/dorie/model/transport/parameterization/interface.hh>
#include <dune/dorie/model/transport/parameterization/hydrodynamic_dispersion/interface.hh>
#include <dune/dorie/model/transport/parameterization/hydrodynamic_dispersion/const.hh>
#include <dune/dorie/model/transport/parameterization/hydrodynamic_dispersion/power_law.hh>
#include <dune/dorie/model/transport/parameterization/hydrodynamic_dispersion/eff_hydromechanic_dispersion/interface.hh>
......
......@@ -11,6 +11,15 @@ namespace Dune {
namespace Dorie {
namespace Parameterization {
/*-------------------------------------------------------------------------*//**
* @brief Class for constant hydrodynamic dispersion.
*
* @ingroup TransportParam
* @author Santiago Ospina De Los Ríos
* @date 2019
*
* @tparam Traits the base traits
*/
template <class Traits>
class ConstHydrodynamicDispersion :
public Transport<Traits>
......@@ -24,6 +33,7 @@ public:
using WaterFluxType = typename Base::WaterFluxType;
using WaterContentType = typename Base::WaterContentType;
/// Parameter defining the constant hydrodynamic dispersion tensor
struct ConstHydrodynamicDispersionType
{
Tensor value;
......@@ -35,10 +45,19 @@ public:
ConstHydrodynamicDispersionType _const_hydrodynamic_dispersion;
public:
/// Construct with default-initialized parameters
/** \param name The name associated with this soil layer
*/
ConstHydrodynamicDispersion (const std::string 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>
ConstHydrodynamicDispersion (
const std::string name,
......@@ -50,8 +69,9 @@ public:
/// Add default destructor to clarify override
~ConstHydrodynamicDispersion () override = default;
public:
/// Return the hydrodynamic dispersion
/** {WaterFlux,WaterContent} -> HydrodynamicDispersion
*/
std::function<HydrodynamicDispersionType(const WaterFluxType, const WaterContentType)>
hydrodynamic_dispersion_f () const override
{
......@@ -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
{
using Map = std::multimap<std::string, double&>;
......@@ -99,6 +122,9 @@ public:
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
{
using Map = std::multimap<std::string, const double&>;
......@@ -138,6 +164,9 @@ public:
return compsite_map;
}
/// Clone the plymorphic class
/** \return unique pointer to the cloned object
*/
std::unique_ptr<Transport<Traits>> clone () const override
{
using ThisType = ConstHydrodynamicDispersion<Traits>;
......
......@@ -11,6 +11,16 @@ namespace Dune {
namespace Dorie {
namespace Parameterization {
/*-------------------------------------------------------------------------*//**
* @brief Class for constant effective diffusion.
*
* @ingroup TransportParam
* @author Santiago Ospina De Los Ríos
* @date 2019
*
* @tparam Traits the base traits
*/
template <class Traits>
class ConstEffectiveDiffusion
: public EffectiveDiffusion<Traits>
......@@ -24,6 +34,7 @@ public:
using WaterFluxType = typename Base::WaterFluxType;
using WaterContentType = typename Base::WaterContentType;
/// Parameter defining the constant effective diffusion
struct ConstEffectiveDiffusionType
{
RangeField value;
......@@ -35,11 +46,19 @@ public:
ConstEffectiveDiffusionType _const_eff_diff;
public:
/// Construct with default-initialized parameters
/** \param name The name associated with this soil layer
*/
ConstEffectiveDiffusion (const std::string 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>
ConstEffectiveDiffusion (
const std::string name,
......@@ -53,6 +72,9 @@ public:
public:
/// Return the effective diffusion
/** {WaterFlux,WaterContent} -> EffectiveDiffusion
*/
std::function<EffectiveDiffusionType(const WaterFluxType, const WaterContentType)>
effective_diffusion_f () const override
{
......@@ -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
{
const std::string _const_eff_diff_name = ConstEffectiveDiffusionType::name;
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
{
const std::string _const_eff_diff_name = ConstEffectiveDiffusionType::name;
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
{
using ThisType = ConstEffectiveDiffusion<Traits>;
......
......@@ -5,12 +5,21 @@
#include <string>
#include <map>
#include <dune/dorie/model/transport/parameterization/hydrodynamic_dispersion/interface.hh>
#include <dune/dorie/model/transport/parameterization/interface.hh>
namespace Dune {
namespace Dorie {
namespace Parameterization {
/*-------------------------------------------------------------------------*//**
* @brief Class for effective diffusion.
*
* @ingroup TransportParam
* @author Santiago Ospina De Los Ríos
* @date 2019
*
* @tparam Traits the base traits
*/
template <class Traits>
class EffectiveDiffusion
{
......@@ -19,15 +28,8 @@ private:
using BaseP = Transport<Traits>;
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
{
RangeField value;
......@@ -36,20 +38,58 @@ public:
using WaterFluxType = typename BaseP::WaterFluxType;
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<
EffectiveDiffusionType(const WaterFluxType, const WaterContentType)>
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;
/// 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;
/// Return a clone of this object
/** \return a unique pointer with a copy of this object.
/// Clone the plymorphic class
/** \return unique pointer to the cloned object
*/
virtual std::unique_ptr<EffectiveDiffusion<Traits>> clone () const = 0;
private:
const std::string _name;
};
} // namespace Parameterization
......
......@@ -11,6 +11,20 @@ namespace Dune {
namespace Dorie {
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 De Los Ríos
* @date 2019
*
* @tparam Traits the base traits
*/
template <class Traits>
class MillingtonQuirk1
: public EffectiveDiffusion<Traits>
......@@ -24,12 +38,14 @@ public:
using WaterFluxType = typename Base::WaterFluxType;
using WaterContentType = typename Base::WaterContentType;
/// Parameter defining molecular diffusion
struct ModelcularDiffusionType
{
RangeField value;
inline static const std::string name = "mol_diff";
};
/// Parameter defining porosity
struct PorosityType
{
RangeField value;
......@@ -42,11 +58,19 @@ public:
ModelcularDiffusionType _mol_diff;
PorosityType _porosity;
public:
/// Construct with default-initialized parameters
/** \param name The name associated with this soil layer
*/
MillingtonQuirk1 (const std::string 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>
MillingtonQuirk1 (
const std::string name,
......@@ -59,9 +83,9 @@ public:
/// Add default destructor to clarify override
~MillingtonQuirk1 () override = default;
public:
/// Return the effective diffusion
/** {WaterFlux,WaterContent} -> EffectiveDiffusion
*/
std::function<EffectiveDiffusionType(const WaterFluxType, const WaterContentType)>
effective_diffusion_f () const override
{
......@@ -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
{
return {
......@@ -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
{
return {
......@@ -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
{
using ThisType = MillingtonQuirk1<Traits>;
......
......@@ -11,6 +11,20 @@ namespace Dune {
namespace Dorie {
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 De Los Ríos
* @date 2019
*
* @tparam Traits the base traits
*/
template <class Traits>
class MillingtonQuirk2
: public EffectiveDiffusion<Traits>
......@@ -24,12 +38,14 @@ public:
using WaterFluxType = typename Base::WaterFluxType;
using WaterContentType = typename Base::WaterContentType;
/// Parameter defining molecular diffusion
struct ModelcularDiffusionType
{
RangeField value;
inline static const std::string name = "mol_diff";
};
/// Parameter defining porosity
struct PorosityType
{
RangeField value;
......@@ -42,11 +58,19 @@ public:
ModelcularDiffusionType _mol_diff;
PorosityType _porosity;
public:
/// Construct with default-initialized parameters
/** \param name The name associated with this soil layer
*/
MillingtonQuirk2 (const std::string 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>
MillingtonQuirk2 (
const std::string name,
......@@ -59,9 +83,9 @@ public:
/// Add default destructor to clarify override
~MillingtonQuirk2 () override = default;
public:
/// Return the effective diffusion
/** {WaterFlux,WaterContent} -> EffectiveDiffusion
*/
std::function<EffectiveDiffusionType(const WaterFluxType, const WaterContentType)>
effective_diffusion_f () const override
{
......@@ -71,6 +95,9 @@ public:
};