6.2
general documentation
cs_boundary.h
Go to the documentation of this file.
1 #ifndef __CS_BOUNDARY_H__
2 #define __CS_BOUNDARY_H__
3 
4 /*============================================================================
5  * Handle the boundaries of a computational domain
6  *============================================================================*/
7 
8 /*
9  This file is part of Code_Saturne, a general-purpose CFD tool.
10 
11  Copyright (C) 1998-2020 EDF S.A.
12 
13  This program is free software; you can redistribute it and/or modify it under
14  the terms of the GNU General Public License as published by the Free Software
15  Foundation; either version 2 of the License, or (at your option) any later
16  version.
17 
18  This program is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
20  FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
21  details.
22 
23  You should have received a copy of the GNU General Public License along with
24  this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
25  Street, Fifth Floor, Boston, MA 02110-1301, USA.
26 */
27 
28 /*----------------------------------------------------------------------------
29  * Local headers
30  *----------------------------------------------------------------------------*/
31 
32 #include "cs_defs.h"
33 
34 #include "cs_base.h"
35 
36 /*----------------------------------------------------------------------------*/
37 
39 
40 /*============================================================================
41  * Macro definitions
42  *============================================================================*/
43 
44 /* Name of the boundary zone gathering all domain boundary walls */
45 #define CS_BOUNDARY_WALLS_NAME "auto:wall"
46 
47 #define CS_BOUNDARY_UNDEFINED 0
48 
49 /*============================================================================
50  * Type definitions
51  *============================================================================*/
52 
53 /* Boundary categories */
54 
55 typedef enum {
56 
57  CS_BOUNDARY_CATEGORY_FLOW, /*< flow related boundaries */
58  CS_BOUNDARY_CATEGORY_ALE, /*< ALE related boundaries */
59  CS_BOUNDARY_CATEGORY_RADIATIVE /*< Radiative boundaries */
60 
62 
65 typedef int cs_boundary_type_t;
66 
67 /* Bit values for flow boundaries
68  ------------------------------ */
69 
70 typedef enum {
71 
72  /* Main types
73  ---------- */
74 
77 
80 
83 
86 
87  /* Additional flags
88  ---------------- */
89 
92 
95 
98 
101 
104 
107 
110 
113 
116 
119 
122 
125 
128 
130 
131 /* Bit values for ALE boundaries
132  ----------------------------- */
133 
134 typedef enum {
135 
145 
151 typedef struct {
152 
158  int *zone_ids;
160 } cs_boundary_t;
161 
162 /*============================================================================
163  * Static global variables
164  *============================================================================*/
165 
166 extern cs_boundary_t *cs_glob_boundaries; /* Pointer to the shared boundaries
167  * on the computational domain */
168 
169 /*============================================================================
170  * Public function prototypes
171  *============================================================================*/
172 
173 /*----------------------------------------------------------------------------*/
182 /*----------------------------------------------------------------------------*/
183 
184 bool
185 cs_boundary_has_type(const cs_boundary_t *boundaries,
186  int type_flag);
187 
188 /*----------------------------------------------------------------------------*/
197 /*----------------------------------------------------------------------------*/
198 
199 int
200 cs_boundary_id_by_zone_id(const cs_boundary_t *boundaries,
201  int z_id);
202 
203 /*----------------------------------------------------------------------------*/
211 /*----------------------------------------------------------------------------*/
212 
213 void
215  cs_boundary_type_t type);
216 
217 /*----------------------------------------------------------------------------*/
226 /*----------------------------------------------------------------------------*/
227 
230  cs_boundary_type_t default_type);
231 
232 /*----------------------------------------------------------------------------*/
238 /*----------------------------------------------------------------------------*/
239 
240 void
241 cs_boundary_free(cs_boundary_t **p_boundaries);
242 
243 /*----------------------------------------------------------------------------*/
251 /*----------------------------------------------------------------------------*/
252 
253 void
255  cs_boundary_type_t type,
256  const char *zone_name);
257 
258 /*----------------------------------------------------------------------------*/
267 /*----------------------------------------------------------------------------*/
268 
269 void
271  cs_lnum_t n_b_faces,
272  cs_boundary_type_t bf_type[]);
273 
274 /*----------------------------------------------------------------------------*/
280 /*----------------------------------------------------------------------------*/
281 
282 void
284 
285 /*----------------------------------------------------------------------------*/
296 /*----------------------------------------------------------------------------*/
297 
298 int
300  const cs_boundary_type_t bf_type[]);
301 
302 /*----------------------------------------------------------------------------*/
311 /*----------------------------------------------------------------------------*/
312 
313 void
315  cs_boundary_type_t b_type,
316  int descr_len_max,
317  char descr[]);
318 
319 /*----------------------------------------------------------------------------*/
325 /*----------------------------------------------------------------------------*/
326 
327 void
329 
330 /*----------------------------------------------------------------------------*/
331 
333 
334 #endif /* __CS_BOUNDARY_H__ */
int cs_boundary_id_by_zone_id(const cs_boundary_t *boundaries, int z_id)
Retrieve the related id associated to a boundary from its zone id.
Definition: cs_boundary.c:396
Definition: cs_boundary.h:100
int cs_boundary_type_t
Definition: cs_boundary.h:65
int cs_boundary_need_pressure_rescaling(cs_lnum_t n_b_faces, const cs_boundary_type_t bf_type[])
Check if one needs to perform a pressure rescaling (in case of a Dirichlet on the velocity for the wh...
Definition: cs_boundary.c:601
cs_boundary_ale_subtype_bits_t
Definition: cs_boundary.h:134
Definition: cs_boundary.h:109
int n_boundaries
Definition: cs_boundary.h:156
#define BEGIN_C_DECLS
Definition: cs_defs.h:495
Definition: cs_boundary.h:140
Definition: cs_boundary.h:58
Definition: cs_boundary.h:121
cs_boundary_category_t category
Definition: cs_boundary.h:153
Definition: cs_boundary.h:91
bool cs_boundary_has_type(const cs_boundary_t *boundaries, int type_flag)
Check if a boundary with a given flag is present.
Definition: cs_boundary.c:370
Definition: cs_boundary.h:127
cs_boundary_type_t default_type
Definition: cs_boundary.h:154
Structure storing information related to the "physical" boundaries associated with the computational ...
Definition: cs_boundary.h:151
cs_boundary_flow_subtype_bits_t
Definition: cs_boundary.h:70
cs_boundary_type_t * types
Definition: cs_boundary.h:157
Definition: cs_boundary.h:115
Definition: cs_boundary.h:118
void cs_boundary_set_default(cs_boundary_t *boundaries, cs_boundary_type_t type)
Set the default boundary related to the given cs_boundary_t structure.
Definition: cs_boundary.c:422
Definition: cs_boundary.h:112
Definition: cs_boundary.h:124
void cs_boundary_def_wall_zones(cs_boundary_t *boundaries)
Add a new zone gathering all CS_BOUNDARY_WALL type zones.
Definition: cs_boundary.c:567
cs_boundary_t * cs_glob_boundaries
cs_boundary_t * cs_boundary_create(cs_boundary_category_t category, cs_boundary_type_t default_type)
Create a default boundary structure for the computational domain.
Definition: cs_boundary.c:449
Definition: cs_boundary.h:142
Definition: cs_boundary.h:138
Definition: cs_boundary.h:106
void cs_boundary_build_type_array(const cs_boundary_t *boundaries, cs_lnum_t n_b_faces, cs_boundary_type_t bf_type[])
Build an array on boundary faces which specifies the boundary type for each face. ...
Definition: cs_boundary.c:537
Definition: cs_boundary.h:136
Definition: cs_boundary.h:103
Definition: cs_boundary.h:137
Definition: cs_boundary.h:85
Definition: cs_boundary.h:139
Definition: cs_boundary.h:76
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:301
Definition: cs_boundary.h:94
Definition: cs_boundary.h:57
Definition: cs_boundary.h:82
#define END_C_DECLS
Definition: cs_defs.h:496
Definition: cs_boundary.h:141
void cs_boundary_free(cs_boundary_t **p_boundaries)
Free all metadate related to the domain boundaries.
Definition: cs_boundary.c:474
void cs_boundary_add(cs_boundary_t *bdy, cs_boundary_type_t type, const char *zone_name)
Add a new boundary type for a given boundary zone.
Definition: cs_boundary.c:498
void cs_boundary_log_setup(const cs_boundary_t *bdy)
Summarize the setup of the boundary of the computational domain.
Definition: cs_boundary.c:672
Definition: cs_boundary.h:59
Definition: cs_boundary.h:79
void cs_boundary_get_type_descr(const cs_boundary_t *bdy, cs_boundary_type_t b_type, int descr_len_max, char descr[])
Build a boundary type description.
Definition: cs_boundary.c:639
cs_boundary_category_t
Definition: cs_boundary.h:55
Definition: cs_boundary.h:97
int * zone_ids
Definition: cs_boundary.h:158