Public API

DORiE’s Public API comprises the usage of the compiled program as well as the main code segments for using instances of DORiE in other (DUNE) modules and programs.

Command Line API

The compiled program and the Docker application are executed via the Command Line Interface. The specifications for the respective configuration files are given in the Config File Guide.

The main routine (dorie run <config>) also requires input files for boundary conditions and soil parameters.

Code API

DORiE supplies the Model abstract base class. All other models follow this structure.

ABC Model

class ModelBase

Base class for models.

This class is used to handle models with a common interface.

Todo:

Dune::Dorie::OutputPolicy can handle specific intermediate times of the stepping.

Author

Santiago Ospina De Los Ríos

Date

2018

Subclassed by Dune::Dorie::ModelRichards< ModelRichardsTraits >, Dune::Dorie::ModelRichardsTransportCoupling< T >, Dune::Dorie::ModelTransport< ModelTransportTraits >, Dune::Dorie::ModelRichards< Traits >

Public Functions

inline ModelBase(const std::string log_name, const std::string log_level, const Dune::MPIHelper &helper, OutputPolicy output_policy = OutputPolicy::None, AdaptivityPolicy adapt_policy = AdaptivityPolicy::None)

Constructs the ModelBase.

Parameters
  • log_name[in] Name of this model. Appears in the log.

  • log_level[in] The log level of the logger.

  • helper[in] The Dune::MPIHelper instance of this process.

  • output_policy[in] The output policy. Defaults to OutputPolicy::None.

  • adapt_policy[in] The adapt policy. Defaults to AdaptiviyPolicy::None.

inline void set_policy(OutputPolicy output_policy)

Sets the output policy.

Remark

Non-Collective

Parameters

output_policy[in] The output policy,

inline void set_policy(AdaptivityPolicy adapt_policy)

Sets the adaptivity policy.

Parameters

adapt_policy[in] The adaptivity policy.

inline OutputPolicy output_policy() const

Returns the current output policy.

Remark

Non-Collective

Returns

The current output policy.

inline AdaptivityPolicy adaptivity_policy() const

Returns the current adaptivity policy.

Returns

The current adaptivity policy.

inline void set_logger(const std::shared_ptr<spdlog::logger> logger)

Set the logger for this model.

Parameters

logger – The new logger

inline std::shared_ptr<spdlog::logger> logger() const

Return the logger of this model.

inline virtual void write_data() const

Writes the data.

inline virtual void mark_grid()

Mark the grid in order to improve the current model.

inline virtual void pre_adapt_grid()

Operations before adaptation of the grid.

inline virtual void adapt_grid()

Adapt the grid together it every dependency of the grid (e.g. solution vector and grid function spaces).

inline virtual void post_adapt_grid()

Operations after adaptation of the grid.

virtual double begin_time() const = 0

Method that provides the begin time of the model.

Returns

Begin time of the model.

virtual double end_time() const = 0

Method that provides the end time of the model.

Returns

End time of the model.

inline virtual double current_time() const

Method that provides the current time of the model.

Returns

Current time of the model.

virtual void suggest_timestep(double dt) = 0

Suggest a time step to the model.

Parameters
  • dt[in] { parameter_description }

  • suggestion[in] for the internal time step of the model.

virtual void step() = 0

Performs one steps in direction to end_time(). The time-step should never result on a bigger step than the one suggested in suggest_timestep().

inline virtual void run()

Runs the model performing steps until current_time() equals end_time()

Model Traits

The model template requires compile-time type specifications wrapped in a suitable Traits structure.

template<class GridType, Dune::GeometryType::BasicType GeometryType>
struct BaseTraits

Traits struct defining basic types based on grid an geometry.

Subclassed by Dune::Dorie::ModelRichardsTraits< BaseTraits, k >, Dune::Dorie::ModelRichardsTransportCouplingTraits< BaseTraits, RichardsOrder, TransportOrder >, Dune::Dorie::ModelTransportTraits< BaseTraits, GFWaterFluxType, GFWaterContentType, k >

Public Types

using TF = double
using TimeField = TF
using RF = double
using RangeField = RF
using Array = std::vector<RangeField>
using Scalar = Dune::FieldVector<RF, 1>
using Vector = Dune::FieldVector<RF, dim>
using Tensor = Dune::FieldMatrix<RF, dim, dim>
using Index = unsigned int
using IndexArray = Dune::FieldVector<Index, dim>
using Grid = GridType
using DomainField = typename Grid::ctype
using DF = DomainField
using Domain = Dune::FieldVector<DF, dim>
using IntersectionDomain = Dune::FieldVector<DF, dim - 1>
using GV = typename Grid::LeafGridView
using GridView = GV
using Element = typename GV::Traits::template Codim<0>::Entity
using Intersection = typename GV::Traits::Intersection

