My Project
programmer's documentation
|
A method of defining an inlet condition which converges towards an infinite channel profile is based simply on feedback from values computed downstream from the inlet.
Here, we define an inlet boundary condition for a very long channel or duct with a section matching the boundary faces of group 'INLET'.
The following local variables need to be defined for the examples in this section:
Note that the inlet_l
pointer has the save
attribute, as the matching structure usually needs to be built only once, then reused at each time step.
Initialization and finalization is similar to that of the base examples, with the addition of the mapping object, described in a specific section hereafter
The base definition given here ensures initialization of a (flat) inlet profile with the required mean velocity.
To define the appropriate mapping object, the boundary_conditions_map function is used. In this example, coordinates of the selected inlet face are shifted by a constant distance (5.95 meters along the x axis), and mapped to the corresponding mesh cells. Here, all cells are selected as point location candidates, but optionally, a restricted list of cells may be provided, which may accelerate location (or ensure it is done on a selected subset). In most cases, as in this example, a constant coordinate shift is used for all inlet points, but it is possible to define a specific shift for each face (defining a stride
argument of 1 instead of 0 and coord_shift(:,ifac)
instead of coord_shift(:,1)
).
In general, when defining a pseudo-periodic boundary condition, it is assumed that the mesh is not moving, so the mapping may be defined once and for all. Hence the test on ntcabs and ntpabs and the save
attribute for the inlet_1
pointer.
At all time steps after the first (possibly even the first if the flow at the mapping locations is initialized to nonzero values), the values at points mapped to inlet face centers are applied to the rcodcl(ifac,1)
values of the corresponding faces, using the boundary_conditions_mapped_set subroutine. Optionally, a normalization by be applied, ensuring the mean values initially defined are preserved. Normalization is recommended for the velocity, and possibly scalars, but not for turbulent quantities, which should adapt to the velocity.
At the end of the computation, it is good practice to free the mapping structure: