My Project
programmer's documentation
Functions
cs_turbulence_bc.c File Reference
#include "cs_defs.h"
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "bft_mem.h"
#include "bft_error.h"
#include "bft_printf.h"
#include "cs_log.h"
#include "cs_field.h"
#include "cs_field_pointer.h"
#include "cs_map.h"
#include "cs_math.h"
#include "cs_parall.h"
#include "cs_mesh_location.h"
#include "cs_turbulence_model.h"
#include "cs_turbulence_bc.h"
Include dependency graph for cs_turbulence_bc.c:

Functions

void cs_turbulence_model_init_bc_ids (void)
 Initialize turbulence model boundary condition ids. More...
 
void cs_turbulence_model_free_bc_ids (void)
 Free memory allocations for turbulence boundary conditions ids. More...
 
void cs_turbulence_bc_ke_hyd_diam (double uref2, double dh, double rho, double mu, double *ustar2, double *k, double *eps)
 Calculation of $ u^\star $, $ k $ and $\varepsilon $ from a diameter $ D_H $ and the reference velocity $ U_{ref} $ for a circular duct flow with smooth wall (use for inlet boundary conditions). More...
 
void cs_turbulence_bc_ke_turb_intensity (double uref2, double t_intensity, double dh, double *k, double *eps)
 Calculation of $ k $ and $\varepsilon$ from a diameter $ D_H $, a turbulent intensity $ I $ and the reference velocity $ U_{ref} $ for a circular duct flow with smooth wall (for inlet boundary conditions). More...
 
void cs_turbulence_bc_inlet_hyd_diam (cs_lnum_t face_id, double uref2, double dh, double rho, double mu, double *rcodcl)
 Set inlet boundary condition values for turbulence variables based on a diameter $ D_H $ and the reference velocity $ U_{ref} $ for a circular duct flow with smooth wall. More...
 
void cs_turbulence_bc_inlet_turb_intensity (cs_lnum_t face_id, double uref2, double t_intensity, double dh, double *rcodcl)
 Set inlet boundary condition values for turbulence variables based on a diameter $ D_H $, a turbulent intensity $ I $ and the reference velocity $ U_{ref} $ for a circular duct flow with smooth wall. More...
 
void cs_turbulence_bc_inlet_k_eps (cs_lnum_t face_id, double k, double eps, double *rcodcl)
 Set inlet boundary condition values for turbulence variables based on given k and epsilon values. More...
 
void cs_turbulence_bc_set_uninit_inlet_k_eps (cs_lnum_t face_id, double k, double eps, double *rcodcl)
 Set inlet boundary condition values for turbulence variables based on given k and epsilon values only if not already initialized. More...
 
void cs_turbulence_bc_rij_transform (int is_sym, cs_real_t p_lg[3][3], cs_real_t alpha[6][6])
 Compute matrix $\tens{\alpha}$ used in the computation of the Reynolds stress tensor boundary conditions. More...
 

Detailed Description

Base turbulence boundary conditions.

Function Documentation

◆ cs_turbulence_bc_inlet_hyd_diam()

void cs_turbulence_bc_inlet_hyd_diam ( cs_lnum_t  face_id,
double  uref2,
double  dh,
double  rho,
double  mu,
double *  rcodcl 
)

Set inlet boundary condition values for turbulence variables based on a diameter $ D_H $ and the reference velocity $ U_{ref} $ for a circular duct flow with smooth wall.

Set inlet boundary condition values for turbulence variables based on a diameter $ D_H $ and the reference velocity $ U_{ref} $ for a circular duct flow with smooth wall (use for inlet boundary conditions).

We use the laws from Idel'Cik, i.e. the head loss coefficient $ \lambda $ is defined by:

\[ |\dfrac{\Delta P}{\Delta x}| = \dfrac{\lambda}{D_H} \frac{1}{2} \rho U_{ref}^2 \]

