7.1
general 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-2021 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_equation_param.h"
42 #include "cs_field.h"
43 #include "cs_tree.h"
44 
45 /*----------------------------------------------------------------------------*/
46 
48 
49 /*=============================================================================
50  * Macro definitions
51  *============================================================================*/
52 
53 /*============================================================================
54  * Type definitions
55  *============================================================================*/
56 
57 /*----------------------------------------------------------------------------
58  * Structure of variable calculation options
59  * (now an alias of cs_equation_param_t)
60  *----------------------------------------------------------------------------*/
61 
63 
64 /*----------------------------------------------------------------------------
65  * Structure of the solving info
66  *----------------------------------------------------------------------------*/
67 
68 typedef struct {
69  int n_it;
70  double rhs_norm;
71  double res_norm;
72  double derive;
73  double l2residual;
75 
76 /*----------------------------------------------------------------------------
77  * Boundary condition types
78  *----------------------------------------------------------------------------*/
79 
80 enum {
81  CS_INDEF = 1,
82  CS_INLET = 2,
83  CS_OUTLET = 3,
87  CS_ESICF = 7,
88  CS_SSPCF = 8,
89  CS_SOPCF = 9,
90  CS_EPHCF = 10,
91  CS_EQHCF = 11,
92  CS_COUPLED = 12, /* coupled face */
93  CS_COUPLED_FD = 13, /* coupled face with decentered flux */
97 };
98 
99 /*----------------------------------------------------------------------------
100  * flag for computing the drift mass flux:
101  * (for coal classes for instance, only the first
102  * scalar of a class compute the drift flux of the class
103  * and the other scalars use it without recomputing it)
104  *----------------------------------------------------------------------------*/
105 
106 enum {
107  CS_DRIFT_SCALAR_ON = (1 << 0),
116 };
117 
118 /*----------------------------------------------------------------------------
119  * Space discretisation options descriptor
120  *----------------------------------------------------------------------------*/
121 
122 typedef struct {
123 
124  int imvisf; /* face viscosity field interpolation
125  - 1: harmonic
126  - 0: arithmetic (default) */
127 
128  int imrgra; /* type of gradient reconstruction
129  - 0: iterative process
130  - 1: standard least square method
131  - 2: least square method with extended
132  neighborhood
133  - 3: least square method with reduced extended
134  neighborhood
135  - 4: Green-Gauss using least squares face
136  values interpolation */
137 
138  int iflxmw; /* method to compute interior mass flux due to ALE
139  mesh velocity
140  - 1: based on cell center mesh velocity
141  - 0: based on nodes displacement */
142 
143  int itbrrb; /* accurate treatment of the wall temperature
144  - 1: true
145  - 0: false (default) */
146 
148 
149 /*----------------------------------------------------------------------------
150  * Time scheme descriptor
151  *----------------------------------------------------------------------------*/
152 
153 typedef struct {
154 
155  int time_order; /* Global time order of the time stepping */
156 
157  int isto2t; /* time scheme activated for the source
158  terms of turbulent equations */
159 
160  double thetst; /* value of \f$theta\f$ for turbulence */
161 
162  int iccvfg; /* calculation with a fixed velocity field
163  - 1: true (default)
164  - 0: false */
166 
167 /*----------------------------------------------------------------------------
168  * Auxiliary checkpoint/restart file parameters
169  *----------------------------------------------------------------------------*/
170 
171 typedef struct {
172 
173  int read_auxiliary; /* Activate reading of auxiliary restart file */
174  int write_auxiliary; /* Activate output of auxiliary restart file */
175 
177 
178 /*============================================================================
179  * Static global variables
180  *============================================================================*/
181 
182 /* Pointer to space discretisation options structure */
183 
184 extern const cs_space_disc_t *cs_glob_space_disc;
185 
186 /* Pointer to time scheme options structure */
187 
189 
190 /* Pointer to auxiliary checkpoint/restart file parameters */
191 
193 
194 /*============================================================================
195  * Global variables
196  *============================================================================*/
197 
200 extern cs_tree_node_t *cs_glob_tree;
201 
202 /*=============================================================================
203  * Public function prototypes
204  *============================================================================*/
205 
206 /*----------------------------------------------------------------------------*/
217 /*----------------------------------------------------------------------------*/
218 
219 static inline int
220 cs_parameters_iscavr(cs_field_t *f)
221 {
222  int iscvr = 0, f_id = 0;
223  int kscavr = cs_field_key_id("first_moment_id");
224  int keysca = cs_field_key_id("scalar_id");
225 
226  if (kscavr >= 0) {
227  f_id = cs_field_get_key_int(f, kscavr);
228  if (f_id >= 0)
229  iscvr = cs_field_get_key_int(cs_field_by_id(f_id), keysca);
230  }
231 
232  return iscvr;
233 }
234 
235 /*----------------------------------------------------------------------------*/
243 /*----------------------------------------------------------------------------*/
244 
247 
248 /*----------------------------------------------------------------------------*/
256 /*----------------------------------------------------------------------------*/
257 
260 
261 /*----------------------------------------------------------------------------*/
268 /*----------------------------------------------------------------------------*/
269 
270 void
272 
273 /*----------------------------------------------------------------------------*/
279 /*----------------------------------------------------------------------------*/
280 
281 void
283 
284 /*----------------------------------------------------------------------------*/
293 /*----------------------------------------------------------------------------*/
294 
295 void
296 cs_parameters_add_variable(const char *name,
297  int dim);
298 
299 /*----------------------------------------------------------------------------*/
308 /*----------------------------------------------------------------------------*/
309 
310 void
311 cs_parameters_add_variable_variance(const char *name,
312  const char *variable_name);
313 
314 /*----------------------------------------------------------------------------*/
322 /*----------------------------------------------------------------------------*/
323 
324 void
325 cs_parameters_add_property(const char *name,
326  int dim,
327  int location_id);
328 
329 /*----------------------------------------------------------------------------*/
338 /*----------------------------------------------------------------------------*/
339 
340 int
342 
343 /*----------------------------------------------------------------------------*/
352 /*----------------------------------------------------------------------------*/
353 
354 int
356 
357 /*----------------------------------------------------------------------------*/
361 /*----------------------------------------------------------------------------*/
362 
363 void
365 
366 /*----------------------------------------------------------------------------*/
370 /*----------------------------------------------------------------------------*/
371 
372 void
374 
375 /*----------------------------------------------------------------------------*/
383 /*----------------------------------------------------------------------------*/
384 
385 cs_field_t *
387 
388 /*----------------------------------------------------------------------------*/
399 /*----------------------------------------------------------------------------*/
400 
401 cs_field_t *
403 
404 /*----------------------------------------------------------------------------*/
408 /*----------------------------------------------------------------------------*/
409 
410 void
412 
413 /*----------------------------------------------------------------------------*/
417 /*----------------------------------------------------------------------------*/
418 
419 void
421 
422 /*----------------------------------------------------------------------------*/
429 /*----------------------------------------------------------------------------*/
430 
433 
434 /*----------------------------------------------------------------------------*/
438 /*----------------------------------------------------------------------------*/
439 
440 void
442 
443 /*----------------------------------------------------------------------------*/
447 /*----------------------------------------------------------------------------*/
448 
449 void
451 
452 /*----------------------------------------------------------------------------*/
453 
455 
456 #endif /* __CS_PARAMETERS_H__ */
Definition: cs_parameters.h:107
void cs_parameters_eqp_complete(void)
Complete general equation parameter definitions.
Definition: cs_parameters.c:1491
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:1303
Definition: cs_parameters.h:114
Definition: cs_parameters.h:68
Definition: cs_parameters.h:108
int read_auxiliary
Definition: cs_parameters.h:173
double thetst
Definition: cs_parameters.h:160
int imrgra
Definition: cs_parameters.h:128
const cs_space_disc_t * cs_glob_space_disc
Definition: cs_parameters.h:112
Definition: cs_parameters.h:84
void cs_parameters_create_added_variables(void)
Create previously added user variables.
Definition: cs_parameters.c:1178
Definition: cs_parameters.h:115
int iflxmw
Definition: cs_parameters.h:138
Field descriptor.
Definition: cs_field.h:125
Set of parameters to handle an unsteady convection-diffusion-reaction equation with term sources...
Definition: cs_equation_param.h:177
Definition: cs_parameters.h:96
cs_field_t * cs_field_by_id(int id)
Return a pointer to a field based on its id.
Definition: cs_field.c:2314
cs_time_scheme_t * cs_get_glob_time_scheme(void)
Provide access to cs_glob_time_scheme.
Definition: cs_parameters.c:863
void cs_parameters_add_variable(const char *name, int dim)
Solved variables are always defined on cells.
Definition: cs_parameters.c:1039
void cs_parameters_read_restart_info(void)
Read general restart info.
Definition: cs_parameters.c:1017
#define BEGIN_C_DECLS
Definition: cs_defs.h:510
void cs_space_disc_log_setup(void)
Print the space discretization structure to setup.log.
Definition: cs_parameters.c:1606
cs_tree_node_t * cs_glob_tree
Definition: cs_parameters.h:111
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:1080
cs_restart_auxiliary_t * cs_glob_restart_auxiliary
Definition: cs_parameters.h:86
void cs_parameters_add_property(const char *name, int dim, int location_id)
Define a user property.
Definition: cs_parameters.c:1117
Additional checkpoint/restart files.
Definition: cs_parameters.h:171
Definition: cs_parameters.h:95
int time_order
Definition: cs_parameters.h:155
cs_space_disc_t * cs_get_glob_space_disc(void)
Provide access to cs_glob_space_disc.
Definition: cs_parameters.c:847
Definition: cs_parameters.h:110
void cs_parameters_create_added_properties(void)
Create previously added user properties.
Definition: cs_parameters.c:1253
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:2991
Definition: cs_parameters.h:81
int cs_field_key_id(const char *name)
Return an id associated with a given key name.
Definition: cs_field.c:2497
Definition: cs_parameters.h:82
int iccvfg
Definition: cs_parameters.h:162
int itbrrb
Definition: cs_parameters.h:143
Definition: cs_parameters.h:94
Definition: cs_parameters.h:113
int cs_parameters_n_added_variables(void)
Return the number of defined user variables not added yet.
Definition: cs_parameters.c:1152
Time scheme descriptor.
Definition: cs_parameters.h:153
Definition: cs_parameters.h:85
int n_it
Definition: cs_parameters.h:69
cs_equation_param_t cs_var_cal_opt_t
Definition: cs_parameters.h:62
const cs_time_scheme_t * cs_glob_time_scheme
double l2residual
Definition: cs_parameters.h:73
Definition: cs_parameters.h:109
void cs_time_scheme_log_setup(void)
Print the time scheme structure to setup.log.
Definition: cs_parameters.c:1580
Definition: cs_parameters.h:88
#define END_C_DECLS
Definition: cs_defs.h:511
Space discretisation options descriptor.
Definition: cs_parameters.h:122
Definition: cs_parameters.h:93
int cs_parameters_n_added_properties(void)
Return the number of defined user properties not added yet.
Definition: cs_parameters.c:1166
int isto2t
Definition: cs_parameters.h:157
Definition: cs_parameters.h:89
Definition: cs_parameters.h:90
double rhs_norm
Definition: cs_parameters.h:70
void cs_parameters_define_field_keys(void)
Define general field keys.
Definition: cs_parameters.c:878
Definition: cs_parameters.h:91
int write_auxiliary
Definition: cs_parameters.h:174
Definition: cs_parameters.h:92
Definition: cs_parameters.h:83
int imvisf
Definition: cs_parameters.h:124
double derive
Definition: cs_parameters.h:72
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:1568
void cs_parameters_output_complete(void)
Complete general output options definitions.
Definition: cs_parameters.c:1518
cs_field_t * cs_parameters_add_boundary_temperature(void)
Define a boundary values field for temperature, if applicable.
Definition: cs_parameters.c:1408
double res_norm
Definition: cs_parameters.h:71