Flow Past a Cylinder

Learning Outcome

Students would be able to simulate a developing 2D flow past a rigid cylinder, and plot the skin friction coefficient & pressure coefficient distribution.

Introduction to the problem

Flow past a cylinder is a common problem in fluid mechanics, highlighting the Von-Karman vortex shedding effect. In this example, developing flow across a cylindrical body is simulated. The flow model is simplified by using a two-dimensional mesh for simulation. The Pressure and skin-friction coefficients of the flow are plotted as a function of the radial angle of the cylinder, and the developing flow is observed across several time-steps through snapshots and animations.

Schematic view of the model

Figure 1 Schematic view of the model

Building Geometry (Step 1)

Create a new geometry

Figure 2. Create a new geometry

To begin with, the geometry of the fluid domain needs to be created. Right-click on the 3D-CAD Models and select “New” to start building a CAD model.

Create a new sketch

Figure 3 Create a new sketch

Create a sketch by right-clicking on the XY plane and select “Create Sketch”.

Grid spacing adjustment of the sketch

Figure 4 Grid spacing adjustment of the sketch

For our convenience, we will set the grid spacing of the sketch to 0.5 m.

Create a circle in sketch

Figure 5 Create a circle in sketch

Create a circle and right-click at the circle to apply a fixation constraint.

Apply length dimension

Figure 6 Apply length dimension

Right-click on the circumference and apply radius dimension, make sure the radius is 0.5 m.

Create a rectangle in sketch

Figure 7 Create a rectangle in sketch

Create three-point rectangle and encompass the circle

Create a new geometry

Figure 2. Create a new geometry

Apply the length by right-click on the line and select “Apply length dimension”. When applying the distance between two objects, press ctrl and select both of the objects and right-click on one of them and select “Apply distance dimension”.

Click “ok” to exit the sketch and extrude the sketch with the thickness of 1 m or any other arbitrary distance.

Extrusion of the sketch

Figure 9 Extrusion of the sketch

Extrusion of the sketch

Figure 9 Extrusion of the sketch

The fluid domain would be created as the figure.

Exit the 3D-CAD mode

Figure 11 Exit the 3D-CAD mode

Close 3D-CAD and go back to the main panel.

Rename the 3D-CAD

Figure 12 Rename the 3D-CAD

Rename the body in the 3D-CAD to “Fluid”. 

Topology (Step 2)

Creating a new geometry part

Figure 13 Creating a new geometry part

In the topology, the flow domain and the boundary faces would be determined in this step. Right-click on the Fluid and select “New Geometry part” and click ok to agree with the default settings.

Create a geometry scene

Figure 14 Create a geometry scene

Create a geometry scene from the toolbar.

Rename “Body1” to “Fluid” and expand the “Surfaces” under the fluid. Right-click on “Default” and select “Split by Patch”. Be sure you have created the geometry scene before you execute this command.

Create a geometry scene an split the default surface

Figure 15 Create a geometry scene an split the default surface

Name each boundary by selecting the surface from the numbers or from the geometry scene. Set the default surface that lies on the xy-plane as “Domain”. Set the other surfaces as specified in Figure 16. Click Close when all the surfaces are properly named. The named surfaces will be shown under Surfaces.

Setting up the boundary surfaces

Figure 16 Setting up the boundary surfaces

Right-click on “Fluid” in “Parts” and select “Badge for 2D Meshing” and click ok. 

Badge for 2D meshing

Figure 17 Badge for 2D meshing

Right-click on “Badge for 2D Meshing” and select “Execute”. The solid icon under the “Surfaces” represents the flow domain and the empty icon represents the boundary. The “Default” surface will not be used in the future simulation.

Execution of badge for 2D meshing

Figure 18 Execution of badge for 2D meshing

Assign parts to regions and make a change on the boundary option  as shown in Figure 19. A “Region” would be created under “Region” folder. Rename the “Region” to “Fluid”. 

Creating simulation region

Figure 19 Creating simulation region

Meshing (Step 3)

Before simulation, the flow domain needs to be discretized, and this step is also called meshing. We can do it by creating the mesh from “Fluid” under “Parts”. Use “Automated mesh” instead of “Automated mesh (2D)”.

Creating mesh operation

Figure 20 Creating mesh operation

Select “Surface Remesher”, “Polyhedral Mesher”, and “Prism Layer Mesher” as the meshing models. Click OK.

