My Project
programmer's documentation
Macros | Functions
cs_gwf.c File Reference

Main functions dedicated to groundwater flows when using CDO schemes. More...

#include "cs_defs.h"
#include <assert.h>
#include <ctype.h>
#include <float.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <bft_mem.h>
#include "cs_boundary_zone.h"
#include "cs_cdovb_scaleq.h"
#include "cs_equation_bc.h"
#include "cs_evaluate.h"
#include "cs_field.h"
#include "cs_hodge.h"
#include "cs_log.h"
#include "cs_math.h"
#include "cs_mesh_location.h"
#include "cs_parall.h"
#include "cs_param.h"
#include "cs_post.h"
#include "cs_reco.h"
#include "cs_zone.h"
#include "cs_gwf.h"
Include dependency graph for cs_gwf.c:

Macros

#define _dp3   cs_math_3_dot_product
 
#define CS_GWF_DBG   0
 

Functions

bool cs_gwf_is_activated (void)
 Check if the groundwater flow module has been activated. More...
 
cs_gwf_t * cs_gwf_activate (cs_property_type_t pty_type, cs_flag_t flag)
 Initialize the module dedicated to groundwater flows. More...
 
cs_gwf_t * cs_gwf_destroy_all (void)
 Free the main structure related to groundwater flows. More...
 
void cs_gwf_log_setup (void)
 Summary of the main cs_gwf_t structure. More...
 
void cs_gwf_set_post_options (cs_flag_t post_flag)
 Set the flag dedicated to the post-processing of the GWF module. More...
 
void cs_gwf_set_gravity_vector (const cs_real_3_t gvec)
 Activate the gravity and set the gravitaty vector. More...
 
void cs_gwf_set_darcian_flux_location (cs_flag_t location_flag)
 Advanced setting: indicate where the darcian flux is stored. More...
 
cs_gwf_tracer_tcs_gwf_add_tracer (const char *eq_name, const char *var_name)
 Add a new equation related to the groundwater flow module This equation is a particular type of unsteady advection-diffusion reaction eq. Tracer is advected thanks to the darcian velocity and diffusion/reaction parameters result from a physical modelling. Terms are activated according to the settings. More...
 
cs_gwf_tracer_tcs_gwf_add_tracer_user (const char *eq_name, const char *var_name, cs_gwf_tracer_setup_t *setup, cs_gwf_tracer_add_terms_t *add_terms)
 Add a new equation related to the groundwater flow module This equation is a particular type of unsteady advection-diffusion reaction eq. Tracer is advected thanks to the darcian velocity and diffusion/reaction parameters result from a physical modelling. Terms are activated according to the settings. Modelling of the tracer parameters are left to the user. More...
 
cs_gwf_tracer_tcs_gwf_tracer_by_name (const char *eq_name)
 Retrieve the pointer to the cs_gwf_tracer_t structure associated to the name given as parameter. More...
 
void cs_gwf_init_setup (void)
 Predefined settings for the Richards equation and the related equations defining the groundwater flow module Create new cs_field_t structures according to the setting. More...
 
void cs_gwf_add_tracer_terms (void)
 Add new terms if needed (such as diffusion or reaction) to tracer equations according to the settings. More...
 
void cs_gwf_finalize_setup (const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant)
 Last initialization step of the groundwater flow module. More...
 
void cs_gwf_update (const cs_mesh_t *mesh, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, const cs_time_step_t *ts, bool cur2prev)
 Update the groundwater system (pressure head, head in law, moisture content, darcian velocity, soil capacity or permeability if needed) More...
 
void cs_gwf_compute_steady_state (const cs_mesh_t *mesh, const cs_time_step_t *time_step, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *cdoq)
 Compute the steady-state of the groundwater flows module. Nothing is done if all equations are unsteady. More...
 
void cs_gwf_compute (const cs_mesh_t *mesh, const cs_time_step_t *time_step, const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *cdoq)
 Compute the system related to groundwater flows module. More...
 
cs_real_t cs_gwf_integrate_tracer (const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *cdoq, const cs_gwf_tracer_t *tracer, const char *z_name)
 Compute the integral over a given set of cells of the field related to a tracer equation. This integral turns out to be exact for linear functions. More...
 
void cs_gwf_extra_op (const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *cdoq)
 Predefined extra-operations for the groundwater flow module. More...
 
