8.3
general documentation
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 given k and epsilon or Rij values.
237 *
238 * \param[in] face_id boundary face id
239 * \param[in] k turbulent kinetic energy
240 * \param[in] eps turbulent dissipation
241 */
242/*----------------------------------------------------------------------------*/
243
244void
246 double k,
247 double rij[],
248 double eps);
249
250/*----------------------------------------------------------------------------*/
251/*
252 * \brief Set inlet boundary condition values for turbulence variables based
253 * on a diameter \f$ D_H \f$ and the reference velocity \f$ U_{ref} \f$
254 * for a circular duct flow with smooth wall, only if not already set.
255 *
256 * Apart from assigning values where not already initialized, this function
257 * is similar to \ref cs_turbulence_bc_inlet_hyd_diam.
258 *
259 * \param[in] face_id boundary face id
260 * \param[in] vel_dir velocity direction (not normalized, or NULL)
261 * \param[in] shear_dir shear direction (or NULL), it also contains the
262 * level of anisotropy (Rnt = a_nt k)
263 * \param[in] uref2 square of the reference flow velocity
264 * \param[in] dh hydraulic diameter \f$ D_H \f$
265 * \param[in] rho mass density \f$ \rho \f$
266 * \param[in] mu dynamic viscosity \f$ \nu \f$
267 */
268/*----------------------------------------------------------------------------*/
269
270void
272 double vel_dir[],
273 double shear_dir[],
274 double uref2,
275 double dh,
276 double rho,
277 double mu);
278
279/*----------------------------------------------------------------------------*/
280/*
281 * \brief Set inlet boundary condition values for turbulence variables based
282 * on a diameter \f$ D_H \f$, a turbulent intensity \f$ I \f$
283 * and the reference velocity \f$ U_{ref} \f$
284 * for a circular duct flow with smooth wall, only if not already set.
285 *
286 * Apart from assigning values where not already initialized, this function
287 * is similar to \ref cs_turbulence_bc_inlet_turb_intensity.
288 *
289 * \param[in] face_id boundary face id
290 * \param[in] uref2 square of the reference flow velocity
291 * \param[in] t_intensity turbulent intensity \f$ I \f$
292 * \param[in] dh hydraulic diameter \f$ D_H \f$
293 */
294/*----------------------------------------------------------------------------*/
295
296void
298 double uref2,
299 double t_intensity,
300 double dh);
301
302/*----------------------------------------------------------------------------*/
303/*
304 * \brief Set inlet boundary condition values for turbulence variables based
305 * on given k and epsilon values only if not already initialized.
306 *
307 * \param[in] face_id boundary face id
308 * \param[in] k turbulent kinetic energy
309 * \param[in] eps turbulent dissipation
310 * \param[in] vel_dir velocity direction
311 * \param[in] shear_dir shear direction
312 */
313/*----------------------------------------------------------------------------*/
314
315void
317 double k,
318 double eps,
319 double vel_dir[],
320 double shear_dir[]);
321
322/*----------------------------------------------------------------------------*/
323/*
324 * \brief Assign homogeneous Neumann turbulent boundary conditions to
325 * a given face.
326 *
327 * This is useful for outgoing flow.
328 */
329/*----------------------------------------------------------------------------*/
330
331void
333
334/*----------------------------------------------------------------------------*/
335/*
336 * \brief Compute matrix \f$\tens{\alpha}\f$ used in the computation of the
337 * Reynolds stress tensor boundary conditions.
338 *
339 * We note \f$\tens{R}_g\f$ the Reynolds Stress tensor in the global reference
340 * frame (mesh reference frame) and \f$\tens{R}_l\f$ the Reynolds stress
341 * tensor in the local reference frame (reference frame associated to the
342 * boundary face).
343 *
344 * \f$\tens{P}_{lg}\f$ is the change of basis orthogonal matrix from local
345 * to global reference frame.
346
347 * \f$\tens{\alpha}\f$ is a 6 by 6 matrix such that:
348 * \f[
349 * \vect{R}_{g,\fib} = \tens{\alpha} \vect{R}_{g,\centip} + \vect{R}_{g}^*
350 * \f]
351 * where symetric tensors \f$\tens{R}_g\f$ have been unfolded as follows:
352 * \f[
353 * \vect{R}_g = \transpose{\left(R_{g,11},R_{g,22},R_{g,33},
354 * R_{g,12},R_{g,13},R_{g,23}\right)}
355 * \f].
356 *
357 * \f$\tens{\alpha}\f$ is defined so that \f$ \tens{R}_{g,\fib} \f$ is computed
358 * as a function of \f$\tens{R}_{g,\centip}\f$ as follows:
359 * \f[
360 * \tens{R}_{g,\fib}=\tens{P}_{lg}\tens{R}_{l,\fib}\transpose{\tens{P}_{lg}}
361 * \f]
362 *
363 * with
364 * \f[
365 * \tens{R}_{l,\fib} =
366 * \begin{bmatrix}
367 * R_{l,11,\centip} & u^* u_k & c R_{l,13,\centip}\\
368 * u^* u_k & R_{l,22,\centip} & 0 \\
369 * c R_{l,13,\centip} & 0 & R_{l,33,\centip}
370 * \end{bmatrix} +
371 * \underbrace{\begin{bmatrix}
372 * 0 & u^* u_k & 0 \\
373 * u^* u_k & 0 & 0 \\
374 * 0 & 0 & 0
375 * \end{bmatrix}}_{\tens{R}_l^*}
376 * \f]
377 *
378 * and
379 * \f$\tens{R}_{l,\centip}=\transpose{\tens{P}_{lg}}\tens{R}_{g,\centip}
380 * \tens{P}_{lg}\f$.
381 *
382 * Constant c is chosen depending on the type of the boundary face:
383 * \f$c = 0\f$ at a wall face, \f$c = 1\f$ at a symmetry face.
384 *
385 * \param[in] is_sym Constant c in description above
386 * (1 at a symmetry face, 0 at a wall face)
387 * \param[in] p_lg change of basis matrix (local to global)
388 * \param[out] alpha transformation matrix
389 */
390/*----------------------------------------------------------------------------*/
391
392void
394 cs_real_t p_lg[3][3],
395 cs_real_t alpha[6][6]);
396
397/*----------------------------------------------------------------------------*/
398
400
401#endif /* __CS_TURBULENCE_BC_H__ */
#define BEGIN_C_DECLS
Definition: cs_defs.h:542
double cs_real_t
Floating-point value.
Definition: cs_defs.h:342
#define END_C_DECLS
Definition: cs_defs.h:543
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:335
@ k
Definition: cs_field_pointer.h:72
@ mu
Definition: cs_field_pointer.h:105
@ eps
Definition: cs_field_pointer.h:73
@ rho
Definition: cs_field_pointer.h:99
@ rij
Definition: cs_field_pointer.h:75
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.cpp:728
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.cpp:772
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.cpp:985
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.cpp:1082
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.cpp:824
void cs_turbulence_bc_free_pointers(void)
Free memory allocations for turbulence boundary condition pointers.
Definition: cs_turbulence_bc.cpp:642
void cs_turbulence_bc_set_uninit_inlet(cs_lnum_t face_num, double k, double rij[], double eps)
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.cpp:1012
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.cpp:696
void cs_turbulence_bc_init_pointers(void)
Initialize turbulence model boundary condition pointers.
Definition: cs_turbulence_bc.cpp:551
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.cpp:800
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.cpp:841
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.cpp:952
real(c_double), dimension(:), pointer, save dh
hydraulic diameter
Definition: ppincl.f90:322