programmer's documentation
cs_parameters.h
Go to the documentation of this file.
1 #ifndef __CS_PARAMETERS_H__
2 #define __CS_PARAMETERS_H__
3 
4 /*============================================================================
5  * General parameters management.
6  *============================================================================*/
7 
8 /*
9  This file is part of Code_Saturne, a general-purpose CFD tool.
10 
11  Copyright (C) 1998-2015 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 
30 /*----------------------------------------------------------------------------
31  * Local headers
32  *----------------------------------------------------------------------------*/
33 
34 #include "cs_defs.h"
35 
36 /*----------------------------------------------------------------------------*/
37 
39 
40 /*=============================================================================
41  * Macro definitions
42  *============================================================================*/
43 
44 /*============================================================================
45  * Type definitions
46  *============================================================================*/
47 
48 /*----------------------------------------------------------------------------
49  * Structure of variable calculation options
50  *----------------------------------------------------------------------------*/
51 
52 typedef struct {
53  int iwarni;
54  int iconv;
55  int istat;
56  int idiff;
57  int idifft;
58  int idften;
59  int iswdyn;
60  int ischcv;
61  int ibdtso;
62  int isstpc;
63  int nswrgr;
64  int nswrsm;
65  int imrgra;
66  int imligr;
67  int ircflu;
68  int iwgrec; /* gradient calculation
69  - 0: standard (default)
70  - 1: weighted (could be used with imvisf = 1) */
71  double thetav;
72  double blencv;
73  double epsilo;
74  double epsrsm;
75  double epsrgr;
76  double climgr;
77  double extrag;
78  double relaxv;
80 
81 /*----------------------------------------------------------------------------
82  * Structure of the solving info
83  *----------------------------------------------------------------------------*/
84 
85 typedef struct {
86  int n_it;
87  double rhs_norm;
88  double res_norm;
89  double derive;
90  double l2residual;
92 
93 /*----------------------------------------------------------------------------
94  * Structure of condensation modelling physical properties
95  *----------------------------------------------------------------------------*/
96 
97 typedef struct {
98  double mol_mas;
99  double cp;
100  double vol_dif;
101  double mu_a;
102  double mu_b;
103  double lambda_a;
104  double lambda_b;
106 
107 
108 /*----------------------------------------------------------------------------
109  * Boundary condition types
110  *----------------------------------------------------------------------------*/
111 
112 enum {
113  CS_INDEF = 1,
114  CS_INLET = 2,
119  CS_ESICF = 7,
120  CS_SSPCF = 8,
121  CS_SOPCF = 9,
122  CS_EPHCF = 10,
123  CS_EQHCF = 11,
128 };
129 
130 /*----------------------------------------------------------------------------
131  * Space discretisation options descriptor
132  *----------------------------------------------------------------------------*/
133 
134 typedef struct {
135 
136  int imvisf; /* face viscosity field interpolation
137  - 1: harmonic
138  - 0: arithmetic (default) */
139 
140  int imrgra; /* type of gradient reconstruction
141  - 0: iterative process
142  - 1: standard least square method
143  - 2: least square method with extended
144  neighborhood
145  - 3: least square method with reduced extended
146  neighborhood
147  - 4: iterative precess initialized by the least
148  square method */
149 
150  double anomax; /* non orthogonality angle of the faces, in radians.
151  For larger angle values, cells with one node
152  on the wall are kept in the extended support of
153  the neighboring cells. */
154 
155  int iflxmw; /* method to compute interior mass flux due to ALE
156  mesh velocity
157  - 1: based on cell center mesh velocity
158  - 0: based on nodes displacement */
159 
161 
162 /*----------------------------------------------------------------------------
163  * PISO descriptor
164  *----------------------------------------------------------------------------*/
165 
166 typedef struct {
167 
168  int nterup; /* number of interations on the pressure-velocity
169  coupling on Navier-Stokes */
170 
171  double epsup; /* relative precision for the convergence test of
172  the iterative process on pressure-velocity
173  coupling */
174 
175  double xnrmu; /* norm of the increment
176  \f$ \vect{u}^{k+1} - \vect{u}^k \f$
177  of the iterative process on pressure-velocity
178  coupling */
179 
180  double xnrmu0; /* norm of \f$ \vect{u}^0 \f$ */
181 
182 } cs_piso_t;
183 
184 /*============================================================================
185  * Static global variables
186  *============================================================================*/
187 
188 /* Pointer to space discretisation options structure */
189 
190 extern const cs_space_disc_t *cs_glob_space_disc;
191 
192 /* Pointer to PISO structure */
193 
194 extern const cs_piso_t *cs_glob_piso;
195 
196 /*=============================================================================
197  * Public function prototypes
198  *============================================================================*/
199 
200 /*----------------------------------------------------------------------------
201  * Define general field keys.
202  *
203  * A recommended practice for different submodules would be to use
204  * "cs_<module>_key_init() functions to define keys specific to those modules.
205  *----------------------------------------------------------------------------*/
206 
207 void
209 
210 /*----------------------------------------------------------------------------*/
216 /*----------------------------------------------------------------------------*/
217 
218 void
220 
221 /*----------------------------------------------------------------------------
222  * Read general restart info.
223  *
224  * This updates the previous time step info.
225  *----------------------------------------------------------------------------*/
226 
227 void
229 
230 /*----------------------------------------------------------------------------
231  * Define a user variable.
232  *
233  * Solved variables are always defined on cells.
234  *
235  * parameters:
236  * name <-- name of variable and associated field
237  * dim <-- variable dimension
238  *----------------------------------------------------------------------------*/
239 
240 void
241 cs_parameters_add_variable(const char *name,
242  int dim);
243 
244 /*----------------------------------------------------------------------------
245  * Define a user variable which is a variance of another variable.
246  *
247  * Only variances of thermal or user-defined variables are currently handled.
248  *
249  * parameters:
250  * name <-- name of variance and associated field
251  * variable_name <-- name of associated variable
252  *----------------------------------------------------------------------------*/
253 
254 void
255 cs_parameters_add_variable_variance(const char *name,
256  const char *variable_name);
257 
258 /*----------------------------------------------------------------------------
259  * Define a user property.
260  *
261  * parameters:
262  * name <-- name of property and associated field
263  * dim <-- property dimension
264  * location_id <-- id of associated mesh location
265  *----------------------------------------------------------------------------*/
266 
267 void
268 cs_parameters_add_property(const char *name,
269  int dim,
270  int location_id);
271 
272 /*----------------------------------------------------------------------------
273  * Return the number of defined user variables not added yet.
274  *
275  * This number is reset to 0 when cs_parameters_create_added_variables()
276  * is called.
277  *
278  * returns:
279  * number of defined user variables
280  *----------------------------------------------------------------------------*/
281 
282 int
284 
285 /*----------------------------------------------------------------------------
286  * Return the number of defined user properties not added yet.
287  *
288  * This number is reset to 0 when cs_parameters_create_added_properties()
289  * is called.
290  *
291  * returns:
292  * number of defined user properties
293  *----------------------------------------------------------------------------*/
294 
295 int
297 
298 /*----------------------------------------------------------------------------
299  * Create previously added user variables.
300  *----------------------------------------------------------------------------*/
301 
302 void
304 
305 /*----------------------------------------------------------------------------
306  * Create previously added user properties.
307  *----------------------------------------------------------------------------*/
308 
309 void
311 
312 /*----------------------------------------------------------------------------*/
313 
315 
316 #endif /* __CS_PARAMETERS_H__ */
Definition: cs_parameters.h:85
double mol_mas
Definition: cs_parameters.h:98
int nswrsm
Definition: cs_parameters.h:64
double epsilo
Definition: cs_parameters.h:73
int idiff
Definition: cs_parameters.h:56
int imrgra
Definition: cs_parameters.h:140
const cs_space_disc_t * cs_glob_space_disc
void cs_parameters_create_added_variables(void)
Create previously added user variables.
Definition: cs_parameters.c:590
int iflxmw
Definition: cs_parameters.h:155
int nterup
Definition: cs_parameters.h:168
double lambda_a
Definition: cs_parameters.h:103
double lambda_b
Definition: cs_parameters.h:104
int iswdyn
Definition: cs_parameters.h:59
int istat
Definition: cs_parameters.h:55
Definition: cs_parameters.h:113
Definition: cs_parameters.h:122
void cs_parameters_add_variable(const char *name, int dim)
Define a user variable.
Definition: cs_parameters.c:466
void cs_parameters_read_restart_info(void)
Read general restart info.
Definition: cs_parameters.c:444
#define BEGIN_C_DECLS
Definition: cs_defs.h:419
double anomax
Definition: cs_parameters.h:150
Definition: cs_parameters.h:114
void cs_parameters_add_variable_variance(const char *name, const char *variable_name)
Define a user variable which is a variance of another variable.
Definition: cs_parameters.c:502
double thetav
Definition: cs_parameters.h:71
void cs_parameters_add_property(const char *name, int dim, int location_id)
Define a user property.
Definition: cs_parameters.c:534
int ircflu
Definition: cs_parameters.h:67
double extrag
Definition: cs_parameters.h:77
double cp
Definition: cs_parameters.h:99
double blencv
Definition: cs_parameters.h:72
void cs_parameters_create_added_properties(void)
Create previously added user properties.
Definition: cs_parameters.c:665
int imrgra
Definition: cs_parameters.h:65
Definition: cs_parameters.h:115
Definition: cs_parameters.h:126
Definition: cs_parameters.h:97
Definition: cs_parameters.h:119
Definition: cs_parameters.h:117
int idften
Definition: cs_parameters.h:58
int iwgrec
Definition: cs_parameters.h:68
int iconv
Definition: cs_parameters.h:54
Definition: cs_parameters.h:121
int iwarni
Definition: cs_parameters.h:53
int idifft
Definition: cs_parameters.h:57
Definition: cs_parameters.h:124
double epsup
Definition: cs_parameters.h:171
Definition: cs_parameters.h:116
int cs_parameters_n_added_variables(void)
Return the number of defined user variables not added yet.
Definition: cs_parameters.c:564
double vol_dif
Definition: cs_parameters.h:100
double epsrsm
Definition: cs_parameters.h:74
void cs_parameters_define_field_key_gas_mix(void)
Define field key for condensation.
Definition: cs_parameters.c:424
double xnrmu
Definition: cs_parameters.h:175
double climgr
Definition: cs_parameters.h:76
const cs_piso_t * cs_glob_piso
int ibdtso
Definition: cs_parameters.h:61
double mu_a
Definition: cs_parameters.h:101
int n_it
Definition: cs_parameters.h:86
double l2residual
Definition: cs_parameters.h:90
int imligr
Definition: cs_parameters.h:66
Definition: cs_parameters.h:120
PISO options descriptor.
Definition: cs_parameters.h:166
Definition: cs_parameters.h:52
#define END_C_DECLS
Definition: cs_defs.h:420
Definition: cs_parameters.h:123
Definition: cs_parameters.h:118
Space discretisation options descriptor.
Definition: cs_parameters.h:134
double relaxv
Definition: cs_parameters.h:78
int cs_parameters_n_added_properties(void)
Return the number of defined user properties not added yet.
Definition: cs_parameters.c:578
int ischcv
Definition: cs_parameters.h:60
double rhs_norm
Definition: cs_parameters.h:87
void cs_parameters_define_field_keys(void)
Define general field keys.
Definition: cs_parameters.c:366
int nswrgr
Definition: cs_parameters.h:63
Definition: cs_parameters.h:125
Definition: cs_parameters.h:127
int imvisf
Definition: cs_parameters.h:136
double xnrmu0
Definition: cs_parameters.h:180
double derive
Definition: cs_parameters.h:89
double mu_b
Definition: cs_parameters.h:102
double epsrgr
Definition: cs_parameters.h:75
int isstpc
Definition: cs_parameters.h:62
double res_norm
Definition: cs_parameters.h:88