8.2
general documentation
Loading...
Searching...
No Matches
cs_turbulence_bc.h
Go to the documentation of this file.
1#ifndef __CS_TURBULENCE_BC_H__
2#define __CS_TURBULENCE_BC_H__
3
4/*============================================================================
5 * Base turbulence boundary conditions.
6 *============================================================================*/
7
8/*
9 This file is part of code_saturne, a general-purpose CFD tool.
10
11 Copyright (C) 1998-2024 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
30/*----------------------------------------------------------------------------
31 * Local headers
32 *----------------------------------------------------------------------------*/
33
34#include "cs_defs.h"
35
36/*----------------------------------------------------------------------------*/
37
39
40/*=============================================================================
41 * Macro definitions
42 *============================================================================*/
43
44/*============================================================================
45 * Type definitions
46 *============================================================================*/
47
48/*============================================================================
49 * Global variables
50 *============================================================================*/
51
52/*=============================================================================
53 * Public function prototypes
54 *============================================================================*/
55
56/*----------------------------------------------------------------------------*/
57/*
58 * Initialize turbulence model boundary condition pointers.
59 */
60/*----------------------------------------------------------------------------*/
61
62void
64
65/*----------------------------------------------------------------------------*/
66/*
67 * \brief Free memory allocations for turbulence boundary condition pointers.
68 */
69/*----------------------------------------------------------------------------*/
70
71void
73
74/*----------------------------------------------------------------------------*/
75/*
76 * \brief Calculation of \f$ u^\star \f$, \f$ k \f$ and \f$\varepsilon \f$
77 * from a diameter \f$ D_H \f$ and the reference velocity \f$ U_{ref} \f$
78 * for a circular duct flow with smooth wall
79 * (use for inlet boundary conditions).
80 *
81 * Both \f$ u^\star \f$ and\f$ (k,\varepsilon )\f$ are returned, so that
82 * the user may compute other values of \f$ k \f$ and \f$ \varepsilon \f$
83 * with \f$ u^\star \f$.
84 *
85 * We use the laws from Idel'Cik, i.e.
86 * the head loss coefficient \f$ \lambda \f$ is defined by:
87 * \f[ |\dfrac{\Delta P}{\Delta x}| =
88 * \dfrac{\lambda}{D_H} \frac{1}{2} \rho U_{ref}^2 \f]
89 *
90 * then the relation reads \f$u^\star = U_{ref} \sqrt{\dfrac{\lambda}{8}}\f$.
91 * \f$\lambda \f$ depends on the hydraulic Reynolds number
92 * \f$ Re = \dfrac{U_{ref} D_H}{ \nu} \f$ and is given by:
93 * - for \f$ Re < 2000 \f$
94 * \f[ \lambda = \dfrac{64}{Re} \f]
95 *
96 * - for \f$ Re > 4000 \f$
97 * \f[ \lambda = \dfrac{1}{( 1.8 \log_{10}(Re)-1.64 )^2} \f]
98 *
99 * - for \f$ 2000 < Re < 4000 \f$, we complete by a straight line
100 * \f[ \lambda = 0.021377 + 5.3115. 10^{-6} Re \f]
101 *
102 * From \f$ u^\star \f$, we can estimate \f$ k \f$ and \f$ \varepsilon\f$
103 * from the well known formulae of developped turbulence
104 *
105 * \f[ k = \dfrac{u^{\star 2}}{\sqrt{C_\mu}} \f]
106 * \f[ \varepsilon = \dfrac{ u^{\star 3}}{(\kappa D_H /10)} \f]
107 *
108 * \param[in] uref2 square of the reference flow velocity
109 * \param[in] dh hydraulic diameter \f$ D_H \f$
110 * \param[in] rho mass density \f$ \rho \f$
111 * \param[in] mu dynamic viscosity \f$ \nu \f$
112 * \param[out] ustar2 square of friction speed
113 * \param[out] k calculated turbulent intensity \f$ k \f$
114 * \param[out] eps calculated turbulent dissipation
115 * \f$ \varepsilon \f$
116 */
117/*----------------------------------------------------------------------------*/
118
119void
121 double dh,
122 double rho,
123 double mu,
124 double *ustar2,
125 double *k,
126 double *eps);
127
128/*----------------------------------------------------------------------------*/
129/*
130 * \brief Calculation of \f$ k \f$ and \f$\varepsilon\f$
131 * from a diameter \f$ D_H \f$, a turbulent intensity \f$ I \f$
132 * and the reference velocity \f$ U_{ref} \f$
133 * for a circular duct flow with smooth wall
134 * (for inlet boundary conditions).
135 *
136 * \f[ k = 1.5 I {U_{ref}}^2 \f]
137 * \f[ \varepsilon = 10 \dfrac{{C_\mu}^{0.75} k^{1.5}}{ \kappa D_H} \f]
138 *
139 * \param[in] uref2 square of the reference flow velocity
140 * \param[in] t_intensity turbulent intensity \f$ I \f$
141 * \param[in] dh hydraulic diameter \f$ D_H \f$
142 * \param[out] k calculated turbulent intensity \f$ k \f$
143 * \param[out] eps calculated turbulent dissipation
144 * \f$ \varepsilon \f$
145 */
146/*----------------------------------------------------------------------------*/
147
148void
150 double t_intensity,
151 double dh,
152 double *k,
153 double *eps);
154
155/*----------------------------------------------------------------------------*/
156/*
157 * \brief Set inlet boundary condition values for turbulence variables based
158 * on a diameter \f$ D_H \f$ and the reference velocity \f$ U_{ref} \f$
159 * for a circular duct flow with smooth wall
160 * (use for inlet boundary conditions).
161 *
162 * We use the laws from Idel'Cik, i.e.
163 * the head loss coefficient \f$ \lambda \f$ is defined by:
164 * \f[ |\dfrac{\Delta P}{\Delta x}| =
165 * \dfrac{\lambda}{D_H} \frac{1}{2} \rho U_{ref}^2 \f]
166 *
167 * then the relation reads \f$u^\star = U_{ref} \sqrt{\dfrac{\lambda}{8}}\f$.
168 * \f$\lambda \f$ depends on the hydraulic Reynolds number
169 * \f$ Re = \dfrac{U_{ref} D_H}{ \nu} \f$ and is given by:
170 * - for \f$ Re < 2000 \f$
171 * \f[ \lambda = \dfrac{64}{Re} \f]
172 *
173 * - for \f$ Re > 4000 \f$
174 * \f[ \lambda = \dfrac{1}{( 1.8 \log_{10}(Re)-1.64 )^2} \f]
175 *
176 * - for \f$ 2000 < Re < 4000 \f$, we complete by a straight line
177 * \f[ \lambda = 0.021377 + 5.3115. 10^{-6} Re \f]
178 *
179 * From \f$ u^\star \f$, we can estimate \f$ k \f$ and \f$ \varepsilon\f$
180 * from the well known formulae of developped turbulence
181 *
182 * \param[in] face_id boundary face id
183 * \param[in] uref2 square of the reference flow velocity
184 * \param[in] dh hydraulic diameter \f$ D_H \f$
185 * \param[in] rho mass density \f$ \rho \f$
186 * \param[in] mu dynamic viscosity \f$ \nu \f$
187 */
188/*----------------------------------------------------------------------------*/
189
190void
192 double uref2,
193 double dh,
194 double rho,
195 double mu);
196
197/*----------------------------------------------------------------------------*/
198/*
199 * \brief Set inlet boundary condition values for turbulence variables based
200 * on a diameter \f$ D_H \f$, a turbulent intensity \f$ I \f$
201 * and the reference velocity \f$ U_{ref} \f$
202 * for a circular duct flow with smooth wall.
203 *
204 * \param[in] face_id boundary face id
205 * \param[in] uref2 square of the reference flow velocity
206 * \param[in] t_intensity turbulent intensity \f$ I \f$
207 * \param[in] dh hydraulic diameter \f$ D_H \f$
208 */
209/*----------------------------------------------------------------------------*/
210
211void
213 double uref2,
214 double t_intensity,
215 double dh);
216
217/*----------------------------------------------------------------------------*/
218/*
219 * \brief Set inlet boundary condition values for turbulence variables based
220 * on given k and epsilon values.
221 *
222 * \param[in] face_id boundary face id
223 * \param[in] k turbulent kinetic energy
224 * \param[in] eps turbulent dissipation
225 */
226/*----------------------------------------------------------------------------*/
227
228void
230 double k,
231 double eps);
232
233/*----------------------------------------------------------------------------*/
234/*
235 * \brief Set inlet boundary condition values for turbulence variables based
236 * on a diameter \f$ D_H \f$ and the reference velocity \f$ U_{ref} \f$
237 * for a circular duct flow with smooth wall, only if not already set.
238 *
239 * Apart from assigning values where not already initialized, this function
240 * is similar to \ref cs_turbulence_bc_inlet_hyd_diam.
241 *
242 * \param[in] face_id boundary face id
243 * \param[in] vel_dir velocity direction (not normalized, or NULL)
244 * \param[in] shear_dir shear direction (or NULL), it also contains the
245 * level of anisotropy (Rnt = a_nt k)
246 * \param[in] uref2 square of the reference flow velocity
247 * \param[in] dh hydraulic diameter \f$ D_H \f$
248 * \param[in] rho mass density \f$ \rho \f$
249 * \param[in] mu dynamic viscosity \f$ \nu \f$
250 */
251/*----------------------------------------------------------------------------*/
252
253void
255 double vel_dir[],
256 double shear_dir[],
257 double uref2,
258 double dh,
259 double rho,
260 double mu);
261
262/*----------------------------------------------------------------------------*/
263/*
264 * \brief Set inlet boundary condition values for turbulence variables based
265 * on a diameter \f$ D_H \f$, a turbulent intensity \f$ I \f$
266 * and the reference velocity \f$ U_{ref} \f$
267 * for a circular duct flow with smooth wall, only if not already set.
268 *
269 * Apart from assigning values where not already initialized, this function
270 * is similar to \ref cs_turbulence_bc_inlet_turb_intensity.
271 *
272 * \param[in] face_id boundary face id
273 * \param[in] uref2 square of the reference flow velocity
274 * \param[in] t_intensity turbulent intensity \f$ I \f$
275 * \param[in] dh hydraulic diameter \f$ D_H \f$
276 */
277/*----------------------------------------------------------------------------*/
278
279void
281 double uref2,
282 double t_intensity,
283 double dh);
284
285/*----------------------------------------------------------------------------*/
286/*
287 * \brief Set inlet boundary condition values for turbulence variables based
288 * on given k and epsilon values only if not already initialized.
289 *
290 * \param[in] face_id boundary face id
291 * \param[in] k turbulent kinetic energy
292 * \param[in] eps turbulent dissipation
293 * \param[in] vel_dir velocity direction
294 * \param[in] shear_dir shear direction
295 */
296/*----------------------------------------------------------------------------*/
297
298void
300 double k,
301 double eps,
302 double vel_dir[],
303 double shear_dir[]);
304
305/*----------------------------------------------------------------------------*/
306/*
307 * \brief Assign homogeneous Neumann turbulent boundary conditions to
308 * a given face.
309 *
310 * This is useful for outgoing flow.
311 */
312/*----------------------------------------------------------------------------*/
313
314void
316
317/*----------------------------------------------------------------------------*/
318/*
319 * \brief Compute matrix \f$\tens{\alpha}\f$ used in the computation of the
320 * Reynolds stress tensor boundary conditions.
321 *
322 * We note \f$\tens{R}_g\f$ the Reynolds Stress tensor in the global reference
323 * frame (mesh reference frame) and \f$\tens{R}_l\f$ the Reynolds stress
324 * tensor in the local reference frame (reference frame associated to the
325 * boundary face).
326 *
327 * \f$\tens{P}_{lg}\f$ is the change of basis orthogonal matrix from local
328 * to global reference frame.
329
330 * \f$\tens{\alpha}\f$ is a 6 by 6 matrix such that:
331 * \f[
332 * \vect{R}_{g,\fib} = \tens{\alpha} \vect{R}_{g,\centip} + \vect{R}_{g}^*
333 * \f]
334 * where symetric tensors \f$\tens{R}_g\f$ have been unfolded as follows:
335 * \f[
336 * \vect{R}_g = \transpose{\left(R_{g,11},R_{g,22},R_{g,33},
337 * R_{g,12},R_{g,13},R_{g,23}\right)}
338 * \f].
339 *
340 * \f$\tens{\alpha}\f$ is defined so that \f$ \tens{R}_{g,\fib} \f$ is computed
341 * as a function of \f$\tens{R}_{g,\centip}\f$ as follows:
342 * \f[
343 * \tens{R}_{g,\fib}=\tens{P}_{lg}\tens{R}_{l,\fib}\transpose{\tens{P}_{lg}}
344 * \f]
345 *
346 * with
347 * \f[
348 * \tens{R}_{l,\fib} =
349 * \begin{bmatrix}
350 * R_{l,11,\centip} & u^* u_k & c R_{l,13,\centip}\\
351 * u^* u_k & R_{l,22,\centip} & 0 \\
352 * c R_{l,13,\centip} & 0 & R_{l,33,\centip}
353 * \end{bmatrix} +
354 * \underbrace{\begin{bmatrix}
355 * 0 & u^* u_k & 0 \\
356 * u^* u_k & 0 & 0 \\
357 * 0 & 0 & 0
358 * \end{bmatrix}}_{\tens{R}_l^*}
359 * \f]
360 *
361 * and
362 * \f$\tens{R}_{l,\centip}=\transpose{\tens{P}_{lg}}\tens{R}_{g,\centip}
363 * \tens{P}_{lg}\f$.
364 *
365 * Constant c is chosen depending on the type of the boundary face:
366 * \f$c = 0\f$ at a wall face, \f$c = 1\f$ at a symmetry face.
367 *
368 * \param[in] is_sym Constant c in description above
369 * (1 at a symmetry face, 0 at a wall face)
370 * \param[in] p_lg change of basis matrix (local to global)
371 * \param[out] alpha transformation matrix
372 */
373/*----------------------------------------------------------------------------*/
374
375void
377 cs_real_t p_lg[3][3],
378 cs_real_t alpha[6][6]);
379
380/*----------------------------------------------------------------------------*/
381
383
384#endif /* __CS_TURBULENCE_BC_H__ */
#define BEGIN_C_DECLS
Definition cs_defs.h:528
double cs_real_t
Floating-point value.
Definition cs_defs.h:332
#define END_C_DECLS
Definition cs_defs.h:529
int cs_lnum_t
local mesh entity id
Definition cs_defs.h:325
@ k
Definition cs_field_pointer.h:70
@ mu
Definition cs_field_pointer.h:103
@ eps
Definition cs_field_pointer.h:71
@ rho
Definition cs_field_pointer.h:97
void cs_turbulence_bc_ke_turb_intensity(double uref2, double t_intensity, double dh, double *k, double *eps)
Calculation of and from a diameter , a turbulent intensity and the reference velocity for a circu...
Definition cs_turbulence_bc.c:827
void cs_turbulence_bc_inlet_hyd_diam(cs_lnum_t face_id, double uref2, double dh, double rho, double mu)
Set inlet boundary condition values for turbulence variables based on a diameter and the reference v...
Definition cs_turbulence_bc.c:871
void cs_turbulence_bc_set_uninit_inlet_turb_intensity(cs_lnum_t face_id, double uref2, double t_intensity, double dh)
Set inlet boundary condition values for turbulence variables based on a diameter ,...
Definition cs_turbulence_bc.c:1084
void cs_turbulence_bc_rij_transform(int is_sym, cs_real_t p_lg[3][3], cs_real_t alpha[6][6])
Compute matrix used in the computation of the Reynolds stress tensor boundary conditions.
Definition cs_turbulence_bc.c:1181
void cs_turbulence_bc_inlet_k_eps(cs_lnum_t face_id, double k, double eps)
Set inlet boundary condition values for turbulence variables based on given k and epsilon values.
Definition cs_turbulence_bc.c:923
void cs_turbulence_bc_free_pointers(void)
Free memory allocations for turbulence boundary condition pointers.
Definition cs_turbulence_bc.c:741
void cs_turbulence_bc_set_uninit_inlet_k_eps(cs_lnum_t face_id, double k, double eps, double vel_dir[], double shear_dir[])
Set inlet boundary condition values for turbulence variables based on given k and epsilon values only...
Definition cs_turbulence_bc.c:1111
void cs_turbulence_bc_ke_hyd_diam(double uref2, double dh, double rho, double mu, double *ustar2, double *k, double *eps)
Calculation of , and from a diameter and the reference velocity for a circular duct flow with smo...
Definition cs_turbulence_bc.c:795
void cs_turbulence_bc_init_pointers(void)
Initialize turbulence model boundary condition pointers.
Definition cs_turbulence_bc.c:650
void cs_turbulence_bc_inlet_turb_intensity(cs_lnum_t face_id, double uref2, double t_intensity, double dh)
Set inlet boundary condition values for turbulence variables based on a diameter ,...
Definition cs_turbulence_bc.c:899
void cs_turbulence_bc_set_hmg_neumann(cs_lnum_t face_id)
Assign homogeneous Neumann turbulent boundary conditions to a given face.
Definition cs_turbulence_bc.c:940
void cs_turbulence_bc_set_uninit_inlet_hyd_diam(cs_lnum_t face_id, double vel_dir[], double shear_dir[], double uref2, double dh, double rho, double mu)
Set inlet boundary condition values for turbulence variables based on a diameter and the reference v...
Definition cs_turbulence_bc.c:1051