I am new to code_saturne, I want to implement a different wall function than the ones that are already available for the k-e turbulence model.
From what I understood it is simple just to replace, in cs_wall_functions.h file, the equations for a built-in wall function with the equations required by the wall function that I want to implement.
For the wall function I have, I need to access the density, molecular viscosity, wall shear stress and the pressure gradient.
I tried to use "const cs_real_t rho = CS_F_(rho)->rho" and "const cs_real_t mu = CS_F_(mu)->mu", but it does not work.
I receive the following warnings:
warning: implicit declaration of function ‘CS_F_’ [-Wimplicit-function-declaration]
warning: nested extern declaration of ‘CS_F_’ [-Wnested-externs]
I attached the compile.log file containing the warnings
1. How can I fix these warnings?
2. How can I calculate the pressure gradient at the cells? Someone recommended I should calculate it in the clptur.f90 file. I found a subroutine "gradient_s" that is supposed to calculate the gradient of a variable, but I do not know how to use it.
Is there an example or documentation on how to use it?
Thanks,
Ionut
Code: Select all
inline 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)
{
/* const double ypluli = cs_glob_wall_functions->ypluli; */
/* Local variables */
double wss, spg, utau, up, alpha;
int sign_wss, sign_spg; /* signs of wss and spg */
const cs_real_t rho = CS_F_(rho)->rho;
const cs_real_t mu = CS_F_(mu)->mu;
/* Compute Wall Shear Stress, wss */
wss = 0.001003 * (vel / y);
if (wss < 0.) { sign_wss = -1; }
else if (wss > 0.) { sign_wss = 1; }
else { sign_wss = 0; }
/* Compute Streamwise Pressure Gradient, spg */
spg = gradpr;
if (spg < 0.) { sign_spg = -1; }
else if (spg > 0.) { sign_spg = 1; }
else { sign_spg = 0; }
/* Compute the characteristic velocity, function of wss and spg */
utau = pow(fabs(wss) / 998.2, (1. / 2.)); /* velocity due to wss */
up = pow((0.001003 / pow(998.2, 2)) * fabs(spg), (1. / 3.)); /*velocity due to spg*/
*uk = sqrt(pow(utau, 2) + pow(up, 2)); /*characteristic velocity, utaup*/
alpha = pow(utau, 2.) / pow(*uk, 2.); /* separation point indicator */
*yplus = (*uk * y) / l_visc; /*dimensionless distance, ystar*/
/* Manhart wall function model, dimensionless velocity */
*ustar = sign_wss * alpha * *yplus +
sign_spg * 0.5 * pow((1 - alpha), 1.5) * pow(*yplus, 2);
/* Viscous sub-layer */
*ypup = 1.;
*cofimp = 0.;
*iuntur = 0;
*nsubla += 1;
/* Viscous sub-layer */
*nlogla = 0.;
}