programmer's documentation
Enumerations | Functions | Variables
cs_groundwater.c File Reference
#include "cs_defs.h"
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <math.h>
#include <float.h>
#include <bft_mem.h>
#include <bft_printf.h>
#include "cs_post.h"
#include "cs_mesh_location.h"
#include "cs_field.h"
#include "cs_cdo.h"
#include "cs_param.h"
#include "cs_cdo_toolbox.h"
#include "cs_hodge.h"
#include "cs_groundwater.h"
Include dependency graph for cs_groundwater.c:

Enumerations

enum  gwkey_t {
  GWKEY_SATURATED_PERMEABILITY, GWKEY_MAX_MOISTURE, GWKEY_RESIDUAL_MOISTURE, GWKEY_TRACY_HS,
  GWKEY_TRACY_HR, GWKEY_POST_FREQ, GWKEY_OUTPUT_MOISTURE, GWKEY_ERROR
}
 

Functions

static const char * _print_gwkey (gwkey_t key)
 Print the name of the corresponding advection key. More...
 
static gwkey_t _get_gwkey (const char *keyname)
 Get the corresponding enum from the name of an advection key. If not found, return a key error. More...
 
static void _set_tracer_param (int tracer_eq_id, cs_real_3_t dispersivity, double bulk_density, double distrib_coef, double reaction_rate, cs_gw_tracer_t *tp)
 Set a cs_gw_tracer_t structure. More...
 
static cs_gw_genuchten_t _set_default_genuchten_param (void)
 Set the default parametrization of Van Genuchten-Mualen laws. More...
 
static void _permeability_by_genuchten_law (double h, const void *gw_struct, cs_get_t *result)
 Define the permeability (or hydraulic conductivity) using the van Genuchten-Mualen law. More...
 
static cs_gw_tracy_t _set_default_tracy_param (void)
 Set the default parametrization of Tracy model. More...
 
static void _permeability_by_tracy_law (double h, const void *gw_struct, cs_get_t *result)
 Define the permeability (or hydraulic conductivity) using the van Tracy law. More...
 
static void _moisture_by_tracy_law (double h, const void *gw_struct, cs_get_t *result)
 Define the moisture content using the Tracy law. More...
 
static void _update_darcian_flux (const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *cdoq, const cs_equation_t *richards, cs_groundwater_t *gw)
 Update the darcian flux playing the role of advection field in groundwater flows. More...
 
static void _update_moisture_content (const cs_cdo_quantities_t *cdoq, const cs_equation_t *richards, cs_groundwater_t *gw)
 Update the moisture content from the value of the hydraulic head. More...
 
cs_groundwater_t * cs_groundwater_create (void)
 Create a structure dedicated to manage groundwater flows. More...
 
cs_groundwater_t * cs_groundwater_finalize (cs_groundwater_t *gw)
 Free the main structure related to groundwater flows. More...
 
void cs_groundwater_set_param (cs_groundwater_t *gw, const char *keyname, const char *keyval)
 Set parameters related to a cs_groundwater_t structure. More...
 
void cs_groundwater_summary (const cs_groundwater_t *gw)
 Summary of a cs_groundwater_t structure. More...
 
cs_equation_t * cs_groundwater_init (const cs_cdo_connect_t *connect, int richards_eq_id, const char *model, cs_property_t *permeability, cs_property_t *soil_capacity, cs_adv_field_t *adv_field, cs_groundwater_t *gw)
 Initialize the module dedicated to groundwater flows. More...
 
cs_equation_t * cs_groundwater_add_tracer (cs_groundwater_t *gw, int tracer_eq_id, const char *eqname, const char *varname, cs_property_t *diff_property, cs_real_3_t dispersivity, double bulk_density, double distrib_coef, double reaction_rate)
 Add a new equation related to the groundwater flow module This equation is a specific unsteady advection/diffusion/reaction eq. Tracer is advected thanks to the darcian velocity which is given by the resolution of the Richards equation. Diffusion/reaction parameters result from a physical modelling. More...
 
void cs_groundwater_automatic_settings (cs_equation_t **equations, cs_groundwater_t *gw)
 Predefined settings for the module dedicated to groundwater flows. More...
 