Public Static Attributes

static constexpr int dim = GridType::dimension
static constexpr Dune::GeometryType::BasicType GridGeometryType = GeometryType

Richards Model

template<typename ModelRichardsTraits>
class ModelRichards : public Dune::Dorie::ModelBase

Class for Richards model. This class manages the model for the richards equation. It can perform time-steps and print the solution.

Template Parameters

ModelRichardsTraits – Traits containing the type definitions for Richards Model

Public Functions

ModelRichards(const Dune::ParameterTree &_inifile, const GridCreator &_grid_creator, Dune::MPIHelper &_helper)

Construct Richards model.

Parameters
  • _inifile – Dune parameter file parser

  • _grid_mapper – Mapper for grid and volume/boundary data

  • _helper – Dune MPI instance controller

virtual void step() override

Compute a time step. Models the time step requirement of ModelBase.

Throws

Dune::Exception – Fatal error occurs during computation

virtual void mark_grid() override

Mark the grid in order to improve the current model.

virtual void adapt_grid() override

Adapt the grid together it every dependency of the grid (e.g. solution vector and grid function spaces).

virtual void post_adapt_grid() override

Setup operators to fit the new grid.

inline virtual double begin_time() const final

Method that provides the begin time of the model.

Returns

Begin time of the model.

inline virtual double end_time() const final

Method that provides the end time of the model.

Returns

End time of the model.

inline State current_state()

Provides an object with all the information that describes the current state of the solved variable.

Returns

Current state of the model.

inline ConstState current_state() const

Provides an object with all the information that describes the current state of the solved variable.

Returns

(Const) Current state of the model.

inline virtual void suggest_timestep(double dt) final

Suggest a time step to the model.

Parameters

dt[in] Suggestion for the internal time step of the model. The new internal time step shall not be bigger than dt.

virtual void write_data() const override

Write the data using the VTKWriter. VTKWriters is always cleared after used.

inline std::shared_ptr<const GFMatricHead> get_matric_head(ConstState state) const

Generates a matric head grid function from a given state.

Returns

Pointer to a matric head grid function

inline std::shared_ptr<const GFMatricHead> get_matric_head() const

Gets the matric head grid function.

Returns

Pointer to a matric head grid function

inline std::shared_ptr<const GFConductivity> get_conductivity(ConstState state) const

Generates a conductivity grid function from a given state.

Returns

Pointer to a conductivity grid function

inline std::shared_ptr<const GFConductivity> get_conductivity() const

Gets the conductivity grid function.

Returns

Pointer to a conductivity grid function

inline std::shared_ptr<const GFWaterContent> get_water_content(ConstState state) const

Generates a water content grid function from a given state.

Returns

Pointer to a water content grid function

inline std::shared_ptr<const GFWaterContent> get_water_content() const

Gets the water content grid function.

Returns

Pointer to a water content grid function

inline std::shared_ptr<const GFSaturation> get_saturation(ConstState state) const

Generates a saturation grid function from a given state.

Returns

Pointer to a saturation grid function

inline std::shared_ptr<const GFSaturation> get_saturation() const

Gets the saturation grid function.

Returns

Pointer to a saturation grid function

inline std::shared_ptr<const GFWaterFlux> get_water_flux(ConstState state) const

Generates a water flux grid function from a given state.

Returns

Pointer to a water flux grid function

inline std::shared_ptr<const GFWaterFlux> get_water_flux() const

Gets the water flux grid function.

Returns

Pointer to a water flux grid function

template<bool enabled = enable_rt_engine>
inline std::enable_if_t<enabled, std::shared_ptr<const GFFluxReconstruction>> get_water_flux_reconstructed(ConstState state) const

Generates a (reconstructed) water flux grid function from a given state.

Parameters

state[in] The state

Returns

Pointer to a (reconstructed) water flux grid function

template<bool enabled = enable_rt_engine>
inline std::enable_if_t<enabled, std::shared_ptr<const GFFluxReconstruction>> get_water_flux_reconstructed() const

Gets the (reconstructed) water flux grid function.

Returns

Pointer to a (reconstructed) water flux grid function

inline void set_policy(OutputPolicy output_policy)

Sets the output policy.

Remark

Non-Collective

Parameters

output_policy[in] The output policy,

inline void set_policy(AdaptivityPolicy adapt_policy)

Sets the adaptivity policy.

Parameters

adapt_policy[in] The adaptivity policy.

inline OutputPolicy output_policy() const

Returns the current output policy.

Remark

Non-Collective

Returns

The current output policy.

inline AdaptivityPolicy adaptivity_policy() const

Returns the current adaptivity policy.

Returns

The current adaptivity policy.

inline void set_logger(const std::shared_ptr<spdlog::logger> logger)

Set the logger for this model.

