A second method of defining an inlet condition which converges towards an infinite channel profile is based simply on feedback from values computed at inlet cell centers (combining the inlet boundary conditions and the effect of wall friction on the inlet walls). It assumes the mesh is very regular and orthogonal, at least on the first two inlet cell layers (using a gradient correction in the case of a less regular mesh might work, but has never been tested.
Initialization and finalization
Initialization and finalization is similar to that of the base examples
= (
const cs_real_t *)domain->mesh_quantities->b_face_surf;
Body
Here, we define an inlet boundary condition for a very long channel or duct with a section matching the boundary faces of zone 'INLET'.
We fix a mean inlet velocity, and use a feedback loop assuming a fixed-point type behavior will allow us to reach a state matching that of a very long inlet channel.
- Warning
- We assume other boundary conditions are defined before this one (ideally, using the GUI).
-
We also assume that the mesh is orthogonal at the inlet, and we are using a RANS (not LES) computation. to the current inlet.
For EBRSM of V2f models, to avoid laminarization at the inlet, the initial velocity (at the first time step) is divided by 10 on inlet faces adjacent to the boundary, so as to ensure a velocity gradient and turbulent production. Otherwise, the initialization may fail.
if (nt_cur == 1) {
int *mrkcel = nullptr;
mrkcel[i] = 0;
for (
cs_lnum_t f_id = 0; f_id < n_b_faces; f_id++) {
mrkcel[c_id] = 1;
}
}
}
const cs_lnum_t c_id = b_face_cells[face_id];
for (
int ii = 0; ii<
CS_F_(
vel)->dim; ii++)
CS_F_(
vel)->bc_coeffs->rcodcl1[n_b_faces*ii + face_id]
= -fmprsc*b_face_normal[face_id][ii]/b_face_surf[face_id];
if (mrkcel[c_id] == 1)
CS_F_(
vel)->bc_coeffs->rcodcl1[n_b_faces*0 + face_id] = fmprsc/10;
for (
int ii = 0; ii<
CS_F_(
vel)->dim; ii++)
uref2 += pow(
CS_F_(
vel)->bc_coeffs->rcodcl1[n_b_faces*ii + face_id], 2);
uref2,
xdh,
b_rho,
viscl0);
for (int f_id = 0; f_id < n_fields; f_id++) {
if (sc_id < 0)
continue;
}
}
}
else {
const cs_lnum_t c_id = b_face_cells[face_id];
acc[0] += vnrm*b_face_surf[face_id];
acc[1] += b_face_surf[face_id];
}
fmul = fmprsc/(acc[0]/acc[1]);
const cs_lnum_t c_id = b_face_cells[face_id];
for (
int ii = 0; ii<
CS_F_(
vel)->dim; ii++)
CS_F_(
vel)->bc_coeffs->rcodcl1[n_b_faces*ii + face_id]
= -fmul*vnrm*b_face_normal[face_id][ii]/b_face_surf[face_id];
CS_F_(
k)->bc_coeffs->rcodcl1[face_id] =
CS_F_(
k)->val[c_id];
}
CS_F_(
rij)->bc_coeffs->rcodcl1[n_b_faces*ii + face_id]
}
CS_F_(
k)->bc_coeffs->rcodcl1[face_id] =
CS_F_(
k)->val[c_id];
}
CS_F_(
k)->bc_coeffs->rcodcl1[face_id] =
CS_F_(
k)->val[c_id];
}
}
for (int f_id = 0; f_id < n_fields; f_id++) {
if (sc_id < 0)
continue;
}
}
}