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_gwf_priv.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_types.h"
#include "cs_physical_constants.h"
#include "cs_post.h"
#include "cs_reco.h"
#include "cs_zone.h"
#include "cs_gwf.h"
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_gwf_model_type_t model, cs_gwf_option_flag_t option_flag) |
Initialize the module dedicated to groundwater flows. More... | |
cs_gwf_t * | cs_gwf_destroy_all (void) |
Free all structures related to groundwater flows. More... | |
void | cs_gwf_log_setup (void) |
Summary of the main cs_gwf_t structure. More... | |
void | cs_gwf_set_two_phase_model (cs_real_t l_mass_density, cs_real_t l_viscosity, cs_real_t g_viscosity, cs_real_t l_diffusivity_h, cs_real_t w_molar_mass, cs_real_t h_molar_mass, cs_real_t ref_temperature, cs_real_t henry_constant) |
Set the parameters defining the two-phase flow model. Use SI unit if not prescribed otherwise. More... | |
void | cs_gwf_set_post_options (cs_flag_t post_flag, bool reset) |
Set the flag dedicated to the post-processing of the GWF module. More... | |
cs_adv_field_t * | cs_gwf_get_adv_field (void) |
Retrieve the advection field related to the Darcy flux in the liquid phase. More... | |
cs_real_t * | cs_gwf_get_uspf_head_in_law (void) |
Retrieve the head used in soil updates when an unsaturated single-phase flow is considered. These values are located at cells. More... | |
cs_gwf_soil_t * | cs_gwf_add_soil (const char *z_name, double bulk_density, double sat_moisture, cs_gwf_soil_hydraulic_model_t soil_model) |
Create and add a new cs_gwf_soil_t structure. An initialization by default of all members is performed. More... | |
cs_gwf_tracer_t * | cs_gwf_add_tracer (cs_gwf_tracer_model_t tr_model, 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 solved in the equation are activated according to the settings. The advection field corresponds to that of the liquid phase. More... | |
cs_gwf_tracer_t * | cs_gwf_add_user_tracer (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_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. 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_init_setup (void) |
Predefined settings for the Richards equation and the related equations defining the groundwater flow module. At this stage, all soils have been defined and equatino parameters are set. Create new cs_field_t structures according to the setting. 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. At this stage, the mesh quantities are defined. 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_sspf (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 in case of saturated single-phase flows (sspf) in porous media. Prototype of this function is given since it is a function pointer defined in cs_post.h (cs_post_time_mesh_dep_output_t) More... | |
void | cs_gwf_extra_post_uspf (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 in case of unsaturated single-phase flows (uspf) in porous media. Prototype of this function is given since it is a function pointer defined in cs_post.h (cs_post_time_mesh_dep_output_t) More... | |
void | cs_gwf_extra_post_mtpf (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 in case of miscible two-phase flows (mtpf) in porous media. Prototype of this function is given since it is a function pointer defined in cs_post.h (cs_post_time_mesh_dep_output_t) More... | |
Main functions dedicated to groundwater flows when using CDO schemes.
#define _dp3 cs_math_3_dot_product |
#define CS_GWF_DBG 0 |
cs_gwf_t* cs_gwf_activate | ( | cs_property_type_t | pty_type, |
cs_gwf_model_type_t | model, | ||
cs_gwf_option_flag_t | option_flag | ||
) |
Initialize the module dedicated to groundwater flows.
[in] | pty_type | type of permeability (iso, ortho...) |
[in] | model | type of physical modelling |
[in] | option_flag | optional flag to specify this module |
cs_gwf_soil_t* cs_gwf_add_soil | ( | const char * | z_name, |
double | bulk_density, | ||
double | sat_moisture, | ||
cs_gwf_soil_hydraulic_model_t | soil_model | ||
) |
Create and add a new cs_gwf_soil_t structure. An initialization by default of all members is performed.
[in] | z_name | name of the volume zone corresponding to the soil |
[in] | bulk_density | value of the mass density |
[in] | sat_moisture | value of the saturated moisture content |
[in] | soil_model | type of modelling for the hydraulic behavior |
cs_gwf_tracer_t* cs_gwf_add_tracer | ( | cs_gwf_tracer_model_t | tr_model, |
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 solved in the equation are activated according to the settings. The advection field corresponds to that of the liquid phase.
[in] | tr_model | physical modelling to consider (0 = default settings) |
[in] | eq_name | name of the tracer equation |
[in] | var_name | name of the related variable |
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_tracer_t* cs_gwf_add_user_tracer | ( | 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.
[in] | eq_name | name of the tracer equation |
[in] | var_name | name of the related variable |
[in] | setup | function pointer (predefined prototype) |
[in] | add_terms | function pointer (predefined prototype) |
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.
[in] | mesh | pointer to a cs_mesh_t structure |
[in] | time_step | pointer to a cs_time_step_t structure |
[in] | connect | pointer to a cs_cdo_connect_t structure |
[in] | cdoq | pointer to a cs_cdo_quantities_t structure |
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.
[in] | mesh | pointer to a cs_mesh_t structure |
[in] | time_step | pointer to a cs_time_step_t structure |
[in] | connect | pointer to a cs_cdo_connect_t structure |
[in] | cdoq | pointer to a cs_cdo_quantities_t structure |
cs_gwf_t* cs_gwf_destroy_all | ( | void | ) |
Free all structures related to groundwater flows.
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.
[in] | connect | pointer to a cs_cdo_connect_t structure |
[in] | cdoq | pointer to a cs_cdo_quantities_t structure |
void cs_gwf_extra_post_mtpf | ( | 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 in case of miscible two-phase flows (mtpf) in porous media. Prototype of this function is given since it is a function pointer defined in cs_post.h (cs_post_time_mesh_dep_output_t)
[in,out] | input | pointer to a optional structure (here a cs_gwf_t structure) |
[in] | mesh_id | id of the output mesh for the current call |
[in] | cat_id | category id of the output mesh for this call |
[in] | ent_flag | indicate 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_cells | local number of cells of post_mesh |
[in] | n_i_faces | local number of interior faces of post_mesh |
[in] | n_b_faces | local number of boundary faces of post_mesh |
[in] | cell_ids | list of cells (0 to n-1) |
[in] | i_face_ids | list of interior faces (0 to n-1) |
[in] | b_face_ids | list of boundary faces (0 to n-1) |
[in] | time_step | pointer to a cs_time_step_t struct. |
void cs_gwf_extra_post_sspf | ( | 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 in case of saturated single-phase flows (sspf) in porous media. Prototype of this function is given since it is a function pointer defined in cs_post.h (cs_post_time_mesh_dep_output_t)
[in,out] | input | pointer to a optional structure (here a cs_gwf_t structure) |
[in] | mesh_id | id of the output mesh for the current call |
[in] | cat_id | category id of the output mesh for this call |
[in] | ent_flag | indicate 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_cells | local number of cells of post_mesh |
[in] | n_i_faces | local number of interior faces of post_mesh |
[in] | n_b_faces | local number of boundary faces of post_mesh |
[in] | cell_ids | list of cells (0 to n-1) |
[in] | i_face_ids | list of interior faces (0 to n-1) |
[in] | b_face_ids | list of boundary faces (0 to n-1) |
[in] | time_step | pointer to a cs_time_step_t struct. |
void cs_gwf_extra_post_uspf | ( | 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 in case of unsaturated single-phase flows (uspf) in porous media. Prototype of this function is given since it is a function pointer defined in cs_post.h (cs_post_time_mesh_dep_output_t)
[in,out] | input | pointer to a optional structure (here a cs_gwf_t structure) |
[in] | mesh_id | id of the output mesh for the current call |
[in] | cat_id | category id of the output mesh for this call |
[in] | ent_flag | indicate 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_cells | local number of cells of post_mesh |
[in] | n_i_faces | local number of interior faces of post_mesh |
[in] | n_b_faces | local number of boundary faces of post_mesh |
[in] | cell_ids | list of cells (0 to n-1) |
[in] | i_face_ids | list of interior faces (0 to n-1) |
[in] | b_face_ids | list of boundary faces (0 to n-1) |
[in] | time_step | pointer to a cs_time_step_t struct. |
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. At this stage, the mesh quantities are defined.
[in] | connect | pointer to a cs_cdo_connect_t structure |
[in] | quant | pointer to a cs_cdo_quantities_t structure |
cs_adv_field_t* cs_gwf_get_adv_field | ( | void | ) |
Retrieve the advection field related to the Darcy flux in the liquid phase.
cs_real_t* cs_gwf_get_uspf_head_in_law | ( | void | ) |
Retrieve the head used in soil updates when an unsaturated single-phase flow is considered. These values are located at cells.
void cs_gwf_init_setup | ( | void | ) |
Predefined settings for the Richards equation and the related equations defining the groundwater flow module. At this stage, all soils have been defined and equatino parameters are set. Create new cs_field_t structures according to the setting.
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.
[in] | connect | pointer to a cs_cdo_connect_t structure |
[in] | cdoq | pointer to a cs_cdo_quantities_t structure |
[in] | tracer | pointer to a cs_gwf_tracer_t structure |
[in] | z_name | name of the volumic zone where the integral is done (if NULL or "" all cells are considered) |
bool cs_gwf_is_activated | ( | void | ) |
Check if the groundwater flow module has been activated.
void cs_gwf_log_setup | ( | void | ) |
Summary of the main cs_gwf_t structure.
void cs_gwf_set_post_options | ( | cs_flag_t | post_flag, |
bool | reset | ||
) |
Set the flag dedicated to the post-processing of the GWF module.
[in] | post_flag | flag to set |
[in] | reset | reset post flag before |
void cs_gwf_set_two_phase_model | ( | cs_real_t | l_mass_density, |
cs_real_t | l_viscosity, | ||
cs_real_t | g_viscosity, | ||
cs_real_t | l_diffusivity_h, | ||
cs_real_t | w_molar_mass, | ||
cs_real_t | h_molar_mass, | ||
cs_real_t | ref_temperature, | ||
cs_real_t | henry_constant | ||
) |
Set the parameters defining the two-phase flow model. Use SI unit if not prescribed otherwise.
[in] | l_mass_density | mass density of the main liquid component |
[in] | l_viscosity | viscosity in the liquid phase (Pa.s) |
[in] | g_viscosity | viscosity in the gas phase (Pa.s) |
[in] | l_diffusivity_h | diffusivity of the main gas component in the liquid phase |
[in] | w_molar_mass | molar mass of the main liquid component |
[in] | h_molar_mass | molar mass of the main gas component |
[in] | ref_temperature | reference temperature |
[in] | henry_constant | constant in the Henry law |
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.
[in] | eq_name | name of the tracer equation |
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)
[in] | mesh | pointer to a cs_mesh_t structure |
[in] | connect | pointer to a cs_cdo_connect_t structure |
[in] | quant | pointer to a cs_cdo_quantities_t structure |
[in] | ts | pointer to a cs_time_step_t structure |
[in] | cur2prev | true or false |