Parameters

logger – The new logger

inline std::shared_ptr<spdlog::logger> logger() const

Return the logger of this model.

inline virtual void pre_adapt_grid()

Operations before adaptation of the grid.

inline virtual double current_time() const

Method that provides the current time of the model.

Returns

Current time of the model.

inline virtual void run()

Runs the model performing steps until current_time() equals end_time()

Transport Model

template<typename ModelTransportTraits>
class ModelTransport : public Dune::Dorie::ModelBase

Class for Transport model.

For given ModelTransportTraits, this class manages the model for the transport equation.

Todo:

Implement source term.

Implement more complex initial conditions.

Implement adaptivity.

Implement DG local operator.

Author

Santiago Ospina De Los Ríos

Date

2018

Template Parameters

ModelTransportTraits – Traits containing the type definitions which this class will use.

Public Functions

ModelTransport(Dune::ParameterTree &_inifile, const GridCreator &_grid_creator, Dune::MPIHelper &_helper)

Construct model.

Parameters
  • _inifile – Dune parameter file parser.

  • _grid_creator – Mapper for grid and volume/boundary data.

  • _helper – Dune MPI instance controller.

virtual void step() override

Compute a time step. Models the time step requirement of ModelBase.

Throws

Dune::Exception – Fatal error occurs during computation.

virtual void mark_grid() override

Mark the grid in order to improve the current model.

virtual void adapt_grid() override

Adapt the grid and the solutions of the transport simulation.

Warning

This method does not adapt solutions of other simulations!

virtual void post_adapt_grid() override

Setup operators to fit the new grid.

inline virtual double begin_time() const final

Method that provides the begin time of the model.

Returns

Begin time of the model.

inline virtual double end_time() const final

Method that provides the end time of the model.

Returns

End time of the model.

inline State current_state()

Provides an object with all the information that describes the current state of the solved variable.

Returns

Current state of the model.

inline ConstState current_state() const

Provides an object with all the information that describes the current state of the solved variable.

Returns

(Const) Current state of the model.

inline virtual void suggest_timestep(double dt) final

Suggest a time step to the model.

Parameters

dt[in] Suggestion for the internal time step of the model. The new internal time step shall not be bigger than dt.

virtual void write_data() const override

Write the current data using the VTKWriter. VTKWriters is always cleared after used.

inline void set_water_flux(std::shared_ptr<GFWaterFlux> _water_flux_gf)

Sets an instationary function for the water flux.

Parameters

_water_flux_gf[in] The grid function water flux.

inline void set_water_content(std::shared_ptr<GFWaterContent> _water_content_gf)

Sets an instationary function for the water content.

Parameters

_water_content_gf[in] The grid function water content.

inline std::shared_ptr<const GFSolute> get_solute(ConstState state) const

Generates a solute grid function from a given state.

Returns

Pointer to a solute grid function

inline std::shared_ptr<const GFSolute> get_solute() const

Gets the solute grid function.

Returns

Pointer to a solute grid function

inline std::shared_ptr<const GFTotalSolute> get_total_solute(ConstState state) const

Generates a total solute grid function from a given state.

Returns

Pointer to a total solute grid function

inline std::shared_ptr<const GFTotalSolute> get_total_solute() const

Gets the total solute grid function.

Returns

Pointer to a total solute grid function

template<bool enabled = enable_rt_engine>
inline std::enable_if_t<enabled, std::shared_ptr<const GFFluxReconstruction>> get_solute_flux_reconstructed(ConstState state) const

Generates a (reconstructed) solute flux grid function from a given state.

Parameters

state[in] The state

Returns

Pointer to a solute grid function

template<bool enabled = enable_rt_engine>
inline std::enable_if_t<enabled, std::shared_ptr<const GFFluxReconstruction>> get_solute_flux_reconstructed() const

Gets the (reconstructed) solute flux grid function.

Returns

Pointer to a solute grid function

inline void set_policy(OutputPolicy output_policy)

Sets the output policy.

Remark

Non-Collective

Parameters

output_policy[in] The output policy,

inline void set_policy(AdaptivityPolicy adapt_policy)

Sets the adaptivity policy.

Parameters

adapt_policy[in] The adaptivity policy.

inline OutputPolicy output_policy() const

Returns the current output policy.

Remark

Non-Collective

Returns

The current output policy.

inline AdaptivityPolicy adaptivity_policy() const

Returns the current adaptivity policy.

Returns

The current adaptivity policy.

inline void set_logger(const std::shared_ptr<spdlog::logger> logger)

Set the logger for this model.

Parameters

logger – The new logger

inline std::shared_ptr<spdlog::logger> logger() const

Return the logger of this model.

inline virtual void pre_adapt_grid()

Operations before adaptation of the grid.

inline virtual double current_time() const

