1 #ifndef __CS_WALL_FUNCTIONS_H__
2 #define __CS_WALL_FUNCTIONS_H__
142 const double ydvisc = y / l_visc;
148 *yplus = *ustar * ydvisc;
151 if (*yplus <= ypluli) {
153 *ustar = sqrt(vel / ydvisc);
154 *yplus = *ustar * ydvisc;
214 double ustarwer, ustarmin, ustaro, ydvisc;
223 reynolds = vel * ydvisc;
230 if (reynolds <= ypluli * ypluli) {
232 *ustar = sqrt(vel / ydvisc);
233 *yplus = *ustar * ydvisc;
249 ustaro =
CS_MAX(ustarwer, ustarmin);
250 *ustar = (cs_turb_xkappa * vel + ustaro)
254 for (iter = 0; iter < niter_max
255 && fabs(*ustar - ustaro) >= eps * ustaro; iter++) {
257 *ustar = (cs_turb_xkappa * vel + ustaro)
261 if (iter >= niter_max) {
262 bft_printf(
_(
"WARNING: non-convergence in the computation\n"
263 "******** of the friction velocity\n\n"
265 "friction vel: %f \n" ), ifac, *ustar);
269 *yplus = *ustar * ydvisc;
271 *cofimp = 1. - *ypup / cs_turb_xkappa * 1.5 / *yplus;
319 double rcprod, ml_visc, Re, g;
324 Re = sqrt(kinetic_en) * y / l_visc;
328 + g * l_visc * vel / y);
330 *yplus = *uk * y / l_visc;
333 if (*yplus > ypluli) {
340 *cofimp = 1. - *ypup /
cs_turb_xkappa * ( 2. * rcprod - 1. / (2. * *yplus));
347 if (*yplus > 1.e-12) {
348 *ustar = fabs(vel / *yplus);
403 double rcprod, ml_visc, Re, g;
407 Re = sqrt(kinetic_en) * y / l_visc;
411 + g * l_visc * vel / y);
413 *yplus = *uk * y / l_visc;
417 *yplus = *uk * y / l_visc;
420 if (*yplus > ypluli) {
429 *dplus = ypluli - *yplus;
463 static double aa[11] = {-0.0091921, 3.9577, 0.031578,
464 -0.51013, -2.3254, -0.72665,
465 2.969, 0.48506, -1.5944,
468 cs_real_t y1,y2,y3,y4,y5,y6,y7,y8,y9,y10, uplus;
470 y1 = 0.25 * log(yplus);
551 double urplus, dup, lmk15;
557 *yplus =
CS_MAX(*uk * y / l_visc, 1.e-4);
564 cs_real_t dyrp = 0.9 * (sqrt(krp) - krp * exp(-krp / 6.));
569 else if (dyrp <= 200.)
574 if (yrplus <= 1.e-1) {
589 }
else if (yrplus <= 200.) {
596 *ypup = *yplus / (urplus-dup);
605 *cofimp = 1. - (2. / (1. + *lmk) - 1. / (1. + lmk15)) * *ypup;
615 *ypup = *yplus / (urplus-dup);
624 *cofimp = 1. - (2. / *lmk - 1. / lmk15) * *ypup;
629 *ustar = vel / (urplus-dup);
682 double rcprod, ml_visc, Re, g;
696 Re = sqrt(kinetic_en) * (y + y0) / l_visc;
700 + g * l_visc * vel / (y + y0));
704 *yplus = *uk * (y + y0) / effective_visc;
707 double yk = *uk * y / l_visc;
710 *dplus = *uk * y0 / effective_visc;
720 *dplus = ypluli - *yplus;
728 *ustar = vel / uplus;
734 *cofimp = 1. - (*yplus - *dplus) / uplus
780 *ustar = sqrt(vel * l_visc / y);
781 *yplus = *ustar * y / l_visc;
787 if (*yplus <= ypluli) {
842 const double epzero = 1.e-12;
852 (*htur) =
CS_MAX(yplus-dplus,epzero)/
CS_MAX(yplus,epzero);
862 if (yplus > (*yplim)) {
864 (*htur) = prl*(yplus-dplus)/tplus;
874 (*yplim) = pow(1000./prl,1./3.);
876 a2 = 15.*pow(prl,2./3.);
877 beta2 = a2 - 500./ pow(yp2,2);
879 if (yplus >= (*yplim) && yplus < yp2) {
880 tplus = a2 - 500./(yplus*yplus);
881 (*htur) = prl*(yplus-dplus)/tplus;
886 (*htur) = prl*(yplus-dplus)/tplus;
926 const int ninter_max = 100;
938 int npeff =
CS_MAX((
int)(ypint / ypmax * (
double)(ninter_max)), 1);
940 double dy = ypint / (double)(npeff);
945 for (
int ip = 1; ip <= npeff; ip++) {
946 double yp = ypint * (double)(ip) / (double)(npeff);
948 stplus += dy / (1. + prlrat * 0.5 * (nut1 + nut2));
954 stplus += log( (1. + r*yplus) / (1. + r*ypint)) / r;
958 *htur = yplus / stplus;
const double cs_turb_cstlog_rough
Definition: cs_turbulence_model.c:326
const double cs_turb_xkappa
Definition: cs_turbulence_model.c:295
double precision epzero
epsilon
Definition: cstnum.f90:40
cs_wall_f_type_t iwallf
Definition: cs_wall_functions.h:82
void wallfunctions(const cs_int_t *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 roughness, const cs_real_t *const rnnb, const cs_real_t *const kinetic_en, cs_int_t *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:185
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:386
#define BEGIN_C_DECLS
Definition: cs_defs.h:429
integer(c_int), pointer, save iwalfs
Wall functions for scalar.
Definition: optcal.f90:552
int cs_int_t
Fortran-compatible integer.
Definition: cs_defs.h:295
double cs_turb_cmu025
Definition: cs_turbulence_model.c:356
static cs_real_t _vdriest_dupdyp_integral(cs_real_t yplus)
Definition: cs_wall_functions.h:460
cs_wall_functions_t * cs_get_glob_wall_functions(void)
Definition: cs_wall_functions.c:263
Definition: cs_wall_functions.h:72
Definition: cs_wall_functions.h:61
double precision, dimension(ncharm), save a2
Definition: cpincl.f90:226
void hturbp(const cs_int_t *const iwalfs, const cs_real_t *const prl, const cs_real_t *const prt, 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:233
Definition: cs_wall_functions.h:60
double cs_turb_dpow
Definition: cs_turbulence_model.c:345
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 roughness, 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:303
const double cs_turb_bpow
Definition: cs_turbulence_model.c:342
Definition: cs_wall_functions.h:62
static void cs_wall_functions_s_arpaci_larsen(cs_real_t prl, cs_real_t prt, 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:829
cs_wall_f_s_type_t
Definition: cs_wall_functions.h:70
Definition: cs_wall_functions.h:64
const double cs_turb_vdriest
Definition: cs_turbulence_model.c:304
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:918
double cs_turb_cstlog_alpha
Definition: cs_turbulence_model.c:336
#define CS_MIN(a, b)
Definition: cs_defs.h:402
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:265
integer(c_int), pointer, save iwallf
Wall functions.
Definition: optcal.f90:547
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 roughness, 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:664
Definition: cs_wall_functions.h:63
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:292
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:128
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:534
#define END_C_DECLS
Definition: cs_defs.h:430
wall functions descriptor.
Definition: cs_wall_functions.h:80
#define _(String)
Definition: cs_defs.h:52
double cs_real_t
Definition: cs_defs.h:296
Definition: cs_wall_functions.h:66
const double cs_turb_cstlog
Definition: cs_turbulence_model.c:315
#define CS_PROCF(x, y)
Definition: cs_defs.h:453
#define CS_MAX(a, b)
Definition: cs_defs.h:403
int iwallt
Definition: cs_wall_functions.h:86
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:303
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:762
int bft_printf(const char *const format,...)
Replacement for printf() with modifiable behavior.
Definition: bft_printf.c:140
cs_wall_f_s_type_t iwalfs
Definition: cs_wall_functions.h:84
Definition: cs_field_pointer.h:70
double ypluli
Definition: cs_wall_functions.h:91
cs_wall_f_type_t
Definition: cs_wall_functions.h:58
Definition: cs_wall_functions.h:73
const double cs_turb_crij1
Definition: cs_turbulence_model.c:400
const double cs_turb_crij2
Definition: cs_turbulence_model.c:406
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:199
const cs_wall_functions_t * cs_glob_wall_functions
void cs_wall_functions_scalar(cs_wall_f_s_type_t iwalfs, cs_real_t prl, cs_real_t prt, 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:478
Definition: cs_wall_functions.h:65
const double cs_turb_apow
Definition: cs_turbulence_model.c:339