联系我们: 手动添加方式: 微信>添加朋友>企业微信联系人>13262280223 或者 QQ: 1483266981
MECH5770M Tutorial 2
Written by Dr Carl Gilkeson School of Mechanical of Engineering, University of Leeds, 2017 1
MECH5770M: Computational Fluid Dynamics Analysis
Tutorial 2: Lid-Driven Cavity (ii) Simulations and
Postprocessing
Tutorial 2 Outline:
Requires your two meshes from Tutorial 1
Read each one into FLUENT and set up case files
Run a laminar flow simulation at a Reynolds number of 100
Basic post-processing of the results
Compare both results with benchmark solutions by Ghia et al., 1982
Prerequisites
1) Ensure that you have completed Tutorial 1 which taught the basics of CFD pre-processing. You will also be
using the two mesh files you created.
Notes
1) You MUST complete the tutorials in order otherwise you will struggle to complete later exercises.
2) Regularly save your work – programs do crash and you will lose unsaved work!
3) This document is written using ANSYS version 18.1, however, you may have access to later versions of the
software. If this is the case, some menus and screen outputs may differ slightly but you should still be able
to complete the tutorial. If you have any questions or problems, the demonstrators will be able to help you.
4) The following acronyms are used throughout this document:
RC = Right mouse button click
LC = Left mouse button click
MC = Middle mouse button click
MECH5770M Tutorial 2
Written by Dr Carl Gilkeson School of Mechanical of Engineering, University of Leeds, 2017 2
1) Now that you have completed the
pre-processing required in Tutorial 1,
you can use the coarse mesh to set
up your first simulation. Open
FLUENT Version 18.1 via the
Windows start button: In the
“Search programs and files” field,
type “Fluent” then LC on the Fluent
18.1 icon (Alternatively you can find
the program in: All Programs →
ANSYS 18.1 → Fluid Dynamics →
Click on the icon for Fluent 18.1).
When the Fluent Launcher appears,
select 2D, Double Precision and tick
both Display Options → OK:
2) Read in the coarse mesh: File → Read → Mesh → Select your mesh file ldc-8×8.msh from your Tutorials folder
→ OK:
By launching Fluent in double precision mode, all calculations will be made using 16 significant figures instead of
the reduced accuracy of 8 significant figures. Using double precision minimises round-off error.
Now that your mesh file has been read into Fluent, all the models and numerical schemes can be set up by
progressively moving down the Tree on the left as well as the Task Page. It is also possible to do this using the
menus at the top of the window. Fluent is a CFD solver and a postprocessor. You will learn more about its
capabilities as you complete these tutorials.
Menus
MECH5770M Tutorial 2
Written by Dr Carl Gilkeson School of Mechanical of Engineering, University of Leeds, 2017 3
3) Next you need to check the scale of the mesh to ensure you are solving the flow inside a 1m x 1m square: LC the
Setting Up Domain menu → LC on the Scale… button in the Mesh sub-menu → Check that the domain extents
are 0 – 1 m in the Scale Mesh menu box for both X and Y coordinates:
If the Domain Extents have incorrect units, click on the down arrow under Mesh Was Created In and LC
on the appropriate units (in this case, metres).
If the scale is incorrect, LC on Specify Scaling Factors and set these manually e.g. if your domain extents
are 0 – 1000 m, set scaling factors to 0.001 → LC Scale) (Note: ALWAYS check the scale of your mesh,
incorrect scale selection is a common mistake for new CFD users).
If the scale is correct, but your origin is in the wrong location (i.e. not 0,0) LC on the Transform button in
the Setting Up Domain menu → LC Translate… → specify appropriate Translation Offsets → LC
Translate.
4) Next, you need to set a translational velocity of 1.4607e-03 m/s to the moving wall (this produces a Reynolds
Number of 100, which represents a laminar flow regime). Double-click on wall-moving which is listed under
Boundary Conditions in the Tree → when the boundary condition window will appears → select Moving Wall →
set Speed = 1.4607e-03 → ensure that the translational direction x = 1 and y = 0 → OK
Note: since the lid-driven cavity problem is governed entirely by the motion of the top surface (the lid) all the other
boundary conditions are defined; by default, the other walls are stationary with the no-slip condition applied.
MECH5770M Tutorial 2
Written by Dr Carl Gilkeson School of Mechanical of Engineering, University of Leeds, 2017 4
5) Now that the boundary conditions are
defined, the next step is to initialise the
solution in preparation for running the
simulation. Double-click on Initialization
which is listed under Solution in the Tree →
in the adjacent Task Page LC Standard
Initialization → LC down arrow next to
Compute From → LC wall-moving → LC
Initialize button at the bottom. If you see
the message “The current data has not
been saved. OK to discard ” LC OK
6) Now that the simulation is ready to run, you
must save a case file. The case saves all of
the options you have set in Fluent so that
you can come back to your simulation and
change parameters and models. File →
Write → Case → locate the directory you
are saving to (e.g. Tutorials) under
Directories -> under the Case File box enter
the name of the file as ldc-8×8.cas.gz.
Note: .cas.gz is the case file extension and this is compressed; gz means that a compression program called
gunzip compresses the file – this is important in keeping your file sizes small.
7) To run the simulation: Double click on Run Calculation… in the Tree → using the keyboard, set Number of
Iterations to 1000 in the Task Page → Calculate (you may need to click this button twice). The simulation will
take only 2 seconds to run in about 35 iterations and you should see a message indicating that the calculation is
complete. Another message in the console states that the solution is converged:
MECH5770M Tutorial 2
Written by Dr Carl Gilkeson School of Mechanical of Engineering, University of Leeds, 2017 5
The plot shown illustrates the Scaled Residuals which are a measure of the error in the solution. Since an
iterative numerical scheme is employed, the errors progressively reduce in magnitude as the number or
iterations increases. The box Calculation Complete indicates that the errors have dropped below the default
convergence tolerance of 0.001; this will be discussed in more detail in later tutorials.
8) Save the simulation data: File → Write → Data → locate the directory you are saving to (Tutorials) → under the
Data File box enter the name of the file as ldc-8×8.dat.gz (As before, the .gz extension ensures that the data file
is compressed saving valuable disk space).
9) The next stage is to postprocess the results. To show static pressure contour plots → Double click on Contours
under Results which appears at the bottom of the Tree → in the Task Page double click on Contours → after the
Contours window appears select Filled under Options → LC Save/Display:
MECH5770M Tutorial 2
Written by Dr Carl Gilkeson School of Mechanical of Engineering, University of Leeds, 2017 6
10) In the Contours window select contours of Velocity… and ensure Velocity Magnitude is selected immediately
below → Save/Display. You should see a contour plot which is the same as the ‘Standard contour plot’ shown
below. This clearly shows that the velocity of the fluid is highest near the top of the cavity (the ‘driven lid’) which
has a sideways translational velocity (you specified this in step 4). Although this looks physical, the interpolation
used by the standard contours disguises a poor solution. LC on the box to the left of Node Values to deselect it in
the Contours menu. Displaying the contours this way shows the actual solution i.e. one numerical value for
velocity per cell:
11) Now read in the fine mesh: File → Read → Mesh… → Select the option Discard Data, Replace Mesh (this
retains all the solver settings from the first simulation, but replaces the mesh) → LC Continue… → Locate the
fine mesh file ldc-32×32.msh → OK:
12) Save a new case file which is the same as the previous one, only with a finer mesh. Name the file ldc-
32×32.cas.gz. Repeat step (7) to run the fine simulation which will take about 10 seconds to run in around 175
iterations. Save the data file as ldc-32×32.dat.gz.
Standard contour plot Contours of the actual node values
MECH5770M Tutorial 2
Written by Dr Carl Gilkeson School of Mechanical of Engineering, University of Leeds, 2017 7
13) Display contours of velocity magnitude using both the standard contours and node values. You should see the
following comparison which illustrates how a much finer mesh resolution resolves the flow field in a more
appropriate level of detail, compared to the 8 x 8 mesh. In later tutorials you will be exploring the concept of
grid independence (also known as mesh independence) which is essential to obtain accurate solutions.
14) Another way to check the accuracy of a numerical solution is to compare quantitative data against either
experimental or analytical data. The lid-driven cavity is a simple geometry so comparisons can be made between
your CFD results above and benchmark analytical results. In the following steps, you will be plotting velocity
profiles and comparing with the data in: Ghia, U., Ghia, K.N. and Shin, C.T. High-Re Solutions for Incompressible
Flow Using the Navier-Stokes Equations and a Multigrid Method, Journal of Computational Physics, 48, 387-
411, 1982. Find a copy of this article online (search using the authors names, they are unique enough to locate
the article) and observe the data in Table I and II; in a later task you will need to plot the data at Re = 100.
15) Create a vertical line passing through the centre of the cavity: LC on the Postprocessing tab at the top of the
window → under Surface LC Create → Line/Rake… → when the Line/Rake Surface menu box appears set the
End Points of the line to be (0.5,0.0) and (0.5,1.0), as shown below → Also set the New Surface Name to
vertical-line → Create:
16) Repeat for the horizontal line which has coordinates of (0.0,0.5) and (1.0,0.5). Name the surface horizontal-line.
MECH5770M Tutorial 2
Written by Dr Carl Gilkeson School of Mechanical of Engineering, University of Leeds, 2017 8
17) To show the horizontal velocity profile: LC on the Postprocessing tab → XY Plot → Edit… → when the Solution X
Y Plot menu box appears set the Plot Direction vectors to be X=1 and Y=0 → Select the Y Axis Function as
Velocity and Y Velocity → Highlight horizontal-line (created in step 16) from the list of Surfaces → Plot:
18) The plot can be altered to make it easier to see: LC Curves… at the bottom of the Solution X Y Plot menu box →
when the Curves – Solution XY Plot menu box appears, under Line Style change the Pattern to — → under
Marker Style change the Symbol to o and the Color to black → Change the Size to 0.5 → Apply → LC Plot again
in the Solution X Y Plot menu box:
Note: You can experiment with the Curves settings to customise your plots and make them easier to interpret;
default settings are not always the best ones to use.
MECH5770M Tutorial 2
Written by Dr Carl Gilkeson School of Mechanical of Engineering, University of Leeds, 2017 9
19) To export the data for use in a spreadsheet, click on the Write to File box under Options in the Solution XY Plot
menu box → Click the Write… button (previously this was the Plot button) → Name the file u-profile-32×32 →
OK.
20) Repeat steps (17) and (19) to plot and the export the X velocity data along the vertical line, being careful to
change the Plot Direction so that X=0 and Y=1. Call the data v-profile-32×32.
21) Save the case file again, over-writing ldc-32×32.cas.gz (recall step 12). The new case file will now contain the two
lines you have created in the previous steps.
22) Read in the case and data file for the coarse simulation which you ran earlier (ldc-8×8.cas.gz and ldc-8×8.dat.gz).
Repeat steps (15-20) to generate the vertical and horizontal velocity profiles for the 8 x 8 mesh.
23) Now that you have all four profiles (two per mesh), import these into Excel. To do this: Open Excel → File →
Open → Select File Type as “All Files (*,*) → Locate one of your profiles e.g. u-profile-32×32 → Open → When
the Text Import Wizard Opens click Next → tick the box next to Space → Finish. You will now see some text
above two columns of data, one for position, the other for velocity. You will need to individually open each data
set and copy the data into a separate Excel file containing all four profiles.
24) Plot the profiles and observe the difference between the fine and coarse solutions.
MECH5770M Tutorial 2
Written by Dr Carl Gilkeson School of Mechanical of Engineering, University of Leeds, 2017 10
25) Before closing Fluent, open the fine case and data file and explore other visualisation tools. Try to generate a
vector plot and an open contour plot of the stream function to compare with the qualitative results shown in the
journal article described in step (14):
26) Close Fluent.
Tutorial 2 Summary:
You have:
Set up a basic flow simulation with appropriate boundary conditions
Post-processed the result qualitatively contour plots
Exported flow data and compared with existing benchmark results
End of Tutorial


发表评论