8.0
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-2023 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 /* Rescaling or not of the pressure */
45 #define CS_BOUNDARY_PRESSURE_NO_RESCALING 1
46 #define CS_BOUNDARY_PRESSURE_RESCALING 0
47 
48 /* Name of the boundary zone gathering all domain boundary walls */
49 #define CS_BOUNDARY_WALLS_NAME "auto:wall"
50 
51 #define CS_BOUNDARY_UNDEFINED 0
52 
53 /*============================================================================
54  * Type definitions
55  *============================================================================*/
56 
57 /* Boundary categories */
58 
59 typedef enum {
60 
61  CS_BOUNDARY_CATEGORY_FLOW, /*< flow related boundaries */
62  CS_BOUNDARY_CATEGORY_ALE, /*< ALE related boundaries */
63  CS_BOUNDARY_CATEGORY_RADIATIVE /*< Radiative boundaries */
64 
66 
69 typedef int cs_boundary_type_t;
70 
71 /* Bit values for flow boundaries
72  ------------------------------ */
73 
74 typedef enum {
75 
76  /* Main types
77  ---------- */
78 
81 
84 
87 
90 
91  /* Additional flags
92  ---------------- */
93 
96 
99 
102 
105 
108 
111 
114 
117 
120 
123 
126 
129 
131  CS_BOUNDARY_COUPLED_DF = 1<<16
132 
134 
135 /* Bit values for ALE boundaries
136  ----------------------------- */
137 
138 typedef enum {
139 
149 
155 typedef struct {
156 
162  int *zone_ids;
164 } cs_boundary_t;
165 
166 /*============================================================================
167  * Static global variables
168  *============================================================================*/
169 
170 extern cs_boundary_t *cs_glob_boundaries; /* Pointer to the shared boundaries
171  * on the computational domain */
172 
173 /*============================================================================
174  * Public function prototypes
175  *============================================================================*/
176 
177 /*----------------------------------------------------------------------------*/
186 /*----------------------------------------------------------------------------*/
187 
188 bool
189 cs_boundary_has_type(const cs_boundary_t *boundaries,
190  int type_flag);
191 
192 /*----------------------------------------------------------------------------*/
201 /*----------------------------------------------------------------------------*/
202 
203 int
204 cs_boundary_id_by_zone_id(const cs_boundary_t *boundaries,
205  int z_id);
206 
207 /*----------------------------------------------------------------------------*/
215 /*----------------------------------------------------------------------------*/
216 
217 void
219  cs_boundary_type_t type);
220 
221 /*----------------------------------------------------------------------------*/
230 /*----------------------------------------------------------------------------*/
231 
234  cs_boundary_type_t default_type);
235 
236 /*----------------------------------------------------------------------------*/
242 /*----------------------------------------------------------------------------*/
243 
244 void
245 cs_boundary_free(cs_boundary_t **p_boundaries);
246 
247 /*----------------------------------------------------------------------------*/
255 /*----------------------------------------------------------------------------*/
256 
257 void
259  cs_boundary_type_t type,
260  const char *zone_name);
261 
262 /*----------------------------------------------------------------------------*/
271 /*----------------------------------------------------------------------------*/
272 
273 void
275  cs_lnum_t n_b_faces,
276  cs_boundary_type_t bf_type[]);
277 
278 /*----------------------------------------------------------------------------*/
284 /*----------------------------------------------------------------------------*/
285 
286 void
288 
289 /*----------------------------------------------------------------------------*/
300 /*----------------------------------------------------------------------------*/
301 
302 int
304  const cs_boundary_type_t bf_type[]);
305 
306 /*----------------------------------------------------------------------------*/
315 /*----------------------------------------------------------------------------*/
316 
317 void
319  cs_boundary_type_t b_type,
320  int descr_len_max,
321  char descr[]);
322 
323 /*----------------------------------------------------------------------------*/
329 /*----------------------------------------------------------------------------*/
330 
331 void
333 
334 /*----------------------------------------------------------------------------*/
335 
337 
338 #endif /* __CS_BOUNDARY_H__ */
cs_boundary_flow_subtype_bits_t
Definition: cs_boundary.h:74
@ CS_BOUNDARY_FREE_INLET_OUTLET
Definition: cs_boundary.h:107
@ CS_BOUNDARY_INLET_QH
Definition: cs_boundary.h:113
@ CS_BOUNDARY_OUTLET
Definition: cs_boundary.h:86
@ CS_BOUNDARY_COUPLED_DF
Definition: cs_boundary.h:131
@ CS_BOUNDARY_FREE_SURFACE
Definition: cs_boundary.h:125
@ CS_BOUNDARY_INLET_SUBSONIC_PH
Definition: cs_boundary.h:116
@ CS_BOUNDARY_ROUGH_WALL
Definition: cs_boundary.h:95
@ CS_BOUNDARY_SYMMETRY
Definition: cs_boundary.h:89
@ CS_BOUNDARY_INLET
Definition: cs_boundary.h:83
@ CS_BOUNDARY_SLIDING_WALL
Definition: cs_boundary.h:98
@ CS_BOUNDARY_IMPOSED_P
Definition: cs_boundary.h:104
@ CS_BOUNDARY_IMPOSED_VEL
Definition: cs_boundary.h:101
@ CS_BOUNDARY_CONVECTIVE_INLET
Definition: cs_boundary.h:110
@ CS_BOUNDARY_COUPLED
Definition: cs_boundary.h:128
@ CS_BOUNDARY_WALL
Definition: cs_boundary.h:80
@ CS_BOUNDARY_SUBSONIC
Definition: cs_boundary.h:119
@ CS_BOUNDARY_SUPERSONIC
Definition: cs_boundary.h:122
int cs_boundary_type_t
Definition: cs_boundary.h:69
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:429
void cs_boundary_free(cs_boundary_t **p_boundaries)
Free all metadate related to the domain boundaries.
Definition: cs_boundary.c:481
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:649
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:609
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:505
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
cs_boundary_category_t
Definition: cs_boundary.h:59
@ CS_BOUNDARY_CATEGORY_ALE
Definition: cs_boundary.h:62
@ CS_BOUNDARY_CATEGORY_FLOW
Definition: cs_boundary.h:61
@ CS_BOUNDARY_CATEGORY_RADIATIVE
Definition: cs_boundary.h:63
void cs_boundary_log_setup(const cs_boundary_t *bdy)
Summarize the setup of the boundary of the computational domain.
Definition: cs_boundary.c:682
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:574
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:456
cs_boundary_ale_subtype_bits_t
Definition: cs_boundary.h:138
@ CS_BOUNDARY_ALE_EXTERNAL_COUPLING
Definition: cs_boundary.h:145
@ CS_BOUNDARY_ALE_IMPOSED_DISP
Definition: cs_boundary.h:143
@ CS_BOUNDARY_ALE_SLIDING
Definition: cs_boundary.h:141
@ CS_BOUNDARY_ALE_FIXED
Definition: cs_boundary.h:140
@ CS_BOUNDARY_ALE_INTERNAL_COUPLING
Definition: cs_boundary.h:144
@ CS_BOUNDARY_ALE_IMPOSED_VEL
Definition: cs_boundary.h:142
@ CS_BOUNDARY_ALE_FREE_SURFACE
Definition: cs_boundary.h:146
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:544
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
#define BEGIN_C_DECLS
Definition: cs_defs.h:509
#define END_C_DECLS
Definition: cs_defs.h:510
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:313
Structure storing information related to the "physical" boundaries associated with the computational ...
Definition: cs_boundary.h:155
cs_boundary_type_t default_type
Definition: cs_boundary.h:158
int n_boundaries
Definition: cs_boundary.h:160
int * zone_ids
Definition: cs_boundary.h:162
cs_boundary_category_t category
Definition: cs_boundary.h:157
cs_boundary_type_t * types
Definition: cs_boundary.h:161