8.1
general documentation
Generation of synthetic turbulence at LES inlets

Introduction

Generation of synthetic turbulence at LES inlets can be defined using the cs_user_les_inflow_define user function, and possibly updated using cs_user_les_inflow_update, with cs_user_les_inflow_advanced allowing for finer definition of target statistics the inlet if needed.

Global caracteristics of synthetic turbulence inlets

General settings

The cs_user_les_inflow_define function is the main entry point for LES inflow definitions.

It can be used to set general options, such as the specific checkpoint/restart behavior, as in the following example:

cs_les_inflow_set_restart(false, /* allow_read */
false); /* allow_write */
void cs_les_inflow_set_restart(bool allow_read, bool allow_write)
Define behavior of the LES inflow module in case of restart.
Definition: cs_les_inflow.c:2193

Defining inlet properties

For each LES inlet, the cs_les_inflow_add_inlet must be used.

For example, to use the Batten Method for boundary faces of a zone named INLET_1:

{
/* Number of turbulence structures */
int n_entities = 50;
/* Velocity, turbulent kinetic energy and dissipation rate */
cs_real_t vel_r[3] = {18.0, 0, 0};
cs_real_t k_r = 4.0;
cs_real_t eps_r = 4.0;
false,
n_entities,
0, /* verbosity */
vel_r,
k_r,
eps_r);
}
const cs_zone_t * cs_boundary_zone_by_name(const char *name)
Return a pointer to a boundary zone based on its name if present.
Definition: cs_boundary_zone.c:711
double cs_real_t
Floating-point value.
Definition: cs_defs.h:319
void cs_les_inflow_add_inlet(cs_les_inflow_type_t type, bool volume_mode, const cs_zone_t *zone, int n_entities, int verbosity, const cs_real_t *vel_r, cs_real_t k_r, cs_real_t eps_r)
Add an inlet definition for synthetic turbulence inflow generation.
Definition: cs_les_inflow.c:650
@ CS_INFLOW_BATTEN
Definition: cs_les_inflow.h:60

And to use the Synthetic Eddy Method for boundary faces of a zone named INLET_2:

Modifying synthetic turbulence inlets

Updating base characteristics

To update reference velocity, turbulent kinetic energy, or dissipation rate for a given turbulence inlet, the cs_user_les_inflow_update function may be used. It is called automatically for each LES inlet defined previously.

The following example illustrates modifying values for the example zone named INLET_1:

if (strcmp(zone->name, "INLET_1") == 0) {
/* Velocity, turbulent kinetic energy and dissipation rate */
vel_r[0] = 19.0;
vel_r[1] = 0.0;
vel_r[2] = 0.0;
*k_r = 5.0;
*eps_r = 5.0;
}

Advanced LES inlet Example 1

Mean velocity, Reynolds stresses an dissipation are deduced from a wall law for the zone named INLET_1 (no modification of the statistics of the flow is provided for the other synthetic turbulence inlets).

