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.
Building Geometry (Step 1)
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 sketch by right-clicking on the XY plane and select “Create Sketch”.
For our convenience, we will set the grid spacing of the sketch to 0.5 m.
Create a circle and right-click at the circle to apply a fixation constraint.
Right-click on the circumference and apply radius dimension, make sure the radius is 0.5 m.
Create three-point rectangle and encompass the circle
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.
The fluid domain would be created as the figure.
Close 3D-CAD and go back to the main panel.
Rename the body in the 3D-CAD to “Fluid”.
Topology (Step 2)
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 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.
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.
Right-click on “Fluid” in “Parts” and select “Badge for 2D Meshing” and click ok.
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.
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”.
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)”.
Select “Surface Remesher”, “Polyhedral Mesher”, and “Prism Layer Mesher” as the meshing models. Click OK.
“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”
Select “Inlet”, “Outlet” and “Symmetry” in parts.
Disable the prism layer at the selected surfaces.
Create another surface control and select the cylinder.
Change the “Target Surface Size” and “Minimum Surface Size” to “Custom”. Make both of the relative sizes to 5%.
Enable the Wake Refinement option. A new Wake Refinement would be created under the Values node.
Click on the mesh icon in the toolbar to generate the mesh.
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.
Physics Models and Boundary Conditions (Step 4)
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
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.
For the outlet, change the type of the boundary to pressure outlet, and the pressure is 0 Pa in default.
For the symmetry boundary, change the type of the boundary to “Symmetry Plane”.
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)
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
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.
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.
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.
Drag the “Solution Time” under Tools to the scene.
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.
Double-click on the lift coefficient plot in “Plots”.
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.
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.
Right-click on Plots and create a new XY plot. Assign the threshold to the Parts.
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.
Go back to XY Plot 1. Change the X Type and Scalar Function.
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.
This gives us the following 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.
Change the state and the scalar scene would show the results at the corresponding time step.
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.