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-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 
30 /*----------------------------------------------------------------------------
31  * Standard C library headers
32  *----------------------------------------------------------------------------*/
33 
34 #include <stdarg.h>
35 
36 /*----------------------------------------------------------------------------
37  * Local headers
38  *----------------------------------------------------------------------------*/
39 
40 #include "cs_defs.h"
41 #include "cs_field.h"
42 
43 /*----------------------------------------------------------------------------*/
44 
46 
47 /*=============================================================================
48  * Macro definitions
49  *============================================================================*/
50 
51 /*============================================================================
52  * Type definitions
53  *============================================================================*/
54 
55 /*----------------------------------------------------------------------------
56  * Structure of variable calculation options
57  *----------------------------------------------------------------------------*/
58 
59 typedef struct {
60  int iwarni;
61  int iconv;
62  int istat;
63  int idiff;
64  int idifft;
65  int idften;
66  int iswdyn;
67  int ischcv;
68  int ibdtso;
69  int isstpc;
70  int nswrgr;
71  int nswrsm;
72  int imrgra;
73  int imligr;
74  int ircflu;
75  int iwgrec; /* gradient calculation
76  - 0: standard (default)
77  - 1: weighted (could be used with imvisf = 1) */
78  int icoupl; /* internal coupling
79  - -1: not coupled (default)
80  - 1: coupled */
81 
82  double thetav;
83  double blencv;
84  double epsilo;
85  double epsrsm;
86  double epsrgr;
87  double climgr;
88  double extrag;
89  double relaxv;
91 
92 /*----------------------------------------------------------------------------
93  * Structure of the solving info
94  *----------------------------------------------------------------------------*/
95 
96 typedef struct {
97  int n_it;
98  double rhs_norm;
99  double res_norm;
100  double derive;
101  double l2residual;
103 
104 /*----------------------------------------------------------------------------
105  * Structure of condensation modelling physical properties
106  *----------------------------------------------------------------------------*/
107 
108 typedef struct {
109  double mol_mas;
110  double cp;
111  double vol_dif;
112  double mu_a;
113  double mu_b;
114  double lambda_a;
115  double lambda_b;
116  double muref; /* ref. viscosity for Sutherland law */
117  double lamref; /* ref. thermal conductivity for Sutherland law */
118  double trefmu; /* ref. temperature for viscosity in Sutherland law */
119  double treflam; /* ref. temperature for conductivity Sutherland law */
120  double smu; /* Sutherland temperature for viscosity */
121  double slam; /* Sutherland temperature for conductivity */
123 
124 /*----------------------------------------------------------------------------
125  * Boundary condition types
126  *----------------------------------------------------------------------------*/
127 
128 enum {
129  CS_INDEF = 1,
130  CS_INLET = 2,
135  CS_ESICF = 7,
136  CS_SSPCF = 8,
137  CS_SOPCF = 9,
138  CS_EPHCF = 10,
139  CS_EQHCF = 11,
140  CS_COUPLED = 12, /* coupled face */
141  CS_COUPLED_FD = 13, /* coupled face with decentered flux */
145 };
146 
147 /*----------------------------------------------------------------------------
148  * Space discretisation options descriptor
149  *----------------------------------------------------------------------------*/
150 
151 typedef struct {
152 
153  int imvisf; /* face viscosity field interpolation
154  - 1: harmonic
155  - 0: arithmetic (default) */
156 
157  int imrgra; /* type of gradient reconstruction
158  - 0: iterative process
159  - 1: standard least square method
160  - 2: least square method with extended
161  neighborhood
162  - 3: least square method with reduced extended
163  neighborhood
164  - 4: iterative process initialized by the least
165  square method */
166 
167  double anomax; /* non orthogonality angle of the faces, in radians.
168  For larger angle values, cells with one node
169  on the wall are kept in the extended support of
170  the neighboring cells. */
171 
172  int iflxmw; /* method to compute interior mass flux due to ALE
173  mesh velocity
174  - 1: based on cell center mesh velocity
175  - 0: based on nodes displacement */
176 
178 
179 /*----------------------------------------------------------------------------
180  * PISO descriptor
181  *----------------------------------------------------------------------------*/
182 
183 typedef struct {
184 
185  int nterup; /* number of interations on the pressure-velocity
186  coupling on Navier-Stokes */
187 
188  double epsup; /* relative precision for the convergence test of
189  the iterative process on pressure-velocity
190  coupling */
191 
192  double xnrmu; /* norm of the increment
193  \f$ \vect{u}^{k+1} - \vect{u}^k \f$
194  of the iterative process on pressure-velocity
195  coupling */
196 
197  double xnrmu0; /* norm of \f$ \vect{u}^0 \f$ */
198 
199 } cs_piso_t;
200 
201 /*============================================================================
202  * Static global variables
203  *============================================================================*/
204 
205 /* Pointer to space discretisation options structure */
206 
207 extern const cs_space_disc_t *cs_glob_space_disc;
208 
209 /* Pointer to PISO options structure */
210 
211 extern const cs_piso_t *cs_glob_piso;
212 
213 /*=============================================================================
214  * Public function prototypes
215  *============================================================================*/
216 
217 /*----------------------------------------------------------------------------*/
228 /*----------------------------------------------------------------------------*/
229 
230 static inline int
232 {
233  int iscvr = 0, f_id = 0;
234  int kscavr = cs_field_key_id("first_moment_id");
235  int keysca = cs_field_key_id("scalar_id");
236 
237  if (kscavr >= 0) {
238  f_id = cs_field_get_key_int(f, kscavr);
239  if (f_id >= 0)
240  iscvr = cs_field_get_key_int(cs_field_by_id(f_id), keysca);
241  }
242 
243  return iscvr;
244 }
245 
246 /*----------------------------------------------------------------------------*/
254 /*----------------------------------------------------------------------------*/
255 
258 
259 /*----------------------------------------------------------------------------*/
267 /*----------------------------------------------------------------------------*/
268 
269 cs_piso_t *
270 cs_get_glob_piso(void);
271 
272 /*----------------------------------------------------------------------------*/
279 /*----------------------------------------------------------------------------*/
280 
281 void
283 
284 /*----------------------------------------------------------------------------*/
290 /*----------------------------------------------------------------------------*/
291 
292 void
294 
295 /*----------------------------------------------------------------------------*/
301 /*----------------------------------------------------------------------------*/
302 
303 void
305 
306 /*----------------------------------------------------------------------------*/
315 /*----------------------------------------------------------------------------*/
316 
317 void
318 cs_parameters_add_variable(const char *name,
319  int dim);
320 
321 /*----------------------------------------------------------------------------*/
330 /*----------------------------------------------------------------------------*/
331 
332 void
333 cs_parameters_add_variable_variance(const char *name,
334  const char *variable_name);
335 
336 /*----------------------------------------------------------------------------*/
344 /*----------------------------------------------------------------------------*/
345 
346 void
347 cs_parameters_add_property(const char *name,
348  int dim,
349  int location_id);
350 
351 /*----------------------------------------------------------------------------*/
360 /*----------------------------------------------------------------------------*/
361 
362 int
364 
365 /*----------------------------------------------------------------------------*/
374 /*----------------------------------------------------------------------------*/
375 
376 int
378 
379 /*----------------------------------------------------------------------------*/
383 /*----------------------------------------------------------------------------*/
384 
385 void
387 
388 /*----------------------------------------------------------------------------*/
392 /*----------------------------------------------------------------------------*/
393 
394 void
396 
397 /*----------------------------------------------------------------------------*/
405 /*----------------------------------------------------------------------------*/
406 
407 cs_field_t *
409 
410 /*----------------------------------------------------------------------------*/
421 /*----------------------------------------------------------------------------*/
422 
423 cs_field_t *
425 
426 /*----------------------------------------------------------------------------*/
433 /*----------------------------------------------------------------------------*/
434 
437 
438 /*----------------------------------------------------------------------------*/
442 /*----------------------------------------------------------------------------*/
443 
444 void
446 
447 /*----------------------------------------------------------------------------*/
448 
450 
451 #endif /* __CS_PARAMETERS_H__ */
double climgr
Definition: cs_parameters.h:87
cs_field_t * cs_parameters_add_boundary_values(cs_field_t *f)
Define a boundary values field for a variable field.
Definition: cs_parameters.c:1210
Definition: cs_parameters.h:96
int istat
Definition: cs_parameters.h:62
double mol_mas
Definition: cs_parameters.h:109
double slam
Definition: cs_parameters.h:121
int ischcv
Definition: cs_parameters.h:67
int nswrgr
Definition: cs_parameters.h:70
int imrgra
Definition: cs_parameters.h:157
const cs_space_disc_t * cs_glob_space_disc
int iconv
Definition: cs_parameters.h:61
void cs_parameters_create_added_variables(void)
Create previously added user variables.
Definition: cs_parameters.c:1085
int iflxmw
Definition: cs_parameters.h:172
Field descriptor.
Definition: cs_field.h:124
int nterup
Definition: cs_parameters.h:185
int nswrsm
Definition: cs_parameters.h:71
int imligr
Definition: cs_parameters.h:73
double lambda_a
Definition: cs_parameters.h:114
cs_field_t * cs_field_by_id(int id)
Return a pointer to a field based on its id.
Definition: cs_field.c:2238
double smu
Definition: cs_parameters.h:120
double lambda_b
Definition: cs_parameters.h:115
Definition: cs_parameters.h:129
Definition: cs_parameters.h:138
void cs_parameters_add_variable(const char *name, int dim)
Solved variables are always defined on cells.
Definition: cs_parameters.c:961
int idifft
Definition: cs_parameters.h:64
double epsrsm
Definition: cs_parameters.h:85
void cs_parameters_read_restart_info(void)
Read general restart info.
Definition: cs_parameters.c:939
#define BEGIN_C_DECLS
Definition: cs_defs.h:451
double anomax
Definition: cs_parameters.h:167
void cs_space_disc_log_setup(void)
Print the space discretization structure to setup.log.
Definition: cs_parameters.c:1413
Definition: cs_parameters.h:141
Definition: cs_parameters.h:130
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:997
double trefmu
Definition: cs_parameters.h:118
double blencv
Definition: cs_parameters.h:83
void cs_parameters_add_property(const char *name, int dim, int location_id)
Define a user property.
Definition: cs_parameters.c:1029
int isstpc
Definition: cs_parameters.h:69
cs_space_disc_t * cs_get_glob_space_disc(void)
Provide access to cs_glob_space_disc.
Definition: cs_parameters.c:794
int icoupl
Definition: cs_parameters.h:78
double cp
Definition: cs_parameters.h:110
void cs_parameters_create_added_properties(void)
Create previously added user properties.
Definition: cs_parameters.c:1160
int iwarni
Definition: cs_parameters.h:60
Definition: cs_parameters.h:131
int cs_field_get_key_int(const cs_field_t *f, int key_id)
Return a integer value for a given key associated with a field.
Definition: cs_field.c:2907
Definition: cs_parameters.h:143
int iswdyn
Definition: cs_parameters.h:66
int cs_field_key_id(const char *name)
Return an id associated with a given key name.
Definition: cs_field.c:2421
Definition: cs_parameters.h:108
Definition: cs_parameters.h:135
Definition: cs_parameters.h:133
int idiff
Definition: cs_parameters.h:63
double extrag
Definition: cs_parameters.h:88
double epsilo
Definition: cs_parameters.h:84
Definition: cs_parameters.h:137
double thetav
Definition: cs_parameters.h:82
int imrgra
Definition: cs_parameters.h:72
Definition: cs_parameters.h:140
double epsup
Definition: cs_parameters.h:188
Definition: cs_parameters.h:132
int cs_parameters_n_added_variables(void)
Return the number of defined user variables not added yet.
Definition: cs_parameters.c:1059
double vol_dif
Definition: cs_parameters.h:111
cs_piso_t * cs_get_glob_piso(void)
Provide acces to cs_glob_piso.
Definition: cs_parameters.c:810
void cs_parameters_define_field_key_gas_mix(void)
Define field key for condensation.
Definition: cs_parameters.c:918
int idften
Definition: cs_parameters.h:65
double xnrmu
Definition: cs_parameters.h:192
const cs_piso_t * cs_glob_piso
double mu_a
Definition: cs_parameters.h:112
int n_it
Definition: cs_parameters.h:97
double l2residual
Definition: cs_parameters.h:101
Definition: cs_parameters.h:136
PISO options descriptor.
Definition: cs_parameters.h:183
structure containing the variable calculation options.
Definition: cs_parameters.h:59
static int cs_parameters_iscavr(cs_field_t *f)
For a given field, returns the scalar number of the fluctuating field if given field is a variance...
Definition: cs_parameters.h:231
#define END_C_DECLS
Definition: cs_defs.h:452
int ibdtso
Definition: cs_parameters.h:68
Definition: cs_parameters.h:139
double relaxv
Definition: cs_parameters.h:89
Definition: cs_parameters.h:134
Space discretisation options descriptor.
Definition: cs_parameters.h:151
int cs_parameters_n_added_properties(void)
Return the number of defined user properties not added yet.
Definition: cs_parameters.c:1073
double lamref
Definition: cs_parameters.h:117
int ircflu
Definition: cs_parameters.h:74
double muref
Definition: cs_parameters.h:116
double rhs_norm
Definition: cs_parameters.h:98
void cs_parameters_define_field_keys(void)
Define general field keys.
Definition: cs_parameters.c:825
Definition: cs_parameters.h:142
int iwgrec
Definition: cs_parameters.h:75
Definition: cs_parameters.h:144
int imvisf
Definition: cs_parameters.h:153
double xnrmu0
Definition: cs_parameters.h:197
double treflam
Definition: cs_parameters.h:119
double derive
Definition: cs_parameters.h:100
cs_var_cal_opt_t cs_parameters_var_cal_opt_default(void)
Return a local variable calculation options structure, with default options.
Definition: cs_parameters.c:1401
double epsrgr
Definition: cs_parameters.h:86
double mu_b
Definition: cs_parameters.h:113
cs_field_t * cs_parameters_add_boundary_temperature(void)
Define a boundary values field for temperature, if applicable.
Definition: cs_parameters.c:1315
double res_norm
Definition: cs_parameters.h:99