programmer's documentation
Data Structures | Macros | Enumerations | Functions
cs_param_eq.h File Reference
#include "cs_base.h"
#include "cs_cdo.h"
#include "cs_quadrature.h"
#include "cs_param.h"
Include dependency graph for cs_param_eq.h:

Go to the source code of this file.

Data Structures

struct  cs_param_eq_algo_t
 
struct  cs_param_eq_t
 
struct  cs_param_navsto_t
 

Macros

#define CS_PARAM_EQ_UNSTEADY   (1 << 0) /* 1: unsteady term */
 
#define CS_PARAM_EQ_CONVECTION   (1 << 1) /* 2: convection term */
 
#define CS_PARAM_EQ_DIFFUSION   (1 << 2) /* 4: diffusion term */
 
#define CS_PARAM_EQ_SOURCETERM   (1 << 3) /* 8: source term */
 

Enumerations

enum  cs_param_eq_type_t {
  CS_PARAM_EQ_TYPE_NONE, CS_PARAM_EQ_TYPE_SCAL, CS_PARAM_EQ_TYPE_VECT, CS_PARAM_EQ_TYPE_TENS,
  CS_PARAM_EQ_N_TYPES
}
 
enum  cs_param_eq_algo_type_t {
  CS_PARAM_EQ_ALGO_NONE, CS_PARAM_EQ_ALGO_CS_ITSOL, CS_PARAM_EQ_ALGO_PETSC_ITSOL, CS_PARAM_EQ_ALGO_UZAWA,
  CS_PARAM_EQ_ALGO_NEWTON, CS_PARAM_EQ_ALGO_PICARD, CS_PARAM_EQ_N_ALGOS
}
 
enum  cs_param_navsto_formulation_t { CS_PARAM_NAVSTO_FORM_NONE, CS_PARAM_NAVSTO_FORM_CURL, CS_PARAM_NAVSTO_FORM_CLASSIC, CS_PARAM_NAVSTO_N_FORMS }
 
enum  cs_param_navsto_algo_t { CS_PARAM_NAVSTO_ALGO_NONE, CS_PARAM_NAVSTO_ALGO_COUPLED, CS_PARAM_NAVSTO_ALGO_SIMPLEC, CS_PARAM_NAVSTO_N_ALGOS }
 

Functions

int cs_param_eq_get_id_by_name (const char *ref_name)
 Find the id related to an equation definition from its name. More...
 
const cs_param_eq_tcs_param_eq_get_by_id (int eq_id)
 Retrieve a pointer to a cs_param_eq_t structure. More...
 
int cs_param_eq_add (const char *name, const char *varname, cs_param_eq_type_t type, bool is_steady, bool do_convection, bool do_diffusion, cs_param_bc_type_t default_bc_type)
 Define and initialize a new structure to store parameters related to an equation. More...
 
void cs_param_eq_set_diffusion_pty (const char *eq_name, const char *pty_name)
 Associate a material property to the diffusion term of an equation By default, a material property equal to the unity is set. More...
 
void cs_param_eq_set_algo_type (const char *eqname, cs_param_eq_algo_type_t algo)
 Set the type of algorithm for solving the linear system related to the equation named eqname. More...
 
void cs_param_eq_set_itsol_type (const char *name, cs_param_itsol_type_t itsol, cs_param_precond_type_t precond)
 Set the type of iterative solver and the type of preconditionner for solving the linear system related to the equation named eqname. More...
 
void cs_param_eq_set_itsol_precision (const char *name, double accuracy)
 Set the solver precision. More...
 
void cs_param_eq_set_itsol_max_iter (const char *name, int n_max_iter)
 Set the maximum number of iterations to do in an iterative solver. More...
 
void cs_param_eq_set_itsol_normalization (const char *name, bool resid_normalized)
 Set if the residual is normalized or not. More...
 
void cs_param_eq_set_verbosity_level (const char *name, int verbosity)
 Modify the level of verbosity (user function) More...
 
const char * cs_param_eq_get_name (int eq_id)
 Retrieve the name associated to an equation from its id. More...
 
void cs_param_eq_set_space_scheme (const char *name, cs_space_scheme_t scheme)
 Modify the scheme used to discretized in space an equation. More...
 
