![]() |
programmer's documentation
|
#include "cs_cdo_quantities.h"
#include "cs_equation_param.h"
#include "cs_field.h"
#include "cs_param.h"
#include "cs_mesh.h"
#include "cs_source_term.h"
#include "cs_time_step.h"
Go to the source code of this file.
Functions | |
void | cs_equation_allocate_common_structures (const cs_cdo_connect_t *connect, const cs_cdo_quantities_t *quant, const cs_time_step_t *time_step, cs_flag_t scheme_flag) |
Allocate a pointer to a buffer of size at least the 2*n_cells for managing temporary usage of memory when dealing with equations Call specific structure allocation related to a numerical scheme according the scheme flag The size of the temporary buffer can be bigger according to the numerical settings Set also shared pointers from the main domain members. More... | |
void | cs_equation_free_common_structures (cs_flag_t scheme_flag) |
Allocate a pointer to a buffer of size at least the 2*n_cells for managing temporary usage of memory when dealing with equations Call specific structure allocation related to a numerical scheme according the scheme flag The size of the temporary buffer can be bigger according to the numerical settings. More... | |
cs_real_t * | cs_equation_get_tmpbuf (void) |
Retrieve a pointer to a buffer of size at least the 2*n_cells The size of the temporary buffer can be bigger according to the numerical settings. More... | |
size_t | cs_equation_get_tmpbuf_size (void) |
Get the allocation size of the temporary buffer. More... | |
cs_equation_t * | cs_equation_create (const char *eqname, const char *varname, cs_equation_type_t eqtype, cs_param_var_type_t vartype, cs_param_bc_type_t default_bc) |
Define and initialize a new structure to store parameters related to an equation. More... | |
cs_equation_t * | cs_equation_free (cs_equation_t *eq) |
Destroy a cs_equation_t structure. More... | |
void | cs_equation_summary (const cs_equation_t *eq) |
Summary of a cs_equation_t structure. More... | |
void | cs_equation_set_timer_stats (cs_equation_t *eq) |
Create timer statistics structures to enable a "home-made" profiling. More... | |
void | cs_equation_last_setup (cs_equation_t *eq) |
Assign a set of pointer functions for managing the cs_equation_t structure during the computation. More... | |
void | cs_equation_set_param (cs_equation_t *eq, cs_equation_key_t key, const char *keyval) |
Set a parameter in a cs_equation_t structure attached to keyname. More... | |
void | cs_equation_link (cs_equation_t *eq, const char *keyword, void *pointer) |
Associate a material property or an advection field with an equation for a given term (diffusion, time, convection) More... | |
void | cs_equation_set_ic (cs_equation_t *eq, const char *ml_name, const char *def_key, void *val) |
Define the initial condition of the unknown related to this equation This definition can be done by mesh location Available types of definition are: "value" and "analytic". More... | |
void | cs_equation_add_bc (cs_equation_t *eq, const char *ml_name, const char *bc_key, const char *def_key, const void *val) |
Define and initialize a new structure to store parameters related to an equation bc_key among "dirichlet", "neumann" or "robin" def_key among "value", "analytic", "user". More... | |
void | cs_equation_add_linear_reaction (cs_equation_t *eq, cs_property_t *property, const char *r_name) |
Define and initialize a new structure to store parameters related to a reaction term. More... | |
void | cs_equation_add_gravity_source_term (cs_equation_t *eq, int ml_id, cs_desc_t array_desc, cs_real_t *array_values) |
Define and initialize a new structure to store parameters related to a source term def_key among "value", "analytic", "user"... More... | |
void | cs_equation_add_source_term_by_val (cs_equation_t *eq, const char *st_name, const char *ml_name, const void *val) |
Define and initialize by value a new structure to store parameters related to a source term defined by a user. More... | |
void | cs_equation_add_source_term_by_analytic (cs_equation_t *eq, const char *st_name, const char *ml_name, cs_analytic_func_t *ana) |
Define and initialize by an analytical function a new structure related to a source term defined by a user. More... | |
void | cs_equation_set_source_term_quadrature (cs_equation_t *eq, const char *st_name, cs_quadra_type_t quad_type) |
Set the type of quadrature to use for computing a source term If st_name is NULL, all source terms of the given equation are set. More... | |
void | cs_equation_set_source_term_reduction (cs_equation_t *eq, const char *st_name, cs_source_term_reduction_t type) |
Set the type of quadrature to use for computing a source term If st_name is NULL, all source terms of the given equation are set. More... | |
void | cs_equation_create_field (cs_equation_t *eq) |
Create a field structure related to this cs_equation_t structure to an equation. More... | |
void | cs_equation_init_system (const cs_mesh_t *mesh, cs_equation_t *eq) |
Initialize the values of a field according to the initial condition related to its equation. More... | |
bool | cs_equation_needs_build (const cs_equation_t *eq) |
Check if one has to build the linear system. More... | |
void | cs_equation_build_system (const cs_mesh_t *m, const cs_time_step_t *time_step, double dt_cur, cs_equation_t *eq) |
Build the linear system for this equation. More... | |
void | cs_equation_solve (cs_equation_t *eq, bool do_logcvg) |
Solve the linear system for this equation. More... | |
void | cs_equation_extra_op (const cs_equation_t *eq, const cs_time_step_t *ts, double dt) |
Predefined extra-operations related to this equation. More... | |
bool | cs_equation_is_steady (const cs_equation_t *eq) |
Return true is the given equation is steady otherwise false. More... | |
const cs_real_t * | cs_equation_get_face_values (const cs_equation_t *eq) |
Get the values at each face of the mesh for the field unknowns related to this equation. More... | |
const cs_real_t * | cs_equation_get_cell_values (const cs_equation_t *eq) |
Get the values at each cell centers for the field unknowns related to this equation. More... | |
const char * | cs_equation_get_name (const cs_equation_t *eq) |
Return the name related to the given cs_equation_t structure to an equation. More... | |
cs_field_t * | cs_equation_get_field (const cs_equation_t *eq) |
Return the field structure associated to a cs_equation_t structure. More... | |
cs_flag_t | cs_equation_get_flag (const cs_equation_t *eq) |
Return the flag associated to an equation. More... | |
const cs_equation_param_t * | cs_equation_get_param (const cs_equation_t *eq) |
Return the cs_equation_param_t structure associated to a cs_equation_t structure. More... | |
cs_property_t * | cs_equation_get_diffusion_property (const cs_equation_t *eq) |
Return a pointer to the cs_property_t structure associated to the diffusion term for this equation. More... | |
cs_property_t * | cs_equation_get_time_property (const cs_equation_t *eq) |
Return a pointer to the cs_property_t structure associated to the unsteady term for this equation. More... | |
cs_property_t * | cs_equation_get_reaction_property (const cs_equation_t *eq, const char *r_name) |
Return a pointer to the cs_property_t structure associated to the reaction term called r_name and related to this equation. More... | |
cs_space_scheme_t | cs_equation_get_space_scheme (const cs_equation_t *eq) |
Return the type of numerical scheme used for the discretization in space. More... | |
cs_param_var_type_t | cs_equation_get_var_type (const cs_equation_t *eq) |
Return the type of variable solved by this equation. More... | |
cs_equation_type_t | cs_equation_get_type (const cs_equation_t *eq) |
Return the type of equation for the given equation structure. More... | |
void | cs_equation_compute_flux_across_plane (const cs_equation_t *eq, const char *ml_name, const cs_real_3_t direction, cs_real_t *diff_flux, cs_real_t *conv_flux) |
Compute the diffusive and convective flux accross a plane defined by a mesh location structure attached to the name ml_name. More... | |
void | cs_equation_compute_diff_flux (const cs_equation_t *eq, cs_real_t *diff_flux) |
Cellwise computation of the diffusive flux across all cell faces. Primal or dual faces are considered according to the space scheme. More... | |
enum cs_equation_key_t |
void cs_equation_add_bc | ( | cs_equation_t * | eq, |
const char * | ml_name, | ||
const char * | bc_key, | ||
const char * | def_key, | ||
const void * | val | ||
) |
Define and initialize a new structure to store parameters related to an equation bc_key among "dirichlet", "neumann" or "robin" def_key among "value", "analytic", "user".
[in,out] | eq | pointer to a cs_equation_t structure |
[in] | ml_name | name of the related mesh location |
[in] | bc_key | type of boundary condition to add |
[in] | def_key | way of defining the value of the bc |
[in] | val | pointer to the value |
void cs_equation_add_gravity_source_term | ( | cs_equation_t * | eq, |
int | ml_id, | ||
cs_desc_t | array_desc, | ||
cs_real_t * | array_values | ||
) |
Define and initialize a new structure to store parameters related to a source term def_key among "value", "analytic", "user"...
[in,out] | eq | pointer to a cs_equation_t structure |
[in] | ml_id | id related to a mesh location |
[in] | array_desc | short description of this array (mask of bits) |
[in] | array_values | pointer to the array values |
void cs_equation_add_linear_reaction | ( | cs_equation_t * | eq, |
cs_property_t * | property, | ||
const char * | r_name | ||
) |
Define and initialize a new structure to store parameters related to a reaction term.
[in,out] | eq | pointer to a cs_equation_t structure |
[in] | property | pointer to a cs_property_t struct. |
[in] | r_name | name of the reaction term (optional, i.e. NULL) |
void cs_equation_add_source_term_by_analytic | ( | cs_equation_t * | eq, |
const char * | st_name, | ||
const char * | ml_name, | ||
cs_analytic_func_t * | ana | ||
) |
Define and initialize by an analytical function a new structure related to a source term defined by a user.
[in,out] | eq | pointer to a cs_equation_t structure |
[in] | st_name | name of the source term or NULL |
[in] | ml_name | name of the related mesh location |
[in] | ana | pointer to an analytical function |
void cs_equation_add_source_term_by_val | ( | cs_equation_t * | eq, |
const char * | st_name, | ||
const char * | ml_name, | ||
const void * | val | ||
) |
Define and initialize by value a new structure to store parameters related to a source term defined by a user.
[in,out] | eq | pointer to a cs_equation_t structure |
[in] | st_name | name of the source term or NULL |
[in] | ml_name | name of the related mesh location |
[in] | val | pointer to the value |
void cs_equation_allocate_common_structures | ( | const cs_cdo_connect_t * | connect, |
const cs_cdo_quantities_t * | quant, | ||
const cs_time_step_t * | time_step, | ||
cs_flag_t | scheme_flag | ||
) |
Allocate a pointer to a buffer of size at least the 2*n_cells for managing temporary usage of memory when dealing with equations Call specific structure allocation related to a numerical scheme according the scheme flag The size of the temporary buffer can be bigger according to the numerical settings Set also shared pointers from the main domain members.
[in] | connect | pointer to a cs_cdo_connect_t structure |
[in] | quant | pointer to additional mesh quantities struct. |
[in] | time_step | pointer to a time step structure |
[in] | scheme_flag | flag to identify which kind of numerical scheme is requested to solve the computational domain |
void cs_equation_build_system | ( | const cs_mesh_t * | mesh, |
const cs_time_step_t * | time_step, | ||
double | dt_cur, | ||
cs_equation_t * | eq | ||
) |
Build the linear system for this equation.
[in] | m | pointer to a cs_mesh_t structure |
[in] | time_step | pointer to a time step structure |
[in] | dt_cur | value of the current time step |
[in,out] | eq | pointer to a cs_equation_t structure |
void cs_equation_compute_diff_flux | ( | const cs_equation_t * | eq, |
cs_real_t * | diff_flux | ||
) |
Cellwise computation of the diffusive flux across all cell faces. Primal or dual faces are considered according to the space scheme.
[in] | eq | pointer to a cs_equation_t structure |
[in,out] | diff_flux | value of the diffusive flux |
void cs_equation_compute_flux_across_plane | ( | const cs_equation_t * | eq, |
const char * | ml_name, | ||
const cs_real_3_t | direction, | ||
cs_real_t * | diff_flux, | ||
cs_real_t * | conv_flux | ||
) |
Compute the diffusive and convective flux accross a plane defined by a mesh location structure attached to the name ml_name.
[in] | eq | pointer to a cs_equation_t structure |
[in] | ml_name | name of the related mesh location |
[in] | direction | vector indicating in which direction flux is > 0 |
[in,out] | diff_flux | value of the diffusive part of the flux |
[in,out] | conv_flux | value of the convective part of the flux |
cs_equation_t* cs_equation_create | ( | const char * | eqname, |
const char * | varname, | ||
cs_equation_type_t | eqtype, | ||
cs_param_var_type_t | vartype, | ||
cs_param_bc_type_t | default_bc | ||
) |
Define and initialize a new structure to store parameters related to an equation.
[in] | eqname | name of the equation |
[in] | varname | name of the variable associated to this equation |
[in] | eqtype | type of equation (user, predefined...) |
[in] | vartype | type of variable (scalar, vector, tensor...) |
[in] | default_bc | type of boundary condition set by default |
void cs_equation_create_field | ( | cs_equation_t * | eq | ) |
Create a field structure related to this cs_equation_t structure to an equation.
[in,out] | eq | pointer to a cs_equation_t structure |
void cs_equation_extra_op | ( | const cs_equation_t * | eq, |
const cs_time_step_t * | ts, | ||
double | dt | ||
) |
Predefined extra-operations related to this equation.
[in] | eq | pointer to a cs_equation_t structure |
[in] | ts | pointer to a cs_time_step_t struct. |
[in] | dt | value of the cureent time step |
cs_equation_t* cs_equation_free | ( | cs_equation_t * | eq | ) |
Destroy a cs_equation_t structure.
[in,out] | eq | pointer to a cs_equation_t structure |
void cs_equation_free_common_structures | ( | cs_flag_t | scheme_flag | ) |
Allocate a pointer to a buffer of size at least the 2*n_cells for managing temporary usage of memory when dealing with equations Call specific structure allocation related to a numerical scheme according the scheme flag The size of the temporary buffer can be bigger according to the numerical settings.
[in] | scheme_flag | flag to identify which kind of numerical scheme is requested to solve the computational domain |
const cs_real_t* cs_equation_get_cell_values | ( | const cs_equation_t * | eq | ) |
Get the values at each cell centers for the field unknowns related to this equation.
[in] | eq | pointer to a cs_equation_t structure |
cs_property_t* cs_equation_get_diffusion_property | ( | const cs_equation_t * | eq | ) |
Return a pointer to the cs_property_t structure associated to the diffusion term for this equation.
[in] | eq | pointer to a cs_equation_t structure |
Return a pointer to the cs_property_t structure associated to the diffusion term for this equation.
[in] | eq | pointer to a cs_equation_t structure |
const cs_real_t* cs_equation_get_face_values | ( | const cs_equation_t * | eq | ) |
Get the values at each face of the mesh for the field unknowns related to this equation.
[in] | eq | pointer to a cs_equation_t structure |
cs_field_t* cs_equation_get_field | ( | const cs_equation_t * | eq | ) |
Return the field structure associated to a cs_equation_t structure.
[in] | eq | pointer to a cs_equation_t structure |
cs_flag_t cs_equation_get_flag | ( | const cs_equation_t * | eq | ) |
Return the flag associated to an equation.
[in] | eq | pointer to a cs_equation_t structure |
const char* cs_equation_get_name | ( | const cs_equation_t * | eq | ) |
Return the name related to the given cs_equation_t structure to an equation.
[in] | eq | pointer to a cs_equation_t structure |
const cs_equation_param_t* cs_equation_get_param | ( | const cs_equation_t * | eq | ) |
Return the cs_equation_param_t structure associated to a cs_equation_t structure.
[in] | eq | pointer to a cs_equation_t structure |
cs_property_t* cs_equation_get_reaction_property | ( | const cs_equation_t * | eq, |
const char * | r_name | ||
) |
Return a pointer to the cs_property_t structure associated to the reaction term called r_name and related to this equation.
[in] | eq | pointer to a cs_equation_t structure |
cs_space_scheme_t cs_equation_get_space_scheme | ( | const cs_equation_t * | eq | ) |
Return the type of numerical scheme used for the discretization in space.
[in] | eq | pointer to a cs_equation_t structure |
cs_property_t* cs_equation_get_time_property | ( | const cs_equation_t * | eq | ) |
Return a pointer to the cs_property_t structure associated to the unsteady term for this equation.
[in] | eq | pointer to a cs_equation_t structure |
Return a pointer to the cs_property_t structure associated to the unsteady term for this equation.
[in] | eq | pointer to a cs_equation_t structure |
cs_real_t* cs_equation_get_tmpbuf | ( | void | ) |
Retrieve a pointer to a buffer of size at least the 2*n_cells The size of the temporary buffer can be bigger according to the numerical settings.
size_t cs_equation_get_tmpbuf_size | ( | void | ) |
Get the allocation size of the temporary buffer.
cs_equation_type_t cs_equation_get_type | ( | const cs_equation_t * | eq | ) |
Return the type of equation for the given equation structure.
[in] | eq | pointer to a cs_equation_t structure |
cs_param_var_type_t cs_equation_get_var_type | ( | const cs_equation_t * | eq | ) |
Return the type of variable solved by this equation.
[in] | eq | pointer to a cs_equation_t structure |
void cs_equation_init_system | ( | const cs_mesh_t * | mesh, |
cs_equation_t * | eq | ||
) |
Initialize the values of a field according to the initial condition related to its equation.
[in] | mesh | pointer to the mesh structure |
[in,out] | eq | pointer to a cs_equation_t structure |
bool cs_equation_is_steady | ( | const cs_equation_t * | eq | ) |
Return true is the given equation is steady otherwise false.
[in] | eq | pointer to a cs_equation_t structure |
void cs_equation_last_setup | ( | cs_equation_t * | eq | ) |
Assign a set of pointer functions for managing the cs_equation_t structure during the computation.
[in,out] | eq | pointer to a cs_equation_t structure |
void cs_equation_link | ( | cs_equation_t * | eq, |
const char * | keyword, | ||
void * | pointer | ||
) |
Associate a material property or an advection field with an equation for a given term (diffusion, time, convection)
[in,out] | eq | pointer to a cs_equation_t structure |
[in] | keyword | "time", "diffusion", "advection" |
[in] | pointer | pointer to a given structure |
bool cs_equation_needs_build | ( | const cs_equation_t * | eq | ) |
Check if one has to build the linear system.
[in] | eq | pointer to a cs_equation_t structure |
void cs_equation_set_ic | ( | cs_equation_t * | eq, |
const char * | ml_name, | ||
const char * | def_key, | ||
void * | val | ||
) |
Define the initial condition of the unknown related to this equation This definition can be done by mesh location Available types of definition are: "value" and "analytic".
[in,out] | eq | pointer to a cs_equation_t structure |
[in] | ml_name | name of the associated mesh location (if NULL or "" all entities are considered) |
[in] | def_key | way of defining the value of the BC |
[in] | val | pointer to the value |
Define the initial condition of the unknown related to this equation This definition can be done by mesh location Available types of definition are: "value" and "analytic".
[in,out] | eq | pointer to a cs_equation_t structure |
[in] | ml_name | name of the associated mesh location (if NULL or "" all entities are considered) |
[in] | def_key | way of defining the value of the BC |
[in] | val | pointer to the value |
void cs_equation_set_param | ( | cs_equation_t * | eq, |
cs_equation_key_t | key, | ||
const char * | keyval | ||
) |
Set a parameter in a cs_equation_t structure attached to keyname.
[in,out] | eq | pointer to a cs_equation_t structure |
[in] | key | key related to the member of eq to set |
[in] | keyval | accessor to the value to set |
void cs_equation_set_source_term_quadrature | ( | cs_equation_t * | eq, |
const char * | st_name, | ||
cs_quadra_type_t | quad_type | ||
) |
Set the type of quadrature to use for computing a source term If st_name is NULL, all source terms of the given equation are set.
[in,out] | eq | pointer to a cs_equation_t structure |
[in] | st_name | name of the source term |
[in] | quad_type | type of quadrature to use |
void cs_equation_set_source_term_reduction | ( | cs_equation_t * | eq, |
const char * | st_name, | ||
cs_source_term_reduction_t | type | ||
) |
Set the type of quadrature to use for computing a source term If st_name is NULL, all source terms of the given equation are set.
[in,out] | eq | pointer to a cs_equation_t structure |
[in] | st_name | name of the source term |
[in] | type | type of reduction to apply |
void cs_equation_set_timer_stats | ( | cs_equation_t * | eq | ) |
Create timer statistics structures to enable a "home-made" profiling.
[in,out] | eq | pointer to a cs_equation_t structure |
void cs_equation_solve | ( | cs_equation_t * | eq, |
bool | do_logcvg | ||
) |
Solve the linear system for this equation.
[in,out] | eq | pointer to a cs_equation_t structure |
[in] | do_logcvg | output information on convergence or not |
void cs_equation_summary | ( | const cs_equation_t * | eq | ) |
Summary of a cs_equation_t structure.
[in] | eq | pointer to a cs_equation_t structure |