8.3
general documentation
cs_domain.h
Go to the documentation of this file.
1#ifndef __CS_DOMAIN_H__
2#define __CS_DOMAIN_H__
3
4/*============================================================================
5 * Manage a computational domain
6 * - equations, settings, fields, connectivities and geometrical quantities
7 *============================================================================*/
8
9/*
10 This file is part of code_saturne, a general-purpose CFD tool.
11
12 Copyright (C) 1998-2024 EDF S.A.
13
14 This program is free software; you can redistribute it and/or modify it under
15 the terms of the GNU General Public License as published by the Free Software
16 Foundation; either version 2 of the License, or (at your option) any later
17 version.
18
19 This program is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
21 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
22 details.
23
24 You should have received a copy of the GNU General Public License along with
25 this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
26 Street, Fifth Floor, Boston, MA 02110-1301, USA.
27*/
28
29/*----------------------------------------------------------------------------
30 * Standard C library headers
31 *----------------------------------------------------------------------------*/
32
33#include <stdbool.h>
34
35/*----------------------------------------------------------------------------
36 * Local headers
37 *----------------------------------------------------------------------------*/
38
39#include "cs_boundary.h"
40#include "cs_cdo_connect.h"
41#include "cs_cdo_quantities.h"
42#include "cs_mesh.h"
43#include "cs_mesh_quantities.h"
44#include "cs_param_cdo.h"
45#include "cs_time_step.h"
46#include "cs_timer.h"
47#include "cs_xdef.h"
48
49/*----------------------------------------------------------------------------*/
50
52
53/*============================================================================
54 * Type definitions
55 *============================================================================*/
56
91typedef enum {
92
99
101
103
104
109typedef struct {
110
111 /* Flag to know if scalar or vector equations are requested and which kind
112 of numerical schemes is requested to solve these equations */
113
121
123
129typedef struct {
130
131 /* Working directory names */
132
133 char *run_id;
136
137 /* code_saturne mesh and mesh quantities structures already computed */
138
141
142 /* CDO structures:
143 * - cs_cdo_connect_t contains additional information about connectivity
144 * - cs_cdo_quantities_t contains additional information on mesh quantities
145 */
146
149
150 /* Boundary of the computational domain */
151
154
155 /* Time step management */
156
158 bool is_last_iter; /* true or false */
159
160 cs_time_step_t *time_step; /* time step descriptor */
161 cs_time_step_options_t *time_options; /* time step options */
162
163 cs_domain_stage_t stage; /* Store the stage of the computation */
164
165 /* Output options */
166
167 int output_nt; /* Logging done every nt iterations */
168 int restart_nt; /* Restart done every nt iterations */
169 int verbosity; /* Level of details given in log */
170
171 /* Specific context structure related to the numerical schemes */
172
174
175 /* Monitoring */
176
177 cs_timer_counter_t tcp; /* Cumulated elapsed time for extra-operations
178 and post-processing */
179 cs_timer_counter_t tca; /* Cumulated elapsed time for all operations */
180
182
183/*============================================================================
184 * Static global variables
185 *============================================================================*/
186
187extern cs_domain_t *cs_glob_domain; /* Pointer to main computational domain */
188
189/*============================================================================
190 * Static inline public function prototypes
191 *============================================================================*/
192
193/*----------------------------------------------------------------------------*/
199/*----------------------------------------------------------------------------*/
200
201static inline void
203{
204 cs_time_step_t *ts = domain->time_step;
205
206 /* Increment the time iteration counter */
207
208 ts->nt_cur++;
209}
210
211/*============================================================================
212 * Public function prototypes
213 *============================================================================*/
214
215/*----------------------------------------------------------------------------*/
221/*----------------------------------------------------------------------------*/
222
224cs_domain_create(void);
225
226/*----------------------------------------------------------------------------*/
232/*----------------------------------------------------------------------------*/
233
234void
235cs_domain_free(cs_domain_t **p_domain);
236
237/*----------------------------------------------------------------------------*/
245/*----------------------------------------------------------------------------*/
246
248
249/*----------------------------------------------------------------------------*/
258/*----------------------------------------------------------------------------*/
259
260int
262
263/*----------------------------------------------------------------------------*/
274/*----------------------------------------------------------------------------*/
275
276void
278 int restart_nt,
279 int log_nt,
280 int verbosity);
281
282/*----------------------------------------------------------------------------*/
289/*----------------------------------------------------------------------------*/
290
291void
293 cs_domain_stage_t stage);
294
295/*----------------------------------------------------------------------------*/
303/*----------------------------------------------------------------------------*/
304
306cs_domain_get_stage(const cs_domain_t *domain);
307
308/*----------------------------------------------------------------------------*/
316/*----------------------------------------------------------------------------*/
317
318bool
320
321/*----------------------------------------------------------------------------*/
329/*----------------------------------------------------------------------------*/
330
331bool
332cs_domain_needs_log(const cs_domain_t *domain);
333
334/*----------------------------------------------------------------------------*/
340/*----------------------------------------------------------------------------*/
341
342void
344
345/*----------------------------------------------------------------------------*/
346
348
349#endif /* __CS_DOMAIN_H__ */
#define BEGIN_C_DECLS
Definition: cs_defs.h:542
#define END_C_DECLS
Definition: cs_defs.h:543
unsigned short int cs_flag_t
Definition: cs_defs.h:344
void cs_domain_free(cs_domain_t **p_domain)
Free a cs_domain_t structure.
Definition: cs_domain.cpp:270
bool cs_domain_needs_log(const cs_domain_t *domain)
Check if an output is requested according to the domain setting.
Definition: cs_domain.cpp:456
void cs_domain_set_output_param(cs_domain_t *domain, int restart_nt, int log_nt, int verbosity)
Set parameters related to the way output/logging is done.
Definition: cs_domain.cpp:352
void cs_domain_set_cdo_mode(cs_domain_t *domain, cs_param_cdo_mode_t mode)
Set the global variable storing the mode of activation to apply to CDO/HHO schemes....
Definition: cs_domain.cpp:314
bool cs_domain_needs_iteration(cs_domain_t *domain)
Check if one needs to continue iterations in time.
Definition: cs_domain.cpp:417
cs_domain_stage_t
Indicator describing at which stage is the computation.
Definition: cs_domain.h:91
@ CS_DOMAIN_STAGE_TIME_STEP_END
Definition: cs_domain.h:97
@ CS_DOMAIN_STAGE_BEFORE_STEADY_COMPUTATION
Definition: cs_domain.h:93
@ CS_DOMAIN_N_STAGES
Definition: cs_domain.h:100
@ CS_DOMAIN_STAGE_TIME_STEP_SUB_ITERATION
Definition: cs_domain.h:96
@ CS_DOMAIN_STAGE_AFTER_TIME_LOOP
Definition: cs_domain.h:98
@ CS_DOMAIN_STAGE_TIME_STEP_BEGIN
Definition: cs_domain.h:95
@ CS_DOMAIN_STAGE_BEFORE_TIME_LOOP
Definition: cs_domain.h:94
void cs_domain_set_stage(cs_domain_t *domain, cs_domain_stage_t stage)
Set the computation stage in the domain structure.
Definition: cs_domain.cpp:376
int cs_domain_get_cdo_mode(const cs_domain_t *domain)
Get the mode of activation for the CDO/HHO schemes. Deprecated way to retrieve the CDO mode.
Definition: cs_domain.cpp:332
void cs_domain_increment_time(cs_domain_t *domain)
Update time step after one temporal iteration.
Definition: cs_domain.cpp:476
cs_domain_stage_t cs_domain_get_stage(const cs_domain_t *domain)
Retrieve the computation stage from the domain structure.
Definition: cs_domain.cpp:397
cs_domain_t * cs_glob_domain
Definition: cs_domain.cpp:89
static void cs_domain_increment_time_step(cs_domain_t *domain)
Update the time step after one temporal iteration.
Definition: cs_domain.h:202
cs_domain_t * cs_domain_create(void)
Create and initialize by default a cs_domain_t structure.
Definition: cs_domain.cpp:172
cs_param_cdo_mode_t
Definition: cs_param_cdo.h:94
Structure storing information related to the "physical" boundaries associated with the computational ...
Definition: cs_boundary.h:155
Definition: cs_cdo_connect.h:61
Definition: cs_cdo_quantities.h:139
High-level metadata for handling CDO/HHO schemes.
Definition: cs_domain.h:109
cs_flag_t hho_scheme_flag
Definition: cs_domain.h:119
cs_flag_t mac_scheme_flag
Definition: cs_domain.h:120
cs_flag_t eb_scheme_flag
Definition: cs_domain.h:114
cs_flag_t vcb_scheme_flag
Definition: cs_domain.h:118
cs_flag_t cb_scheme_flag
Definition: cs_domain.h:116
cs_flag_t fb_scheme_flag
Definition: cs_domain.h:115
cs_flag_t vb_scheme_flag
Definition: cs_domain.h:117
Structure storing the main features of the computational domain and pointers to the main geometrical ...
Definition: cs_domain.h:129
cs_boundary_t * ale_boundaries
Definition: cs_domain.h:153
int verbosity
Definition: cs_domain.h:169
cs_mesh_quantities_t * mesh_quantities
Definition: cs_domain.h:140
cs_time_step_t * time_step
Definition: cs_domain.h:160
char * study_name
Definition: cs_domain.h:135
char * case_name
Definition: cs_domain.h:134
cs_mesh_t * mesh
Definition: cs_domain.h:139
int output_nt
Definition: cs_domain.h:167
cs_timer_counter_t tcp
Definition: cs_domain.h:177
bool only_steady
Definition: cs_domain.h:157
cs_cdo_connect_t * connect
Definition: cs_domain.h:147
char * run_id
Definition: cs_domain.h:133
cs_time_step_options_t * time_options
Definition: cs_domain.h:161
cs_domain_stage_t stage
Definition: cs_domain.h:163
int restart_nt
Definition: cs_domain.h:168
cs_timer_counter_t tca
Definition: cs_domain.h:179
bool is_last_iter
Definition: cs_domain.h:158
cs_domain_cdo_context_t * cdo_context
Definition: cs_domain.h:173
cs_boundary_t * boundaries
Definition: cs_domain.h:152
cs_cdo_quantities_t * cdo_quantities
Definition: cs_domain.h:148
Definition: cs_mesh_quantities.h:92
Definition: cs_mesh.h:85
time step options descriptor
Definition: cs_time_step.h:92
time step descriptor
Definition: cs_time_step.h:64
int nt_cur
Definition: cs_time_step.h:74
Definition: cs_timer.h:55