My Project
programmer's documentation
Loading...
Searching...
No Matches
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-2019 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#include "cs_tree.h"
43
44/*----------------------------------------------------------------------------*/
45
47
48/*=============================================================================
49 * Macro definitions
50 *============================================================================*/
51
52/*============================================================================
53 * Type definitions
54 *============================================================================*/
55
56/*----------------------------------------------------------------------------
57 * Structure of variable calculation options
58 *----------------------------------------------------------------------------*/
59
60typedef struct {
61 int iwarni;
62 int iconv;
63 int istat;
64 int idircl;
65 int ndircl;
66 int idiff;
67 int idifft;
68 int idften;
69 int iswdyn;
70 int ischcv;
71 int ibdtso;
72 int isstpc;
73 int nswrgr;
74 int nswrsm;
75 int imrgra;
76 int imligr;
77 int ircflu;
78 int iwgrec; /* gradient calculation
79 - 0: standard (default)
80 - 1: weighted (could be used with imvisf = 1) */
81 int icoupl; /* internal coupling
82 - -1: not coupled (default)
83 - 1: coupled */
84
85 double thetav;
86 double blencv;
87 double blend_st;
88 double epsilo;
89 double epsrsm;
90 double epsrgr;
91 double climgr;
92 double extrag;
93 double relaxv;
95
96/*----------------------------------------------------------------------------
97 * Structure of the solving info
98 *----------------------------------------------------------------------------*/
99
100typedef struct {
101 int n_it;
102 double rhs_norm;
103 double res_norm;
104 double derive;
107
108/*----------------------------------------------------------------------------
109 * Structure of condensation modelling physical properties
110 *----------------------------------------------------------------------------*/
111
112typedef struct {
113 double mol_mas;
114 double cp;
115 double vol_dif;
116 double mu_a;
117 double mu_b;
118 double lambda_a;
119 double lambda_b;
120 double muref; /* ref. viscosity for Sutherland law */
121 double lamref; /* ref. thermal conductivity for Sutherland law */
122 double trefmu; /* ref. temperature for viscosity in Sutherland law */
123 double treflam; /* ref. temperature for conductivity Sutherland law */
124 double smu; /* Sutherland temperature for viscosity */
125 double slam; /* Sutherland temperature for conductivity */
127
128/*----------------------------------------------------------------------------
129 * Boundary condition types
130 *----------------------------------------------------------------------------*/
131
132enum {
144 CS_COUPLED = 12, /* coupled face */
145 CS_COUPLED_FD = 13, /* coupled face with decentered flux */
150
151/*----------------------------------------------------------------------------
152 * flag for computing the drift mass flux:
153 * (for coal classes for instance, only the first
154 * scalar of a class compute the drift flux of the class
155 * and the other scalars use it without recomputing it)
156 *----------------------------------------------------------------------------*/
157
158enum {
168
169/*----------------------------------------------------------------------------
170 * Space discretisation options descriptor
171 *----------------------------------------------------------------------------*/
172
173typedef struct {
174
175 int imvisf; /* face viscosity field interpolation
176 - 1: harmonic
177 - 0: arithmetic (default) */
178
179 int imrgra; /* type of gradient reconstruction
180 - 0: iterative process
181 - 1: standard least square method
182 - 2: least square method with extended
183 neighborhood
184 - 3: least square method with reduced extended
185 neighborhood
186 - 4: iterative process initialized by the least
187 square method */
188
189 double anomax; /* non orthogonality angle of the faces, in radians.
190 For larger angle values, cells with one node
191 on the wall are kept in the extended support of
192 the neighboring cells. */
193
194 int iflxmw; /* method to compute interior mass flux due to ALE
195 mesh velocity
196 - 1: based on cell center mesh velocity
197 - 0: based on nodes displacement */
198
200
201/*----------------------------------------------------------------------------
202 * PISO descriptor
203 *----------------------------------------------------------------------------*/
204
205typedef struct {
206
207 int nterup; /* number of interations on the pressure-velocity
208 coupling on Navier-Stokes */
209
210 double epsup; /* relative precision for the convergence test of
211 the iterative process on pressure-velocity
212 coupling */
213
214 double xnrmu; /* norm of the increment
215 \f$ \vect{u}^{k+1} - \vect{u}^k \f$
216 of the iterative process on pressure-velocity
217 coupling */
218
219 double xnrmu0; /* norm of \f$ \vect{u}^0 \f$ */
220
221 int n_buoyant_scal; /* number of buoyant scalars,
222 zero if there is no buoyant scalar */
223
224} cs_piso_t;
225
226/*============================================================================
227 * Static global variables
228 *============================================================================*/
229
230/* Pointer to space discretisation options structure */
231
233
234/* Pointer to PISO options structure */
235
236extern const cs_piso_t *cs_glob_piso;
237
238/*============================================================================
239 * Global variables
240 *============================================================================*/
241
244extern cs_tree_node_t *cs_glob_tree;
245
246/*=============================================================================
247 * Public function prototypes
248 *============================================================================*/
249
250/*----------------------------------------------------------------------------*/
261/*----------------------------------------------------------------------------*/
262
263static inline int
265{
266 int iscvr = 0, f_id = 0;
267 int kscavr = cs_field_key_id("first_moment_id");
268 int keysca = cs_field_key_id("scalar_id");
269
270 if (kscavr >= 0) {
271 f_id = cs_field_get_key_int(f, kscavr);
272 if (f_id >= 0)
273 iscvr = cs_field_get_key_int(cs_field_by_id(f_id), keysca);
274 }
275
276 return iscvr;
277}
278
279/*----------------------------------------------------------------------------*/
287/*----------------------------------------------------------------------------*/
288
291
292/*----------------------------------------------------------------------------*/
300/*----------------------------------------------------------------------------*/
301
302cs_piso_t *
303cs_get_glob_piso(void);
304
305/*----------------------------------------------------------------------------
306 *!
307 * \brief Count and set number of buoyant scalars.
308 */
309/*----------------------------------------------------------------------------*/
310
311void
313
314/*----------------------------------------------------------------------------*/
321/*----------------------------------------------------------------------------*/
322
323void
325
326/*----------------------------------------------------------------------------*/
332/*----------------------------------------------------------------------------*/
333
334void
336
337/*----------------------------------------------------------------------------*/
343/*----------------------------------------------------------------------------*/
344
345void
347
348/*----------------------------------------------------------------------------*/
357/*----------------------------------------------------------------------------*/
358
359void
360cs_parameters_add_variable(const char *name,
361 int dim);
362
363/*----------------------------------------------------------------------------*/
372/*----------------------------------------------------------------------------*/
373
374void
376 const char *variable_name);
377
378/*----------------------------------------------------------------------------*/
386/*----------------------------------------------------------------------------*/
387
388void
389cs_parameters_add_property(const char *name,
390 int dim,
391 int location_id);
392
393/*----------------------------------------------------------------------------*/
402/*----------------------------------------------------------------------------*/
403
404int
406
407/*----------------------------------------------------------------------------*/
416/*----------------------------------------------------------------------------*/
417
418int
420
421/*----------------------------------------------------------------------------*/
425/*----------------------------------------------------------------------------*/
426
427void
429
430/*----------------------------------------------------------------------------*/
434/*----------------------------------------------------------------------------*/
435
436void
438
439/*----------------------------------------------------------------------------*/
447/*----------------------------------------------------------------------------*/
448
451
452/*----------------------------------------------------------------------------*/
463/*----------------------------------------------------------------------------*/
464
467
468/*----------------------------------------------------------------------------*/
475/*----------------------------------------------------------------------------*/
476
479
480/*----------------------------------------------------------------------------*/
484/*----------------------------------------------------------------------------*/
485
486void
488
489/*----------------------------------------------------------------------------*/
490
492
493#endif /* __CS_PARAMETERS_H__ */
#define BEGIN_C_DECLS
Definition cs_defs.h:467
#define END_C_DECLS
Definition cs_defs.h:468
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:2976
cs_field_t * cs_field_by_id(int id)
Return a pointer to a field based on its id.
Definition cs_field.c:2307
int cs_field_key_id(const char *name)
Return an id associated with a given key name.
Definition cs_field.c:2490
void cs_parameters_read_restart_info(void)
Read general restart info.
Definition cs_parameters.c:1060
void cs_parameters_create_added_properties(void)
Create previously added user properties.
Definition cs_parameters.c:1296
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:1537
int cs_parameters_n_added_properties(void)
Return the number of defined user properties not added yet.
Definition cs_parameters.c:1209
const cs_piso_t * cs_glob_piso
void cs_parameters_add_variable(const char *name, int dim)
Solved variables are always defined on cells.
Definition cs_parameters.c:1082
void cs_parameters_add_property(const char *name, int dim, int location_id)
Define a user property.
Definition cs_parameters.c:1160
cs_field_t * cs_parameters_add_boundary_temperature(void)
Define a boundary values field for temperature, if applicable.
Definition cs_parameters.c:1451
void cs_parameters_create_added_variables(void)
Create previously added user variables.
Definition cs_parameters.c:1221
void cs_space_disc_log_setup(void)
Print the space discretization structure to setup.log.
Definition cs_parameters.c:1549
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:1123
cs_piso_t * cs_get_glob_piso(void)
Provide acces to cs_glob_piso.
Definition cs_parameters.c:878
@ CS_DRIFT_SCALAR_ON
Definition cs_parameters.h:159
@ CS_DRIFT_SCALAR_THERMOPHORESIS
Definition cs_parameters.h:161
@ CS_DRIFT_SCALAR_IMPOSED_MASS_FLUX
Definition cs_parameters.h:165
@ CS_DRIFT_SCALAR_ADD_DRIFT_FLUX
Definition cs_parameters.h:160
@ CS_DRIFT_SCALAR_TURBOPHORESIS
Definition cs_parameters.h:162
@ CS_DRIFT_SCALAR_CENTRIFUGALFORCE
Definition cs_parameters.h:164
@ CS_DRIFT_SCALAR_ELECTROPHORESIS
Definition cs_parameters.h:163
@ CS_DRIFT_SCALAR_ZERO_BNDY_FLUX
Definition cs_parameters.h:166
int cs_parameters_n_added_variables(void)
Return the number of defined user variables not added yet.
Definition cs_parameters.c:1195
void cs_parameters_define_field_keys(void)
Define general field keys.
Definition cs_parameters.c:917
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:264
const cs_space_disc_t * cs_glob_space_disc
void cs_parameters_set_n_buoyant_scalars(void)
Definition cs_parameters.c:890
cs_space_disc_t * cs_get_glob_space_disc(void)
Provide access to cs_glob_space_disc.
Definition cs_parameters.c:862
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:1346
@ CS_OUTLET
Definition cs_parameters.h:135
@ CS_COUPLED_FD
Definition cs_parameters.h:145
@ CS_EPHCF
Definition cs_parameters.h:142
@ CS_INLET
Definition cs_parameters.h:134
@ CS_COUPLED
Definition cs_parameters.h:144
@ CS_ESICF
Definition cs_parameters.h:139
@ CS_INDEF
Definition cs_parameters.h:133
@ CS_CONVECTIVE_INLET
Definition cs_parameters.h:148
@ CS_ROUGHWALL
Definition cs_parameters.h:138
@ CS_SOPCF
Definition cs_parameters.h:141
@ CS_SSPCF
Definition cs_parameters.h:140
@ CS_FREE_INLET
Definition cs_parameters.h:146
@ CS_EQHCF
Definition cs_parameters.h:143
@ CS_SMOOTHWALL
Definition cs_parameters.h:137
@ CS_SYMMETRY
Definition cs_parameters.h:136
@ CS_FREE_SURFACE
Definition cs_parameters.h:147
cs_tree_node_t * cs_glob_tree
void cs_parameters_define_field_key_gas_mix(void)
Define field key for condensation.
Definition cs_parameters.c:1039
Field descriptor.
Definition cs_field.h:124
Definition cs_parameters.h:112
double muref
Definition cs_parameters.h:120
double vol_dif
Definition cs_parameters.h:115
double lambda_a
Definition cs_parameters.h:118
double smu
Definition cs_parameters.h:124
double lamref
Definition cs_parameters.h:121
double trefmu
Definition cs_parameters.h:122
double mol_mas
Definition cs_parameters.h:113
double mu_b
Definition cs_parameters.h:117
double cp
Definition cs_parameters.h:114
double treflam
Definition cs_parameters.h:123
double lambda_b
Definition cs_parameters.h:119
double mu_a
Definition cs_parameters.h:116
double slam
Definition cs_parameters.h:125
PISO options descriptor.
Definition cs_parameters.h:205
double xnrmu
Definition cs_parameters.h:214
int nterup
Definition cs_parameters.h:207
double xnrmu0
Definition cs_parameters.h:219
int n_buoyant_scal
Definition cs_parameters.h:221
double epsup
Definition cs_parameters.h:210
Definition cs_parameters.h:100
int n_it
Definition cs_parameters.h:101
double rhs_norm
Definition cs_parameters.h:102
double res_norm
Definition cs_parameters.h:103
double derive
Definition cs_parameters.h:104
double l2residual
Definition cs_parameters.h:105
Space discretisation options descriptor.
Definition cs_parameters.h:173
int iflxmw
Definition cs_parameters.h:194
double anomax
Definition cs_parameters.h:189
int imrgra
Definition cs_parameters.h:179
int imvisf
Definition cs_parameters.h:175
structure containing the variable calculation options.
Definition cs_parameters.h:60
double extrag
Definition cs_parameters.h:92
int istat
Definition cs_parameters.h:63
int imligr
Definition cs_parameters.h:76
int ndircl
Definition cs_parameters.h:65
int iwarni
Definition cs_parameters.h:61
double blencv
Definition cs_parameters.h:86
int isstpc
Definition cs_parameters.h:72
int ibdtso
Definition cs_parameters.h:71
int nswrsm
Definition cs_parameters.h:74
int idften
Definition cs_parameters.h:68
double epsrsm
Definition cs_parameters.h:89
int idiff
Definition cs_parameters.h:66
double relaxv
Definition cs_parameters.h:93
int idifft
Definition cs_parameters.h:67
double thetav
Definition cs_parameters.h:85
int imrgra
Definition cs_parameters.h:75
int iswdyn
Definition cs_parameters.h:69
int idircl
Definition cs_parameters.h:64
double epsilo
Definition cs_parameters.h:88
int nswrgr
Definition cs_parameters.h:73
double epsrgr
Definition cs_parameters.h:90
double climgr
Definition cs_parameters.h:91
int icoupl
Definition cs_parameters.h:81
int iwgrec
Definition cs_parameters.h:78
int ischcv
Definition cs_parameters.h:70
int ircflu
Definition cs_parameters.h:77
int iconv
Definition cs_parameters.h:62
double blend_st
Definition cs_parameters.h:87