Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dorie
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
31
Issues
31
List
Boards
Labels
Service Desk
Milestones
Merge Requests
9
Merge Requests
9
Operations
Operations
Incidents
Environments
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
dorie
dorie
Commits
ad2d3d77
Commit
ad2d3d77
authored
Feb 14, 2020
by
Santiago Ospina De Los Ríos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Apply clang format to .hh files in DORiE
parent
a6e1e7c2
Changes
51
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
51 changed files
with
6599 additions
and
5976 deletions
+6599
-5976
dune/dorie/common/finite_element/raviart_thomas_dg_fem.hh
dune/dorie/common/finite_element/raviart_thomas_dg_fem.hh
+1
-1
dune/dorie/model/base.hh
dune/dorie/model/base.hh
+48
-52
dune/dorie/model/coupling/richards_coupling.hh
dune/dorie/model/coupling/richards_coupling.hh
+72
-85
dune/dorie/model/factory.hh
dune/dorie/model/factory.hh
+72
-86
dune/dorie/model/factory_richards.hh
dune/dorie/model/factory_richards.hh
+88
-98
dune/dorie/model/factory_transport.hh
dune/dorie/model/factory_transport.hh
+136
-155
dune/dorie/model/local_operator_cfg.hh
dune/dorie/model/local_operator_cfg.hh
+46
-48
dune/dorie/model/richards/adapters/conductivity.hh
dune/dorie/model/richards/adapters/conductivity.hh
+155
-79
dune/dorie/model/richards/adapters/discrete_grid_function_gradient.hh
...odel/richards/adapters/discrete_grid_function_gradient.hh
+66
-39
dune/dorie/model/richards/adapters/saturation.hh
dune/dorie/model/richards/adapters/saturation.hh
+178
-84
dune/dorie/model/richards/adapters/water_content.hh
dune/dorie/model/richards/adapters/water_content.hh
+182
-85
dune/dorie/model/richards/adapters/water_flux.hh
dune/dorie/model/richards/adapters/water_flux.hh
+191
-83
dune/dorie/model/richards/adaptivity/handler.hh
dune/dorie/model/richards/adaptivity/handler.hh
+267
-244
dune/dorie/model/richards/adaptivity/operator_error_indicator.hh
...rie/model/richards/adaptivity/operator_error_indicator.hh
+298
-277
dune/dorie/model/richards/flow_parameters.hh
dune/dorie/model/richards/flow_parameters.hh
+218
-227
dune/dorie/model/richards/flow_source.hh
dune/dorie/model/richards/flow_source.hh
+82
-84
dune/dorie/model/richards/initial_condition.hh
dune/dorie/model/richards/initial_condition.hh
+25
-29
dune/dorie/model/richards/knofu.hh
dune/dorie/model/richards/knofu.hh
+208
-189
dune/dorie/model/richards/local_operator_DG.hh
dune/dorie/model/richards/local_operator_DG.hh
+831
-722
dune/dorie/model/richards/local_operator_FV.hh
dune/dorie/model/richards/local_operator_FV.hh
+123
-110
dune/dorie/model/richards/local_operator_cfg.hh
dune/dorie/model/richards/local_operator_cfg.hh
+41
-42
dune/dorie/model/richards/parameterization/factory.hh
dune/dorie/model/richards/parameterization/factory.hh
+19
-21
dune/dorie/model/richards/parameterization/interface.hh
dune/dorie/model/richards/parameterization/interface.hh
+124
-132
dune/dorie/model/richards/parameterization/mualem_van_genuchten.hh
...e/model/richards/parameterization/mualem_van_genuchten.hh
+124
-136
dune/dorie/model/richards/parameterization/scaling.hh
dune/dorie/model/richards/parameterization/scaling.hh
+120
-139
dune/dorie/model/richards/richards.hh
dune/dorie/model/richards/richards.hh
+596
-558
dune/dorie/model/transport/adapters/effective_hydrodynamic_dispersion.hh
...l/transport/adapters/effective_hydrodynamic_dispersion.hh
+76
-49
dune/dorie/model/transport/adapters/peclet.hh
dune/dorie/model/transport/adapters/peclet.hh
+42
-38
dune/dorie/model/transport/adapters/total_solute.hh
dune/dorie/model/transport/adapters/total_solute.hh
+141
-65
dune/dorie/model/transport/initial_condition.hh
dune/dorie/model/transport/initial_condition.hh
+15
-19
dune/dorie/model/transport/local_operator_DG.hh
dune/dorie/model/transport/local_operator_DG.hh
+80
-110
dune/dorie/model/transport/parameterization/factory.hh
dune/dorie/model/transport/parameterization/factory.hh
+60
-46
dune/dorie/model/transport/parameterization/hydrodynamic_dispersion/const.hh
...ansport/parameterization/hydrodynamic_dispersion/const.hh
+161
-144
dune/dorie/model/transport/parameterization/hydrodynamic_dispersion/eff_diffusion/const.hh
...terization/hydrodynamic_dispersion/eff_diffusion/const.hh
+74
-79
dune/dorie/model/transport/parameterization/hydrodynamic_dispersion/eff_diffusion/interface.hh
...zation/hydrodynamic_dispersion/eff_diffusion/interface.hh
+58
-62
dune/dorie/model/transport/parameterization/hydrodynamic_dispersion/eff_diffusion/millington_quirk_1.hh
...drodynamic_dispersion/eff_diffusion/millington_quirk_1.hh
+91
-97
dune/dorie/model/transport/parameterization/hydrodynamic_dispersion/eff_diffusion/millington_quirk_2.hh
...drodynamic_dispersion/eff_diffusion/millington_quirk_2.hh
+91
-97
dune/dorie/model/transport/parameterization/hydrodynamic_dispersion/eff_hydromechanic_dispersion/const.hh
...odynamic_dispersion/eff_hydromechanic_dispersion/const.hh
+147
-120
dune/dorie/model/transport/parameterization/hydrodynamic_dispersion/eff_hydromechanic_dispersion/interface.hh
...amic_dispersion/eff_hydromechanic_dispersion/interface.hh
+69
-69
dune/dorie/model/transport/parameterization/hydrodynamic_dispersion/eff_hydromechanic_dispersion/isotropic.hh
...amic_dispersion/eff_hydromechanic_dispersion/isotropic.hh
+120
-114
dune/dorie/model/transport/parameterization/hydrodynamic_dispersion/eff_hydromechanic_dispersion/longitudinal/const.hh
...ersion/eff_hydromechanic_dispersion/longitudinal/const.hh
+76
-79
dune/dorie/model/transport/parameterization/hydrodynamic_dispersion/eff_hydromechanic_dispersion/longitudinal/interface.hh
...on/eff_hydromechanic_dispersion/longitudinal/interface.hh
+57
-58
dune/dorie/model/transport/parameterization/hydrodynamic_dispersion/eff_hydromechanic_dispersion/transverse/const.hh
...spersion/eff_hydromechanic_dispersion/transverse/const.hh
+77
-80
dune/dorie/model/transport/parameterization/hydrodynamic_dispersion/eff_hydromechanic_dispersion/transverse/interface.hh
...sion/eff_hydromechanic_dispersion/transverse/interface.hh
+57
-58
dune/dorie/model/transport/parameterization/hydrodynamic_dispersion/power_law.hh
...ort/parameterization/hydrodynamic_dispersion/power_law.hh
+115
-118
dune/dorie/model/transport/parameterization/hydrodynamic_dispersion/superposition.hh
...parameterization/hydrodynamic_dispersion/superposition.hh
+98
-96
dune/dorie/model/transport/parameterization/interface.hh
dune/dorie/model/transport/parameterization/interface.hh
+119
-123
dune/dorie/model/transport/solute_parameters.hh
dune/dorie/model/transport/solute_parameters.hh
+171
-174
dune/dorie/model/transport/transport.hh
dune/dorie/model/transport/transport.hh
+205
-186
dune/dorie/test/test-grid-creation.hh
dune/dorie/test/test-grid-creation.hh
+53
-56
dune/dorie/test/test-parameterization.hh
dune/dorie/test/test-parameterization.hh
+35
-34
No files found.
dune/dorie/common/finite_element/raviart_thomas_dg_fem.hh
View file @
ad2d3d77
#ifndef DUNE_DORIE_RAVIART_THOMAS_DG_FEM_HH
#define DUNE_DORIE_RAVIART_THOMAS_DG_FEM_HH
#include <dune/pdelab/finiteelementmap/finiteelementmap.hh>
#include <dune/pdelab/finiteelement/l2orthonormal.hh>
#include <dune/pdelab/finiteelementmap/finiteelementmap.hh>
#include <dune/dorie/common/finite_element/raviart_thomas_dg/local_finite_element.hh>
...
...
dune/dorie/model/base.hh
View file @
ad2d3d77
...
...
@@ -9,8 +9,8 @@
#include <dune/dorie/common/typedefs.hh>
namespace
Dune
{
namespace
Dorie
{
namespace
Dune
{
namespace
Dorie
{
/**
* @brief Base class for models.
...
...
@@ -24,7 +24,6 @@ namespace Dorie{
class
ModelBase
{
public:
/**
* @brief Constructs the ModelBase.
*
...
...
@@ -36,26 +35,27 @@ public:
* @param[in] adapt_policy The adapt policy.
* Defaults to AdaptiviyPolicy::None.
*/
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
)
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
)
:
_output_policy
(
output_policy
)
,
_adapt_policy
(
adapt_policy
)
,
_time
(
0.0
)
,
_log
(
create_logger
(
log_name
,
helper
,
spdlog
::
level
::
from_str
(
log_level
)))
{
}
{}
virtual
~
ModelBase
()
=
default
;
virtual
~
ModelBase
()
=
default
;
/**
* @brief Sets the output policy.
*
* @param[in] output_policy The output policy,
*/
void
set_policy
(
OutputPolicy
output_policy
)
{
_output_policy
=
output_policy
;}
void
set_policy
(
OutputPolicy
output_policy
)
{
_output_policy
=
output_policy
;
}
/**
* @brief Sets the adaptivity policy.
...
...
@@ -72,20 +72,19 @@ public:
*
* @return The current output policy.
*/
OutputPolicy
output_policy
()
const
{
return
_output_policy
;}
OutputPolicy
output_policy
()
const
{
return
_output_policy
;
}
/**
* @brief Returns the current adaptivity policy.
*
* @return The current adaptivity policy.
*/
AdaptivityPolicy
adaptivity_policy
()
const
{
return
_adapt_policy
;
}
AdaptivityPolicy
adaptivity_policy
()
const
{
return
_adapt_policy
;
}
/// Set the logger for this model
/** @param logger The new logger
*/
void
set_logger
(
const
std
::
shared_ptr
<
spdlog
::
logger
>
logger
)
void
set_logger
(
const
std
::
shared_ptr
<
spdlog
::
logger
>
logger
)
{
_log
=
logger
;
}
...
...
@@ -119,7 +118,7 @@ public:
/**
* @brief Operations before adaptation of the grid
*/
virtual
void
pre_adapt_grid
()
{};
virtual
void
pre_adapt_grid
(){};
/**
* @brief Adapt the grid together it every dependency of the grid (e.g.
...
...
@@ -131,8 +130,7 @@ public:
_log
->
error
(
"This model does not implement a grid adaptation "
"algorithm."
);
DUNE_THROW
(
Dune
::
NotImplemented
,
"'adapt_grid' not implemented"
);
}
else
{
}
else
{
_log
->
error
(
"Calling 'adapt_grid' on a model with "
"AdaptivityPolicy::None. Grid adaptation refused"
);
DUNE_THROW
(
Dune
::
InvalidStateException
,
"Invalid adaptation policy"
);
...
...
@@ -142,7 +140,7 @@ public:
/**
* @brief Operations after adaptation of the grid
*/
virtual
void
post_adapt_grid
()
{};
virtual
void
post_adapt_grid
(){};
/**
* @brief Method that provides the begin time of the model.
...
...
@@ -189,13 +187,11 @@ public:
if
(
output_policy
()
!=
OutputPolicy
::
None
)
write_data
();
while
(
Dune
::
FloatCmp
::
lt
(
current_time
(),
end_time
())
)
{
while
(
Dune
::
FloatCmp
::
lt
(
current_time
(),
end_time
()))
{
step
();
if
(
adaptivity_policy
()
!=
AdaptivityPolicy
::
None
)
if
(
Dune
::
FloatCmp
::
lt
(
current_time
(),
end_time
())
)
{
if
(
Dune
::
FloatCmp
::
lt
(
current_time
(),
end_time
()))
{
mark_grid
();
pre_adapt_grid
();
adapt_grid
();
...
...
@@ -205,8 +201,8 @@ public:
}
private:
OutputPolicy
_output_policy
;
AdaptivityPolicy
_adapt_policy
;
OutputPolicy
_output_policy
;
AdaptivityPolicy
_adapt_policy
;
protected:
/// The current time of the model
...
...
@@ -222,28 +218,28 @@ protected:
## Base class for models
### Stepping:
The method `step()` must be an abstract method that always has to be
implemented by the derived class. The step must succeed always, otherwise,
it should throw a `ModelStepException`. It means that time adaptivity
The method `step()` must be an abstract method that always has to be
implemented by the derived class. The step must succeed always, otherwise,
it should throw a `ModelStepException`. It means that time adaptivity
must be done internally so that the time step succeeds.
### Writing data:
The method `step()` must be able to decide whether to write data or not.
(Say that in one case one wants that transport writes that every step and in
another case one wants that it writes at the end of the Richards step. The
first case can't be covered writing data in the `run()` method of the
coupled model.) Then, enum class called `OutputPolicy` must decide
whether to call the method `write_data()`. This policy can be set and be
extracted by the methods `set_policy(OutputPolicy)` and `output_policy()`
The method `step()` must be able to decide whether to write data or not.
(Say that in one case one wants that transport writes that every step and in
another case one wants that it writes at the end of the Richards step. The
first case can't be covered writing data in the `run()` method of the
coupled model.) Then, enum class called `OutputPolicy` must decide
whether to call the method `write_data()`. This policy can be set and be
extracted by the methods `set_policy(OutputPolicy)` and `output_policy()`
respectively.
The method `write_data()` should be in charge of writing the data.
In principle, this method should be only used following the `OutputPolicy`.
Usually called at the end of each step and at the beginning of the
model. Since the `step()` method is in charge of it, it is assumed that
this method writes the *current* state of the model (e.g. intermediate
The method `write_data()` should be in charge of writing the data.
In principle, this method should be only used following the `OutputPolicy`.
Usually called at the end of each step and at the beginning of the
model. Since the `step()` method is in charge of it, it is assumed that
this method writes the *current* state of the model (e.g. intermediate
results of the coupled model for the transport state).
### Adaptivity:
...
...
@@ -270,19 +266,19 @@ protected:
A minimal interface is only providing `begin_time()`, `end_time()` and
`current_time()`.
In order to keep solution vectors minimal at the time of adaptivity, DORiE
expect the several models synchronized in time. Therefore, a good and still
minimal interface is only suggesting the timestep to the model via
`suggest_timestep(double dt)`. Such suggestion has to be taken into account
within the model, and the model must ensure that the timestep is done in
`step()` is never bigger than the suggested one so that coupled models can
achieve synchronization. Naturally, models have to ensure that
In order to keep solution vectors minimal at the time of adaptivity, DORiE
expect the several models synchronized in time. Therefore, a good and still
minimal interface is only suggesting the timestep to the model via
`suggest_timestep(double dt)`. Such suggestion has to be taken into account
within the model, and the model must ensure that the timestep is done in
`step()` is never bigger than the suggested one so that coupled models can
achieve synchronization. Naturally, models have to ensure that
`begin_time()` \f$=\f$ `current_time()` when they are constructed.
### Local Operator Setup:
Since adaptivity can modify the complete setup of the model, and since
the method `adapt_grid()` is not necessarily called by the model.
Since adaptivity can modify the complete setup of the model, and since
the method `adapt_grid()` is not necessarily called by the model.
There is a need for the method `post_adapt_grid()` which is in charge of
setup everything again to the new grid. Same argument holds for
`pre_adapt_grid()`.
...
...
dune/dorie/model/coupling/richards_coupling.hh
View file @
ad2d3d77
...
...
@@ -10,8 +10,8 @@
#include <gtest/gtest.h>
#endif
namespace
Dune
{
namespace
Dorie
{
namespace
Dune
{
namespace
Dorie
{
/**
* @brief Traits for the class ModelRichardsTransportCoupling.
...
...
@@ -29,38 +29,42 @@ namespace Dorie{
* @tparam TransportOrder Order of the polynomial degree used for the basis
* functions in the Transport DG/FV method.
*/
template
<
class
BaseTraits
,
unsigned
int
RichardsOrder
,
unsigned
int
TransportOrder
>
template
<
class
BaseTraits
,
unsigned
int
RichardsOrder
,
unsigned
int
TransportOrder
>
struct
ModelRichardsTransportCouplingTraits
:
public
BaseTraits
{
private:
using
ModelRichardsTraits
=
Dune
::
Dorie
::
ModelRichardsTraits
<
BaseTraits
,
RichardsOrder
>
;
using
ModelRichardsTraits
=
Dune
::
Dorie
::
ModelRichardsTraits
<
BaseTraits
,
RichardsOrder
>
;
public:
static_assert
(
ModelRichardsTraits
::
enable_rt_engine
,
"Flux reconstruction is not available in the Richards model!"
);
"Flux reconstruction is not available in the Richards model!"
);
/// Container for the water content grid function
/** \note Interpolates linearly between time steps.
* \see GridFunctionContainerPolicy
*/
using
GFWaterContentContainer
=
GridFunctionContainer
<
const
typename
ModelRichardsTraits
::
GFWaterContent
,
double
,
GridFunctionContainerPolicy
::
LinearInterpolation
>
;
using
GFWaterContentContainer
=
GridFunctionContainer
<
const
typename
ModelRichardsTraits
::
GFWaterContent
,
double
,
GridFunctionContainerPolicy
::
LinearInterpolation
>
;
/// Container for the water flux grid function
/** \note Returns the next future value
* \see GridFunctionContainerPolicy
*/
using
GFWaterFluxContainer
=
GridFunctionContainer
<
const
typename
ModelRichardsTraits
::
GFFluxReconstruction
>
;
using
GFWaterFluxContainer
=
GridFunctionContainer
<
const
typename
ModelRichardsTraits
::
GFFluxReconstruction
>
;
private:
using
ModelTransportTraits
=
Dune
::
Dorie
::
ModelTransportTraits
<
BaseTraits
,
GFWaterFluxContainer
,
GFWaterContentContainer
,
TransportOrder
>
;
using
ModelTransportTraits
=
Dune
::
Dorie
::
ModelTransportTraits
<
BaseTraits
,
GFWaterFluxContainer
,
GFWaterContentContainer
,
TransportOrder
>
;
public:
using
ModelRichards
=
Dune
::
Dorie
::
ModelRichards
<
ModelRichardsTraits
>
;
using
ModelTransport
=
Dune
::
Dorie
::
ModelTransport
<
ModelTransportTraits
>
;
...
...
@@ -70,7 +74,6 @@ public:
using
GridCreator
=
Dune
::
Dorie
::
GridCreator
<
typename
BaseTraits
::
Grid
>
;
};
/**
* @brief Class for richards transport coupling model.
* @details For given ModelRichardsTransportCouplingTraits, this class
...
...
@@ -91,31 +94,31 @@ class ModelRichardsTransportCoupling : public ModelBase
{
public:
using
Traits
=
T
;
private:
using
ModelRichards
=
typename
Traits
::
ModelRichards
;
using
ModelRichards
=
typename
Traits
::
ModelRichards
;
using
ModelTransport
=
typename
Traits
::
ModelTransport
;
using
ModelRichardsTraits
=
typename
ModelRichards
::
Traits
;
using
ModelRichardsTraits
=
typename
ModelRichards
::
Traits
;
using
ModelTransportTraits
=
typename
ModelTransport
::
Traits
;
using
GFWaterContentContainer
=
typename
Traits
::
GFWaterContentContainer
;
using
GFWaterContentContainer
=
typename
Traits
::
GFWaterContentContainer
;
using
GFWaterFluxContainer
=
typename
Traits
::
GFWaterFluxContainer
;
using
GridCreator
=
typename
Traits
::
GridCreator
;
using
TimeField
=
typename
Traits
::
TimeField
;
using
RichardsState
=
typename
ModelRichardsTraits
::
State
;
std
::
shared_ptr
<
typename
Traits
::
BaseTraits
::
Grid
>
_grid
;
Dune
::
ParameterTree
_inifile_richards
,
_inifile_transport
;
std
::
unique_ptr
<
ModelRichards
>
_richards
;
std
::
unique_ptr
<
ModelRichards
>
_richards
;
std
::
unique_ptr
<
ModelTransport
>
_transport
;
RichardsState
richards_state_before_step
,
richards_state_after_step
;
public:
/**
* @brief Construct Coupled model.
*
...
...
@@ -126,21 +129,19 @@ public:
*
* @todo Fix logger warning.
*/
ModelRichardsTransportCoupling
(
Dune
::
ParameterTree
&
inifile_richards
,
Dune
::
ParameterTree
&
inifile_transport
,
const
GridCreator
&
_grid_creator
,
Dune
::
MPIHelper
&
helper
);
ModelRichardsTransportCoupling
(
Dune
::
ParameterTree
&
inifile_richards
,
Dune
::
ParameterTree
&
inifile_transport
,
const
GridCreator
&
_grid_creator
,
Dune
::
MPIHelper
&
helper
);
~
ModelRichardsTransportCoupling
()
=
default
;
/*------------------------------------------------------------------------*//**
* @brief Compute a time step. Models the time step requirement of
* ModelBase
*
* @throws Dune::Exception Fatal error occurs during computation
*/
/*------------------------------------------------------------------------*/
/**
* @brief Compute a time step. Models the time step requirement of
* ModelBase
*
* @throws Dune::Exception Fatal error occurs during computation
*/
void
step
()
override
;
/**
...
...
@@ -149,30 +150,27 @@ public:
void
mark_grid
()
override
{
// select model and mark the grid
if
(
adaptivity_policy
()
==
AdaptivityPolicy
::
WaterFlux
)
{
if
(
adaptivity_policy
()
==
AdaptivityPolicy
::
WaterFlux
)
{
_richards
->
set_policy
(
adaptivity_policy
());
_richards
->
mark_grid
();
}
else
if
(
adaptivity_policy
()
==
AdaptivityPolicy
::
SoluteFlux
)
{
}
else
if
(
adaptivity_policy
()
==
AdaptivityPolicy
::
SoluteFlux
)
{
_transport
->
set_policy
(
adaptivity_policy
());
_transport
->
mark_grid
();
}
else
if
(
adaptivity_policy
()
!=
AdaptivityPolicy
::
None
)
DUNE_THROW
(
Dune
::
NotImplemented
,
"Not known adaptivity policy!"
);
DUNE_THROW
(
Dune
::
NotImplemented
,
"Not known adaptivity policy!"
);
}
/**
* @brief Operations before adaptation of the grid
*/
void
pre_adapt_grid
()
override
void
pre_adapt_grid
()
override
{
_richards
->
pre_adapt_grid
();
_transport
->
pre_adapt_grid
();
};
/**
* @brief Adapt the grid together it every dependency of the
* @brief Adapt the grid together it every dependency of the
* grid (e.g. solution vector and grid function spaces).
*/
void
adapt_grid
()
override
;
...
...
@@ -182,44 +180,35 @@ public:
*/
void
post_adapt_grid
()
override
;
/*------------------------------------------------------------------------*//**
* @brief Method that provides the begin time of the model.
*
* @return Begin time of the model.
*/
double
begin_time
()
const
override
{
return
_richards
->
begin_time
();
}
/*------------------------------------------------------------------------*//**
* @brief Method that provides the end time of the model.
*
* @return End time of the model.
*/
double
end_time
()
const
override
{
return
_richards
->
end_time
();
}
/*------------------------------------------------------------------------*//**
* @brief Suggest a time step to the model.
*
* @param[in] dt Suggestion for the internal time step of the model. The
* new internal time step shall not be bigger than dt
*/
void
suggest_timestep
(
double
dt
)
override
{
_richards
->
suggest_timestep
(
dt
);
}
/*------------------------------------------------------------------------*//**
* @brief Write the data using the VTKWriter. VTKWriters is always
* cleared after used.
*
* @param[in] time The time to print in th pvd file.
*/
void
write_data
()
const
override
/*------------------------------------------------------------------------*/
/**
* @brief Method that provides the begin time of the model.
*
* @return Begin time of the model.
*/
double
begin_time
()
const
override
{
return
_richards
->
begin_time
();
}
/*------------------------------------------------------------------------*/
/**
* @brief Method that provides the end time of the model.
*
* @return End time of the model.
*/
double
end_time
()
const
override
{
return
_richards
->
end_time
();
}
/*------------------------------------------------------------------------*/
/**
* @brief Suggest a time step to the model.
*
* @param[in] dt Suggestion for the internal time step of the model. The
* new internal time step shall not be bigger than dt
*/
void
suggest_timestep
(
double
dt
)
override
{
_richards
->
suggest_timestep
(
dt
);
}
/*------------------------------------------------------------------------*/
/**
* @brief Write the data using the VTKWriter. VTKWriters is always
* cleared after used.
*
* @param[in] time The time to print in th pvd file.
*/
void
write_data
()
const
override
{
if
(
_richards
->
output_policy
()
!=
OutputPolicy
::
None
)
_richards
->
write_data
();
...
...
@@ -228,13 +217,11 @@ public:
}
private:
#ifdef GTEST
FRIEND_TEST
(
ModelCoupling
,
TimeSteps
);
#endif
};
}
// namespace Dorie
}
// namespace Dune
...
...
dune/dorie/model/factory.hh
View file @
ad2d3d77
#ifndef DUNE_DORIE_MODEL_FACTORY_HH
#define DUNE_DORIE_MODEL_FACTORY_HH
#ifndef DORIE_DIM
#error DORIE_DIM macro must be defined for factory builds
#error DORIE_DIM macro must be defined for factory builds
#else
static_assert
(
DORIE_DIM
==
2
or
DORIE_DIM
==
3
,
"DORiE can only be built in 2D or 3D"
);
static_assert
(
DORIE_DIM
==
2
or
DORIE_DIM
==
3
,
"DORiE can only be built in 2D or 3D"
);
#endif
#include <memory>
#include <utility>
#include <dune/common/parametertree.hh>
#include <dune/common/parallel/mpihelper.hh>
#include <dune/common/parametertree.hh>
#include <dune/geometry/type.hh>
#include <dune/grid/uggrid.hh>
#include <dune/grid/yaspgrid.hh>
#include <dune/dorie/common/setup.hh>
#include <dune/dorie/common/logging.hh>
#include <dune/dorie/common/utility.hh>
#include <dune/dorie/common/grid_creator.hh>
#include <dune/dorie/common/logging.hh>
#include <dune/dorie/common/setup.hh>
#include <dune/dorie/common/utility.hh>
#include <dune/dorie/model/base.hh>
...
...
@@ -42,87 +40,75 @@ namespace Dorie {
struct
ModelFactory
{
protected:
/// An unstructured grid (simplices & rectangles, adaptive)
template
<
int
dim
>
using
UnstructuredGrid
=
Dune
::
UGGrid
<
dim
>
;
/// A structured grid (rectangles only)
template
<
int
dim
>
using
StructuredGrid
=
Dune
::
YaspGrid
<
dim
>
;
template
<
class
Grid
>
using
BaseTraitsSimplex
=
BaseTraits
<
Grid
,
Dune
::
GeometryType
::
BasicType
::
simplex
>
;
template
<
class
Grid
>
using
BaseTraitsCube
=
BaseTraits
<
Grid
,
Dune
::
GeometryType
::
BasicType
::
cube
>
;
/// Return the grid settings
/** \return Pair: Grid type/mode setting, bool if adaptivity is enabled
*/
static
std
::
pair
<
GridMode
,
bool
>
get_grid_config
(
const
Dune
::
ParameterTree
&
config
)
{
const
auto
log
=
get_logger
(
log_base
);
// check if adaptivity is enabled
const
auto
policy
=
config
.
get
<
std
::
string
>
(
"adaptivity.policy"
);
const
bool
adaptivity_enbaled
=
not
is_none
(
policy
);
// check grid type
GridMode
grid_mode
;
const
auto
grid_type
=
config
.
get
<
std
::
string
>
(
"grid.gridType"
);
if
(
grid_type
==
"gmsh"
)
{
grid_mode
=
GridMode
::
gmsh
;
}
else
if
(
grid_type
==
"rectangular"
)
{
grid_mode
=
GridMode
::
rectangular
;
}
else
{
log
->
error
(
"Unknown grid type: {}"
,
grid_type
);
DUNE_THROW
(
IOError
,
"Unknown grid type"
);
}
return
{
grid_mode
,
adaptivity_enbaled
};
}
/// Return the adaptivity policy read from a config tree
static
AdaptivityPolicy
get_adaptivity_policy
(
const
Dune
::
ParameterTree
&
config
)
{
std
::
string
adapt_policy_str
=
config
.
get
<
std
::
string
>
(
"adaptivity.policy"
);
if
(
adapt_policy_str
==
"waterFlux"
)
{
return
AdaptivityPolicy
::
WaterFlux
;
}
else
if
(
adapt_policy_str
==
"soluteFlux"
)
{
return
AdaptivityPolicy
::
SoluteFlux
;
}
else
if
(
is_none
(
adapt_policy_str
))
{
return
AdaptivityPolicy
::
None
;
}
else
{
const
auto
log
=
get_logger
(
log_base
);
log
->
error
(
"Unknown adaptivity policy: {}"
,
adapt_policy_str
);
DUNE_THROW
(
IOError
,
"Unknown adaptivity policy"
);
}
/// An unstructured grid (simplices & rectangles, adaptive)
template
<
int
dim
>
using
UnstructuredGrid
=
Dune
::
UGGrid
<
dim
>
;
/// A structured grid (rectangles only)
template
<
int
dim
>
using
StructuredGrid
=
Dune
::
YaspGrid
<
dim
>
;
template
<
class
Grid
>
using
BaseTraitsSimplex
=
BaseTraits
<
Grid
,
Dune
::
GeometryType
::
BasicType
::
simplex
>
;