6.3
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 
127  CS_BOUNDARY_COUPLED_DF = 1<<16
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__ */
CS_BOUNDARY_ALE_FREE_SURFACE
@ CS_BOUNDARY_ALE_FREE_SURFACE
Definition: cs_boundary.h:142
cs_boundary_free
void cs_boundary_free(cs_boundary_t **p_boundaries)
Free all metadate related to the domain boundaries.
Definition: cs_boundary.c:481
cs_boundary_set_default
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
cs_defs.h
CS_BOUNDARY_ALE_IMPOSED_VEL
@ CS_BOUNDARY_ALE_IMPOSED_VEL
Definition: cs_boundary.h:138
CS_BOUNDARY_OUTLET
@ CS_BOUNDARY_OUTLET
Definition: cs_boundary.h:82
CS_BOUNDARY_INLET_SUBSONIC_PH
@ CS_BOUNDARY_INLET_SUBSONIC_PH
Definition: cs_boundary.h:112
CS_BOUNDARY_COUPLED
@ CS_BOUNDARY_COUPLED
Definition: cs_boundary.h:124
CS_BOUNDARY_IMPOSED_P
@ CS_BOUNDARY_IMPOSED_P
Definition: cs_boundary.h:100
cs_boundary_need_pressure_rescaling
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:608
CS_BOUNDARY_WALL
@ CS_BOUNDARY_WALL
Definition: cs_boundary.h:76
cs_boundary_t::zone_ids
int * zone_ids
Definition: cs_boundary.h:158
CS_BOUNDARY_SUPERSONIC
@ CS_BOUNDARY_SUPERSONIC
Definition: cs_boundary.h:118
cs_boundary_t
Structure storing information related to the "physical" boundaries associated with the computational ...
Definition: cs_boundary.h:151
cs_boundary_t::category
cs_boundary_category_t category
Definition: cs_boundary.h:153
END_C_DECLS
#define END_C_DECLS
Definition: cs_defs.h:493
cs_boundary_has_type
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
CS_BOUNDARY_FREE_INLET_OUTLET
@ CS_BOUNDARY_FREE_INLET_OUTLET
Definition: cs_boundary.h:103
BEGIN_C_DECLS
#define BEGIN_C_DECLS
Definition: cs_defs.h:492
CS_BOUNDARY_SYMMETRY
@ CS_BOUNDARY_SYMMETRY
Definition: cs_boundary.h:85
cs_boundary_def_wall_zones
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_CONVECTIVE_INLET
@ CS_BOUNDARY_CONVECTIVE_INLET
Definition: cs_boundary.h:106
CS_BOUNDARY_CATEGORY_FLOW
@ CS_BOUNDARY_CATEGORY_FLOW
Definition: cs_boundary.h:57
CS_BOUNDARY_INLET
@ CS_BOUNDARY_INLET
Definition: cs_boundary.h:79
cs_boundary_flow_subtype_bits_t
cs_boundary_flow_subtype_bits_t
Definition: cs_boundary.h:70
CS_BOUNDARY_CATEGORY_RADIATIVE
@ CS_BOUNDARY_CATEGORY_RADIATIVE
Definition: cs_boundary.h:59
CS_BOUNDARY_COUPLED_DF
@ CS_BOUNDARY_COUPLED_DF
Definition: cs_boundary.h:127
cs_lnum_t
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:298
CS_BOUNDARY_SUBSONIC
@ CS_BOUNDARY_SUBSONIC
Definition: cs_boundary.h:115
CS_BOUNDARY_FREE_SURFACE
@ CS_BOUNDARY_FREE_SURFACE
Definition: cs_boundary.h:121
CS_BOUNDARY_INLET_QH
@ CS_BOUNDARY_INLET_QH
Definition: cs_boundary.h:109
cs_boundary_t::types
cs_boundary_type_t * types
Definition: cs_boundary.h:157
cs_boundary_type_t
int cs_boundary_type_t
Definition: cs_boundary.h:65
cs_boundary_t::n_boundaries
int n_boundaries
Definition: cs_boundary.h:156
cs_boundary_build_type_array
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
cs_boundary_add
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
cs_boundary_category_t
cs_boundary_category_t
Definition: cs_boundary.h:55
cs_boundary_create
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_FIXED
@ CS_BOUNDARY_ALE_FIXED
Definition: cs_boundary.h:136
CS_BOUNDARY_IMPOSED_VEL
@ CS_BOUNDARY_IMPOSED_VEL
Definition: cs_boundary.h:97
CS_BOUNDARY_CATEGORY_ALE
@ CS_BOUNDARY_CATEGORY_ALE
Definition: cs_boundary.h:58
CS_BOUNDARY_ALE_IMPOSED_DISP
@ CS_BOUNDARY_ALE_IMPOSED_DISP
Definition: cs_boundary.h:139
CS_BOUNDARY_ALE_SLIDING
@ CS_BOUNDARY_ALE_SLIDING
Definition: cs_boundary.h:137
CS_BOUNDARY_ALE_EXTERNAL_COUPLING
@ CS_BOUNDARY_ALE_EXTERNAL_COUPLING
Definition: cs_boundary.h:141
cs_glob_boundaries
cs_boundary_t * cs_glob_boundaries
cs_boundary_ale_subtype_bits_t
cs_boundary_ale_subtype_bits_t
Definition: cs_boundary.h:134
cs_boundary_log_setup
void cs_boundary_log_setup(const cs_boundary_t *bdy)
Summarize the setup of the boundary of the computational domain.
Definition: cs_boundary.c:679
CS_BOUNDARY_ALE_INTERNAL_COUPLING
@ CS_BOUNDARY_ALE_INTERNAL_COUPLING
Definition: cs_boundary.h:140
cs_boundary_get_type_descr
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:646
CS_BOUNDARY_ROUGH_WALL
@ CS_BOUNDARY_ROUGH_WALL
Definition: cs_boundary.h:91
cs_boundary_id_by_zone_id
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_t::default_type
cs_boundary_type_t default_type
Definition: cs_boundary.h:154
cs_base.h
CS_BOUNDARY_SLIDING_WALL
@ CS_BOUNDARY_SLIDING_WALL
Definition: cs_boundary.h:94