My Project
programmer's 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-2019 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
69typedef 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 */
80
82
87typedef struct {
88
89 /* Code_Saturne mesh and mesh quantities structures already computed */
92
93 /* CDO structures:
94 * - cs_cdo_connect_t contains additional information about connectivity
95 * - cs_cdo_quantities_t contains additional information on mesh quantities
96 */
99
100 /* Boundary of the computational domain */
103
104 /* Time step management */
106 bool is_last_iter; /* true or false */
107 cs_xdef_t *time_step_def; /* Definition of the time_step */
108 cs_time_step_t *time_step; /* time step descriptor */
109 cs_time_step_options_t time_options; /* time step options */
110
111 /* Output options */
112 int output_nt; /* Logging done every nt iterations */
113 int restart_nt; /* Restart done every nt iterations */
114 int verbosity; /* Level of details given in log */
115
116 /* Specific context structure related to the numerical schemes */
118
119 /* Monitoring */
120 cs_timer_counter_t tcp; /* Cumulated elapsed time for extra-operations
121 and post-processing */
122 cs_timer_counter_t tcs; /* Cumulated elapsed time for setup operations */
123
125
126/*============================================================================
127 * Static global variables
128 *============================================================================*/
129
130extern cs_domain_t *cs_glob_domain; /* Pointer to main computational domain */
131
132/*============================================================================
133 * Static inline public function prototypes
134 *============================================================================*/
135
136/*----------------------------------------------------------------------------*/
142/*----------------------------------------------------------------------------*/
143
144static inline void
146{
147 cs_time_step_t *ts = domain->time_step;
148
149 /* Increment time iteration */
150 ts->nt_cur++;
151}
152
153/*============================================================================
154 * Public function prototypes
155 *============================================================================*/
156
157/*----------------------------------------------------------------------------*/
163/*----------------------------------------------------------------------------*/
164
166cs_domain_create(void);
167
168/*----------------------------------------------------------------------------*/
174/*----------------------------------------------------------------------------*/
175
176void
177cs_domain_free(cs_domain_t **p_domain);
178
179/*----------------------------------------------------------------------------*/
187/*----------------------------------------------------------------------------*/
188
189void
191 int mode);
192
193/*----------------------------------------------------------------------------*/
201/*----------------------------------------------------------------------------*/
202
203int
205
206/*----------------------------------------------------------------------------*/
214/*----------------------------------------------------------------------------*/
215
216bool
218
219/*----------------------------------------------------------------------------*/
227/*----------------------------------------------------------------------------*/
228
229bool
230cs_domain_needs_log(const cs_domain_t *domain);
231
232/*----------------------------------------------------------------------------*/
238/*----------------------------------------------------------------------------*/
239
240void
242
243/*----------------------------------------------------------------------------*/
249/*----------------------------------------------------------------------------*/
250
251void
253
254/*----------------------------------------------------------------------------*/
260/*----------------------------------------------------------------------------*/
261
262void
263cs_domain_cdo_log(const cs_domain_t *domain);
264
265/*----------------------------------------------------------------------------*/
266
268
269#endif /* __CS_DOMAIN_H__ */
#define BEGIN_C_DECLS
Definition cs_defs.h:467
#define END_C_DECLS
Definition cs_defs.h:468
unsigned short int cs_flag_t
Definition cs_defs.h:304
void cs_domain_free(cs_domain_t **p_domain)
Free a cs_domain_t structure.
Definition cs_domain.c:214
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:336
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:365
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:463
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:255
bool cs_domain_needs_iteration(cs_domain_t *domain)
Check if one needs to continue iterations in time.
Definition cs_domain.c:302
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:281
void cs_domain_increment_time(cs_domain_t *domain)
Update time step after one temporal iteration.
Definition cs_domain.c:442
cs_domain_t * cs_glob_domain
Definition cs_domain.c:85
static void cs_domain_increment_time_step(cs_domain_t *domain)
Update the time step after one temporal iteration.
Definition cs_domain.h:145
cs_domain_t * cs_domain_create(void)
Create and initialize by default a cs_domain_t structure.
Definition cs_domain.c:151
Structure storing information related to the "physical" boundaries that one want to set on the comput...
Definition cs_boundary.h:77
Definition cs_cdo_connect.h:74
Definition cs_cdo_quantities.h:94
High-level metadata for handling CDO/HHO schemes.
Definition cs_domain.h:69
cs_flag_t hho_scheme_flag
Definition cs_domain.h:79
int mode
Definition cs_domain.h:72
cs_flag_t vcb_scheme_flag
Definition cs_domain.h:78
cs_flag_t fb_scheme_flag
Definition cs_domain.h:76
cs_flag_t vb_scheme_flag
Definition cs_domain.h:77
Structure storing the main features of the computational domain and pointers to the main geometrical ...
Definition cs_domain.h:87
cs_boundary_t * ale_boundaries
Definition cs_domain.h:102
cs_timer_counter_t tcs
Definition cs_domain.h:122
int verbosity
Definition cs_domain.h:114
cs_mesh_quantities_t * mesh_quantities
Definition cs_domain.h:91
cs_time_step_t * time_step
Definition cs_domain.h:108
cs_mesh_t * mesh
Definition cs_domain.h:90
int output_nt
Definition cs_domain.h:112
cs_timer_counter_t tcp
Definition cs_domain.h:120
bool only_steady
Definition cs_domain.h:105
cs_cdo_connect_t * connect
Definition cs_domain.h:97
int restart_nt
Definition cs_domain.h:113
bool is_last_iter
Definition cs_domain.h:106
cs_time_step_options_t time_options
Definition cs_domain.h:109
cs_xdef_t * time_step_def
Definition cs_domain.h:107
cs_domain_cdo_context_t * cdo_context
Definition cs_domain.h:117
cs_boundary_t * boundaries
Definition cs_domain.h:101
cs_cdo_quantities_t * cdo_quantities
Definition cs_domain.h:98
Definition cs_mesh_quantities.h:90
Definition cs_mesh.h:63
time step options descriptor
Definition cs_time_step.h:80
time step descriptor
Definition cs_time_step.h:51
int nt_cur
Definition cs_time_step.h:61
Definition cs_timer.h:57
Structure storing medata for defining a quantity in a very flexible way.
Definition cs_xdef.h:126