cs_space_scheme_t cs_param_eq_get_space_scheme (int eq_id)
 Retrieve the numerical scheme used to discretize in space this equation from its id. More...
 
cs_param_eq_type_t cs_param_eq_get_type (int eq_id)
 Retrieve the type of equation associated to this equation from its id. More...
 
void cs_param_eq_hodge_diffusion_set_algo (const char *name, cs_param_hodge_algo_t algo)
 Modify the algorithm used to build the discrete Hodge operator related to the diffusion term. More...
 
void cs_param_eq_hodge_diffusion_set_coef (const char *name, double coef)
 Modify the coefficient related to an algorithm used to build the discrete Hodge operator associated to the diffusion term. More...
 
void cs_param_eq_add_scalbc_by_val (const char *eq_name, const char *location_name, cs_param_bc_type_t bc_type, double bc_val)
 Define a new boundary condition for a scalar. More...
 
void cs_param_eq_add_scalbc_by_analytic (const char *eq_name, const char *location_name, cs_param_bc_type_t bc_type, cs_analytic_func_t *func)
 Define a new boundary condition for a scalar using an analytic function. More...
 
void cs_param_eq_add_source_term_by_val (const char *eq_name, const char *st_name, const char *ml_name, cs_param_source_term_type_t type, cs_get_t get_imp, cs_get_t get_exp)
 Define a source term by value(s). This source term is added to the list of source terms associated to an equation. More...
 
void cs_param_eq_add_source_term_by_user (const char *eq_name, const char *st_name, const char *ml_name, cs_param_source_term_type_t type, cs_quadra_type_t quad_type, cs_user_func_t *imp_func, cs_user_func_t *exp_func)
 Define a source term by a user-defined function. This source term is added to the list of source terms associated to an equation. More...
 
void cs_param_eq_add_source_term_by_analytic (const char *eq_name, const char *st_name, const char *ml_name, cs_param_source_term_type_t type, cs_quadra_type_t quad_type, cs_analytic_func_t *imp_func, cs_analytic_func_t *exp_func)
 Define a source term by an analytic function. This source term is added to the list of source terms associated to an equation. More...
 
void cs_param_eq_add_fields (void)
 Create a field related to a variable solved in an equation. More...
 
void cs_param_eq_free_all (void)
 Free all definitions of equations initialized during the simulation. More...
 
void cs_param_eq_get_info (int *n_cdo_eqs)
 Retrieve high-level information on the setting. More...
 
void cs_param_eq_resume_all (void)
 Resume parameters of all conv./diff./source terms equations. More...
 

Macro Definition Documentation

#define CS_PARAM_EQ_CONVECTION   (1 << 1) /* 2: convection term */
#define CS_PARAM_EQ_DIFFUSION   (1 << 2) /* 4: diffusion term */
#define CS_PARAM_EQ_SOURCETERM   (1 << 3) /* 8: source term */
#define CS_PARAM_EQ_UNSTEADY   (1 << 0) /* 1: unsteady term */

Enumeration Type Documentation

Enumerator
CS_PARAM_EQ_ALGO_NONE 
CS_PARAM_EQ_ALGO_CS_ITSOL 
CS_PARAM_EQ_ALGO_PETSC_ITSOL 
CS_PARAM_EQ_ALGO_UZAWA 
CS_PARAM_EQ_ALGO_NEWTON 
CS_PARAM_EQ_ALGO_PICARD 
CS_PARAM_EQ_N_ALGOS 
Enumerator
CS_PARAM_EQ_TYPE_NONE 
CS_PARAM_EQ_TYPE_SCAL 
CS_PARAM_EQ_TYPE_VECT 
CS_PARAM_EQ_TYPE_TENS 
CS_PARAM_EQ_N_TYPES 
Enumerator
CS_PARAM_NAVSTO_ALGO_NONE 
CS_PARAM_NAVSTO_ALGO_COUPLED 
CS_PARAM_NAVSTO_ALGO_SIMPLEC 
CS_PARAM_NAVSTO_N_ALGOS 
Enumerator
CS_PARAM_NAVSTO_FORM_NONE 
CS_PARAM_NAVSTO_FORM_CURL 
CS_PARAM_NAVSTO_FORM_CLASSIC 
CS_PARAM_NAVSTO_N_FORMS 

