OpenFOAM 3D Steady Turbulent Simulation (OF-1.4.1)

In this example we shall investigate how to make a 3D simulation with OpenFOAM. The case we want to study is a steady turbulent flow circulating inside a room. This example introduces almost all the basic steps which should be done for studying a CFD problem and explains how these things can be carried out in a quite simple way in OpenFOAM.

1 Problem specification

We want to study the motion of air circulating inside a room. The outline of the geometry is shown in Fig. 1. The room is crossed by a conduct. The air enters perpendicularly to one of the extremities of the conduct (inlet) at a velocity U = 0.5 m/s and flows out the other (outlet). There are two holes in the conduct and four small windows on one of the room walls through which the air can also flow. Two pillars are placed between the conduct and the wall with the windows.

Figure 1: The geometry of the room.

1.1 Governing equations

As the case is steady-state and the fluid is supposed viscous and incompressible, the governing equations to be solved are:

Mass conservation for incompressible flow: ∇ ⋅U = 0

Steady-flow momentum conservation: (U⋅ ∇) U + (∇P/ρ) = ν ∇2U + g

where P, ρ, ν and g are, respectively, presuure, density, kinematic viscosity and gravitational field. We have already talked about the initial velocity above. The initial pressure has been set equal to 1 atm = 101325 Pa at all the boundaries except at the windows where its value is 0.995 atm to allow a pressure gradient.

2 Mesh generation

The mesh was generated by converting a .msh GAMBIT file according to the procedure described in the section Mesh conversion. The domain consists of about 5000000 cells. In Fig. 2 are shown some of the meshed patches of the domain.

Figure 2: Structured patch meshes of the conduct, room walls, inlet and pillars obtained by using the OpenFOAM conversion routines.

3 Boundary conditions and initial fields

The case requires initial and boundary conditions settings for all the involved fields: velocity U, pressure P, turbulent kinetic energy k and energy dissipation rate ε. The initial values for the fields are specified in the casename/0/fieldname files. The reader may consult the boundary conditions documentation section (in Italian) for more details. We report the rilevant sections of the fieldname files.

The initial velocity U has been set equal to 0.5 m/s in the y direction at the inlet:

The initial pressure field P has been set equal to 1 atm at the inlet and at all the outlets except at the windows where its value is 0.995 atm to allow internal flow circulation. The gradient of the pressure in the direction perpendicular to the the patches of type wall has been set equal to 0:

4 Solver and case control

We used the simpleFoam solver, implemented for steady incompressible flow. The numerical schemes for terms such as derivatives, interpolation procedures etc. are set in the casename/system/fvSchemes file. In this file we specify that the case is steady-state by giving the SteadyState value to the keyword timeScheme. The terms ∇ and ∇ 2 controlled respectively by the keywords gradSchemes and laplacianSchemes have been set to the value Gauss because we adopted the standard finite volume discretization of Gaussian integration which requires the interpolation of values from cell centres to face centres. The divergence term ∇ ⋅, controlled by the keyword divSchemes has been set to UD to ensure boundedness.

5 Results

In Fig. 3 are shown the residuals of the involved fields after 1000 iterations. The case has been run in parallel using 64 cores.

Fig. 3: Residuals of the velocity components, the pressure, the turbulent kinetic energy and the dissipation energy rate.

Even if the maximum pressure gradient is only 0.5%, it is sufficient to cause a back flow with the air entering the room from the outlet as shown in Fig. 4.

Figure 4: Velocity flow on a horizontal plane parallel to the floor. On the left is shown the vertical view looking at the floor from the ceiling of the room. On the right is shown in detail the region near the outlet. The pressure gradient forces the air to enter the room from the outlet, where the velocity reaches its maximum value. The air moves through the conduct and flows towards the wall windows, where the pressure has the lowest value.

The same simulation has been run with Fluent. In order to make a comparison we shall analyse the shape of the fields on two cutting planes, as shown in Fig. 5.

Figure 5: The figure shows the two cutting planes chosen to compare the results of the simulation for OpenFOAM and Fluent.

We observe that the magnitude of the velocity fields is of the same order. In the regions far from the two small holes placed on the conduct the velocity magnitude approaches to zero in both the two simulations. In the regions next to the conduct holes the velocity contour has a more diffusive shape in the OpenFOAM case. In Fig. 7 are shown the contour plots for the velocity components. An overall agreement is observed.

Fig. 7: Contour plot comparisons for the velocity components on the horizontal plane.

In Fig. 8 are shown the contour plots for the magnitude velocity field on the vertical plane. On average, the strength of the velocity fields at the conduct section are comparable. There is a nice agreement even for the size of the region where the velocity field doest not dump to zero.

In Fig. 8 are shown the pressure contour plots on the horizontal plane. The Fluent picture reports (in Pa) the pressure gradient with respect to 1 atm = 101325 Pa as reference value, thus the negative values mean a value of pressure lower tham 1 atm. On the other hand the OpenFOAM picture reports (in Pa) the absolute pressure values as shown in the dispayed range. Hence in this case too there is an overall agreement.