then the relation reads $u^\star = U_{ref} \sqrt{\dfrac{\lambda}{8}}$. $\lambda $ depends on the hydraulic Reynolds number $ Re = \dfrac{U_{ref} D_H}{ \nu} $ and is given by:

  • for $ Re < 2000 $

    \[ \lambda = \dfrac{64}{Re} \]

  • for $ Re > 4000 $

    \[ \lambda = \dfrac{1}{( 1.8 \log_{10}(Re)-1.64 )^2} \]

  • for $ 2000 < Re < 4000 $, we complete by a straight line

    \[ \lambda = 0.021377 + 5.3115. 10^{-6} Re \]

From $ u^\star $, we can estimate $ k $ and $ \varepsilon$ from the well known formulae of developped turbulence

Parameters
[in]face_idboundary face id
[in]uref2square of the reference flow velocity
[in]dhhydraulic diameter $ D_H $
[in]rhomass density $ \rho $
[in]mudynamic viscosity $ \nu $
[out]rcodclboundary condition values

◆ cs_turbulence_bc_inlet_k_eps()

void cs_turbulence_bc_inlet_k_eps ( cs_lnum_t  face_id,
double  k,
double  eps,
double *  rcodcl 
)

Set inlet boundary condition values for turbulence variables based on given k and epsilon values.

Parameters
[in]face_idboundary face id
[in]kturbulent kinetic energy
[in]epsturbulent dissipation
[out]rcodclboundary condition values

◆ cs_turbulence_bc_inlet_turb_intensity()

void cs_turbulence_bc_inlet_turb_intensity ( cs_lnum_t  face_id,
double  uref2,
double  t_intensity,
double  dh,
double *  rcodcl 
)

Set inlet boundary condition values for turbulence variables based on a diameter $ D_H $, a turbulent intensity $ I $ and the reference velocity $ U_{ref} $ for a circular duct flow with smooth wall.

Parameters
[in]face_idboundary face id
[in]uref2square of the reference flow velocity
[in]t_intensityturbulent intensity $ I $
[in]dhhydraulic diameter $ D_H $
[out]rcodclboundary condition values

◆ cs_turbulence_bc_ke_hyd_diam()

void cs_turbulence_bc_ke_hyd_diam ( double  uref2,
double  dh,
double  rho,
double  mu,
double *  ustar2,
double *  k,
double *  eps 
)

Calculation of $ u^\star $, $ k $ and $\varepsilon $ from a diameter $ D_H $ and the reference velocity $ U_{ref} $ for a circular duct flow with smooth wall (use for inlet boundary conditions).

Both $ u^\star $ and $ (k,\varepsilon )$ are returned, so that the user may compute other values of $ k $ and $ \varepsilon $ with $ u^\star $.

We use the laws from Idel'Cik, i.e. the head loss coefficient $ \lambda $ is defined by:

\[ |\dfrac{\Delta P}{\Delta x}| = \dfrac{\lambda}{D_H} \frac{1}{2} \rho U_{ref}^2 \]

then the relation reads $u^\star = U_{ref} \sqrt{\dfrac{\lambda}{8}}$. $\lambda $ depends on the hydraulic Reynolds number $ Re = \dfrac{U_{ref} D_H}{ \nu} $ and is given by:

  • for $ Re < 2000 $

    \[ \lambda = \dfrac{64}{Re} \]

  • for $ Re > 4000 $

    \[ \lambda = \dfrac{1}{( 1.8 \log_{10}(Re)-1.64 )^2} \]

  • for $ 2000 < Re < 4000 $, we complete by a straight line

    \[ \lambda = 0.021377 + 5.3115. 10^{-6} Re \]

From $ u^\star $, we can estimate $ k $ and $ \varepsilon$ from the well known formulae of developped turbulence

\[ k = \dfrac{u^{\star 2}}{\sqrt{C_\mu}} \]

\[ \varepsilon = \dfrac{ u^{\star 3}}{(\kappa D_H /10)} \]

Parameters
[in]uref2square of the reference flow velocity
[in]dhhydraulic diameter $ D_H $
[in]rhomass density $ \rho $
[in]mudynamic viscosity $ \nu $
[out]ustar2square of friction speed
[out]kcalculated turbulent intensity $ k $
[out]epscalculated turbulent dissipation $ \varepsilon $

◆ cs_turbulence_bc_ke_turb_intensity()

