programmer's documentation
cs_equation_param.h
Go to the documentation of this file.
1 #ifndef __CS_EQUATION_PARAM_H__
2 #define __CS_EQUATION_PARAM_H__
3 
4 /*============================================================================
5  * Header to handle specific settings related to a cs_equation_t structure
6  *============================================================================*/
7 
8 /*
9  This file is part of Code_Saturne, a general-purpose CFD tool.
10 
11  Copyright (C) 1998-2018 EDF S.A.
12 
13  This program is free software; you can redistribute it and/or modify it under
14  the terms of the GNU General Public License as published by the Free Software
15  Foundation; either version 2 of the License, or (at your option) any later
16  version.
17 
18  This program is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
20  FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
21  details.
22 
23  You should have received a copy of the GNU General Public License along with
24  this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
25  Street, Fifth Floor, Boston, MA 02110-1301, USA.
26 */
27 
28 /*----------------------------------------------------------------------------
29  * Local headers
30  *----------------------------------------------------------------------------*/
31 
32 #include "cs_param.h"
33 #include "cs_property.h"
34 #include "cs_advection_field.h"
35 #include "cs_source_term.h"
36 
37 /*----------------------------------------------------------------------------*/
38 
40 
41 /*============================================================================
42  * Macro definitions
43  *============================================================================*/
44 
45 /* Term flag */
46 #define CS_EQUATION_LOCKED (1 << 0) // 1: modification not allowed
47 #define CS_EQUATION_UNSTEADY (1 << 1) // 2: unsteady term
48 #define CS_EQUATION_CONVECTION (1 << 2) // 4: convection term
49 #define CS_EQUATION_DIFFUSION (1 << 3) // 8: diffusion term
50 #define CS_EQUATION_REACTION (1 << 4) // 16: reaction term
51 
52 /* Extra operations flag */
53 #define CS_EQUATION_POST_PECLET (1 << 0) // 1: Export Peclet number
54 #define CS_EQUATION_POST_UPWIND_COEF (1 << 1) // 2: Export upwinding coef.
55 
56 /*============================================================================
57  * Type definitions
58  *============================================================================*/
59 
60 /* Type of equations managed by the solver */
61 typedef enum {
62 
63  CS_EQUATION_TYPE_USER, // User-defined equation
64  CS_EQUATION_TYPE_GROUNDWATER, // Equation specific to groundwater flows
65  CS_EQUATION_TYPE_PREDEFINED, // General predefined equation
67 
69 
70 /* Type of algorithm to get the solution of an equation */
71 typedef enum {
72 
73  CS_EQUATION_ALGO_CS_ITSOL, /* Used an iterative solver
74  defined by Code_Saturne */
75  CS_EQUATION_ALGO_PETSC_ITSOL, /* Used an iterative solver
76  defined by PETSc */
77  CS_EQUATION_ALGO_UZAWA, // To solve sadle-point system
78  CS_EQUATION_ALGO_NEWTON, // To solve non-linear system
79  CS_EQUATION_ALGO_PICARD, // To solve non-linear system
81 
83 
84 /* Description of the algorithm used to solve an equation */
85 typedef struct {
86 
88 
89  int n_iters;
93 
94  double eps; /* stopping criterion on accuracy */
95 
97 
98 /* Set of parameters to handle an unsteady convection-diffusion-reaction
99  equation with term sources */
100 typedef struct {
101 
102  cs_equation_type_t type; /* predefined, user... */
103  cs_param_var_type_t var_type; /* scalar, vector, tensor... */
104  int verbosity; /* Level of detail to output */
105  int sles_verbosity; /* Level of detail to output for SLES */
106 
107  /* Unsteady-Diffusion-Convection-Source term activated or not */
109 
110  /* Post-treatment */
111  cs_flag_t process_flag; /* Type of post-treatment to do */
112 
113  /* Numerical settings */
115  int space_poly_degree; /* Max. degree of the polynomial
116  basis */
117 
118  /* Boundary conditions */
120 
121  /* High-level structure to manage/monitor the resolution of this equation */
124 
125  /* Unsteady term parametrization */
129 
130  /* Diffusion term parametrization */
133 
134  /* Advection term parametrization */
137 
138  /* Reaction term parametrization
139  Belong to the left-hand and/or right-hand side according to the time scheme
140  */
145 
146  /* Parametrization of source terms (Belong to the right-hand side) */
149 
151 
152 /*============================================================================
153  * Public function prototypes
154  *============================================================================*/
155 
156 /*----------------------------------------------------------------------------*/
166 /*----------------------------------------------------------------------------*/
167 
170  cs_param_var_type_t var_type,
171  cs_param_bc_type_t default_bc);
172 
173 /*----------------------------------------------------------------------------*/
181 /*----------------------------------------------------------------------------*/
182 
185 
186 /*----------------------------------------------------------------------------*/
193 /*----------------------------------------------------------------------------*/
194 
195 void
196 cs_equation_param_summary(const char *eqname,
197  const cs_equation_param_t *eqp);
198 
199 /*----------------------------------------------------------------------------*/
208 /*----------------------------------------------------------------------------*/
209 
210 void
211 cs_equation_param_init_sles(const char *eqname,
212  const cs_equation_param_t *eqp,
213  int field_id);
214 
215 /*----------------------------------------------------------------------------*/
216 
218 
219 #endif /* __CS_EQUATION_PARAM_H__ */
cs_param_reaction_t * reaction_info
Definition: cs_equation_param.h:144
int n_max_iters
Definition: cs_equation_param.h:90
cs_property_t * diffusion_property
Definition: cs_equation_param.h:132
void cs_equation_param_summary(const char *eqname, const cs_equation_param_t *eqp)
Summary of a cs_equation_param_t structure.
Definition: cs_equation_param.c:466
Definition: cs_advection_field.h:59
Definition: cs_equation_param.h:73
cs_adv_field_t * advection_field
Definition: cs_equation_param.h:136
cs_param_hodge_t time_hodge
Definition: cs_equation_param.h:127
cs_source_term_t * source_terms
Definition: cs_equation_param.h:148
Definition: cs_equation_param.h:100
int n_cumulated_iters
Definition: cs_equation_param.h:91
cs_param_var_type_t var_type
Definition: cs_equation_param.h:103
cs_equation_algo_t algo_info
Definition: cs_equation_param.h:122
cs_equation_type_t type
Definition: cs_equation_param.h:102
Definition: cs_equation_param.h:85
#define BEGIN_C_DECLS
Definition: cs_defs.h:451
void cs_equation_param_init_sles(const char *eqname, const cs_equation_param_t *eqp, int field_id)
Initialize SLES structure for the resolution of the linear system according to the settings related t...
Definition: cs_equation_param.c:740
Definition: cs_equation_param.h:78
int n_iters
Definition: cs_equation_param.h:89
double eps
Definition: cs_equation_param.h:94
Definition: cs_param.h:232
cs_space_scheme_t
Definition: cs_cdo.h:137
cs_equation_param_t * cs_equation_param_free(cs_equation_param_t *eqp)
Free a cs_equation_param_t.
Definition: cs_equation_param.c:414
cs_space_scheme_t space_scheme
Definition: cs_equation_param.h:114
int n_reaction_terms
Definition: cs_equation_param.h:142
cs_flag_t process_flag
Definition: cs_equation_param.h:111
cs_param_advection_t advection_info
Definition: cs_equation_param.h:135
cs_param_hodge_t diffusion_hodge
Definition: cs_equation_param.h:131
Definition: cs_param.h:184
cs_equation_param_t * cs_equation_param_create(cs_equation_type_t type, cs_param_var_type_t var_type, cs_param_bc_type_t default_bc)
Create a cs_equation_param_t.
Definition: cs_equation_param.c:324
Definition: cs_equation_param.h:80
cs_equation_algo_type_t type
Definition: cs_equation_param.h:87
int n_source_terms
Definition: cs_equation_param.h:147
Definition: cs_equation_param.h:79
int space_poly_degree
Definition: cs_equation_param.h:115
cs_equation_type_t
Definition: cs_equation_param.h:61
cs_param_bc_type_t
Definition: cs_param.h:273
int verbosity
Definition: cs_equation_param.h:104
cs_property_t ** reaction_properties
Definition: cs_equation_param.h:143
int n_max_cumulated_iters
Definition: cs_equation_param.h:92
cs_param_bc_t * bc
Definition: cs_equation_param.h:119
int sles_verbosity
Definition: cs_equation_param.h:105
cs_param_itsol_t itsol_info
Definition: cs_equation_param.h:123
Definition: cs_equation_param.h:66
#define END_C_DECLS
Definition: cs_defs.h:452
unsigned short int cs_flag_t
Definition: cs_defs.h:299
cs_param_var_type_t
Definition: cs_param.h:120
cs_param_hodge_t reaction_hodge
Definition: cs_equation_param.h:141
Definition: cs_param.h:251
cs_flag_t flag
Definition: cs_equation_param.h:108
Definition: cs_equation_param.h:64
Definition: cs_equation_param.h:63
cs_param_time_t time_info
Definition: cs_equation_param.h:126
Definition: cs_equation_param.h:65
Definition: cs_param.h:298
Definition: cs_equation_param.h:75
Definition: cs_param.h:156
Definition: cs_property.h:66
Definition: cs_equation_param.h:77
cs_equation_algo_type_t
Definition: cs_equation_param.h:71
cs_property_t * time_property
Definition: cs_equation_param.h:128
Definition: cs_param.h:361
Definition: cs_source_term.h:56