1 #ifndef __CS_WALL_FUNCTIONS_H__ 2 #define __CS_WALL_FUNCTIONS_H__ 143 const double ydvisc = y / l_visc;
149 *yplus = *ustar * ydvisc;
152 if (*yplus <= ypluli) {
154 *ustar = sqrt(vel / ydvisc);
155 *yplus = *ustar * ydvisc;
215 double ustarwer, ustarmin, ustaro, ydvisc;
224 reynolds = vel * ydvisc;
231 if (reynolds <= ypluli * ypluli) {
233 *ustar = sqrt(vel / ydvisc);
234 *yplus = *ustar * ydvisc;
250 ustaro =
CS_MAX(ustarwer, ustarmin);
251 *ustar = (cs_turb_xkappa * vel + ustaro)
255 for (iter = 0; iter < niter_max
256 && fabs(*ustar - ustaro) >= eps * ustaro; iter++) {
258 *ustar = (cs_turb_xkappa * vel + ustaro)
262 if (iter >= niter_max) {
263 bft_printf(
_(
"WARNING: non-convergence in the computation\n" 264 "******** of the friction velocity\n\n" 266 "friction vel: %f \n" ), ifac, *ustar);
270 *yplus = *ustar * ydvisc;
272 *cofimp = 1. - *ypup / cs_turb_xkappa * 1.5 / *
yplus;
299 f_blend = exp(-0.25*cuv*pow(yp,3)) ;
300 uplus = f_blend*yp + (log(yp)/ka +B)*(1.-exp(-pow(yp/y0,n)))*(1-f_blend);
323 dupdyp = exp(-0.25*cuv*pow(yp,3))
324 - 0.75*cuv*pow(yp,3.)*exp(-0.25*cuv*pow(yp,3.))
325 + n*(1.-exp(-0.25*cuv*pow(yp,3.)))*(pow(yp,n-1.)/pow(y0,n))*exp(-pow(yp/y0,n))*((1./ka)*log(yp)+B)
326 + 0.75*cuv*pow(yp,2.)*exp(-0.25*cuv*pow(yp,3.))*(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 ) {
412 *ypup = *yplus / uplus ;
426 t_visc_durb = t_visc / (kinetic_en *
cs_turb_cmu ) * rnnb * 0.22 ;
428 t_visc_durb = t_visc ;
431 *cofimp = 1. - *ypup * (2.0 * sqrt( l_visc / t_visc_durb * dup1 * (1.0 - dup1) ) - dup2) ;
434 if (*yplus > ypluli) {
483 double rcprod, ml_visc, Re, g;
488 Re = sqrt(kinetic_en) * y / l_visc;
492 + g * l_visc * vel / y);
494 *yplus = *uk * y / l_visc;
497 if (*yplus > ypluli) {
511 if (*yplus > 1.e-12) {
512 *ustar = fabs(vel / *yplus);
569 double rcprod, ml_visc, Re, g;
573 Re = sqrt(kinetic_en) * y / l_visc;
577 + g * l_visc * vel / y);
579 *yplus = *uk * y / l_visc;
583 *yplus = *uk * y / l_visc;
586 if (*yplus > ypluli) {
595 *dplus = ypluli - *
yplus;
629 static double aa[11] = {-0.0091921, 3.9577, 0.031578,
630 -0.51013, -2.3254, -0.72665,
631 2.969, 0.48506, -1.5944,
634 cs_real_t y1,y2,y3,y4,y5,y6,y7,y8,y9,y10, uplus;
636 y1 = 0.25 * log(yplus);
717 double urplus, d_up, lmk15;
723 *yplus =
CS_MAX(*uk * y / l_visc, 1.e-4);
730 cs_real_t dyrp = 0.9 * (sqrt(krp) - krp * exp(-krp / 6.));
735 else if (dyrp <= 200.)
740 if (yrplus <= 1.e-1) {
755 }
else if (yrplus <= 200.) {
762 *ypup = *yplus / (urplus-d_up);
771 *cofimp = 1. - (2. / (1. + *lmk) - 1. / (1. + lmk15)) * *ypup;
781 *ypup = *yplus / (urplus-d_up);
790 *cofimp = 1. - (2. / *lmk - 1. / lmk15) * *ypup;
795 *ustar = vel / (urplus-d_up);
850 double rcprod, ml_visc, Re, g;
864 Re = sqrt(kinetic_en) * (y + y0) / l_visc;
868 + g * l_visc * vel / (y + y0));
873 *yplus = *uk * (y + y0) / effective_visc;
875 double yk = *uk * y / l_visc;
878 *dplus = *uk * y0 / effective_visc;
888 *dplus = ypluli - *
yplus;
896 *ustar = vel / uplus;
902 *cofimp = 1. - (*yplus - *dplus) / uplus
952 *ustar = sqrt(vel * l_visc / y);
953 *yplus = *ustar * y / l_visc;
959 if (*yplus <= ypluli) {
1014 const double epzero = 1.e-12;
1024 (*htur) =
CS_MAX(yplus-dplus,epzero)/
CS_MAX(yplus,epzero);
1034 if (yplus > (*yplim)) {
1036 (*htur) = prl*(yplus-dplus)/tplus;
1046 (*yplim) = pow(1000./prl,1./3.);
1048 a2 = 15.*pow(prl,2./3.);
1049 beta2 = a2 - 500./ pow(yp2,2);
1051 if (yplus >= (*yplim) && yplus < yp2) {
1052 tplus = a2 - 500./(yplus*
yplus);
1053 (*htur) = prl*(yplus-dplus)/tplus;
1058 (*htur) = prl*(yplus-dplus)/tplus;
1098 const int ninter_max = 100;
1110 int npeff =
CS_MAX((
int)(ypint / ypmax * (
double)(ninter_max)), 1);
1112 double dy = ypint / (double)(npeff);
1117 for (
int ip = 1; ip <= npeff; ip++) {
1118 double yp = ypint * (double)(ip) / (double)(npeff);
1120 stplus += dy / (1. + prlrat * 0.5 * (nut1 + nut2));
1124 if (yplus > ypint) {
1126 stplus += log( (1. + r*yplus) / (1. + r*ypint)) / r;
1129 if (stplus >= 1.e-6)
1130 *htur = yplus / stplus;
const double cs_turb_cstlog_rough
Definition: cs_turbulence_model.c:404
const double cs_turb_xkappa
Definition: cs_turbulence_model.c:373
int itytur
Definition: cs_turbulence_model.h:99
double precision epzero
epsilon
Definition: cstnum.f90:40
cs_wall_f_type_t iwallf
Definition: cs_wall_functions.h:83
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
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:202
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:550
#define BEGIN_C_DECLS
Definition: cs_defs.h:467
integer(c_int), pointer, save iwalfs
Wall functions for scalar.
Definition: optcal.f90:619
int cs_int_t
Fortran-compatible integer.
Definition: cs_defs.h:301
#define CS_UNUSED(x)
Definition: cs_defs.h:453
double cs_turb_cmu025
Definition: cs_turbulence_model.c:434
static cs_real_t _vdriest_dupdyp_integral(cs_real_t yplus)
Definition: cs_wall_functions.h:626
cs_wall_functions_t * cs_get_glob_wall_functions(void)
Definition: cs_wall_functions.c:280
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:290
Definition: cs_wall_functions.h:73
Definition: cs_wall_functions.h:61
double precision, dimension(ncharm), save a2
Definition: cpincl.f90:233
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:250
double cs_turb_cmu
Definition: cs_turbulence_model.c:431
Definition: cs_wall_functions.h:60
double cs_turb_dpow
Definition: cs_turbulence_model.c:423
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:320
double cs_real_t
Floating-point value.
Definition: cs_defs.h:302
const double cs_turb_bpow
Definition: cs_turbulence_model.c:420
Definition: cs_field_pointer.h:68
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:1001
double cs_turb_crij2
Definition: cs_turbulence_model.c:484
cs_wall_f_s_type_t
Definition: cs_wall_functions.h:71
Definition: cs_wall_functions.h:64
const double cs_turb_vdriest
Definition: cs_turbulence_model.c:382
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:1090
double cs_turb_cstlog_alpha
Definition: cs_turbulence_model.c:414
#define CS_MIN(a, b)
Definition: cs_defs.h:430
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:293
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:614
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:830
Definition: cs_wall_functions.h:63
double cs_turb_crij1
Definition: cs_turbulence_model.c:478
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:298
Definition: cs_wall_functions.h:67
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:129
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:700
#define END_C_DECLS
Definition: cs_defs.h:468
wall functions descriptor.
Definition: cs_wall_functions.h:81
#define _(String)
Definition: cs_defs.h:52
Definition: cs_wall_functions.h:66
const double cs_turb_cstlog
Definition: cs_turbulence_model.c:393
#define CS_PROCF(x, y)
Definition: cs_defs.h:481
#define CS_MAX(a, b)
Definition: cs_defs.h:431
int iwallt
Definition: cs_wall_functions.h:87
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:467
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:930
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:85
double precision, dimension(4, npot), save ka
Definition: ppcpfu.f90:159
const cs_turb_model_t * cs_glob_turb_model
Definition: cs_field_pointer.h:71
double ypluli
Definition: cs_wall_functions.h:92
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:314
cs_wall_f_type_t
Definition: cs_wall_functions.h:58
Definition: cs_wall_functions.h:74
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:200
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:511
Definition: cs_field_pointer.h:237
Definition: cs_wall_functions.h:65
const double cs_turb_apow
Definition: cs_turbulence_model.c:417