void cs_turbulence_bc_ke_turb_intensity ( double  uref2,
double  t_intensity,
double  dh,
double *  k,
double *  eps 
)

Calculation of $ k $ and $\varepsilon$ from a diameter $ D_H $, a turbulent intensity $ I $ and the reference velocity $ U_{ref} $ for a circular duct flow with smooth wall (for inlet boundary conditions).

\[ k = 1.5 I {U_{ref}}^2 \]

\[ \varepsilon = 10 \dfrac{{C_\mu}^{0.75} k^{1.5}}{ \kappa D_H} \]

Parameters
[in]uref2square of the reference flow velocity
[in]t_intensityturbulent intensity $ I $
[in]dhhydraulic diameter $ D_H $
[out]kcalculated turbulent intensity $ k $
[out]epscalculated turbulent dissipation $ \varepsilon $

◆ cs_turbulence_bc_rij_transform()

void cs_turbulence_bc_rij_transform ( int  is_sym,
cs_real_t  p_lg[3][3],
cs_real_t  alpha[6][6] 
)

Compute matrix $\tens{\alpha}$ used in the computation of the Reynolds stress tensor boundary conditions.

We note $\tens{R}_g$ the Reynolds Stress tensor in the global reference frame (mesh reference frame) and $\tens{R}_l$ the Reynolds stress tensor in the local reference frame (reference frame associated to the boundary face).

$\tens{P}_{lg}$ is the change of basis orthogonal matrix from local to global reference frame.

$\tens{\alpha}$ is a 6 by 6 matrix defined such that:

\[ \vect{R}_{g,\fib} = \tens{\alpha} \vect{R}_{g,\centip} + \vect{R}_{g}^* \]

where symetric tensors $\tens{R}_g$ have been unfolded as follows:

\[ \vect{R}_g = \transpose{\left(R_{g,11},R_{g,22},R_{g,33}, R_{g,12},R_{g,13},R_{g,23}\right)} \]

.

$ \tens{R}_{g,\fib} $ should be computed as a function of $\tens{R}_{g,\centip}$ as follows:

\[ \tens{R}_{g,\fib}=\tens{P}_{lg}\tens{R}_{l,\fib}\transpose{\tens{P}_{lg}} \]

with

\[ \tens{R}_{l,\fib} = \begin{bmatrix} R_{l,11,\centip} & 0 & c R_{l,13,\centip}\\ 0 & R_{l,22,\centip} & 0 \\ c R_{l,13,\centip} & 0 & R_{l,33,\centip} \end{bmatrix} + \underbrace{\begin{bmatrix} 0 & (1-c) u^* u_k & 0 \\ (1-c) u^* u_k & 0 & 0 \\ 0 & 0 & 0 \end{bmatrix}}_{\vect{R}_l^*} \]

and $\tens{R}_{l,\centip}=\transpose{\tens{P}_{lg}}\tens{R}_{g,\centip} \tens{P}_{lg}$.

Constant c is chosen depending on the type of the boundary face: $c = 0$ at a wall face, $c = 1$ at a symmetry face.

Parameters
[in]is_symConstant c in description above (1 at a symmetry face, 0 at a wall face)
[in]p_lgchange of basis matrix (local to global)
[out]alphatransformation matrix

◆ cs_turbulence_bc_set_uninit_inlet_k_eps()

void cs_turbulence_bc_set_uninit_inlet_k_eps ( cs_lnum_t  face_id,
double  k,
double  eps,
double *  rcodcl 
)

Set inlet boundary condition values for turbulence variables based on given k and epsilon values only if not already initialized.

Parameters
[in]face_idboundary face id
[in]kturbulent kinetic energy
[in]epsturbulent dissipation
[out]rcodclboundary condition values

◆ cs_turbulence_model_free_bc_ids()

void cs_turbulence_model_free_bc_ids ( void  )

Free memory allocations for turbulence boundary conditions ids.

◆ cs_turbulence_model_init_bc_ids()

void cs_turbulence_model_init_bc_ids ( void  )

Initialize turbulence model boundary condition ids.

Initialize turbulence model boundary condition ids.