Method that provides the current time of the model.

Returns

Current time of the model.

inline virtual void run()

Runs the model performing steps until current_time() equals end_time()

Coupling Model

The coupling between Richards and Transport models is done by yet another model which is in charge of managing the steps of the two sub-models.

template<typename ModelTransportTraits>
class ModelTransport : public Dune::Dorie::ModelBase

Class for Transport model.

For given ModelTransportTraits, this class manages the model for the transport equation.

Todo:

Implement source term.

Implement more complex initial conditions.

Implement adaptivity.

Implement DG local operator.

Author

Santiago Ospina De Los Ríos

Date

2018

Template Parameters

ModelTransportTraits – Traits containing the type definitions which this class will use.

Public Functions

ModelTransport(Dune::ParameterTree &_inifile, const GridCreator &_grid_creator, Dune::MPIHelper &_helper)

Construct model.

Parameters
  • _inifile – Dune parameter file parser.

  • _grid_creator – Mapper for grid and volume/boundary data.

  • _helper – Dune MPI instance controller.

virtual void step() override

Compute a time step. Models the time step requirement of ModelBase.

Throws

Dune::Exception – Fatal error occurs during computation.

virtual void mark_grid() override

Mark the grid in order to improve the current model.

virtual void adapt_grid() override

Adapt the grid and the solutions of the transport simulation.

Warning

This method does not adapt solutions of other simulations!

virtual void post_adapt_grid() override

Setup operators to fit the new grid.

inline virtual double begin_time() const final

Method that provides the begin time of the model.

Returns

Begin time of the model.

inline virtual double end_time() const final

Method that provides the end time of the model.

Returns

End time of the model.

inline State current_state()

Provides an object with all the information that describes the current state of the solved variable.

Returns

Current state of the model.

inline ConstState current_state() const

Provides an object with all the information that describes the current state of the solved variable.

Returns

(Const) Current state of the model.

inline virtual void suggest_timestep(double dt) final

Suggest a time step to the model.

Parameters

dt[in] Suggestion for the internal time step of the model. The new internal time step shall not be bigger than dt.

virtual void write_data() const override

Write the current data using the VTKWriter. VTKWriters is always cleared after used.

inline void set_water_flux(std::shared_ptr<GFWaterFlux> _water_flux_gf)

Sets an instationary function for the water flux.

Parameters

_water_flux_gf[in] The grid function water flux.

inline void set_water_content(std::shared_ptr<GFWaterContent> _water_content_gf)

Sets an instationary function for the water content.

Parameters

_water_content_gf[in] The grid function water content.

inline std::shared_ptr<const GFSolute> get_solute(ConstState state) const

Generates a solute grid function from a given state.

Returns

Pointer to a solute grid function

inline std::shared_ptr<const GFSolute> get_solute() const

Gets the solute grid function.

Returns

Pointer to a solute grid function

inline std::shared_ptr<const GFTotalSolute> get_total_solute(ConstState state) const

Generates a total solute grid function from a given state.

Returns

Pointer to a total solute grid function

inline std::shared_ptr<const GFTotalSolute> get_total_solute() const

Gets the total solute grid function.

Returns

Pointer to a total solute grid function

template<bool enabled = enable_rt_engine>
inline std::enable_if_t<enabled, std::shared_ptr<const GFFluxReconstruction>> get_solute_flux_reconstructed(ConstState state) const

Generates a (reconstructed) solute flux grid function from a given state.

Parameters

state[in] The state

Returns

Pointer to a solute grid function

template<bool enabled = enable_rt_engine>
inline std::enable_if_t<enabled, std::shared_ptr<const GFFluxReconstruction>> get_solute_flux_reconstructed() const

Gets the (reconstructed) solute flux grid function.

Returns

Pointer to a solute grid function

inline void set_policy(OutputPolicy output_policy)

Sets the output policy.

Remark

Non-Collective

Parameters

output_policy[in] The output policy,

inline void set_policy(AdaptivityPolicy adapt_policy)

Sets the adaptivity policy.

Parameters

adapt_policy[in] The adaptivity policy.

inline OutputPolicy output_policy() const

Returns the current output policy.

Remark

Non-Collective

Returns

The current output policy.

inline AdaptivityPolicy adaptivity_policy() const

Returns the current adaptivity policy.

Returns

The current adaptivity policy.

inline void set_logger(const std::shared_ptr<spdlog::logger> logger)

Set the logger for this model.

Parameters

logger – The new logger

inline std::shared_ptr<spdlog::logger> logger() const

Return the logger of this model.

inline virtual void pre_adapt_grid()

Operations before adaptation of the grid.

inline virtual double current_time() const

Method that provides the current time of the model.

Returns

Current time of the model.

inline virtual void run()

Runs the model performing steps until current_time() equals end_time()