The Hydrogeology module of code_saturne is a numerical model for groundwater flow and solute transport in continuous porous media. The flow part is based on the Richards equation, derived from the Darcy law and the conservation of mass. The transport part is based on the the classical advection-diffusion equation of tracers, slightly modified to account the specificities of groundwater transport.
This module can be used to simulate transfers of water and solutes in several saturated and/or unsaturated porous media. The flow part can be steady or unsteady, with isotropic or anisotropic permeabilities and allows for any type of soil water retention model thanks to a user-defined model. Two classical models are predefined: the saturated model and the van Genuchten-Mualen model. The transport part considers dispersion, sorption and radioactive decay. The partition between soil and water phases can be modeled by a classical Kd approach model. Additionaly solute precipitation/dissolution phenomena can also be taken into account by an instantaneous model.
Physical concepts and equations are presented in the theory guide
The groundwater flow module (GWF) relies on CDO vertex-based or CDO vertex+cell-based discretization schemes. Here is listed a set of references useful for the reader willing to get a better understanding of the mathematical concepts underpinning CDO schemes.
To set-up a GWF computation, one has to update the cs_user_parameters.c file and edit the function cs_user_model at least in simple cases. In more complex cases, editing cs_user_finalize_setup should be necessary.
The first step is to activate the CDO module in the function cs_user_model (please refer to Activation of CDO/HHO schemes).
Then, one has to activate the groundwater flow (GWF) module in the function cs_user_model. The function to call is cs_gwf_activate.
There are three parameters:
Remark: If a CS_GWF_MODEL_SATURATED_SINGLE_PHASE is set at the activation step, then one expects that all soil models are defined by the type CS_GWF_SOIL_SATURATED
Example 1: Activate the GWF model with a fully saturated single-phase flow model and no other option.
Example 2: Second example: Activate the GWF model with an unsaturated single-phase flow model without any additional option.
Example 3: Activate the GWF model with an unsaturated single-phase flow model. Moreover, one takes into account the gravity effect and the postprocessing of the soil permeability as well as the Darcy flux across domain boundaries.
The second step is to add at least one new soil. The add of soil(s) should be done before adding tracers inside the function cs_user_model and after having activated the GWF module. Two functions are available to add a new soil:
These two functions have a similar set of parameters:
1
for instance.The saturated model is the simplest model.
Example 1: A saturated soils defined by an isotropic permeability on all the computational domain.
Example 2: Two saturated soils defined by an anisotropic (saturated) permeability
Soils which behave according to a Van Genuchten-Mualen model are specified in two steps: a call to cs_gwf_add_iso_soil and then a call to cs_gwf_soil_set_genuchten_param to specifiy the parameters associated to this model.
Example 3: Soil relying on a Van Genuchten-Mualen and considering a isotropic permeability
If the predefined models are not sufficient, it is possible to add a user-defined soil. In this case, the add of the new soil is made as follows
These three steps are performed inside the function cs_user_model
Here is a complete example of a user-defined soil model (called hereafter Tracy since it has been designed by F. T. Tracy in this article).
Example of the structure used to handle the soil model parameters
with the two requested functions (defined for instance as a static function in the file cs_user_parameters.c). These functions have to fullfill the prototype defined in cs_gwf_soil_update_t (for the update of the soil properties) and in cs_gwf_soil_free_param_t (for the free of the soil parameter structure).
Here is an example of how to update soil properties (function called tracy_update)
and an example of how to free the soil parameter structure (function called tracy_free_param)
In this example, we also give some highlights on how this soil structure can be used to further set the problem for instance to specify the initial and boundary conditions. This step is made in the function cs_user_finalize_setup
where the two functions used to define either the boundary condition (called "get_bc") in the example or the initial condition (called "get_ic") in the example follow a predefined prototype (see cs_analytic_func_t)
Here are collected two examples of such functions:
The third step (which is not mandatory) is to add tracer(s) thanks to the function cs_gwf_add_tracer This tracer will be advected by the Darcy flux arising from the Richards equation.
There are currently two models :
The first parameter in cs_gwf_add_tracer is a flag which can be built with
Here is a simple example for a standard tracer which can be added in the function cs_user_model
Remark: Get a tracer structure.
TODO
It is possible to activate or add an automatic post-processing of several quantities of interest related to groundwater flows. Here are available flags to activate through the usage of cs_gwf_set_post_options
Get a soil structure from its name.
There is a similar which retrieve the soil structure from its id (see cs_gwf_soil_by_id).
Get a tracer structure from its name.