7.0
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-2021 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 schemes */
57 #define CS_DOMAIN_CDO_MODE_OFF -1 /* CDO schemes are not used */
58 #define CS_DOMAIN_CDO_MODE_WITH_FV 1 /* CDO and legacy FV schemes are used */
59 #define CS_DOMAIN_CDO_MODE_ONLY 2 /* CDO schemes are exclusively used */
60 
61 /*============================================================================
62  * Type definitions
63  *============================================================================*/
64 
69 typedef struct {
70 
71  /* Mode for CDO: activated, switched off... */
72  int mode;
73 
74  /* Flag to know if scalar or vector equations are requested and which kind
75  of numerical schemes is requested to solve these equations */
81 
83 
88 typedef struct {
89 
90  /* Code_Saturne mesh and mesh quantities structures already computed */
93 
94  /* CDO structures:
95  * - cs_cdo_connect_t contains additional information about connectivity
96  * - cs_cdo_quantities_t contains additional information on mesh quantities
97  */
100 
101  /* Boundary of the computational domain */
104 
105  /* Time step management */
107  bool is_last_iter; /* true or false */
108 
109  cs_time_step_t *time_step; /* time step descriptor */
110  cs_time_step_options_t time_options; /* time step options */
111 
112  /* Output options */
113  int output_nt; /* Logging done every nt iterations */
114  int restart_nt; /* Restart done every nt iterations */
115  int verbosity; /* Level of details given in log */
116 
117  /* Specific context structure related to the numerical schemes */
119 
120  /* Monitoring */
121  cs_timer_counter_t tcp; /* Cumulated elapsed time for extra-operations
122  and post-processing */
123  cs_timer_counter_t tcs; /* Cumulated elapsed time for setup operations */
124 
125 } cs_domain_t;
126 
127 /*============================================================================
128  * Static global variables
129  *============================================================================*/
130 
131 extern cs_domain_t *cs_glob_domain; /* Pointer to main computational domain */
132 
133 /*============================================================================
134  * Static inline public function prototypes
135  *============================================================================*/
136 
137 /*----------------------------------------------------------------------------*/
143 /*----------------------------------------------------------------------------*/
144 
145 static inline void
146 cs_domain_increment_time_step(cs_domain_t *domain)
147 {
148  cs_time_step_t *ts = domain->time_step;
149 
150  /* Increment time iteration */
151  ts->nt_cur++;
152 }
153 
154 /*============================================================================
155  * Public function prototypes
156  *============================================================================*/
157 
158 /*----------------------------------------------------------------------------*/
164 /*----------------------------------------------------------------------------*/
165 
166 cs_domain_t *
167 cs_domain_create(void);
168 
169 /*----------------------------------------------------------------------------*/
175 /*----------------------------------------------------------------------------*/
176 
177 void
178 cs_domain_free(cs_domain_t **p_domain);
179 
180 /*----------------------------------------------------------------------------*/
188 /*----------------------------------------------------------------------------*/
189 
190 void
192  int mode);
193 
194 /*----------------------------------------------------------------------------*/
202 /*----------------------------------------------------------------------------*/
203 
204 int
205 cs_domain_get_cdo_mode(const cs_domain_t *domain);
206 
207 /*----------------------------------------------------------------------------*/
215 /*----------------------------------------------------------------------------*/
216 
217 bool
219 
220 /*----------------------------------------------------------------------------*/
228 /*----------------------------------------------------------------------------*/
229 
230 bool
231 cs_domain_needs_log(const cs_domain_t *domain);
232 
233 /*----------------------------------------------------------------------------*/
239 /*----------------------------------------------------------------------------*/
240 
241 void
243 
244 /*----------------------------------------------------------------------------*/
250 /*----------------------------------------------------------------------------*/
251 
252 void
253 cs_domain_cdo_log(const cs_domain_t *domain);
254 
255 /*----------------------------------------------------------------------------*/
256 
258 
259 #endif /* __CS_DOMAIN_H__ */
time step descriptor
Definition: cs_time_step.h:64
cs_time_step_options_t time_options
Definition: cs_domain.h:110
cs_time_step_t * time_step
Definition: cs_domain.h:109
bool cs_domain_needs_iteration(cs_domain_t *domain)
Check if one needs to continue iterations in time.
Definition: cs_domain.c:314
cs_domain_t * cs_domain_create(void)
Create and initialize by default a cs_domain_t structure.
Definition: cs_domain.c:167
cs_flag_t eb_scheme_flag
Definition: cs_domain.h:76
cs_cdo_connect_t * connect
Definition: cs_domain.h:98
void cs_domain_increment_time(cs_domain_t *domain)
Update time step after one temporal iteration.
Definition: cs_domain.c:377
#define BEGIN_C_DECLS
Definition: cs_defs.h:495
Definition: cs_cdo_connect.h:76
Structure storing information related to the "physical" boundaries associated with the computational ...
Definition: cs_boundary.h:155
int verbosity
Definition: cs_domain.h:115
High-level metadata for handling CDO/HHO schemes.
Definition: cs_domain.h:69
int cs_domain_get_cdo_mode(const cs_domain_t *domain)
Get the mode of activation for the CDO/HHO schemes.
Definition: cs_domain.c:293
cs_domain_cdo_context_t * cdo_context
Definition: cs_domain.h:118
Definition: cs_cdo_quantities.h:124
void cs_domain_cdo_log(const cs_domain_t *domain)
Print a welcome message indicating which mode of CDO is activated.
Definition: cs_domain.c:398
void cs_domain_free(cs_domain_t **p_domain)
Free a cs_domain_t structure.
Definition: cs_domain.c:231
int output_nt
Definition: cs_domain.h:113
cs_timer_counter_t tcs
Definition: cs_domain.h:123
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:267
Definition: cs_mesh.h:84
cs_flag_t vb_scheme_flag
Definition: cs_domain.h:78
cs_domain_t * cs_glob_domain
Definition: cs_domain.c:85
bool is_last_iter
Definition: cs_domain.h:107
Definition: cs_mesh_quantities.h:89
cs_cdo_quantities_t * cdo_quantities
Definition: cs_domain.h:99
cs_boundary_t * ale_boundaries
Definition: cs_domain.h:103
Structure storing the main features of the computational domain and pointers to the main geometrical ...
Definition: cs_domain.h:88
cs_boundary_t * boundaries
Definition: cs_domain.h:102
bool only_steady
Definition: cs_domain.h:106
cs_flag_t fb_scheme_flag
Definition: cs_domain.h:77
cs_timer_counter_t tcp
Definition: cs_domain.h:121
bool cs_domain_needs_log(const cs_domain_t *domain)
Check if an output is requested according to the domain setting.
Definition: cs_domain.c:348
time step options descriptor
Definition: cs_time_step.h:92
#define END_C_DECLS
Definition: cs_defs.h:496
int nt_cur
Definition: cs_time_step.h:74
unsigned short int cs_flag_t
Definition: cs_defs.h:309
cs_flag_t hho_scheme_flag
Definition: cs_domain.h:80
int mode
Definition: cs_domain.h:72
cs_mesh_quantities_t * mesh_quantities
Definition: cs_domain.h:92
cs_flag_t vcb_scheme_flag
Definition: cs_domain.h:79
int restart_nt
Definition: cs_domain.h:114
cs_mesh_t * mesh
Definition: cs_domain.h:91
Definition: cs_timer.h:57