Function Documentation

int cs_param_eq_add ( const char *  name,
const char *  varname,
cs_param_eq_type_t  type,
bool  is_steady,
bool  do_convection,
bool  do_diffusion,
cs_param_bc_type_t  default_bc_type 
)

Define and initialize a new structure to store parameters related to an equation.

Parameters
[in]namename of the material property
[in]varnamename of the variable associated to this equation
[in]typetype of equation (scalar, vector, tensor...)
[in]is_steadyadd an unsteady term or not
[in]do_convectionadd a convection term
[in]do_diffusionadd a diffusion term
[in]default_bc_typetype of boundary condition set by default
Returns
id associated to this equation
void cs_param_eq_add_fields ( void  )

Create a field related to a variable solved in an equation.

void cs_param_eq_add_scalbc_by_analytic ( const char *  eq_name,
const char *  ml_name,
cs_param_bc_type_t  bc_type,
cs_analytic_func_t analytic 
)

Define a new boundary condition for a scalar using an analytic function.

Parameters
[in]eq_namename of the equation
[in]location_namename of the location
[in]bc_typetype of boundary condition
[in]analyticpointer to an analytic function

Define a new boundary condition for a scalar using an analytic function.

Parameters
[in]eq_namename of the equation
[in]location_namename of the mesh location
[in]bc_typetype of boundary condition
[in]analyticpointer to an analytic function
void cs_param_eq_add_scalbc_by_val ( const char *  eq_name,
const char *  ml_name,
cs_param_bc_type_t  bc_type,
double  bc_val 
)

Define a new boundary condition for a scalar.

Parameters
[in]eq_namename of the equation
[in]location_namename of the location
[in]bc_typetype of boundary condition
[in]bc_valvalue of the boundary condition

Define a new boundary condition for a scalar.

Parameters
[in]eq_namename of the equation
[in]ml_namename of the mesh location
[in]bc_typetype of boundary condition
[in]bc_valvalue of the boundary condition
void cs_param_eq_add_source_term_by_analytic ( const char *  eq_name,
const char *  st_name,
const char *  ml_name,
cs_param_source_term_type_t  type,
cs_quadra_type_t  quad_type,
cs_analytic_func_t imp_func,
cs_analytic_func_t exp_func 
)

Define a source term by an analytic function. This source term is added to the list of source terms associated to an equation.

Parameters
[in]eq_namename of the equation
[in]st_namename of the source term (for log/post-processing)
[in]ml_namename of the mesh location
[in]do_posttrue or false
[in]typetype of source term
[in]quad_typequadrature rule
[in]imp_funcpointer to the function related to the implicit part
[in]exp_funcpointer to the function related to the explicit part
void cs_param_eq_add_source_term_by_user ( const char *  eq_name,
const char *  st_name,
const char *  ml_name,
cs_param_source_term_type_t  type,
cs_quadra_type_t  quad_type,
cs_user_func_t imp_func,
cs_user_func_t exp_func 
)

Define a source term by a user-defined function. This source term is added to the list of source terms associated to an equation.

Parameters
[in]eq_namename of the equation
[in]st_namename of the source term (for log/post-processing)
[in]ml_namename of the mesh location
[in]typetype of source term
[in]quad_typequadrature rule
[in]imp_funcpointer to a function related to the implicit part
[in]exp_funcpointer to a function related to the explicit part
void cs_param_eq_add_source_term_by_val ( const char *  eq_name,
const char *  st_name,
const char *  ml_name,
cs_param_source_term_type_t  type,
cs_get_t  get_imp,
cs_get_t  get_exp 
)

Define a source term by value(s). This source term is added to the list of source terms associated to an equation.

Parameters
[in]eq_namename of the equation
[in]st_namename of the source term (for log/post-processing)
[in]ml_namename of the mesh location
[in]typetype of source term
[in]get_impvalue(s) of the implicit part
[in]get_expvalue(s) of the explicit part
void cs_param_eq_free_all ( void  )

Free all definitions of equations initialized during the simulation.

const cs_param_eq_t* cs_param_eq_get_by_id ( int  eq_id)