Mesh model selection

Figure 21 Mesh model selection

Change the base size of the mesh

Figure 22 Change the base size of the mesh

“Automated Mesh” will be created under “Operations”. Change the default controls to the following:

Base size = 0.5 m (radius),Target Surface Size = 50 (%), Minimum Surface size = 50 (%)

Number of prism layers = 5, Prism layer stretching = 1.2, Prism layer total thickness = 20%

Create a “Surface Control” under “Custom Control”

Creating custom mesh control

Figure 23 Creating custom mesh control

Select “Inlet”, “Outlet” and “Symmetry” in parts.

Selecting surfaces for custom mesh control

Figure 24 Selecting surfaces for custom mesh control

Disable the prism layer at the selected surfaces.

Disabling Prism layers for the custom surfaces

Figure 25 Disabling Prism layers for the custom surfaces

Create another surface control and select the cylinder.

Creating another surface control for the cylinder

Figure 26 Creating another surface control for the cylinder

Change the “Target Surface Size” and “Minimum Surface Size” to “Custom”.  Make both of the relative sizes to 5%.

Changing target & minimum surface size for cylinder

Figure 27 Changing target & minimum surface size for cylinder

Enable the Wake Refinement option. A new Wake Refinement would be created under the Values node. 

Setting up wake refinement for cylinder

Figure 28 Setting up wake refinement for cylinder

Click on the mesh icon in the toolbar to generate the mesh.

Generating mesh

Figure 29 Generating mesh

Create a mesh scene

Figure 30 Create a mesh scene

Create a mesh scene to check on the mesh in the window.

The final mesh can be visualized in the mesh scene. The mesh has been refined to better capture the high velocity gradient around the solid and the velocity change in the wake region. 

Final mesh

Figure 31 Final mesh

Physics Models and Boundary Conditions (Step 4)

Physics model selection

Figure 32 Physics model selection

In this section, physics models for the simulation and the boundary conditions would be determined. To enable the required physics models, double click on “Models” under “Continua” and select the following model:

  • Two Dimensional
  • Implicit Unsteady
  • Gas
  • Segregated Flow
  • Constant Density
  • Laminar
Air Properties

Figure 33 Air Properties

After finishing the selection of physics models, change the air density and dynamic viscosity to 1 kg/m3 and 5×10-2 N-s/m2  respectively.

The boundary conditions need to be specified in each surface. The default settings of all the boundaries would be wall, so we have to change them accordingly. For the inlet, change the type of the boundary to velocity inlet and set the value of velocity to 1 m/s.

Inlet boundary conditions

Figure 34 Inlet boundary conditions

Outlet boundary conditions

Figure 35 Outlet boundary conditions

For the outlet, change the type of the boundary to pressure outlet, and the pressure is 0 Pa in default.

Symmetry boundary conditions

Figure 36 Symmetry boundary conditions

For the symmetry boundary, change the type of the boundary to “Symmetry Plane”.

Cylinder boundary conditions

Figure 37 Cylinder boundary conditions

Leave the cylinder boundary condition to the default value “Wall”.

It is worth noting that the Reynolds number for this exercise is 20.

Preparing Simulation (Step 5)

Updating solvers

Figure 38 Updating solvers

In this step, we will set up the solvers for the simulation. Go to “Solvers”, change the time step to 0.2 s and the temporal discretization to 2nd-order.

In this step, we will set up the stopping criteria for the simulation. We can set the converging criteria by checking the residuals instead of giving a fixed iteration step alone. Right-click on “Stopping Criteria” and create a new monitor criterion. Create 3 monitors. After that, set the minimum limit to 1E-6  for all of them and also change the logical rule to “AND”. Also set the following values for the stopping criteria:

Maximum Inner Iterations: 200

Maximum Physical Time: 3000 s

Maximum steps: disabled

From the settings in the stopping criteria, the simulation will stop when the maximum iterations are reached and all of the residuals are below 10-6

Setting up the stopping criteria

Figure 39 Setting up the stopping criteria

Create a scalar scene

Figure 40 Create a scalar scene

Next, we will set up the scenes and monitors. This will allow us to check the results while running and after the simulation is finished. To visualize the velocity contour, create a scalar scene from the tool bar.

Select the function of scalar scene

Figure 41 Select the function of scalar scene

In the scalar scene, right-click on the legend and select velocity magnitude function.

