8.0
general documentation
Loading...
Searching...
No Matches
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-2023 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_time_step.h"
45#include "cs_timer.h"
46#include "cs_xdef.h"
47
48/*----------------------------------------------------------------------------*/
49
51
52/*============================================================================
53 * Macro definitions
54 *============================================================================*/
55
56/* Flag related to the activation (or not) of the CDO/HHO schemes.
57 * Deprecated way to activate CDO/HHO schemes. */
58
59#define CS_DOMAIN_CDO_MODE_OFF -1 /* CDO schemes are not used */
60#define CS_DOMAIN_CDO_MODE_WITH_FV 1 /* CDO and legacy FV schemes are used */
61#define CS_DOMAIN_CDO_MODE_ONLY 2 /* CDO schemes are exclusively used */
62
63/*============================================================================
64 * Type definitions
65 *============================================================================*/
66
100
113
114
118
119typedef struct {
120
121 /* Flag to know if scalar or vector equations are requested and which kind
122 of numerical schemes is requested to solve these equations */
123
130
132
137
138typedef struct {
139
140 /* Working directory names */
141
142 char *run_id;
145
146 /* code_saturne mesh and mesh quantities structures already computed */
147
150
151 /* CDO structures:
152 * - cs_cdo_connect_t contains additional information about connectivity
153 * - cs_cdo_quantities_t contains additional information on mesh quantities
154 */
155
158
159 /* Boundary of the computational domain */
160
163
164 /* Time step management */
165
167 bool is_last_iter; /* true or false */
168
169 cs_time_step_t *time_step; /* time step descriptor */
170 cs_time_step_options_t time_options; /* time step options */
171
172 cs_domain_stage_t stage; /* Store the stage of the computation */
173
174 /* Output options */
175
176 int output_nt; /* Logging done every nt iterations */
177 int restart_nt; /* Restart done every nt iterations */
178 int verbosity; /* Level of details given in log */
179
180 /* Specific context structure related to the numerical schemes */
181
183
184 /* Monitoring */
185
186 cs_timer_counter_t tcp; /* Cumulated elapsed time for extra-operations
187 and post-processing */
188 cs_timer_counter_t tca; /* Cumulated elapsed time for all operations */
189
191
192/*============================================================================
193 * Static global variables
194 *============================================================================*/
195
196extern cs_domain_t *cs_glob_domain; /* Pointer to main computational domain */
197
198/*============================================================================
199 * Static inline public function prototypes
200 *============================================================================*/
201
202/*----------------------------------------------------------------------------*/
208/*----------------------------------------------------------------------------*/
209
210static inline void
212{
213 cs_time_step_t *ts = domain->time_step;
214
215 /* Increment the time iteration counter */
216
217 ts->nt_cur++;
218}
219
220/*============================================================================
221 * Public function prototypes
222 *============================================================================*/
223
224/*----------------------------------------------------------------------------*/
230/*----------------------------------------------------------------------------*/
231
233cs_domain_create(void);
234
235/*----------------------------------------------------------------------------*/
241/*----------------------------------------------------------------------------*/
242
243void
244cs_domain_free(cs_domain_t **p_domain);
245
246/*----------------------------------------------------------------------------*/
254/*----------------------------------------------------------------------------*/
255
256void
258 int mode);
259
260/*----------------------------------------------------------------------------*/
269/*----------------------------------------------------------------------------*/
270
271int
273
274/*----------------------------------------------------------------------------*/
281/*----------------------------------------------------------------------------*/
282
283void
285 cs_domain_stage_t stage);
286
287/*----------------------------------------------------------------------------*/
295/*----------------------------------------------------------------------------*/
296
298cs_domain_get_stage(const cs_domain_t *domain);
299
300/*----------------------------------------------------------------------------*/
308/*----------------------------------------------------------------------------*/
309
310bool
312
313/*----------------------------------------------------------------------------*/
322/*----------------------------------------------------------------------------*/
323
324bool
325cs_domain_needs_log(const cs_domain_t *domain,
326 bool oneplus);
327
328/*----------------------------------------------------------------------------*/
334/*----------------------------------------------------------------------------*/
335
336void
338
339/*----------------------------------------------------------------------------*/
340
342
343#endif /* __CS_DOMAIN_H__ */
#define BEGIN_C_DECLS
Definition cs_defs.h:509
#define END_C_DECLS
Definition cs_defs.h:510
unsigned short int cs_flag_t
Definition cs_defs.h:321
cs_domain_t * cs_glob_domain
Definition cs_domain.c:88
void cs_domain_free(cs_domain_t **p_domain)
Free a cs_domain_t structure.
Definition cs_domain.c:276
bool cs_domain_needs_log(const cs_domain_t *domain, bool oneplus)
Check if an output is requested according to the domain setting.
Definition cs_domain.c:436
void cs_domain_set_cdo_mode(cs_domain_t *domain, int mode)
Set the global variable storing the mode of activation to apply to CDO/HHO schemes....
Definition cs_domain.c:320
bool cs_domain_needs_iteration(cs_domain_t *domain)
Check if one needs to continue iterations in time.
Definition cs_domain.c:396
cs_domain_stage_t
Indicator describing at which stage is the computation.
Definition cs_domain.h:101
@ CS_DOMAIN_STAGE_AFTER_TIME_LOOP
Definition cs_domain.h:108
@ CS_DOMAIN_STAGE_TIME_STEP_END
Definition cs_domain.h:107
@ CS_DOMAIN_STAGE_BEFORE_TIME_LOOP
Definition cs_domain.h:104
@ CS_DOMAIN_STAGE_TIME_STEP_SUB_ITERATION
Definition cs_domain.h:106
@ CS_DOMAIN_STAGE_TIME_STEP_BEGIN
Definition cs_domain.h:105
@ CS_DOMAIN_STAGE_BEFORE_STEADY_COMPUTATION
Definition cs_domain.h:103
@ CS_DOMAIN_N_STAGES
Definition cs_domain.h:110
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.c:355
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.c:339
void cs_domain_increment_time(cs_domain_t *domain)
Update time step after one temporal iteration.
Definition cs_domain.c:477
cs_domain_stage_t cs_domain_get_stage(const cs_domain_t *domain)
Retrieve the computation stage from the domain structure.
Definition cs_domain.c:376
static void cs_domain_increment_time_step(cs_domain_t *domain)
Update the time step after one temporal iteration.
Definition cs_domain.h:211
cs_domain_t * cs_domain_create(void)
Create and initialize by default a cs_domain_t structure.
Definition cs_domain.c:170
Definition mesh.f90:26
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:137
High-level metadata for handling CDO/HHO schemes.
Definition cs_domain.h:119
cs_flag_t hho_scheme_flag
Definition cs_domain.h:129
cs_flag_t eb_scheme_flag
Definition cs_domain.h:124
cs_flag_t vcb_scheme_flag
Definition cs_domain.h:128
cs_flag_t cb_scheme_flag
Definition cs_domain.h:126
cs_flag_t fb_scheme_flag
Definition cs_domain.h:125
cs_flag_t vb_scheme_flag
Definition cs_domain.h:127
Structure storing the main features of the computational domain and pointers to the main geometrical ...
Definition cs_domain.h:138
cs_boundary_t * ale_boundaries
Definition cs_domain.h:162
int verbosity
Definition cs_domain.h:178
cs_mesh_quantities_t * mesh_quantities
Definition cs_domain.h:149
cs_time_step_t * time_step
Definition cs_domain.h:169
char * study_name
Definition cs_domain.h:144
char * case_name
Definition cs_domain.h:143
int output_nt
Definition cs_domain.h:176
cs_timer_counter_t tcp
Definition cs_domain.h:186
bool only_steady
Definition cs_domain.h:166
cs_cdo_connect_t * connect
Definition cs_domain.h:156
char * run_id
Definition cs_domain.h:142
cs_domain_stage_t stage
Definition cs_domain.h:172
int restart_nt
Definition cs_domain.h:177
cs_timer_counter_t tca
Definition cs_domain.h:188
bool is_last_iter
Definition cs_domain.h:167
cs_time_step_options_t time_options
Definition cs_domain.h:170
cs_domain_cdo_context_t * cdo_context
Definition cs_domain.h:182
cs_boundary_t * boundaries
Definition cs_domain.h:161
cs_cdo_quantities_t * cdo_quantities
Definition cs_domain.h:157
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