programmer's 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-2018 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 "cs_cdo_connect.h"
34 #include "cs_cdo_quantities.h"
35 #include "cs_domain_boundary.h"
36 #include "cs_mesh.h"
37 #include "cs_mesh_quantities.h"
38 #include "cs_time_step.h"
39 #include "cs_timer.h"
40 #include "cs_xdef.h"
41 
42 /*----------------------------------------------------------------------------*/
43 
45 
46 /*============================================================================
47  * Macro definitions
48  *============================================================================*/
49 
50 /* Flag related to the activation (or not) of the CDO schemes */
51 #define CS_DOMAIN_CDO_MODE_OFF -1 /* CDO schemes are not used */
52 #define CS_DOMAIN_CDO_MODE_WITH_FV 1 /* CDO and legacy FV schemes are used */
53 #define CS_DOMAIN_CDO_MODE_ONLY 2 /* CDO schemes are exclusively used */
54 
55 /*============================================================================
56  * Type definitions
57  *============================================================================*/
58 
63 typedef struct {
64 
65  /* Mode for CDO: activated, switched off... */
66  int mode;
67 
68  /* Metadata for CDO */
70 
71  /* Flag to know if scalar or vector equations are requested and which kind
72  of numerical schemes is requested to solve these equations */
77 
79 
84 typedef struct {
85 
86  /* Code_Saturne mesh and mesh quantities structures already computed */
87  const cs_mesh_t *mesh;
89 
90  /* CDO structures:
91  - cs_cdo_connect_t contains additional information about connectivity
92  - cs_cdo_quantities_t contains additional information on mesh quantities
93  */
96 
97  /* Time step management */
99  bool is_last_iter; // true or false
100  double dt_cur; // current time step
101  cs_xdef_t *time_step_def; // Definition of the time_step
102  cs_time_step_t *time_step; // time step descriptor
103  cs_time_step_options_t time_options; // time step options
104 
105  /* Output options */
106  int output_nt; /* Log information every nt iterations */
107  int restart_nt; /* Write a restart every nt iterations */
108  int verbosity; /* Level of details given in log */
109 
110  /* Specific context structure related to the numerical schemes */
112 
113  /* Monitoring */
114  cs_timer_counter_t tcp; /* Cumulated elapsed time for extra-operations
115  and post-processing */
116  cs_timer_counter_t tcs; /* Cumulated elapsed time for setup operations */
117 
118 } cs_domain_t;
119 
120 /*============================================================================
121  * Static global variables
122  *============================================================================*/
123 
124 extern cs_domain_t *cs_glob_domain; /* Pointer to main computational domain
125  used in CDO/HHO schmes */
126 
127 /*============================================================================
128  * Public function prototypes
129  *============================================================================*/
130 
131 /*----------------------------------------------------------------------------*/
137 /*----------------------------------------------------------------------------*/
138 
139 cs_domain_t *
140 cs_domain_create(void);
141 
142 /*----------------------------------------------------------------------------*/
148 /*----------------------------------------------------------------------------*/
149 
150 void
151 cs_domain_free(cs_domain_t **p_domain);
152 
153 /*----------------------------------------------------------------------------*/
161 /*----------------------------------------------------------------------------*/
162 
163 void
165  int mode);
166 
167 /*----------------------------------------------------------------------------*/
175 /*----------------------------------------------------------------------------*/
176 
177 int
178 cs_domain_get_cdo_mode(const cs_domain_t *domain);
179 
180 /*----------------------------------------------------------------------------*/
188 /*----------------------------------------------------------------------------*/
189 
190 bool
192 
193 /*----------------------------------------------------------------------------*/
201 /*----------------------------------------------------------------------------*/
202 
203 bool
204 cs_domain_needs_log(const cs_domain_t *domain);
205 
206 /*----------------------------------------------------------------------------*/
212 /*----------------------------------------------------------------------------*/
213 
214 void
216 
217 /*----------------------------------------------------------------------------*/
223 /*----------------------------------------------------------------------------*/
224 
225 void
227 
228 /*----------------------------------------------------------------------------*/
234 /*----------------------------------------------------------------------------*/
235 
236 void
238 
239 /*----------------------------------------------------------------------------*/
245 /*----------------------------------------------------------------------------*/
246 
247 void
248 cs_domain_cdo_log(const cs_domain_t *domain);
249 
250 /*----------------------------------------------------------------------------*/
251 
253 
254 #endif /* __CS_DOMAIN_H__ */
time step descriptor
Definition: cs_time_step.h:51
cs_time_step_options_t time_options
Definition: cs_domain.h:103
cs_time_step_t * time_step
Definition: cs_domain.h:102
bool cs_domain_needs_iteration(cs_domain_t *domain)
Check if one needs to continue iterations in time.
Definition: cs_domain.c:307
cs_domain_t * cs_domain_create(void)
Create and initialize by default a cs_domain_t structure.
Definition: cs_domain.c:154
cs_cdo_connect_t * connect
Definition: cs_domain.h:94
void cs_domain_increment_time(cs_domain_t *domain)
Update time step after one temporal iteration.
Definition: cs_domain.c:434
#define BEGIN_C_DECLS
Definition: cs_defs.h:462
Definition: cs_cdo_connect.h:74
int verbosity
Definition: cs_domain.h:108
High-level metadata for handling CDO/HHO schemes.
Definition: cs_domain.h:63
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:286
cs_domain_cdo_context_t * cdo_context
Definition: cs_domain.h:111
Definition: cs_cdo_quantities.h:94
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:476
void cs_domain_free(cs_domain_t **p_domain)
Free a cs_domain_t structure.
Definition: cs_domain.c:220
int output_nt
Definition: cs_domain.h:106
const cs_mesh_t * mesh
Definition: cs_domain.h:87
cs_timer_counter_t tcs
Definition: cs_domain.h:116
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:260
Definition: cs_mesh.h:63
const cs_mesh_quantities_t * mesh_quantities
Definition: cs_domain.h:88
cs_flag_t vb_scheme_flag
Definition: cs_domain.h:74
cs_domain_t * cs_glob_domain
Definition: cs_domain.c:86
bool is_last_iter
Definition: cs_domain.h:99
double dt_cur
Definition: cs_domain.h:100
Definition: cs_mesh_quantities.h:90
cs_cdo_quantities_t * cdo_quantities
Definition: cs_domain.h:95
bool force_advfield_update
Definition: cs_domain.h:69
Structure storing the main features of the computational domain and pointers to the main geometrical ...
Definition: cs_domain.h:84
Structure storing medata for defining a quantity in a very flexible way.
Definition: cs_xdef.h:126
void cs_domain_define_current_time_step(cs_domain_t *domain)
Set the current time step for this new time iteration.
Definition: cs_domain.c:370
bool only_steady
Definition: cs_domain.h:98
void cs_domain_increment_time_step(cs_domain_t *domain)
Update the time step after one temporal iteration.
Definition: cs_domain.c:458
cs_flag_t fb_scheme_flag
Definition: cs_domain.h:73
cs_timer_counter_t tcp
Definition: cs_domain.h:114
bool cs_domain_needs_log(const cs_domain_t *domain)
Check if an ouput is requested according to the domain setting.
Definition: cs_domain.c:341
time step options descriptor
Definition: cs_time_step.h:76
#define END_C_DECLS
Definition: cs_defs.h:463
unsigned short int cs_flag_t
Definition: cs_defs.h:299
cs_flag_t hho_scheme_flag
Definition: cs_domain.h:76
int mode
Definition: cs_domain.h:66
cs_xdef_t * time_step_def
Definition: cs_domain.h:101
cs_flag_t vcb_scheme_flag
Definition: cs_domain.h:75
int restart_nt
Definition: cs_domain.h:107
Definition: cs_timer.h:57