![]() |
programmer's documentation
|
#include "cs_defs.h"
#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <float.h>
#include <locale.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <bft_mem.h>
#include <bft_printf.h>
#include "cs_evaluate.h"
#include "cs_equation_common.h"
#include "cs_groundwater.h"
#include "cs_hodge.h"
#include "cs_log_iteration.h"
#include "cs_mesh_location.h"
#include "cs_post.h"
#include "cs_prototypes.h"
#include "cs_restart.h"
#include "cs_restart_default.h"
#include "cs_source_term.h"
#include "cs_walldistance.h"
#include "cs_domain.h"
Functions | |
static cs_domain_boundary_t * | _init_domain_boundaries (cs_lnum_t n_b_faces) |
Allocate and initialize a cs_domain_boundary_t structure. More... | |
static cs_domain_boundary_t * | _free_domain_boundaries (cs_domain_boundary_t *dby) |
Destroy a cs_domain_boundary_t structure. More... | |
static void | _set_default_boundary (cs_domain_t *domain, const char *bdy_name) |
Set the boundary type by default. More... | |
static void | _add_mesh_locations (cs_domain_t *domain) |
Add new mesh locations related to domain boundaries from existing mesh locations. More... | |
static void | _check_boundary_setup (cs_domain_t *domain) |
Check if the setup of boundary is reliable. More... | |
static void | _compute_steady_user_equations (cs_domain_t *domain, bool do_logcvg) |
Compute equations which user-defined and steady-state. More... | |
static void | _compute_unsteady_user_equations (cs_domain_t *domain, int nt_cur, bool do_logcvg) |
Compute user-defined equation which are time-dependent. More... | |
static void | _set_shared_pointers (const cs_cdo_quantities_t *quant, const cs_cdo_connect_t *connect, const cs_time_step_t *time_step) |
Set shared pointers for the main domain members. More... | |
cs_domain_t * | cs_domain_init (const cs_mesh_t *mesh, const cs_mesh_quantities_t *mesh_quantities) |
Create and initialize a cs_domain_t structure. More... | |
cs_domain_t * | cs_domain_free (cs_domain_t *domain) |
Free a cs_domain_t structure. More... | |
void | cs_domain_set_param (cs_domain_t *domain, cs_domain_key_t key, const char *keyval) |
Set auxiliary parameters related to a cs_domain_t structure. More... | |
bool | cs_domain_needs_log (const cs_domain_t *domain) |
Check if an ouput is requested according to the domain setting. More... | |
void | cs_domain_summary (const cs_domain_t *domain) |
Summary of a cs_domain_t structure. More... | |
void | cs_domain_last_setup (cs_domain_t *domain) |
Proceed to the last settings of a cs_domain_t structure. More... | |
void | cs_domain_add_boundary (cs_domain_t *domain, const char *ml_name, const char *bdy_name) |
Add a boundary type defined on a mesh location. More... | |
void | cs_domain_def_time_step_by_function (cs_domain_t *domain, cs_timestep_func_t *func) |
Define the value of the time step thanks to a predefined function. More... | |
void | cs_domain_def_time_step_by_value (cs_domain_t *domain, double dt) |
Define the value of the time step. More... | |
bool | cs_domain_needs_iterate (cs_domain_t *domain) |
Check if one needs to continue iterations in time. More... | |
void | cs_domain_define_current_time_step (cs_domain_t *domain) |
Set the current time step for this new time iteration. More... | |
void | cs_domain_increment_time (cs_domain_t *domain) |
Update time step after one temporal iteration. More... | |
void | cs_domain_add_property (cs_domain_t *domain, const char *pty_name, const char *type_name, int n_subdomains) |
Add a new property to the current computational domain. More... | |
cs_property_t * | cs_domain_get_property (const cs_domain_t *domain, const char *ref_name) |
Find the related property definition from its name. More... | |
void | cs_domain_add_advection_field (cs_domain_t *domain, const char *adv_name) |
Add a new advection field to the current computational domain. More... | |
cs_adv_field_t * | cs_domain_get_advection_field (const cs_domain_t *domain, const char *ref_name) |
Find the related advection field definition from its name. More... | |
cs_equation_t * | cs_domain_get_equation (const cs_domain_t *domain, const char *eqname) |
Find the cs_equation_t structure whith name eqname Return NULL if not find. More... | |
void | cs_domain_activate_wall_distance (cs_domain_t *domain) |
Activate the computation of the wall distance. More... | |
void | cs_domain_activate_groundwater (cs_domain_t *domain, const char *kw_type, const char *kw_time, int n_soils, int n_tracers) |
Activate the computation of the Richards' equation. More... | |
cs_groundwater_t * | cs_domain_get_groundwater (const cs_domain_t *domain) |
Retrieve the pointer to a cs_groundwater_t structure related to this domain. More... | |
void | cs_domain_add_groundwater_tracer (cs_domain_t *domain, 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. More... | |
void | cs_domain_set_groundwater_tracer (cs_domain_t *domain, const char *eq_name, const char *ml_name, double wmd, double alpha_l, double alpha_t, double bulk_density, double distrib_coef, double reaction_rate) |
Set the parameters related to a tracer equation used in the groundwater flow module. More... | |
void | cs_domain_setup_predefined_equations (cs_domain_t *domain) |
Setup predefined equations which are activated. More... | |
void | cs_domain_add_user_equation (cs_domain_t *domain, const char *eqname, const char *varname, const char *key_type, const char *key_bc) |
Add a new user equation to a domain. More... | |
void | cs_domain_create_fields (cs_domain_t *domain) |
Create cs_field_t structures attached to equation unknowns and advection fields. More... | |
void | cs_domain_solve (cs_domain_t *domain) |
Solve all the equations of a computational domain for one time step. More... | |
void | cs_domain_postprocess (cs_domain_t *domain) |
Process the computed solution. More... | |
void | cs_domain_write_restart (const cs_domain_t *domain) |
Write a restart file for the CDO module. More... | |
Variables | |
static const char | _err_empty_domain [] |
static const char | _domain_boundary_ml_name [CS_PARAM_N_BOUNDARY_TYPES][CS_BASE_STRING_LEN] |
static double | cs_domain_kahan_time_compensation = 0.0 |
|
static |
Add new mesh locations related to domain boundaries from existing mesh locations.
[in] | domain | pointer to a cs_domain_t structure |
|
static |
Check if the setup of boundary is reliable.
[in] | domain | pointer to a cs_domain_t structure |
|
static |
Compute equations which user-defined and steady-state.
[in,out] | domain | pointer to a cs_domain_t structure |
[in] | do_logcvg | output information on convergence or not |
|
static |
Compute user-defined equation which are time-dependent.
[in,out] | domain | pointer to a cs_domain_t structure |
[in] | nt_cur | current number of iteration done |
[in] | do_logcvg | output information on convergence or not |
|
static |
Destroy a cs_domain_boundary_t structure.
[in,out] | dby | pointer to the cs_domain_t structure to free |
|
static |
Allocate and initialize a cs_domain_boundary_t structure.
[in] | n_b_faces | number of boundary faces |
|
static |
Set the boundary type by default.
[in,out] | domain | pointer to a cs_domain_t structure |
[in] | bdy_name | key name of the default boundary |
|
static |
Set shared pointers for the main domain members.
[in] | quant | additional mesh quantities struct. |
[in] | connect | pointer to a cs_cdo_connect_t struct. |
[in] | time_step | pointer to a time step structure |
void cs_domain_activate_groundwater | ( | cs_domain_t * | domain, |
const char * | kw_type, | ||
const char * | kw_time, | ||
int | n_soils, | ||
int | n_tracers | ||
) |
Activate the computation of the Richards' equation.
[in,out] | domain | pointer to a cs_domain_t structure |
[in] | kw_type | "isotropic", "orthotropic or "anisotropic" \param[in] kw_time Richards equation is "steady" or "unsteady" |
[in] | n_soils | number of soils to consider |
[in] | n_tracers | number of tracer equations |
void cs_domain_activate_wall_distance | ( | cs_domain_t * | domain | ) |
Activate the computation of the wall distance.
[in,out] | domain | pointer to a cs_domain_t structure |
void cs_domain_add_advection_field | ( | cs_domain_t * | domain, |
const char * | adv_name | ||
) |
Add a new advection field to the current computational domain.
[in,out] | domain | pointer to a cs_domain_t structure |
[in] | adv_name | name of the advection field to add |
void cs_domain_add_boundary | ( | cs_domain_t * | domain, |
const char * | ml_name, | ||
const char * | bdy_name | ||
) |
Add a boundary type defined on a mesh location.
[in,out] | domain | pointer to a cs_domain_t structure |
[in] | ml_name | mesh location name |
[in] | bdy_name | key name of boundary to set |
void cs_domain_add_groundwater_tracer | ( | cs_domain_t * | domain, |
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.
[in,out] | domain | pointer to a cs_domain_t structure |
[in] | eqname | name of the equation |
[in] | varname | name of the related variable |
void cs_domain_add_property | ( | cs_domain_t * | domain, |
const char * | pty_name, | ||
const char * | type_name, | ||
int | n_subdomains | ||
) |
Add a new property to the current computational domain.
[in,out] | domain | pointer to a cs_domain_t structure |
[in] | pty_name | name of the property to add |
[in] | type_name | key name related to the type of property |
[in] | n_subdomains | specify a definition in n_subdomains |
void cs_domain_add_user_equation | ( | cs_domain_t * | domain, |
const char * | eqname, | ||
const char * | varname, | ||
const char * | key_type, | ||
const char * | key_bc | ||
) |
Add a new user equation to a domain.
[in,out] | domain | pointer to a cs_domain_t structure |
[in] | eqname | name of the equation |
[in] | varname | name of the related variable |
[in] | key_type | type of equation: "scalar", "vector", "tensor" |
[in] | key_bc | type of boundary condition set by default "zero_value" or "zero_flux" |
void cs_domain_create_fields | ( | cs_domain_t * | domain | ) |
Create cs_field_t structures attached to equation unknowns and advection fields.
Create a cs_field_t structure for each equation defined in the domain.
[in,out] | domain | pointer to a cs_domain_t structure |
void cs_domain_def_time_step_by_function | ( | cs_domain_t * | domain, |
cs_timestep_func_t * | func | ||
) |
Define the value of the time step thanks to a predefined function.
[in,out] | domain | pointer to a cs_domain_t structure |
[in] | func | pointer to a cs_timestep_func_t function |
void cs_domain_def_time_step_by_value | ( | cs_domain_t * | domain, |
double | dt | ||
) |
Define the value of the time step.
[in,out] | domain | pointer to a cs_domain_t structure |
[in] | dt | value of the constant time step |
void cs_domain_define_current_time_step | ( | cs_domain_t * | domain | ) |
Set the current time step for this new time iteration.
[in,out] | domain | pointer to a cs_domain_t structure |
cs_domain_t* cs_domain_free | ( | cs_domain_t * | domain | ) |
Free a cs_domain_t structure.
[in,out] | domain | pointer to the cs_domain_t structure to free |
cs_adv_field_t* cs_domain_get_advection_field | ( | const cs_domain_t * | domain, |
const char * | ref_name | ||
) |
Find the related advection field definition from its name.
[in] | domain | pointer to a domain structure |
[in] | ref_name | name of the adv_field to find |
cs_equation_t* cs_domain_get_equation | ( | const cs_domain_t * | domain, |
const char * | eqname | ||
) |
Find the cs_equation_t structure whith name eqname Return NULL if not find.
[in] | domain | pointer to a cs_domain_t structure |
[in] | eqname | name of the equation to find |
cs_groundwater_t* cs_domain_get_groundwater | ( | const cs_domain_t * | domain | ) |
Retrieve the pointer to a cs_groundwater_t structure related to this domain.
[in] | domain | pointer to a cs_domain_t structure |
cs_property_t* cs_domain_get_property | ( | const cs_domain_t * | domain, |
const char * | ref_name | ||
) |
Find the related property definition from its name.
[in] | domain | pointer to a domain structure |
[in] | ref_name | name of the property to find |
void cs_domain_increment_time | ( | cs_domain_t * | domain | ) |
Update time step after one temporal iteration.
[in,out] | domain | pointer to a cs_domain_t structure |
cs_domain_t* cs_domain_init | ( | const cs_mesh_t * | mesh, |
const cs_mesh_quantities_t * | mesh_quantities | ||
) |
Create and initialize a cs_domain_t structure.
Create and initialize of cs_domain_t structure.
[in] | mesh | pointer to a cs_mesh_t struct. |
[in] | mesh_quantities | pointer to a cs_mesh_quantities_t struct. |
void cs_domain_last_setup | ( | cs_domain_t * | domain | ) |
Proceed to the last settings of a cs_domain_t structure.
[in,out] | domain | pointer to the cs_domain_t structure to set |
bool cs_domain_needs_iterate | ( | cs_domain_t * | domain | ) |
Check if one needs to continue iterations in time.
[in,out] | domain | pointer to a cs_domain_t structure |
bool cs_domain_needs_log | ( | const cs_domain_t * | domain | ) |
Check if an ouput is requested according to the domain setting.
[in] | domain | pointer to a cs_domain_t structure |
void cs_domain_postprocess | ( | cs_domain_t * | domain | ) |
Process the computed solution.
[in] | domain | pointer to a cs_domain_t structure |
void cs_domain_set_groundwater_tracer | ( | cs_domain_t * | domain, |
const char * | eq_name, | ||
const char * | ml_name, | ||
double | wmd, | ||
double | alpha_l, | ||
double | alpha_t, | ||
double | bulk_density, | ||
double | distrib_coef, | ||
double | reaction_rate | ||
) |
Set the parameters related to a tracer equation used in the groundwater flow module.
[in,out] | domain | pointer to a cs_domain_t structure |
[in] | eqname | name of the equation |
[in] | ml_name | name of the related mesh location |
[in] | wmd | value of the water molecular diffusivity |
[in] | alpha_l | value of the longitudinal dispersivity |
[in] | alpha_t | value of the transversal dispersivity |
[in] | bulk_density | value of the bulk density |
[in] | distrib_coef | value of the distribution coefficient |
[in] | reaction_rate | value of the first order rate of reaction |
void cs_domain_set_param | ( | cs_domain_t * | domain, |
cs_domain_key_t | key, | ||
const char * | keyval | ||
) |
Set auxiliary parameters related to a cs_domain_t structure.
[in,out] | domain | pointer to a cs_domain_t structure |
[in] | key | key related to the parameter to set |
[in] | keyval | value related to the parameter to set |
void cs_domain_setup_predefined_equations | ( | cs_domain_t * | domain | ) |
Setup predefined equations which are activated.
[in,out] | domain | pointer to a cs_domain_t structure |
void cs_domain_solve | ( | cs_domain_t * | domain | ) |
Solve all the equations of a computational domain for one time step.
[in,out] | domain | pointer to a cs_domain_t structure |
void cs_domain_summary | ( | const cs_domain_t * | domain | ) |
Summary of a cs_domain_t structure.
[in] | domain | pointer to the cs_domain_t structure to summarize |
void cs_domain_write_restart | ( | const cs_domain_t * | domain | ) |
Write a restart file for the CDO module.
[in] | domain | pointer to a cs_domain_t structure |
|
static |
|
static |
|
static |