void cs_groundwater_compute (const cs_mesh_t *mesh, const cs_time_step_t *time_step, double dt_cur, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *cdoq, cs_equation_t *eqs[], cs_groundwater_t *gw)
 Compute the system related to groundwater flows. More...
 
void cs_groundwater_post (const cs_time_step_t *time_step, const cs_groundwater_t *gw)
 Predefined postprocessing for the groundwater module. More...
 

Variables

static const char _err_empty_gw []
 

Enumeration Type Documentation

enum gwkey_t
Enumerator
GWKEY_SATURATED_PERMEABILITY 
GWKEY_MAX_MOISTURE 
GWKEY_RESIDUAL_MOISTURE 
GWKEY_TRACY_HS 
GWKEY_TRACY_HR 
GWKEY_POST_FREQ 
GWKEY_OUTPUT_MOISTURE 
GWKEY_ERROR 

Function Documentation

static gwkey_t _get_gwkey ( const char *  keyname)
static

Get the corresponding enum from the name of an advection key. If not found, return a key error.

Parameters
[in]keynamename of the key
Returns
a gwkey_t
static void _moisture_by_tracy_law ( double  h,
const void *  gw_struct,
cs_get_t result 
)
static

Define the moisture content using the Tracy law.

Parameters
[in]hvalue of the hydralic head
[in]gw_structpointer to the groundwater structure
[in,out]resultpointer to a cs_get_t structure
static void _permeability_by_genuchten_law ( double  h,
const void *  gw_struct,
cs_get_t result 
)
static

Define the permeability (or hydraulic conductivity) using the van Genuchten-Mualen law.

Parameters
[in]hvalue of the hydralic head
[in]gw_structpointer to the groundwater structure
[in,out]resultpointer to a cs_get_t structure
static void _permeability_by_tracy_law ( double  h,
const void *  gw_struct,
cs_get_t result 
)
static

Define the permeability (or hydraulic conductivity) using the van Tracy law.

Parameters
[in]hvalue of the hydralic head
[in]gw_structpointer to the groundwater structure
[in,out]resultpointer to a cs_get_t structure
static const char* _print_gwkey ( gwkey_t  key)
static

Print the name of the corresponding advection key.

Parameters
[in]keyname of the key
Returns
a string
static cs_gw_genuchten_t _set_default_genuchten_param ( void  )
static

Set the default parametrization of Van Genuchten-Mualen laws.

static cs_gw_tracy_t _set_default_tracy_param ( void  )
static

Set the default parametrization of Tracy model.

static void _set_tracer_param ( int  tracer_eq_id,
cs_real_3_t  dispersivity,
double  bulk_density,
double  distrib_coef,
double  reaction_rate,
cs_gw_tracer_t *  tp 
)
static

Set a cs_gw_tracer_t structure.

Parameters
[in]tracer_eq_idid related to the tracer equation
[in]dispersivitydispersivity for each axis (x, y, z]
[in]bulk_densityvalue of the bulk density
[in]distrib_coefvalue of the distribution coefficient
[in]reaction_ratevalue of the first order rate of reaction
[in,out]tppointer to a cs_gw_tracer_t structure
static void _update_darcian_flux ( const cs_cdo_connect_t connect,
const cs_cdo_quantities_t cdoq,
const cs_equation_t *  richards,
cs_groundwater_t *  gw 
)
static

Update the darcian flux playing the role of advection field in groundwater flows.

Parameters
[in]connectpointer to a cs_cdo_connect_t structure
[in]cdoqpointer to a cs_cdo_quantities_t structure
[in]richardspointer to the Richards equation structure
[in,out]gwpointer to a cs_groundwater_t structure
static void _update_moisture_content ( const cs_cdo_quantities_t cdoq,
const cs_equation_t *  richards,
cs_groundwater_t *  gw 
)
static

Update the moisture content from the value of the hydraulic head.

Parameters
[in]cdoqpointer to a cs_cdo_quantities_t structure
[in]richardspointer to the Richards equation structure
[in,out]gwpointer to a cs_groundwater_t structure
cs_equation_t* cs_groundwater_add_tracer ( cs_groundwater_t *  gw,
int  tracer_eq_id,
const char *  eqname,
const char *  varname,
cs_property_t *  diff_property,
cs_real_3_t  dispersivity,
double  bulk_density,
double  distrib_coef,
double  reaction_rate 
)

