9.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-2026 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 "base/cs_defs.h"
33
34#include "base/cs_base.h"
35
36/*============================================================================
37 * Macro definitions
38 *============================================================================*/
39
40/* Rescaling or not of the pressure */
41#define CS_BOUNDARY_PRESSURE_NO_RESCALING 1
42#define CS_BOUNDARY_PRESSURE_RESCALING 0
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
55typedef 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
66
67/* Bit values for flow boundaries
68 ------------------------------ */
69
70typedef 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
129 /* mapped */
130 CS_BOUNDARY_MAPPED = 1<<17
131
133
134/* Bit values for ALE boundaries
135 ----------------------------- */
136
137typedef enum {
138
148
154typedef struct {
155
161 int *zone_ids;
164
165/*============================================================================
166 * Static global variables
167 *============================================================================*/
168
169extern cs_boundary_t *cs_glob_boundaries; /* Pointer to the shared boundaries
170 * on the computational domain */
171
172/*============================================================================
173 * Public function prototypes
174 *============================================================================*/
175
176/*----------------------------------------------------------------------------*/
177/*
178 * \brief Check if a boundary with a given flag is present.
179 *
180 * \param[in] boundaries pointer to a cs_boundary_t structure
181 * \param[in] type_flag boundary type flag
182 *
183 * \return true or false
184 */
185/*----------------------------------------------------------------------------*/
186
187bool
188cs_boundary_has_type(const cs_boundary_t *boundaries,
189 int type_flag);
190
191/*----------------------------------------------------------------------------*/
192/*
193 * \brief Retrieve the related id associated to a boundary from its zone id
194 *
195 * \param[in] boundaries pointer to a cs_boundary_t structure
196 * \param[in] z_id id of the related zone
197 *
198 * \return the associated boundary id in the boundary list
199 */
200/*----------------------------------------------------------------------------*/
201
202int
204 int z_id);
205
206/*----------------------------------------------------------------------------*/
207/*
208 * \brief Set the default boundary related to the given \ref cs_boundary_t
209 * structure
210 *
211 * \param[in, out] boundaries pointer to a structure storing boundary info
212 * \param[in] type type of boundary to set
213 */
214/*----------------------------------------------------------------------------*/
215
216void
218 cs_boundary_type_t type);
219
220/*----------------------------------------------------------------------------*/
221/*
222 * \brief Create a default boundary structure for the computational domain
223 *
224 * \param[in] category default type of boundary to set
225 * \param[in] default_type default type of boundary to set
226 *
227 * \return a pointer to the new allocated structure
228 */
229/*----------------------------------------------------------------------------*/
230
233 cs_boundary_type_t default_type);
234
235/*----------------------------------------------------------------------------*/
236/*
237 * \brief Free all metadate related to the domain boundaries
238 *
239 * \param[in, out] p_boundaries pointer to the structure to free
240 */
241/*----------------------------------------------------------------------------*/
242
243void
244cs_boundary_free(cs_boundary_t **p_boundaries);
245
246/*----------------------------------------------------------------------------*/
247/*
248 * \brief Add a new boundary type for a given boundary zone
249 *
250 * \param[in, out] bdy pointer to a structure storing boundary info
251 * \param[in] type type of boundary to set
252 * \param[in] zone_name name of the zone related to this boundary
253 */
254/*----------------------------------------------------------------------------*/
255
256void
259 const char *zone_name);
260
261/*----------------------------------------------------------------------------*/
262/*
263 * \brief Build an array on boundary faces which specifies the boundary type
264 * for each face.
265 *
266 * \param[in] boundaries pointer to the domain boundaries
267 * \param[in] n_b_faces number of boundaries faces
268 * \param[in, out] bf_type boundary type flag
269 */
270/*----------------------------------------------------------------------------*/
271
272void
274 cs_lnum_t n_b_faces,
275 cs_boundary_type_t bf_type[]);
276
277/*----------------------------------------------------------------------------*/
278/*
279 * \brief Add a new zone gathering all CS_BOUNDARY_WALL type zones
280 *
281 * \param[in, out] boundaries pointer to the domain boundaries
282 */
283/*----------------------------------------------------------------------------*/
284
285void
287
288/*----------------------------------------------------------------------------*/
289/*
290 * \brief Check if one needs to perform a pressure rescaling (in case of a
291 * Dirichlet on the velocity for the whole boundary)
292 * Use in CDO schemes for Navier--Stokes
293 *
294 * \param[in] n_b_faces number of border faces
295 * \param[in] bf_type array of types of boundary for each boundary face
296 *
297 * \return 1 if a pressure rescaling is needed otherwise 0
298 */
299/*----------------------------------------------------------------------------*/
300
301int
303 const cs_boundary_type_t bf_type[]);
304
305/*----------------------------------------------------------------------------*/
306/*
307 * \brief Build a boundary type description
308 *
309 * \param[in] bdy pointer to a structure storing boundary info
310 * \param[in] b_type type flag
311 * \param[in] descr_len_max maximum name length
312 * \param[out] descr subtype name
313 */
314/*----------------------------------------------------------------------------*/
315
316void
318 cs_boundary_type_t b_type,
319 int descr_len_max,
320 char descr[]);
321
322/*----------------------------------------------------------------------------*/
323/*
324 * \brief Summarize the setup of the boundary of the computational domain
325 *
326 * \param[in] bdy pointer to a structure storing boundary info
327 */
328/*----------------------------------------------------------------------------*/
329
330void
332
333/*----------------------------------------------------------------------------*/
334
335#endif /* CS_BOUNDARY_H */
cs_boundary_flow_subtype_bits_t
Definition: cs_boundary.h:70
@ CS_BOUNDARY_FREE_INLET_OUTLET
Definition: cs_boundary.h:103
@ CS_BOUNDARY_INLET_QH
Definition: cs_boundary.h:109
@ CS_BOUNDARY_OUTLET
Definition: cs_boundary.h:82
@ CS_BOUNDARY_COUPLED_DF
Definition: cs_boundary.h:127
@ CS_BOUNDARY_FREE_SURFACE
Definition: cs_boundary.h:121
@ CS_BOUNDARY_INLET_SUBSONIC_PH
Definition: cs_boundary.h:112
@ CS_BOUNDARY_ROUGH_WALL
Definition: cs_boundary.h:91
@ CS_BOUNDARY_SYMMETRY
Definition: cs_boundary.h:85
@ CS_BOUNDARY_INLET
Definition: cs_boundary.h:79
@ CS_BOUNDARY_SLIDING_WALL
Definition: cs_boundary.h:94
@ CS_BOUNDARY_MAPPED
Definition: cs_boundary.h:130
@ CS_BOUNDARY_IMPOSED_P
Definition: cs_boundary.h:100
@ CS_BOUNDARY_IMPOSED_VEL
Definition: cs_boundary.h:97
@ CS_BOUNDARY_CONVECTIVE_INLET
Definition: cs_boundary.h:106
@ CS_BOUNDARY_COUPLED
Definition: cs_boundary.h:124
@ CS_BOUNDARY_WALL
Definition: cs_boundary.h:76
@ CS_BOUNDARY_SUBSONIC
Definition: cs_boundary.h:115
@ CS_BOUNDARY_SUPERSONIC
Definition: cs_boundary.h:118
int cs_boundary_type_t
Definition: cs_boundary.h:65
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.cpp:429
void cs_boundary_free(cs_boundary_t **p_boundaries)
Free all metadate related to the domain boundaries.
Definition: cs_boundary.cpp: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.cpp:649
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.cpp:456
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.cpp: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.cpp: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.cpp:396
cs_boundary_category_t
Definition: cs_boundary.h:55
@ CS_BOUNDARY_CATEGORY_ALE
Definition: cs_boundary.h:58
@ CS_BOUNDARY_CATEGORY_FLOW
Definition: cs_boundary.h:57
@ CS_BOUNDARY_CATEGORY_RADIATIVE
Definition: cs_boundary.h:59
void cs_boundary_log_setup(const cs_boundary_t *bdy)
Summarize the setup of the boundary of the computational domain.
Definition: cs_boundary.cpp:682
void cs_boundary_def_wall_zones(cs_boundary_t *boundaries)
Add a new zone gathering all CS_BOUNDARY_WALL zone type.
Definition: cs_boundary.cpp:574
cs_boundary_t * cs_glob_boundaries
cs_boundary_ale_subtype_bits_t
Definition: cs_boundary.h:137
@ CS_BOUNDARY_ALE_EXTERNAL_COUPLING
Definition: cs_boundary.h:144
@ CS_BOUNDARY_ALE_IMPOSED_DISP
Definition: cs_boundary.h:142
@ CS_BOUNDARY_ALE_SLIDING
Definition: cs_boundary.h:140
@ CS_BOUNDARY_ALE_FIXED
Definition: cs_boundary.h:139
@ CS_BOUNDARY_ALE_INTERNAL_COUPLING
Definition: cs_boundary.h:143
@ CS_BOUNDARY_ALE_IMPOSED_VEL
Definition: cs_boundary.h:141
@ CS_BOUNDARY_ALE_FREE_SURFACE
Definition: cs_boundary.h:145
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.cpp: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.cpp:370
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:325
Structure storing information related to the "physical" boundaries associated with the computational ...
Definition: cs_boundary.h:154
cs_boundary_type_t default_type
Definition: cs_boundary.h:157
int n_boundaries
Definition: cs_boundary.h:159
int * zone_ids
Definition: cs_boundary.h:161
cs_boundary_category_t category
Definition: cs_boundary.h:156
cs_boundary_type_t * types
Definition: cs_boundary.h:160