if (strcmp(zone->name, "INLET_1") == 0) {
const cs_lnum_t n_faces = zone->n_elts;
const cs_lnum_t *face_ids = zone->elt_ids;
const cs_real_t d2_s3 = 2.0/3.0;
const cs_mesh_t *m = cs_glob_mesh;
const cs_real_3_t *b_face_cog
const cs_real_t *cpro_mu = CS_F_(mu)->val;
/* Approximation of the friction velocity */
const cs_real_t utau = uref/20.0;
/* Reference length scale */
const cs_real_t h_ref = 1.0;
for (cs_lnum_t i = 0; i < n_faces; i++) {
const cs_lnum_t f_id = face_ids[i];
const cs_lnum_t c_id = m->b_face_cells[f_id];
const cs_real_t x_mu = cpro_mu[c_id];
const cs_real_t r_fro = utau * h_ref / x_mu;
/* Dimensionless wall distance */
const cs_real_t yy = 1.0 - b_face_cog[f_id][1];
const cs_real_t yplus = yy / h_ref * r_fro;
/* Reichart laws (dimensionless) */
const cs_real_t uplus = log(1. + 0.4*yplus)/kappa
+ 7.8*(1. - exp(-yplus/11.0)
- yplus/11.0*exp(-0.33*yplus));
const cs_real_t kplus = 0.07*yplus*yplus*exp(-yplus/8.0)
+ (1.0 - exp(-yplus/20.0)) *4.5
/ (1. + 4.0*yplus/r_fro);
const cs_real_t eplus = (1.0/kappa)
+ cs_math_pow4(15.)), 0.25);
/* Arrays are filled with dimensionnal stats */
vel_l[i][0] = uplus * utau;
vel_l[i][1] = 0.0;
vel_l[i][2] = 0.0;
rij_l[i][0] = d2_s3 * kplus * cs_math_pow2(utau);
rij_l[i][1] = d2_s3 * kplus * cs_math_pow2(utau);
rij_l[i][2] = d2_s3 * kplus * cs_math_pow2(utau);
rij_l[i][3] = 0;
rij_l[i][4] = 0;
rij_l[i][5] = 0;
eps_l[i] = eplus * cs_math_pow4(utau) / x_mu;
}
}
cs_real_t cs_real_3_t[3]
vector of 3 floating-point values
Definition: cs_defs.h:334
int cs_lnum_t
local mesh entity id
Definition: cs_defs.h:313
@ mu
Definition: cs_field_pointer.h:103
@ yplus
Definition: cs_field_pointer.h:239
#define CS_F_(e)
Macro used to return a field pointer by its enumerated value.
Definition: cs_field_pointer.h:51
static cs_real_t cs_math_pow2(cs_real_t x)
Compute the square of a real value.
Definition: cs_math.h:238
static cs_real_t cs_math_pow4(cs_real_t x)
Compute the 4-th power of a real value.
Definition: cs_math.h:270
cs_mesh_t * cs_glob_mesh
cs_mesh_quantities_t * cs_glob_mesh_quantities
double cs_turb_xkappa
Definition: cs_turbulence_model.c:444
const cs_turb_ref_values_t * cs_glob_turb_ref_values
real(c_double), pointer, save uref
the characteristic flow velocity, used for the initialization of the turbulence. Negative value: not ...
Definition: cstphy.f90:353
double precision, dimension(ncharm), save kappa
Definition: cpincl.f90:96
cs_real_t * b_face_cog
Definition: cs_mesh_quantities.h:111
Definition: cs_mesh.h:85
cs_lnum_t * b_face_cells
Definition: cs_mesh.h:112
double uref
Definition: cs_turbulence_model.h:169

Advanced LES Example 2

Reynolds stresses and dissipation at the inlet are computed using the turbulence intensity and standard laws for a circular pipe for for the zone named INLET_1 (no modification of the statistics of the flow is provided for the other synthetic turbulence inlets).

if (strcmp(zone->name, "INLET_1") == 0) {
const cs_lnum_t n_faces = zone->n_elts;
const cs_real_t d2_s3 = 2.0/3.0;
for (cs_lnum_t i = 0; i < n_faces; i++) {
vel_l[i][0] = 1.1;
vel_l[i][1] = 1.1;
vel_l[i][2] = 1.1;
cs_real_t uref2 = cs_math_3_square_norm(vel_l[i]);
uref2 = cs_math_fmax(uref2, 1e-12);
/* Hydraulic diameter */
const cs_real_t x_hd = 0.075;
/* Turbulence intensity */
const cs_real_t x_ti = 0.02;
cs_real_t x_k = 1e-12;
cs_real_t x_eps = 1e-12;
x_ti,
x_hd,
&x_k,
&x_eps);
rij_l[i][0] = d2_s3 * x_k;
rij_l[i][1] = d2_s3 * x_k;
rij_l[i][2] = d2_s3 * x_k;
rij_l[i][3] = 0;
rij_l[i][4] = 0;
rij_l[i][5] = 0;
eps_l[i] = x_eps;
}
}
static cs_real_t cs_math_fmax(cs_real_t x, cs_real_t y)
Compute the max value of two real values.
Definition: cs_math.h:180
static cs_real_t cs_math_3_square_norm(const cs_real_t v[3])
Compute the square norm of a vector of 3 real values.
Definition: cs_math.h:456
void cs_turbulence_bc_ke_turb_intensity(double uref2, double t_intensity, double dh, double *k, double *eps)
Calculation of and from a diameter , a turbulent intensity and the reference velocity for a circu...
Definition: cs_turbulence_bc.c:827