Retrieve a pointer to a cs_param_eq_t structure.

Parameters
[in]eq_idid of the selected equation
Returns
a pointer to the selected cs_param_eq_t structure
int cs_param_eq_get_id_by_name ( const char *  ref_name)

Find the id related to an equation definition from its name.

Parameters
[in]ref_namename of the property to find
Returns
-1 if not found otherwise the associated id
void cs_param_eq_get_info ( int *  n_cdo_eqs)

Retrieve high-level information on the setting.

Parameters
[in,out]n_cdo_eqsnumber of additional equations using the CDO kernel
const char* cs_param_eq_get_name ( int  eq_id)

Retrieve the name associated to an equation from its id.

Parameters
[in]eq_idid associated to a cs_param_eq_t structure
Returns
the name of this equation
cs_space_scheme_t cs_param_eq_get_space_scheme ( int  eq_id)

Retrieve the numerical scheme used to discretize in space this equation from its id.

Parameters
[in]eq_idid associated to a cs_param_eq_t structure
Returns
the current space scheme used to discretize this equation
cs_param_eq_type_t cs_param_eq_get_type ( int  eq_id)

Retrieve the type of equation associated to this equation from its id.

Parameters
[in]eq_idid associated to a cs_param_eq_t structure
Returns
the type of equation
void cs_param_eq_hodge_diffusion_set_algo ( const char *  name,
cs_param_hodge_algo_t  algo 
)

Modify the algorithm used to build the discrete Hodge operator related to the diffusion term.

Parameters
[in]namename of the equation to deal with
[in]schemetype of space scheme to use
void cs_param_eq_hodge_diffusion_set_coef ( const char *  name,
double  coef 
)

Modify the coefficient related to an algorithm used to build the discrete Hodge operator associated to the diffusion term.

Parameters
[in]namename of the equation to deal with
[in]coefvalue of the coefficient
void cs_param_eq_resume_all ( void  )

Resume parameters of all conv./diff./source terms equations.

void cs_param_eq_set_algo_type ( const char *  eqname,
cs_param_eq_algo_type_t  algo 
)

Set the type of algorithm for solving the linear system related to the equation named eqname.

Parameters
[in]eqnamename of the equation to deal with
[in]algoalgorithm used for solving linear systems
void cs_param_eq_set_diffusion_pty ( const char *  eq_name,
const char *  pty_name 
)

Associate a material property to the diffusion term of an equation By default, a material property equal to the unity is set.

Parameters
[in]eq_namename of the equation to deal with
[in]pty_namename of the material property to associate
void cs_param_eq_set_itsol_max_iter ( const char *  name,
int  n_max_iter 
)

Set the maximum number of iterations to do in an iterative solver.

Parameters
[in]namename of the equation to deal with
[in]n_max_itermax num. of iterations
void cs_param_eq_set_itsol_normalization ( const char *  name,
bool  resid_normalized 
)

Set if the residual is normalized or not.

Parameters
[in]namename of the equation to deal with
[in]resid_normalizedtrue/false
void cs_param_eq_set_itsol_precision ( const char *  name,
double  accuracy 
)

Set the solver precision.

Parameters
[in]namename of the equation to deal with
[in]accuracyvalue of the stopping criterion
void cs_param_eq_set_itsol_type ( const char *  name,
cs_param_itsol_type_t  itsol,
cs_param_precond_type_t  precond 
)

Set the type of iterative solver and the type of preconditionner for solving the linear system related to the equation named eqname.

Parameters
[in]namename of the equation to deal with
[in]itsoliterative solver used for solving linear systems
[in]precondpreconditionner used for solving linear systems
void cs_param_eq_set_space_scheme ( const char *  name,
cs_space_scheme_t  scheme 
)

Modify the scheme used to discretized in space an equation.

Parameters
[in]namename of the equation to deal with
[in]schemetype of space scheme to use

Modify the scheme used to discretized in space an equation.

Parameters
[in]namename of the equation to deal with
[in]schemetype of space scheme to use
void cs_param_eq_set_verbosity_level ( const char *  name,
int  verbosity 
)

Modify the level of verbosity (user function)

Parameters
[in]namename of the equation to deal with
[in]verbositylevel of verbosity