You are on page 1of 6

Unsteady Flow Over a Cylinder OpenFOAM

Unsteady flow over a cylinder


In this example the flow over a cylinder is modeled. The flow field over the cylinder is symmetric at low values of Reynolds numbers. As the Reynolds number increases, flow begins to separate behind the cylinder causing vortex shedding, which is an unsteady phenomenon.

Problem specification
A Reynolds number of 150 will be targeted. At this velocity the viscous forces are greater than the inertial forces and laminar flow around the cylinder can be modeled avoiding having to account for turbulent viscous flow. At this Reynolds number vortex shedding will occur, which will provide exposure to simulating unsteady flows.

Solution domain
The domain is 2 dimensional. The cylinder, which is perpendicular to the flow, is modeled as a circle and a rectangular flow domain is created around the cylinder. For the Ralph Regula School of Computational Science CFD portal, a fixed velocity is specified at the inlet and a fixed pressure boundary is specified at the outlet. For this example, we will consider water as the fluid medium.

In the previous example, the geometric parameters had the following settings: X1 = -2.0 X2 = 8.0 Y1 = -2.0 Y2 = 2.0 In this model, the geometric parameters have the following settings:

Page 1

Unsteady Flow Over a Cylinder OpenFOAM X1 = -4.0 X2 = 16.0 Y1 = -4.0 Y2 = 4.0

Solver name icoFoam:


icoFoam is a transient solver for incompressible, laminar flow.

Boundary conditions
Boundary conditions for the unsteady problem are currently defined as: Inlet (left) with fixed velocity U = 0.006 m/s; Outlet (right) with fixed pressure p = 1 atm; No-slip walls on other boundaries. Based on a flow Reynolds number of ~150.

Physical properties
For water at room temperature (23.8 degrees C, or 75 degrees F), we can find in property tables a density of 997 kg/m^3 and a kinematic viscosity of 1.004x10-6 m^2/s.

Initial and Boundary Conditions


As with the previous case, we set the initial and boundary fields for velocity U and pressure p. The upper and lower boundaries are set to symmetry, the left patch to Inlet and the right patch to Outlet. These physical boundary conditions require us to specify a fixedValue at the inlet on U. A no-slip boundary condition is set around the surface of the cylinder. With a convert to meters setting of 0.025, the cylinder diameter is 0.025m. Using this as the characteristic length, an inlet flow velocity of 0.006m/s will yield a Reynolds number of 150. Keeping the Reynolds number under 1000 should allow us to maintain the laminar flow property. At the outlet we specify P = 1 atm.

Case Control
deltaT should be set to 0.02. We will increase the run time to 300 seconds, from 160 seconds in the previous simulation. We will see that the boundary conditions artificially caused the vortex shedding to begin earlier in the simulation, when the smaller domain was used.

Page 2

Unsteady Flow Over a Cylinder OpenFOAM

Laboratory Exercise
Open a Linux command window. Copy the first and second cylinder OpenFOAM models to your directory by executing the following commands: cd export LABS=~jimg/CFD_Course/labs cp R $LABS/cylinder_mesh3 $PWD cp R $LABS/cylinder_mesh3.job $PWD cd cylinder_mesh3 Solid Modeling The dimensionless parameters of the first mesh were -2 to 8 in the horizontal direction and -2 to 2 in the vertical direction. The cylinder had a diameter of 1.0 and a convert to meter multiplier of 0.025 was used. In the 2nd mesh, the dimension are expanded to -4 to 16 in the horizontal direction and -4 to 4 in the vertical direction, keeping the same 1.0 diameter cylinder. These dimensions are still somewhat small, but will allow us to see the impact on the solution while still maintaining a reasonable run-time for a 2 day workshop.

Grid Generation The updated mesh parameters are contained in the file cylinder_mesh2/constant/polyMesh/controlMeshDict. To look at this file type the command: emacs constant/polyMesh/blockMeshDict (File -> Exit to quit) To generate the mesh from this file, the blockMesh utility is used. Type the following command. blockMesh

Page 3

Unsteady Flow Over a Cylinder OpenFOAM

Physical Properties For water at room temperature (23.8 degrees C, or 75 degrees F), we can find in property tables a density of 997 kg/m^3 and a kinematic viscosity of 1.004x10-6 m^2/s. The kinematic viscosity is set in the file: cylinder_mesh2/constant/polyMesh/blockMeshDict. Edit this file and make sure that the kinematic viscosity is set to 1.004e-6. emacs constant/polyMesh/blockMeshDict the line where the kinematic viscosity is set is: nu nu [0 2 -1 0 0 0 0] 1.004e-06;

Initial and Boundary Conditions As described in the problem specification for the CFD portal, we have fixed the types of boundary conditions to be: fixed velocity inlet, pressure outlet, symmetry at the upper and lower flow-field boundaries and no-slip at the cylinder wall. To achieve a laminar Reynolds number of 150 at the cylinder diameter and kinematic viscosity already set, we need to specify an inlet velocity of 0.006 m/s. emacs 0/U To set the inlet velocity, set 0.006 in the following section inlet { type value }

fixedValue; uniform (0.006 0 0);

To set the initial flowfield velocity to 0.006 m/s, set 0.006 at the following line: internalField uniform (0.006 0 0);

(File -> Save, and then File -> Exit) A pressure boundary condition is set at the outlet and a value of 1 atm is specified. emacs 0/p To set the outlet pressure, set 1.0 in the following section: outlet { type

fixedValue; Page 4

Unsteady Flow Over a Cylinder OpenFOAM value } To set the internal flowfield pressure to 1 atm, set 1.0 at the following line: internalField uniform 1; uniform 1.0;

(File -> Save, and then File -> Exit) Solution Control Parameters As mentioned, the flow field around the cylinder in cylinder_mesh1 extended to the boundaries and the boundary conditions imposed impacted the flowfield dynamics. The larger domain in cylinder_mesh2 allows for more time until the vorticies begin to shed, so the runtime will be extended. To 300 seconds. The same time step (deltaT) of 0.02 seconds will be used. To set these parameters, edit the system/controlDict file with the command: emacs system/controlDict The above parameters are set in the following lines: stopAt endTime deltaT writeControl writeInterval endTime; 300; 0.02; timeStep; 100;

You can adjust writeInterval to whatever value you would like. A writeInterval of 100 means that data for post-processing will be written out every 100 time steps (or every 0.02 seconds). (File -> Save, and then File -> Exit) Start the Solver The solution is now ready to be solved. To start the solver, run the command: icoFoam > run1.log & The icoFoam is the command that executes the solver. The Linux re-direct symbol, the greater than sign, takes all output that would normally go to the screen and sends it to the file run1.log.

Page 5

Unsteady Flow Over a Cylinder OpenFOAM To look at the last 30 lines of the run1.log file, type the command: tail -30 run1.log To monitor continuously the contents of the run1.log file, type the command: tail f run1.log ( Press <CTRL>-C to break out of monitoring) A utility was developed to automatically plot the residules from the simulation. To plot the residuales, run the command: perl $LABS/plot_residual.pl run1.log

Page 6

You might also like