void cs_gwf_extra_post (void *input, int mesh_id, int cat_id, int ent_flag[5], cs_lnum_t n_cells, cs_lnum_t n_i_faces, cs_lnum_t n_b_faces, const cs_lnum_t cell_ids[], const cs_lnum_t i_face_ids[], const cs_lnum_t b_face_ids[], const cs_time_step_t *time_step)
 Predefined post-processing output for the groundwater flow module prototype of this function is fixed since it is a function pointer defined in cs_post.h (cs_post_time_mesh_dep_output_t) More...
 

Detailed Description

Main functions dedicated to groundwater flows when using CDO schemes.

Macro Definition Documentation

◆ _dp3

#define _dp3   cs_math_3_dot_product

◆ CS_GWF_DBG

#define CS_GWF_DBG   0

Function Documentation

◆ cs_gwf_activate()

cs_gwf_t* cs_gwf_activate ( cs_property_type_t  pty_type,
cs_flag_t  flag 
)

Initialize the module dedicated to groundwater flows.

Parameters
[in]pty_typetype of permeability (iso, ortho...)
[in]flagflag to handle this module
Returns
a pointer to a new allocated groundwater flow structure

◆ cs_gwf_add_tracer()

cs_gwf_tracer_t* cs_gwf_add_tracer ( const char *  eq_name,
const char *  var_name 
)

Add a new equation related to the groundwater flow module This equation is a particular type of unsteady advection-diffusion reaction eq. Tracer is advected thanks to the darcian velocity and diffusion/reaction parameters result from a physical modelling. Terms are activated according to the settings.

Parameters
[in]eq_namename of the tracer equation
[in]var_namename of the related variable

◆ cs_gwf_add_tracer_terms()

void cs_gwf_add_tracer_terms ( void  )

Add new terms if needed (such as diffusion or reaction) to tracer equations according to the settings.

◆ cs_gwf_add_tracer_user()

cs_gwf_tracer_t* cs_gwf_add_tracer_user ( const char *  eq_name,
const char *  var_name,
cs_gwf_tracer_setup_t setup,
cs_gwf_tracer_add_terms_t add_terms 
)

Add a new equation related to the groundwater flow module This equation is a particular type of unsteady advection-diffusion reaction eq. Tracer is advected thanks to the darcian velocity and diffusion/reaction parameters result from a physical modelling. Terms are activated according to the settings. Modelling of the tracer parameters are left to the user.

Parameters
[in]eq_namename of the tracer equation
[in]var_namename of the related variable
[in]setupfunction pointer (predefined prototype)
[in]add_termsfunction pointer (predefined prototype)

◆ cs_gwf_compute()

void cs_gwf_compute ( const cs_mesh_t mesh,
const cs_time_step_t time_step,
const cs_cdo_connect_t connect,
const cs_cdo_quantities_t cdoq 
)

Compute the system related to groundwater flows module.

Parameters
[in]meshpointer to a cs_mesh_t structure
[in]time_steppointer to a cs_time_step_t structure
[in]connectpointer to a cs_cdo_connect_t structure
[in]cdoqpointer to a cs_cdo_quantities_t structure

◆ cs_gwf_compute_steady_state()

void cs_gwf_compute_steady_state ( const cs_mesh_t mesh,
const cs_time_step_t time_step,
const cs_cdo_connect_t connect,
const cs_cdo_quantities_t cdoq 
)

Compute the steady-state of the groundwater flows module. Nothing is done if all equations are unsteady.

Parameters
[in]meshpointer to a cs_mesh_t structure
[in]time_steppointer to a cs_time_step_t structure
[in]connectpointer to a cs_cdo_connect_t structure
[in]cdoqpointer to a cs_cdo_quantities_t structure

◆ cs_gwf_destroy_all()

cs_gwf_t* cs_gwf_destroy_all ( void  )

Free the main structure related to groundwater flows.

Returns
a NULL pointer

◆ cs_gwf_extra_op()

void cs_gwf_extra_op ( const cs_cdo_connect_t connect,
const cs_cdo_quantities_t cdoq 
)

Predefined extra-operations for the groundwater flow module.

Parameters
[in]connectpointer to a cs_cdo_connect_t structure
[in]cdoqpointer to a cs_cdo_quantities_t structure

◆ cs_gwf_extra_post()

void cs_gwf_extra_post ( void *  input,
int  mesh_id,
int  cat_id,
int  ent_flag[5],
cs_lnum_t  n_cells,
cs_lnum_t  n_i_faces,
cs_lnum_t  n_b_faces,
const cs_lnum_t  cell_ids[],
const cs_lnum_t  i_face_ids[],
const cs_lnum_t  b_face_ids[],
const cs_time_step_t time_step 
)

