Transient Analysis Compressible Fluid PDF
Transient Analysis Compressible Fluid PDF
Transient Analysis Compressible Fluid PDF
Introduction
In this tutorial, ANSYS FLUENT’s density-based implicit solver is used to predict the
time-dependent flow through a two-dimensional nozzle. As an initial condition for the
transient problem, a steady-state solution is generated to provide the initial values for
the mass flow rate at the nozzle exit.
This tutorial demonstrates how to do the following:
• Use dynamic mesh adaption for both steady-state and transient flows.
• Create an animation of the transient flow using ANSYS FLUENT’s transient solution
animation feature.
Prerequisites
This tutorial is written with the assumption that you have completed Tutorial 1, and
that you are familiar with the ANSYS FLUENT navigation pane and menu structure.
Some steps in the setup and solution procedure will not be shown explicitly.
Release 12.0
c ANSYS, Inc. March 12, 2009 4-1
Modeling Transient Compressible Flow
Problem Description
The geometry to be considered in this tutorial is shown in Figure 4.1. Flow through a
simple nozzle is simulated as a 2D planar model. The nozzle has an inlet height of 0.2 m,
and the nozzle contours have a sinusoidal shape that produces a 20% reduction in flow
area. Due to symmetry, only half of the nozzle is modeled.
plane of symmetry
0.2 m p (t )
exit
2. Unzip unsteady_compressible.zip.
The files nozzle.msh and pexit.c can be found in the unsteady compressible
folder created after unzipping the file.
Step 1: Mesh
1. Read the mesh file nozzle.msh.
File −→ Read −→Mesh...
Release 12.0
c ANSYS, Inc. March 12, 2009 4-3
Modeling Transient Compressible Flow
(a) Select Density-Based from the Type list in the Solver group box.
The density-based implicit solver is the solver of choice for compressible, tran-
sonic flows without significant regions of low-speed flow. In cases with sig-
nificant low-speed flow regions, the pressure-based solver is preferred. Also,
for transient cases with traveling shocks, the density-based explicit solver with
explicit time stepping may be the most efficient.
(b) Retain the default selection of Steady from the Time list.
Note: You will solve for the steady flow through the nozzle initially. In later
steps, you will use these initial results as a starting point for a transient
calculation.
Release 12.0
c ANSYS, Inc. March 12, 2009 4-5
Modeling Transient Compressible Flow
Step 3: Models
Models
Release 12.0
c ANSYS, Inc. March 12, 2009 4-7
Modeling Transient Compressible Flow
Step 4: Materials
Materials
(a) Select ideal-gas from the Density drop-down list, so that the ideal gas law is
used to calculate density.
Note: ANSYS FLUENT automatically enables the solution of the energy equa-
tion when the ideal gas law is used, in case you did not already enable it
manually in the Energy dialog box.
(b) Retain the default values for all other properties.
(c) Click the Change/Create button to save your change.
(d) Close the Create/Edit Materials dialog box.
Release 12.0
c ANSYS, Inc. March 12, 2009 4-9
Modeling Transient Compressible Flow
Release 12.0
c ANSYS, Inc. March 12, 2009 4-11
Modeling Transient Compressible Flow
(a) Retain the default selection of Least Squares Cell Based from the Gradient drop-
down list in the Spatial Discretization group box.
(b) Select Second Order Upwind from the Turbulent Kinetic Energy and Specific
Dissipation Rate drop-down lists.
Second-order discretization provides optimum accuracy.
Release 12.0
c ANSYS, Inc. March 12, 2009 4-13
Modeling Transient Compressible Flow
Release 12.0
c ANSYS, Inc. March 12, 2009 4-15
Modeling Transient Compressible Flow
Release 12.0
c ANSYS, Inc. March 12, 2009 4-17
Modeling Transient Compressible Flow
9. Save the case and data files (noz ss.cas and noz ss.dat).
File −→ Write −→Case & Data...
Release 12.0
c ANSYS, Inc. March 12, 2009 4-19
Modeling Transient Compressible Flow
10. Display the steady flow contours of static pressure (Figure 4.4).
Graphics and Animations −→ Contours −→ Set Up...
The steady flow prediction in Figure 4.4 shows the expected pressure distribution,
with low pressure near the nozzle throat.
Release 12.0
c ANSYS, Inc. March 12, 2009 4-21
Modeling Transient Compressible Flow
! Although the mass flow rate history indicates that the solution is con-
verged, you should also check the mass flux throughout the domain to
ensure that mass is being conserved.
! The net mass imbalance should be a small fraction (e.g., 0.1%) of the total
flux through the system. The imbalance is displayed in the lower right
field under kg/s. If a significant imbalance occurs, you should decrease
your residual tolerances by at least an order of magnitude and continue
iterating.
(d) Close the Flux Reports dialog box.
2. Read the user-defined function (pexit.c), in preparation for defining the transient
condition for the nozzle exit.
Define −→ User-Defined −→ Functions −→Interpreted...
The pressure at the outlet is defined as a wave-shaped profile, and is described by
the following equation:
Release 12.0
c ANSYS, Inc. March 12, 2009 4-23
Modeling Transient Compressible Flow
where
ω = circular frequency of transient pressure (rad/s)
pexit = mean exit pressure (atm)
In this case, ω = 2200 rad/s, and pexit = 0.7369 atm.
A user-defined function (pexit.c) has been written to define the equation (Equa-
tion 4.1) required for the pressure profile.
Note: To input the value of Equation 4.1 in the correct units, the function pexit.c
has to be written in SI units.
More details about user-defined functions can be found in the separate UDF Man-
ual.
(a) Select udf transient pressure (the user-defined function) from the Gauge Pressure
drop-down list.
(b) Click OK to close the Pressure Outlet dialog box.
Release 12.0
c ANSYS, Inc. March 12, 2009 4-25
Modeling Transient Compressible Flow
Release 12.0
c ANSYS, Inc. March 12, 2009 4-27
Modeling Transient Compressible Flow
! Calculating 600 time steps will require significant CPU resources. Instead
of calculating the solution, you can read the data file (noz uns.dat.gz)
with the precalculated solution. This data file can be found in the folder
where you found the mesh and UDF files.
By requesting 600 time steps, you are asking ANSYS FLUENT to compute six pres-
sure cycles. The mass flow rate history is shown in Figure 4.6.
5. Save the transient case and data files (noz uns.cas and noz uns.dat).
File −→ Write −→Case & Data...
1. Request the saving of case and data files every 10 time steps.
Calculation Activities (Autosave Every)−→ Edit...
Release 12.0
c ANSYS, Inc. March 12, 2009 4-29
Modeling Transient Compressible Flow
Extra: If you have constraints on disk space, you can restrict the number of
files saved by ANSYS FLUENT by enabling the Retain Only the Most Recent
Files option and setting the Maximum Number of Data Files to a nonzero
number.
2. Create animation sequences for the nozzle pressure and Mach number contour plots.
Calculation Activities (Solution Animations)−→ Create/Edit...
Release 12.0
c ANSYS, Inc. March 12, 2009 4-31
Modeling Transient Compressible Flow
Figure 4.7 shows the contours of static pressure in the nozzle after 600
time steps.
iv. Click OK to close the Animation Sequence dialog box associated with the
pressure sequence.
(e) Click the Define... button for mach-number to open the associated Animation
Sequence dialog box.
i. Make sure that In Memory is selected in the Storage Type list.
ii. Set Window to 4 and click the Set button.
iii. Select Contours in the Display Type group box to open the Contours dialog
box.
A. Select Velocity... and Mach Number from the Contours of drop-down
lists.
B. Make sure that Filled is enabled from the Options group box.
C. Disable Auto Range.
D. Enter 0.00 for Min and 1.30 for Max.
E. Click Display and close the Contours dialog box.
Figure 4.8 shows the Mach number contours in the nozzle after 600
time steps.
iv. Click OK to close the Animation Sequence dialog box associated with the
mach-number sequence.
(f) Click OK to close the Solution Animation dialog box.
Release 12.0
c ANSYS, Inc. March 12, 2009 4-33
Modeling Transient Compressible Flow
When the calculation finishes, you will have ten pairs of case and data files and
there will be 100 pairs of contour plots stored in memory. In the next few steps,
you will play back the animation sequences and examine the results at several time
steps after reading in pairs of newly saved case and data files.
Release 12.0
c ANSYS, Inc. March 12, 2009 4-35
Modeling Transient Compressible Flow
(a) Retain the default selection of pressure in the Sequences selection list.
(b) Click the play button (the second from the right in the group of buttons in
the Playback group box).
(c) Close the Playback dialog box.
Examples of pressure contours at t = 0.017993 s (the 630th time step) and t =
0.019135 s (the 670th time step) are shown in Figures 4.9 and 4.10.
6. In a similar manner to steps 4. and 5., select the appropriate active window and
sequence name for the Mach number contours.
Examples of Mach number contours at t = 0.017993 s and t = 0.019135 s are shown
in Figures 4.11 and 4.12.
Release 12.0
c ANSYS, Inc. March 12, 2009 4-37
Modeling Transient Compressible Flow
! Since the solution animation was stored in memory, it will be lost if you
exit ANSYS FLUENT without saving it in one of the formats described
previously. Note that only the animation-frame format can be read back
into the Playback dialog box for display in a later ANSYS FLUENT session.
7. Read the case and data files for the 660th time step (noz anim0660.cas and
noz anim0660.dat) into ANSYS FLUENT.
Release 12.0
c ANSYS, Inc. March 12, 2009 4-39
Modeling Transient Compressible Flow
The transient flow prediction in Figure 4.13 shows the expected form, with peak
velocity of approximately 241 m/s through the nozzle at t = 0.018849 seconds.
9. In a similar manner to step 7. and 8., read the case and data files saved for other
time steps of interest and display the vectors.
Summary
In this tutorial, you modeled the transient flow of air through a nozzle. You learned how
to generate a steady-state solution as an initial condition for the transient case, and how
to set solution parameters for implicit time-stepping.
You also learned how to manage the file saving and graphical postprocessing for time-
dependent flows, using file autosaving to automatically save solution information as the
transient calculation proceeds.
Finally, you learned how to use ANSYS FLUENT’s solution animation tool to create
animations of transient data, and how to view the animations using the playback feature.
Further Improvements
This tutorial guides you through the steps to generate a second-order solution. You
may be able to increase the accuracy of the solution even further by using an appropriate
higher-order discretization scheme and by adapting the mesh further. Mesh adaption can
also ensure that the solution is independent of the mesh. These steps are demonstrated
in Tutorial 1.
Release 12.0
c ANSYS, Inc. March 12, 2009 4-41
Modeling Transient Compressible Flow