1 #ifndef __CS_WALL_FUNCTIONS_H__
2 #define __CS_WALL_FUNCTIONS_H__
135 cs_wall_functions_1scale_power(
cs_real_t l_visc,
149 const double ydvisc = y / l_visc;
155 *
yplus = *ustar * ydvisc;
160 *ustar = sqrt(
vel / ydvisc);
161 *
yplus = *ustar * ydvisc;
206 cs_wall_functions_1scale_log(
cs_lnum_t ifac,
221 double ustarwer, ustarmin, ustaro, ydvisc;
230 reynolds =
vel * ydvisc;
239 *ustar = sqrt(
vel / ydvisc);
240 *
yplus = *ustar * ydvisc;
256 ustaro =
CS_MAX(ustarwer, ustarmin);
261 for (iter = 0; iter < niter_max
262 && fabs(*ustar - ustaro) >=
eps * ustaro; iter++) {
268 if (iter >= niter_max) {
269 bft_printf(
_(
"WARNING: non-convergence in the computation\n"
270 "******** of the friction velocity\n\n"
272 "friction vel: %f \n" ), (
long)ifac, *ustar);
276 *
yplus = *ustar * ydvisc;
307 f_blend = exp(-0.25*cuv*pow(yp,3));
308 uplus = f_blend*yp + (log(yp)/
ka +B)*(1.-exp(-pow(yp/y0,n)))*(1-f_blend);
331 dupdyp = exp(-0.25*cuv*pow(yp,3))
332 - 0.75*cuv*pow(yp,3.)*exp(-0.25*cuv*pow(yp,3.))
333 + n*(1.-exp(-0.25*cuv*pow(yp,3.)))*(pow(yp,n-1.)/pow(y0,n))
334 *exp(-pow(yp/y0,n))*((1./
ka)*log(yp)+B)
335 + 0.75*cuv*pow(yp,2.)*exp(-0.25*cuv*pow(yp,3.))
336 *(1.-exp(-pow(yp/y0,n)))*((1./
ka)*log(yp)+B)
337 + (1./
ka/yp)*(1.-exp(-pow(yp/y0,n)))*(1-exp(-0.25*cuv*pow(yp,3.)));
368 cs_wall_functions_2scales_continuous(
cs_real_t rnnb,
384 double Re, g, t_visc_durb;
394 Re = sqrt(kinetic_en) * y / l_visc;
399 + g * l_visc *
vel/y);
402 *
yplus = *uk * y / l_visc;
405 *ustar =
vel / uplus;
407 if (*
yplus < 1.e-1) {
420 cstcuv, csty0, cstN);
425 *ypup = *
yplus / uplus;
439 assert(turb_model != NULL);
440 if (turb_model->
itytur == 3)
441 t_visc_durb = t_visc / (kinetic_en *
cs_turb_cmu ) * rnnb * 0.22;
443 t_visc_durb = t_visc;
446 = 1. - *ypup * (2. * sqrt(l_visc / t_visc_durb * dup1 * (1. - dup1))
483 cs_wall_functions_2scales_log(
cs_real_t l_visc,
499 double rcprod, ml_visc, Re, g;
504 Re = sqrt(kinetic_en) * y / l_visc;
508 + g * l_visc *
vel / y);
510 *
yplus = *uk * y / l_visc;
527 if (*
yplus > 1.e-12) {
566 cs_wall_functions_2scales_scalable(
cs_real_t l_visc,
585 double rcprod, ml_visc, Re, g;
589 Re = sqrt(kinetic_en) * y / l_visc;
593 + g * l_visc *
vel / y);
595 *
yplus = *uk * y / l_visc;
599 *
yplus = *uk * y / l_visc;
644 static double aa[11] = {-0.0091921, 3.9577, 0.031578,
645 -0.51013, -2.3254, -0.72665,
646 2.969, 0.48506, -1.5944,
649 cs_real_t y1,y2,y3,y4,y5,y6,y7,y8,y9,y10, uplus;
651 y1 = 0.25 * log(
yplus);
715 cs_wall_functions_2scales_vdriest(
cs_real_t rnnb,
732 double urplus, d_up, lmk15;
745 cs_real_t dyrp = 0.9 * (sqrt(krp) - krp * exp(-krp / 6.));
750 else if (dyrp <= 200.)
751 d_up = _vdriest_dupdyp_integral(dyrp);
755 if (yrplus <= 1.e-1) {
770 }
else if (yrplus <= 200.) {
772 urplus = _vdriest_dupdyp_integral(yrplus);
777 *ypup = *
yplus / (urplus-d_up);
786 *cofimp = 1. - (2. / (1. + *lmk) - 1. / (1. + lmk15)) * *ypup;
796 *ypup = *
yplus / (urplus-d_up);
805 *cofimp = 1. - (2. / *lmk - 1. / lmk15) * *ypup;
810 *ustar =
vel / (urplus-d_up);
849 cs_wall_functions_2scales_smooth_rough(
cs_real_t l_visc,
869 double rcprod, ml_visc, Re, g;
891 Re = sqrt(kinetic_en) * (y + y0) / l_visc;
895 + g * l_visc *
vel / (y + y0));
898 *
yplus = *uk * y / l_visc;
901 *dplus = *uk * y0 / l_visc;
924 *ustar =
vel / uplus;
926 bft_printf(
"uet=%f, u=%f, uplus=%f, yk=%f, vel=%f, duplus=%f\n", *ustar,
vel, uplus, *
yplus,
vel, 1./uplus);
928 *ypup = *
yplus / uplus;
933 *cofimp = 1. - *
yplus / uplus
961 cs_wall_functions_disabled(
cs_real_t l_visc,
983 *ustar = sqrt(
vel * l_visc / y);
984 *
yplus = *ustar * y / l_visc;
1036 cs_wall_functions_s_arpaci_larsen(
cs_real_t l_visc,
1082 if (
yplus > (*yplim)) {
1084 (*htur) = prl *
yplus / tplus;
1093 (*yplim) = pow(1000./prl, 1./3.);
1095 a2 = 15.*pow(prl, 2./3.);
1099 (*htur) = prl *
yplus / tplus;
1105 (*htur) = prl *
yplus / tplus;
1138 cs_wall_functions_s_vdriest(
cs_real_t prl,
1146 const int ninter_max = 100;
1158 int npeff =
CS_MAX((
int)(ypint / ypmax * (
double)(ninter_max)), 1);
1160 double dy = ypint / (double)(npeff);
1165 for (
int ip = 1; ip <= npeff; ip++) {
1166 double yp = ypint * (double)(ip) / (double)(npeff);
1168 stplus += dy / (1. + prlrat * 0.5 * (nut1 + nut2));
1172 if (
yplus > ypint) {
1174 stplus += log( (1. + r*
yplus) / (1. + r*ypint)) / r;
1177 if (stplus >= 1.e-6)
1178 *htur =
yplus / stplus;
1203 cs_wall_functions_s_smooth_rough(
cs_real_t l_visc,
1234 (*htur) = prl *
yplus / tplus;
int bft_printf(const char *const format,...)
Replacement for printf() with modifiable behavior.
Definition: bft_printf.c:140
#define BEGIN_C_DECLS
Definition: cs_defs.h:492
double cs_real_t
Floating-point value.
Definition: cs_defs.h:304
#define CS_MIN(a, b)
Definition: cs_defs.h:455
#define _(String)
Definition: cs_defs.h:63
#define CS_MAX(a, b)
Definition: cs_defs.h:456
#define CS_PROCF(x, y)
Definition: cs_defs.h:506
#define CS_UNUSED(x)
Definition: cs_defs.h:478
#define END_C_DECLS
Definition: cs_defs.h:493
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:298
@ eps
Definition: cs_field_pointer.h:71
@ vel
Definition: cs_field_pointer.h:68
@ yplus
Definition: cs_field_pointer.h:242
const cs_real_t cs_math_epzero
const double cs_turb_bpow
Definition: cs_turbulence_model.c:435
const double cs_turb_cstlog_rough
Definition: cs_turbulence_model.c:418
double cs_turb_cstlog_alpha
Definition: cs_turbulence_model.c:429
double cs_turb_crij2
Definition: cs_turbulence_model.c:486
const double cs_turb_vdriest
Definition: cs_turbulence_model.c:396
const double cs_turb_cstlog
Definition: cs_turbulence_model.c:407
double cs_turb_crij1
Definition: cs_turbulence_model.c:480
double cs_turb_cmu025
Definition: cs_turbulence_model.c:449
const double cs_turb_xkappa
Definition: cs_turbulence_model.c:387
cs_turb_model_t * cs_get_glob_turb_model(void)
Provide write access to turbulence model structure.
Definition: cs_turbulence_model.c:1432
double cs_turb_dpow
Definition: cs_turbulence_model.c:438
const double cs_turb_apow
Definition: cs_turbulence_model.c:432
double cs_turb_cmu
Definition: cs_turbulence_model.c:446
cs_wall_f_s_type_t
Definition: cs_wall_functions.h:73
@ CS_WALL_F_S_SMOOTH_ROUGH
Definition: cs_wall_functions.h:80
@ CS_WALL_F_S_MONIN_OBUKHOV
Definition: cs_wall_functions.h:79
@ CS_WALL_F_S_VDRIEST
Definition: cs_wall_functions.h:77
@ CS_WALL_F_S_ARPACI_LARSEN
Definition: cs_wall_functions.h:76
@ CS_WALL_F_S_UNSET
Definition: cs_wall_functions.h:75
@ CS_WALL_F_S_LOUIS
Definition: cs_wall_functions.h:78
void cs_wall_functions_scalar(cs_wall_f_s_type_t iwalfs, cs_real_t l_visc, cs_real_t prl, cs_real_t prt, cs_real_t rough_t, cs_real_t uk, cs_real_t yplus, cs_real_t dplus, cs_real_t *htur, cs_real_t *yplim)
Compute the correction of the exchange coefficient between the fluid and the wall for a turbulent flo...
Definition: cs_wall_functions.c:540
const cs_wall_functions_t * cs_glob_wall_functions
void hturbp(const int *const iwalfs, const cs_real_t *const l_visc, const cs_real_t *const prl, const cs_real_t *const prt, const cs_real_t *const rough_t, const cs_real_t *const uk, const cs_real_t *const yplus, const cs_real_t *const dplus, cs_real_t *htur, cs_real_t *yplim)
Definition: cs_wall_functions.c:270
void cs_wall_functions_velocity(cs_wall_f_type_t iwallf, cs_lnum_t ifac, cs_real_t l_visc, cs_real_t t_visc, cs_real_t vel, cs_real_t y, cs_real_t rough_d, cs_real_t rnnb, cs_real_t kinetic_en, int *iuntur, cs_lnum_t *nsubla, cs_lnum_t *nlogla, cs_real_t *ustar, cs_real_t *uk, cs_real_t *yplus, cs_real_t *ypup, cs_real_t *cofimp, cs_real_t *dplus)
Compute the friction velocity and / .
Definition: cs_wall_functions.c:340
cs_wall_f_type_t
Definition: cs_wall_functions.h:59
@ CS_WALL_F_1SCALE_LOG
Definition: cs_wall_functions.h:64
@ CS_WALL_F_1SCALE_POWER
Definition: cs_wall_functions.h:63
@ CS_WALL_F_2SCALES_SMOOTH_ROUGH
Definition: cs_wall_functions.h:68
@ CS_WALL_F_2SCALES_LOG
Definition: cs_wall_functions.h:65
@ CS_WALL_F_2SCALES_VDRIEST
Definition: cs_wall_functions.h:67
@ CS_WALL_F_DISABLED
Definition: cs_wall_functions.h:62
@ CS_WALL_F_UNSET
Definition: cs_wall_functions.h:61
@ CS_WALL_F_2SCALES_CONTINUOUS
Definition: cs_wall_functions.h:69
@ CS_WALL_F_SCALABLE_2SCALES_LOG
Definition: cs_wall_functions.h:66
void wallfunctions(const int *const iwallf, const cs_lnum_t *const ifac, const cs_real_t *const viscosity, const cs_real_t *const t_visc, const cs_real_t *const vel, const cs_real_t *const y, const cs_real_t *const rough_d, const cs_real_t *const rnnb, const cs_real_t *const kinetic_en, int *iuntur, cs_lnum_t *nsubla, cs_lnum_t *nlogla, cs_real_t *ustar, cs_real_t *uk, cs_real_t *yplus, cs_real_t *ypup, cs_real_t *cofimp, cs_real_t *dplus)
Definition: cs_wall_functions.c:222
cs_wall_functions_t * cs_get_glob_wall_functions(void)
Definition: cs_wall_functions.c:306
double precision epzero
epsilon
Definition: cstnum.f90:40
real(c_double), pointer, save ypluli
limit value of for the viscous sublayer. ypluli depends on the chosen wall function: it is initializ...
Definition: cstphy.f90:303
integer(c_int), pointer, save iwallf
Wall functions Indicates the type of wall function used for the velocity boundary conditions on a fri...
Definition: optcal.f90:562
integer(c_int), pointer, save iwalfs
Wall functions for scalar.
Definition: optcal.f90:567
double precision, dimension(ncharm), save a2
Definition: cpincl.f90:233
double precision, dimension(4, npot), save ka
Definition: ppcpfu.f90:159
Turbulence model general options descriptor.
Definition: cs_turbulence_model.h:114
int itytur
Definition: cs_turbulence_model.h:138
wall functions descriptor.
Definition: cs_wall_functions.h:87
double ypluli
Definition: cs_wall_functions.h:98
cs_wall_f_s_type_t iwalfs
Definition: cs_wall_functions.h:91
int iwallt
Definition: cs_wall_functions.h:93
cs_wall_f_type_t iwallf
Definition: cs_wall_functions.h:89