Next, we will prepare the lift plot. Right-click on Report and select “Force Coefficient” and rename the “Force Coefficient 1” to “Lift Coefficient”. Change the direction to [0.0, 1.0. 0.0] and assign “Fluid.Cylinder” to “Parts. Then Right-click on “Lift Coefficient” and create monitor and plot from report.

Setting up the lift coefficient plot

Figure 42 Setting up the lift coefficient plot

Setting up the solution history

Figure 43 Setting up the solution history

Next, we will set up the scenes and monitors. This will allow us to check the results while running and after the simulation is finished. To visualize the velocity contour, create a scalar scene from the tool bar.

Before running the simulation, initial values should be given. Go to “Initial Condition” and set the intial velocity as [0.0, 0.0]. Next, select the green flag icon in tool bar and initialize the solution. 

Solution initialization

Figure 44 Solution initialization

Drag the “Solution Time” under Tools to the scene.

Adding  solution time to the scalar scene

Figure 45 Adding solution time to the scalar scene

Figure 46 Run the solution

Figure 46 Run the solution

Finally, click on the run icon to start the simulation.

Post Processing (Step 6)

Post processing is rather important because we need to examine the result and further analyze it. After finishing the simulation, check the residual plot and see if all the converging criteria are satisfied. The velocity contour would be shown in the scalar scene.

Velocity contour

Figure 47 Velocity contour

Double-click on the lift coefficient plot in “Plots”.

Lift coefficient plot

Figure 48 Lift coefficient plot

Creating a vector scene

Figure 49 Creating a vector scene

For a better view of the vortex patterns around the cylinder, create a vector scene from the tool bar. Change the Relative Length to 2% to have a better view. A pair of steady vortex can be seen behind the cylinder.

Next, we will create a Drag Coefficient report. Right-click on report and create another force coefficient. Rename it to Drag Coefficient. Assign Fluid.Cylinder to Parts, and double-click on Drag Coefficient to open the report.

Creating a drag coefficient report

Figure 50 Creating a drag coefficient report

Next, we will create a plot of the drag coefficient distribution. Right-click on derived part and select threshold. Extract the upper surface of the cylinder. After finishing the settings, click Create.

Drag coefficient distribution across the cylinder

Figure 51 Drag coefficient distribution across the cylinder

Right-click on Plots and create a new XY plot. Assign the threshold to the Parts.

Creating an XY plot

Figure 52 Creating an XY plot

Creating a new cylindrical coordinate system

Figure 53 Creating a new cylindrical coordinate system

Create a new X type (Angle). Go to Tools and find the Coordinate Systems. Right-click on Local Coordinate Systems and create a cylindrical coordinate (r, θ, z). A new Cylindrical 1 will be created.

Right-click Field Functions and create a scalar function. Right-click on the new function and rename it to Angle.

Creating an angle field function

Figure 54 Creating an angle field function

Go back to XY Plot 1. Change the X Type and Scalar Function.

Updating X type in the XY plot

Figure 55 Updating X type in the XY plot

Create a new Y type. Assign the pressure coefficient and skin friction coefficient to the scalar function of Y Type 1 and Y Type 2, respectively.

Creating and updating the Y types in the XY plot

Figure 56 Creating and updating the Y types in the XY plot

This gives us the following plot:

Creating and updating the Y types in the XY plot

Figure 57 Creating and updating the Y types in the XY plot

Note: The reference velocity (1 m/s) and reference density (1 kg/m3) of pressure coefficient and skin friction coefficient can be set under Tools -> Field Functions.

To view the results at different time steps, right-click on demo and create recorded solution view. A demo would be generated under solution views. Drag demo under Solution Views to the scalar scene. 

Creating and updating the Y types in the XY plot

Figure 58 Creating and updating the Y types in the XY plot

Change the state and the scalar scene would show the results at the corresponding time step.

Viewing scalar scenes at different time steps

Figure 59 Viewing scalar scenes at different time steps

Turning video animation on for solution view

Figure 60 Turning video animation on for solution view

To create a video animation out of different time step still images, Go to Solution Views and set the animation mode to “Solution Time”. “Solution Time Animation” node would be created.

Go to the scalar scene. Click the recording icon in the toolbar. Set the frame rate and the animation length.

0.2 [s/time step] x 10 [time step/s] x 50 [s] = 100 [s]

This will render a video file on a specified address on your computer.

Recording the animation into a video file

Figure 61 Recording the animation into a video file