Cavity Flow

cavity_flow_image.png

This tutorial will cover the basics of setting up and running the common fluid problem of the flow in a cavity. Files for running the case yourself can be found here: LOCI-STREAM RUN FILES

The cavity flow problem is a canonical problem in computational fluid dynamics(CFD). It is often given to students as a project in their first course on the topic of CFD. The flow is incompressible, viscous, and bounded within a sealed 2D box. The top of the domain moves to the right continuously, which drags the viscous fluid to the right. A steady-state flow pattern develops within the box after some time, which can be seen from the image at the beginning of this example.


ComputatIOnal Domain

Simulation_domain.png

The domain is a square with sides of 0.1 m on edge. Loci-Stream does not run in a purely 2D mode, rather it uses 3D extrusions of 2D geometry. For this geometry the extrusion is done into the screen, which produces two extra faces on the front and back. The 2D mesh is extruded 0.025 m.

The top boundary is prescribed using the Loci-Stream syntax: incompressibleInlet(v=1 m/s) . 

To see the Loci-Stream control file click HERE.


Running the Code

Loci-Stream is an MPI based parallel code, so execution of the code is started with a call to mpirun. A template call is shown below where the terms in brackets(<>) are replaced by the specifics of your case.
mpirun -np <np> <path_to_stream_exec> --scheduleoutput -q solution <casename> <restart> > /dev/null >run.out 2>&1 &

For this example the call is:
mpirun -np 4 /home/user/Loci-Stream/bin/stream --scheduleoutput -q solution cavity  > /dev/null >run.out 2>&1 &


Results

The 'extract' utility is used to view the results of a simulation. For this case we view the simulation at the 10,000th time step. In the run directory extract the solution using: extract -vtk cavity 10000 P v . This will generate a solution directory with files in the Paraview VTK format which can be opened by Paraview. The case name is 'cavity' and the timestep is '10000', and the variables to extract are the pressure(P) and velocity(v).

Above on the left is a contour plot of the velocity magnitude within the cavity. On the right is a stream traced plot of the velocity field. A set of secondary vortices in the corners can be seen as well as the formation of tertiary vortices.