Predefined post-processing output for the groundwater flow module prototype of this function is fixed since it is a function pointer defined in cs_post.h (cs_post_time_mesh_dep_output_t)

Parameters
[in,out]inputpointer to a optional structure (here a cs_gwf_t structure)
[in]mesh_idid of the output mesh for the current call
[in]cat_idcategory id of the output mesh for this call
[in]ent_flagindicate global presence of cells (ent_flag[0]), interior faces (ent_flag[1]), boundary faces (ent_flag[2]), particles (ent_flag[3]) or probes (ent_flag[4])
[in]n_cellslocal number of cells of post_mesh
[in]n_i_faceslocal number of interior faces of post_mesh
[in]n_b_faceslocal number of boundary faces of post_mesh
[in]cell_idslist of cells (0 to n-1)
[in]i_face_idslist of interior faces (0 to n-1)
[in]b_face_idslist of boundary faces (0 to n-1)
[in]time_steppointer to a cs_time_step_t struct.

◆ cs_gwf_finalize_setup()

void cs_gwf_finalize_setup ( const cs_cdo_connect_t connect,
const cs_cdo_quantities_t quant 
)

Last initialization step of the groundwater flow module.

Parameters
[in]connectpointer to a cs_cdo_connect_t structure
[in]quantpointer to a cs_cdo_quantities_t structure

◆ cs_gwf_init_setup()

void cs_gwf_init_setup ( void  )

Predefined settings for the Richards equation and the related equations defining the groundwater flow module Create new cs_field_t structures according to the setting.

◆ cs_gwf_integrate_tracer()

cs_real_t cs_gwf_integrate_tracer ( const cs_cdo_connect_t connect,
const cs_cdo_quantities_t cdoq,
const cs_gwf_tracer_t tracer,
const char *  z_name 
)

Compute the integral over a given set of cells of the field related to a tracer equation. This integral turns out to be exact for linear functions.

Parameters
[in]connectpointer to a cs_cdo_connect_t structure
[in]cdoqpointer to a cs_cdo_quantities_t structure
[in]tracerpointer to a cs_gwf_tracer_t structure
[in]z_namename of the volumic zone where the integral is done (if NULL or "" all cells are considered)
Returns
the value of the integral

◆ cs_gwf_is_activated()

bool cs_gwf_is_activated ( void  )

Check if the groundwater flow module has been activated.

Returns
true or false

◆ cs_gwf_log_setup()

void cs_gwf_log_setup ( void  )

Summary of the main cs_gwf_t structure.

◆ cs_gwf_set_darcian_flux_location()

void cs_gwf_set_darcian_flux_location ( cs_flag_t  location_flag)

Advanced setting: indicate where the darcian flux is stored.

Advanced setting: indicate where the darcian flux is stored cs_flag_primal_cell is the default setting cs_flag_dual_face_byc is a valid choice for vertex-based schemes.

    cs_flag_dual_face_byc is the default setting for Vb (default space
    scheme) whereas cs_flag_primal_cell should be prefered for other
    schemes
Parameters
[in]location_flagwhere the flux is defined

◆ cs_gwf_set_gravity_vector()

void cs_gwf_set_gravity_vector ( const cs_real_3_t  gvec)

Activate the gravity and set the gravitaty vector.

Parameters
[in]gvecvalues of the gravity vector

◆ cs_gwf_set_post_options()

void cs_gwf_set_post_options ( cs_flag_t  post_flag)

Set the flag dedicated to the post-processing of the GWF module.

Parameters
[in]post_flagflag to set

◆ cs_gwf_tracer_by_name()

cs_gwf_tracer_t* cs_gwf_tracer_by_name ( const char *  eq_name)

Retrieve the pointer to the cs_gwf_tracer_t structure associated to the name given as parameter.

Parameters
[in]eq_namename of the tracer equation
Returns
the pointer to a cs_gwf_tracer_t structure

◆ cs_gwf_update()

void cs_gwf_update ( const cs_mesh_t mesh,
const cs_cdo_connect_t connect,
const cs_cdo_quantities_t quant,
const cs_time_step_t ts,
bool  cur2prev 
)

Update the groundwater system (pressure head, head in law, moisture content, darcian velocity, soil capacity or permeability if needed)

Parameters
[in]meshpointer to a cs_mesh_t structure
[in]connectpointer to a cs_cdo_connect_t structure
[in]quantpointer to a cs_cdo_quantities_t structure
[in]tspointer to a cs_time_step_t structure
[in]cur2prevtrue or false