Add a new equation related to the groundwater flow module This equation is a specific unsteady advection/diffusion/reaction eq. Tracer is advected thanks to the darcian velocity which is given by the resolution of the Richards equation. Diffusion/reaction parameters result from a physical modelling.

Parameters
[in,out]gwpointer to a cs_groundwater_t structure
[in]tracer_eq_idid related to the tracer equation
[in]eqnamename of the equation
[in]varnamename of the related variable
[in]diff_propertypointer to a cs_property_t struct.
[in]dispersivitydispersivity for each axis (x, y, z]
[in]bulk_densityvalue of the bulk density
[in]distrib_coefvalue of the distribution coefficient
[in]reaction_ratevalue of the first order rate of reaction
Returns
a pointer to a new allocated equation structure (Tracer eq.)
void cs_groundwater_automatic_settings ( cs_equation_t **  equations,
cs_groundwater_t *  gw 
)

Predefined settings for the module dedicated to groundwater flows.

Parameters
[in,out]equationspointer to the array of cs_equation_t struct.
[in,out]gwpointer to a cs_groundwater_t structure
void cs_groundwater_compute ( const cs_mesh_t mesh,
const cs_time_step_t time_step,
double  dt_cur,
const cs_cdo_connect_t connect,
const cs_cdo_quantities_t cdoq,
cs_equation_t *  eqs[],
cs_groundwater_t *  gw 
)

Compute the system related to groundwater flows.

Parameters
[in]meshpointer to a cs_mesh_t structure
[in]time_steppointer to a cs_time_step_t structure
[in]dt_curcurrent value of the time step
[in]connectpointer to a cs_cdo_connect_t structure
[in]cdoqpointer to a cs_cdo_quantities_t structure
[in,out]eqsarray of pointers to cs_equation_t structures
[in,out]gwpointer to a cs_groundwater_t structure
cs_groundwater_t* cs_groundwater_create ( void  )

Create a structure dedicated to manage groundwater flows.

Returns
a pointer to a new allocated cs_groundwater_t structure
cs_groundwater_t* cs_groundwater_finalize ( cs_groundwater_t *  gw)

Free the main structure related to groundwater flows.

Parameters
[in,out]gwpointer to a cs_groundwater_t struct. to free
Returns
a NULL pointer
cs_equation_t* cs_groundwater_init ( const cs_cdo_connect_t connect,
int  richards_eq_id,
const char *  model,
cs_property_t *  permeability,
cs_property_t *  soil_capacity,
cs_adv_field_t *  adv_field,
cs_groundwater_t *  gw 
)

Initialize the module dedicated to groundwater flows.

Parameters
[in]connectpointer to a cs_cdo_connect_t structure
[in]richards_eq_idid related to the Richards equation
[in]modelkeyword related to the model used
[in,out]permeabilitypointer to a property structure
[in,out]soil_capacitypointer to a property structure
[in,out]adv_fieldpointer to a cs_adv_field_t structure
[in,out]gwpointer to a cs_groundwater_t structure
Returns
a pointer to a new allocated equation structure (Richards eq.)
void cs_groundwater_post ( const cs_time_step_t time_step,
const cs_groundwater_t *  gw 
)

Predefined postprocessing for the groundwater module.

Parameters
[in]time_steppointer to a cs_time_step_t struct.
[in]gwpointer to a cs_groundwater_t structure
void cs_groundwater_set_param ( cs_groundwater_t *  gw,
const char *  keyname,
const char *  keyval 
)

Set parameters related to a cs_groundwater_t structure.

Parameters
[in,out]gwpointer to a cs_groundwater_t structure
[in]keynamename of key related to the member of adv to set
[in]keyvalaccessor to the value to set
void cs_groundwater_summary ( const cs_groundwater_t *  gw)

Summary of a cs_groundwater_t structure.

Parameters
[in]gwpointer to a cs_groundwater_t struct. to summarize

Variable Documentation

const char _err_empty_gw[]
static
Initial value:
=
" Stop execution. The structure related to the groundwater module is empty.\n"
" Please check your settings.\n"