1 #ifndef __CS_WALL_FUNCTIONS_H__ 2 #define __CS_WALL_FUNCTIONS_H__ 139 const double ydvisc = y / l_visc;
145 *yplus = *ustar * ydvisc;
148 if (*yplus <= ypluli) {
150 *ustar = sqrt(vel / ydvisc);
151 *yplus = *ustar * ydvisc;
211 double ustarwer, ustarmin, ustaro, ydvisc;
220 reynolds = vel * ydvisc;
227 if (reynolds <= ypluli * ypluli) {
229 *ustar = sqrt(vel / ydvisc);
230 *yplus = *ustar * ydvisc;
246 ustaro =
CS_MAX(ustarwer, ustarmin);
247 *ustar = (cs_turb_xkappa * vel + ustaro)
251 for (iter = 0; iter < niter_max
252 && fabs(*ustar - ustaro) >= eps * ustaro; iter++) {
254 *ustar = (cs_turb_xkappa * vel + ustaro)
258 if (iter >= niter_max) {
259 bft_printf(
_(
"WARNING: non-convergence in the computation\n" 260 "******** of the friction velocity\n\n" 262 "friction vel: %f \n" ), (
long)ifac, *ustar);
266 *yplus = *ustar * ydvisc;
268 *cofimp = 1. - *ypup / cs_turb_xkappa * 1.5 / *
yplus;
297 f_blend = exp(-0.25*cuv*pow(yp,3));
298 uplus = f_blend*yp + (log(yp)/ka +B)*(1.-exp(-pow(yp/y0,n)))*(1-f_blend);
321 dupdyp = exp(-0.25*cuv*pow(yp,3))
322 - 0.75*cuv*pow(yp,3.)*exp(-0.25*cuv*pow(yp,3.))
323 + n*(1.-exp(-0.25*cuv*pow(yp,3.)))*(pow(yp,n-1.)/pow(y0,n))
324 *exp(-pow(yp/y0,n))*((1./ka)*log(yp)+B)
325 + 0.75*cuv*pow(yp,2.)*exp(-0.25*cuv*pow(yp,3.))
326 *(1.-exp(-pow(yp/y0,n)))*((1./ka)*log(yp)+B)
327 + (1./ka/yp)*(1.-exp(-pow(yp/y0,n)))*(1-exp(-0.25*cuv*pow(yp,3.)));
374 double Re, g, t_visc_durb;
384 Re = sqrt(kinetic_en) * y / l_visc;
389 + g * l_visc * vel/y);
392 *yplus = *uk * y / l_visc;
395 *ustar = vel / uplus;
397 if (*yplus < 1.e-1) {
410 cstcuv, csty0, cstN);
415 *ypup = *yplus / uplus;
429 assert(turb_model != NULL);
430 if (turb_model->
itytur == 3)
431 t_visc_durb = t_visc / (kinetic_en *
cs_turb_cmu ) * rnnb * 0.22;
433 t_visc_durb = t_visc;
436 = 1. - *ypup * (2. * sqrt(l_visc / t_visc_durb * dup1 * (1. - dup1))
440 if (*yplus > ypluli) {
489 double rcprod, ml_visc, Re, g;
494 Re = sqrt(kinetic_en) * y / l_visc;
498 + g * l_visc * vel / y);
500 *yplus = *uk * y / l_visc;
503 if (*yplus > ypluli) {
517 if (*yplus > 1.e-12) {
518 *ustar = fabs(vel / *yplus);
575 double rcprod, ml_visc, Re, g;
579 Re = sqrt(kinetic_en) * y / l_visc;
583 + g * l_visc * vel / y);
585 *yplus = *uk * y / l_visc;
589 *yplus = *uk * y / l_visc;
592 if (*yplus > ypluli) {
601 *dplus = ypluli - *
yplus;
634 static double aa[11] = {-0.0091921, 3.9577, 0.031578,
635 -0.51013, -2.3254, -0.72665,
636 2.969, 0.48506, -1.5944,
639 cs_real_t y1,y2,y3,y4,y5,y6,y7,y8,y9,y10, uplus;
641 y1 = 0.25 * log(yplus);
722 double urplus, d_up, lmk15;
728 *yplus =
CS_MAX(*uk * y / l_visc, 1.e-4);
735 cs_real_t dyrp = 0.9 * (sqrt(krp) - krp * exp(-krp / 6.));
740 else if (dyrp <= 200.)
745 if (yrplus <= 1.e-1) {
760 }
else if (yrplus <= 200.) {
767 *ypup = *yplus / (urplus-d_up);
776 *cofimp = 1. - (2. / (1. + *lmk) - 1. / (1. + lmk15)) * *ypup;
786 *ypup = *yplus / (urplus-d_up);
795 *cofimp = 1. - (2. / *lmk - 1. / lmk15) * *ypup;
800 *ustar = vel / (urplus-d_up);
859 double rcprod, ml_visc, Re, g;
882 Re = sqrt(kinetic_en) * (y + y0) / l_visc;
886 + g * l_visc * vel / (y + y0));
889 *yplus = *uk * y / l_visc;
892 *dplus = *uk * y0 / l_visc;
899 if (*yplus > ypluli) {
908 *dplus = ypluli - *
yplus;
915 *ustar = vel / uplus;
917 bft_printf(
"uet=%f, u=%f, uplus=%f, yk=%f, duplus=%f\n", *ustar, vel, uplus, *yplus, 1./uplus);
919 *ypup = *yplus / uplus;
925 * ( 2. * rcprod - 1. / (2. * *yplus + *dplus));
974 *ustar = sqrt(vel * l_visc / y);
975 *yplus = *ustar * y / l_visc;
981 if (*yplus <= ypluli) {
1049 (*htur) =
CS_MAX(yplus,epzero)/
CS_MAX(yplus+dplus,epzero);
1073 if (yplus > (*yplim)) {
1074 tplus = prl*(*yplim) + prt/
cs_turb_xkappa * (log((yplus+dplus)/(*yplim)) + shift_temp);
1075 (*htur) = prl * yplus / tplus;
1084 (*yplim) = pow(1000./prl, 1./3.);
1086 a2 = 15.*pow(prl, 2./3.);
1088 if (yplus >= (*yplim) && yplus < yp2) {
1089 tplus = a2 - 500./((yplus+dplus)*(yplus+dplus));
1090 (*htur) = prl * yplus / tplus;
1096 (*htur) = prl * yplus / tplus;
1137 const int ninter_max = 100;
1149 int npeff =
CS_MAX((
int)(ypint / ypmax * (
double)(ninter_max)), 1);
1151 double dy = ypint / (double)(npeff);
1156 for (
int ip = 1; ip <= npeff; ip++) {
1157 double yp = ypint * (double)(ip) / (double)(npeff);
1159 stplus += dy / (1. + prlrat * 0.5 * (nut1 + nut2));
1163 if (yplus > ypint) {
1165 stplus += log( (1. + r*yplus) / (1. + r*ypint)) / r;
1168 if (stplus >= 1.e-6)
1169 *htur = yplus / stplus;
1218 (*htur) =
CS_MAX(yplus,epzero)/
CS_MAX(yplus+dplus,epzero);
1223 if (yplus > ypluli) {
1225 (*htur) = prl * yplus / tplus;
int itytur
Definition: cs_turbulence_model.h:139
double precision epzero
epsilon
Definition: cstnum.f90:40
Definition: cs_wall_functions.h:70
cs_wall_f_type_t iwallf
Definition: cs_wall_functions.h:84
static void cs_wall_functions_2scales_continuous(cs_real_t rnnb, cs_real_t l_visc, cs_real_t t_visc, cs_real_t vel, cs_real_t y, 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)
Continuous law of the wall between the linear and log law, with two velocity scales based on the fric...
Definition: cs_wall_functions.h:358
static void cs_wall_functions_2scales_scalable(cs_real_t l_visc, cs_real_t t_visc, cs_real_t vel, cs_real_t y, 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 *dplus, cs_real_t *ypup, cs_real_t *cofimp)
Scalable wall function: shift the wall if .
Definition: cs_wall_functions.h:556
cs_turb_model_t * cs_get_glob_turb_model(void)
Provide write access to turbulence model structure.
Definition: cs_turbulence_model.c:1535
#define BEGIN_C_DECLS
Definition: cs_defs.h:512
integer(c_int), pointer, save iwalfs
Wall functions for scalar.
Definition: optcal.f90:510
const cs_real_t cs_math_epzero
double cs_turb_cstlog
Definition: cs_turbulence_model.c:452
Turbulence model general options descriptor.
Definition: cs_turbulence_model.h:115
#define CS_UNUSED(x)
Definition: cs_defs.h:498
double cs_turb_cmu025
Definition: cs_turbulence_model.c:493
static cs_real_t _vdriest_dupdyp_integral(cs_real_t yplus)
Definition: cs_wall_functions.h:631
cs_wall_functions_t * cs_get_glob_wall_functions(void)
Definition: cs_wall_functions.c:296
static cs_real_t _uplus(cs_real_t yp, cs_real_t ka, cs_real_t B, cs_real_t cuv, cs_real_t y0, cs_real_t n)
Definition: cs_wall_functions.h:288
static void cs_wall_functions_s_arpaci_larsen(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)
The correction of the exchange coefficient is computed thanks to a similarity model between dynamic v...
Definition: cs_wall_functions.h:1027
double cs_turb_vdriest
Definition: cs_turbulence_model.c:441
Definition: cs_wall_functions.h:71
Definition: cs_wall_functions.h:58
double precision, dimension(ncharm), save a2
Definition: cpincl.f90:233
double cs_turb_cmu
Definition: cs_turbulence_model.c:490
Definition: cs_wall_functions.h:74
Definition: cs_wall_functions.h:57
double cs_turb_dpow
Definition: cs_turbulence_model.c:483
double cs_real_t
Floating-point value.
Definition: cs_defs.h:322
Definition: cs_field_pointer.h:68
Definition: cs_wall_functions.h:59
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:260
double cs_turb_crij2
Definition: cs_turbulence_model.c:530
static void cs_wall_functions_s_smooth_rough(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)
Rough Smooth Thermal Wall Function - Prototype.
Definition: cs_wall_functions.h:1194
static void cs_wall_functions_2scales_smooth_rough(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 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 *dplus, cs_real_t *ypup, cs_real_t *cofimp)
Two velocity scales wall function with automatic switch from rough to smooth.
Definition: cs_wall_functions.h:839
cs_wall_f_s_type_t
Definition: cs_wall_functions.h:68
double cs_turb_bpow
Definition: cs_turbulence_model.c:480
Definition: cs_wall_functions.h:61
Definition: cs_wall_functions.h:56
static void cs_wall_functions_s_vdriest(cs_real_t prl, cs_real_t prt, cs_real_t yplus, cs_real_t *htur)
The correction of the exchange coefficient is computed thanks to a numerical integration of: with ...
Definition: cs_wall_functions.h:1129
Definition: cs_wall_functions.h:73
#define CS_MIN(a, b)
Definition: cs_defs.h:475
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:302
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:505
Definition: cs_wall_functions.h:60
double cs_turb_crij1
Definition: cs_turbulence_model.c:524
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:316
Definition: cs_wall_functions.h:64
static void cs_wall_functions_1scale_power(cs_real_t l_visc, cs_real_t vel, cs_real_t y, 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)
Power law: Werner & Wengle.
Definition: cs_wall_functions.h:125
static void cs_wall_functions_2scales_vdriest(cs_real_t rnnb, cs_real_t l_visc, cs_real_t vel, cs_real_t y, 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 *lmk, cs_real_t kr, bool wf)
Two velocity scales wall function using Van Driest mixing length.
Definition: cs_wall_functions.h:705
#define END_C_DECLS
Definition: cs_defs.h:513
wall functions descriptor.
Definition: cs_wall_functions.h:82
#define _(String)
Definition: cs_defs.h:66
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:530
Definition: cs_wall_functions.h:75
double cs_turb_apow
Definition: cs_turbulence_model.c:477
Definition: cs_wall_functions.h:63
#define CS_PROCF(x, y)
Definition: cs_defs.h:526
#define CS_MAX(a, b)
Definition: cs_defs.h:476
static void cs_wall_functions_2scales_log(cs_real_t l_visc, cs_real_t t_visc, cs_real_t vel, cs_real_t y, 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)
Log law: piecewise linear and log, with two velocity scales based on the friction and the turbulent k...
Definition: cs_wall_functions.h:473
static void cs_wall_functions_disabled(cs_real_t l_visc, cs_real_t t_visc, cs_real_t vel, cs_real_t y, 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 *dplus, cs_real_t *ypup, cs_real_t *cofimp)
No wall function.
Definition: cs_wall_functions.h:952
int bft_printf(const char *const format,...)
Replacement for printf() with modifiable behavior.
Definition: bft_printf.c:140
double cs_turb_xkappa
Definition: cs_turbulence_model.c:432
cs_wall_f_s_type_t iwalfs
Definition: cs_wall_functions.h:86
double precision, dimension(4, npot), save ka
Definition: ppcpfu.f90:159
Definition: cs_field_pointer.h:71
double ypluli
Definition: cs_wall_functions.h:88
static cs_real_t _dupdyp(cs_real_t yp, cs_real_t ka, cs_real_t B, cs_real_t cuv, cs_real_t y0, cs_real_t n)
Definition: cs_wall_functions.h:312
cs_wall_f_type_t
Definition: cs_wall_functions.h:54
Definition: cs_wall_functions.h:72
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:330
static void cs_wall_functions_1scale_log(cs_lnum_t ifac, cs_real_t l_visc, cs_real_t vel, cs_real_t y, 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)
Log law: piecewise linear and log, with one velocity scale based on the friction. ...
Definition: cs_wall_functions.h:196
const cs_wall_functions_t * cs_glob_wall_functions
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:212
Definition: cs_field_pointer.h:236
void cs_immersed_boundary_wall_functions(int f_id, cs_real_t *st_exp, cs_real_t *st_imp)
Compute boundary contributions for all immersed boundaries.
Definition: cs_wall_functions.c:599
Definition: cs_wall_functions.h:62