9.2
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-2026 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 * Local headers
31 *----------------------------------------------------------------------------*/
32
33#include "base/cs_boundary.h"
35#include "base/cs_time_step.h"
36#include "base/cs_timer.h"
37#include "cdo/cs_cdo_connect.h"
39#include "cdo/cs_param_cdo.h"
40#include "cdo/cs_xdef.h"
41#include "mesh/cs_mesh.h"
43
44/*============================================================================
45 * Type definitions
46 *============================================================================*/
47
82typedef enum {
83
90
92
94
95
100typedef struct {
101
102 /* Flag to know if scalar or vector equations are requested and which kind
103 of numerical schemes is requested to solve these equations */
104
112
114
120typedef struct {
121
122 /* Working directory names */
123
124 char *run_id;
127
128 /* code_saturne mesh and mesh quantities structures already computed */
129
132
133 /* CDO structures:
134 * - cs_cdo_connect_t contains additional information about connectivities
135 * - cs_cdo_quantities_t contains additional information on mesh quantities
136 */
137
140
141 /* Boundary of the computational domain */
142
145
146 /* Time step management */
147
149 bool is_last_iter; /* true or false */
150
151 cs_time_step_t *time_step; /* time step descriptor */
153
154 cs_domain_stage_t stage; /* Store the stage of the computation */
155
156 /* Extra_operations */
157
159
160 /* Output options */
161
162 int output_nt; /* Logging done every nt iterations */
163 int restart_nt; /* Restart done every nt iterations */
164 int verbosity; /* Level of details given in log */
165
166 /* Specific context structure related to the numerical schemes */
167
169
170 /* Monitoring */
171
172 cs_timer_counter_t tcp; /* Cumulated elapsed time for extra-operations
173 and post-processing */
174 cs_timer_counter_t tca; /* Cumulated elapsed time for all operations */
175
177
178/*============================================================================
179 * Static global variables
180 *============================================================================*/
181
182extern cs_domain_t *cs_glob_domain; /* Pointer to main computational domain */
183
184/*============================================================================
185 * Static inline public function prototypes
186 *============================================================================*/
187
188/*----------------------------------------------------------------------------*/
194/*----------------------------------------------------------------------------*/
195
196static inline void
198{
199 cs_time_step_t *ts = domain->time_step;
200
201 /* Increment the time iteration counter */
202
203 ts->nt_cur++;
204}
205
206/*============================================================================
207 * Public function prototypes
208 *============================================================================*/
209
210/*----------------------------------------------------------------------------*/
216/*----------------------------------------------------------------------------*/
217
219cs_domain_create(void);
220
221/*----------------------------------------------------------------------------*/
227/*----------------------------------------------------------------------------*/
228
229void
230cs_domain_free(cs_domain_t **p_domain);
231
232/*----------------------------------------------------------------------------*/
240/*----------------------------------------------------------------------------*/
241
242[[deprecated]] void
244
245/*----------------------------------------------------------------------------*/
254/*----------------------------------------------------------------------------*/
255
256int
258
259/*----------------------------------------------------------------------------*/
270/*----------------------------------------------------------------------------*/
271
272void
274 int restart_nt,
275 int log_nt,
276 int verbosity);
277
278/*----------------------------------------------------------------------------*/
285/*----------------------------------------------------------------------------*/
286
287void
289 cs_domain_stage_t stage);
290
291/*----------------------------------------------------------------------------*/
299/*----------------------------------------------------------------------------*/
300
302cs_domain_get_stage(const cs_domain_t *domain);
303
304/*----------------------------------------------------------------------------*/
312/*----------------------------------------------------------------------------*/
313
314bool
316
317/*----------------------------------------------------------------------------*/
325/*----------------------------------------------------------------------------*/
326
327bool
328cs_domain_needs_log(const cs_domain_t *domain);
329
330/*----------------------------------------------------------------------------*/
338/*----------------------------------------------------------------------------*/
339
340bool
342
343/*----------------------------------------------------------------------------*/
349/*----------------------------------------------------------------------------*/
350
351void
353
354/*----------------------------------------------------------------------------*/
355
356#endif /* CS_DOMAIN_H */
Definition: cs_time_control.h:92
time step descriptor
Definition: cs_time_step.h:60
int nt_cur
Definition: cs_time_step.h:72
unsigned short int cs_flag_t
Definition: cs_defs.h:334
void cs_domain_free(cs_domain_t **p_domain)
Free a cs_domain_t structure.
Definition: cs_domain.cpp:260
bool cs_domain_needs_extra_op(cs_domain_t *domain)
Check if one has to perform extra-operations.
Definition: cs_domain.cpp:468
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:446
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:344
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:306
bool cs_domain_needs_iteration(cs_domain_t *domain)
Check if one needs to continue iterations in time.
Definition: cs_domain.cpp:409
cs_domain_stage_t
Indicator describing at which stage is the computation.
Definition: cs_domain.h:82
@ CS_DOMAIN_STAGE_TIME_STEP_END
Definition: cs_domain.h:88
@ CS_DOMAIN_STAGE_BEFORE_STEADY_COMPUTATION
Definition: cs_domain.h:84
@ CS_DOMAIN_N_STAGES
Definition: cs_domain.h:91
@ CS_DOMAIN_STAGE_TIME_STEP_SUB_ITERATION
Definition: cs_domain.h:87
@ CS_DOMAIN_STAGE_AFTER_TIME_LOOP
Definition: cs_domain.h:89
@ CS_DOMAIN_STAGE_TIME_STEP_BEGIN
Definition: cs_domain.h:86
@ CS_DOMAIN_STAGE_BEFORE_TIME_LOOP
Definition: cs_domain.h:85
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:368
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:324
void cs_domain_increment_time(cs_domain_t *domain)
Update time step after one temporal iteration.
Definition: cs_domain.cpp:495
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:389
cs_domain_t * cs_glob_domain
Definition: cs_domain.cpp:79
static void cs_domain_increment_time_step(cs_domain_t *domain)
Update the time step after one temporal iteration.
Definition: cs_domain.h:197
cs_domain_t * cs_domain_create(void)
Create and initialize by default a cs_domain_t structure.
Definition: cs_domain.cpp:162
cs_param_cdo_mode_t
Definition: cs_param_cdo.h:90
Structure storing information related to the "physical" boundaries associated with the computational ...
Definition: cs_boundary.h:154
Definition: cs_cdo_connect.h:57
Definition: cs_cdo_quantities.h:142
High-level metadata for handling CDO/HHO schemes.
Definition: cs_domain.h:100
cs_flag_t hho_scheme_flag
Definition: cs_domain.h:110
cs_flag_t mac_scheme_flag
Definition: cs_domain.h:111
cs_flag_t eb_scheme_flag
Definition: cs_domain.h:105
cs_flag_t vcb_scheme_flag
Definition: cs_domain.h:109
cs_flag_t cb_scheme_flag
Definition: cs_domain.h:107
cs_flag_t fb_scheme_flag
Definition: cs_domain.h:106
cs_flag_t vb_scheme_flag
Definition: cs_domain.h:108
Structure storing the main features of the computational domain and pointers to the main geometrical ...
Definition: cs_domain.h:120
cs_boundary_t * ale_boundaries
Definition: cs_domain.h:144
int verbosity
Definition: cs_domain.h:164
cs_time_step_options_t * time_step_options
Definition: cs_domain.h:152
cs_mesh_quantities_t * mesh_quantities
Definition: cs_domain.h:131
cs_time_step_t * time_step
Definition: cs_domain.h:151
char * study_name
Definition: cs_domain.h:126
char * case_name
Definition: cs_domain.h:125
cs_mesh_t * mesh
Definition: cs_domain.h:130
int output_nt
Definition: cs_domain.h:162
cs_timer_counter_t tcp
Definition: cs_domain.h:172
bool only_steady
Definition: cs_domain.h:148
cs_time_control_t * extra_op_time_control
Definition: cs_domain.h:158
cs_cdo_connect_t * connect
Definition: cs_domain.h:138
char * run_id
Definition: cs_domain.h:124
cs_domain_stage_t stage
Definition: cs_domain.h:154
int restart_nt
Definition: cs_domain.h:163
cs_timer_counter_t tca
Definition: cs_domain.h:174
bool is_last_iter
Definition: cs_domain.h:149
cs_domain_cdo_context_t * cdo_context
Definition: cs_domain.h:168
cs_boundary_t * boundaries
Definition: cs_domain.h:143
cs_cdo_quantities_t * cdo_quantities
Definition: cs_domain.h:139
Definition: cs_mesh_quantities.h:88
Definition: cs_mesh.h:85
time step options descriptor
Definition: cs_time_step.h:95
Definition: cs_timer.h:51