Fluid flow simulations in the undergraduate fluids class

Transcription

Fluid flow simulations in the undergraduate fluids class
Introducing CFD in
Undergraduate Fluid Mechanics
John Cimbala, Mechanical Engr., Penn State Univ.
with collaboration from:
Shane Moeykens, Strategic Partnerships Manager, ANSYS.
Ajay Parihar, FlowLab Support Engineer, ANSYS.
Sujith Sukumaran, FlowLab Support Engineer, ANSYS
Satyanarayana Kondle, FlowLab Support Engineer, ANSYS.
ISTEC Meeting, Cornell University
July 25-26, 2008, Ithaca, NY
Introduction
z It
has become important in recent years to
introduce the fundamentals of CFD in introlevel undergraduate fluid mechanics classes
due to the changing requirements of the job
market for graduating engineers
z At a minimum, it is desirable to teach the
Many
of
them
will
use
CFD
in
their
fundamental steps required to obtain a useful
whether they know anything
CFD jobs,
solution
about
CFD
or
not!
z Many instructors want to include CFD in their
undergrad fluids course, but don’t know how
and/or think they can’t afford the class time
Our first attempt to
introduce CFD to
undergrads
z Undergraduate
fluid
mechanics textbook,
Fluid Mechanics:
Fundamentals and
Applications, by Y. A.
Çengel and J. M.
Cimbala, McGraw-Hill,
2006
z Chapter 15:
Introduction to CFD
Çengel-Cimbala
textbook
zThe CFD
chapter
introduces:
– grids
– boundary
conditions
– residuals
– etc.
Çengel-Cimbala
textbook
zThe CFD
chapter
introduces:
– grids
– boundary
conditions
– residuals
– etc.
Çengel-Cimbala
textbook
zThe CFD
chapter
introduces:
– grids
– boundary
conditions
– residuals
– etc.
Çengel-Cimbala
textbook
zThe CFD
chapter
introduces:
– grids
– boundary
conditions
– residuals
– etc. – just the basics, not anything about
numerical algorithms, stability, etc. – how to
use CFD as a tool.
Intro to CFD using FlowLab
z The
Çengel-Cimbala book includes FlowLab
as a textbook companion, where CFD exercises
are employed to convey important concepts to
the student
z 46 FlowLab end-of-chapter problems are
included in Ed. 1, Chapter 15 (Intro to CFD)
z FlowLab exercises jointly developed by John
Cimbala and Fluent Inc. (now part of ANSYS).
z FlowLab & these FlowLab templates are free
to students who use the Çengel-Cimbala book
What is FlowLab?
zA
virtual (CFD) fluids laboratory
z Simple to use with a very fast learning curve
z Runs pre-defined exercises (templates)
z Setup, solution, and post-processing are all
performed in the same interface
z Students vary only one or two parameters in
each template (to look at trends, compare
boundary conditions, grid resolution, etc.)
FlowLab Templates
zEach homework problem, along with its
corresponding FlowLab template, has been
carefully designed with two major learning
objectives in mind:
– Enhance the student’s understanding of a
specific fluid mechanics concept
– Introduce the student to a specific
capability and/or limitation of CFD
through hands-on practice
Original Templates for Ed. 1
z FlowLab
HW problems only in CFD chapter
z Most templates are too complex to compare
with analytical calculations (e.g., flow over
cylinders, flow through diffusers, etc.)
z Emphasis mostly on CFD – grid resolution,
extent of computational domain, BCs, etc.
z In the first edition, the primary emphasis of the
FlowLab templates was as a CFD learning
tool, with only a secondary emphasis on
learning fluid mechanics
New Templates for Ed. 2
z New
FlowLab templates in almost all chapters
– goal is to introduce students to CFD early on
z Most new templates compare CFD calculations
with analytical calculations
z The primary emphasis is learning fluid
mechanics, with a secondary emphasis on CFD
z New templates are intentionally more simple
z Homework problems show a progression in
difficulty and level of sophistication, often
based on the same base problem or theme
Examples: New homework & templates, Ed. 2
z
End-of-chapter homework problem, Chap. 2
2-89 A rotating viscometer consists of two
concentric cylinders – an inner cylinder of
radius Ri rotating at angular velocity (rotation
This
is a astandard
analytical
problem
rate)
ωi, and
stationary
outer cylinder
of as
found
in most
undergraduate
fluids books.
the tiny gap between
the
inside
radius
Ro. In
two cylinders is the fluid of viscosity μ. The
length
of the
theanpage
in the
They
arecylinders
able to (into
obtain
analytical
sketch)
is L. L is large
such that
effects
are
(approximate)
solution
forend
a small
gap.
negligible (we can treat this as a twodimensional problem). Torque (T) is required
to rotate the inner cylinder at constant speed.
Ro
Ri
ωi
Fluid: ρ, μ
Rotating inner cylinder
Stationary outer cylinder
(a) Showing all your work and algebra, generate an approximate expression
for T as a function of the other variables. (b) Explain why your solution is
only an approximation. In particular, do you expect the velocity profile in
the gap to remain linear as the gap becomes larger and larger (i.e., if the
outer radius Ro were to increase, all else staying the same)?
z
Solution (from solutions manual)
2-89 (a) We assume a linear velocity profile between the two walls as sketched – the
inner wall is moving at speed V = ωiRi and the outer wall is stationary. The thickness
of the gap is h, and we let y be the distance from the outer wall into the fluid
Inner cylinder
(towards the inner wall). Thus,
y
du
V
V
u =V
and τ = μ
=μ
h
dy
h
h
u
y
where
h = R - R and V = ω R
o
i
i
i
Outer cylinder
Since shear stress τ has dimensions of force/area, the clockwise (mathematically
negative) tangential force acting along the surface of the inner cylinder by the fluid
is
μωi Ri
V
2π Ri L
F = −τ A = − μ 2π Ri L = −
h
Ro − Ri
But the torque is the tangential force times the moment arm Ri. Also, we are asked
for the torque required to turn the inner cylinder. This applied torque is
counterclockwise (mathematically positive). Thus,
Analytical
solution for a
small gap
2π Lμωi Ri 3 2π Lμωi Ri 3
=
T = − FRi =
Ro − Ri
h
z
Another end-of-chapter homework problem, Chap. 2
2-90
This is one of their first exposures
to CFD through FlowLab
Consider the rotating viscometer of the previous problem. We make an
approximation that the gap (distance between the inner and outer cylinders)
is very small. Consider an experiment in which the inner cylinder radius is
Ri = 0.0600 m, the outer cylinder radius is Ro = 0.0602 m, the fluid viscosity
is 0.799 kg/m⋅s, and the length L of the viscometer is 1.00 m. Everything is
held constant in the experiment except that the rotation rate of the inner
cylinder varies. (a) Calculate the torque in N⋅m for several rotation rates in
the range -700 to 700 rpm. Discuss the relationship between T and ωi (is the
relationship linear, quadratic, etc.?). (b) Run FlowLab with the template
Concentric_inner. Set the rotation rate to the same values as in Part (a), and
calculate the torque on the inner cylinder for all cases. Compare to the
approximate values of Part (a), and calculate a percentage error for each
case, assuming that the CFD results are “exact”. Discuss. In particular, how
good is the small-gap approximation? Note: Be careful with the sign (+ or -)
of the torque.
They calculate torque as a function of rpm
z
Solution (from solutions manual)
2-90 (a) Note that we must convert the rotation rate from rpm to radians per second
so that the units are proper. When ωi is -700 rpm, we get
rot ⎞⎛ 2π rad ⎞⎛ 1 min ⎞
rad
⎛
ωi = ⎜ −700
73.304
=
−
⎟⎜
⎟⎜
⎟
min ⎠⎝ rot ⎠⎝ 60 s ⎠
s
⎝
For h = 0.0002 m, the torque is calculated (using the equation derived in the previous
problem). Note, however, that since we are calculating the torque of the fluid acting
on the cylinder, the sign is opposite to that of the previous problem,
2π Lμωi Ri 3
2π Lμωi Ri 3
T=−
=−
Ro − Ri
h
=−
We run various rpm cases,
both manually and with CFD
rad ⎞
3
⎛
2π (1.00 m )( 0.799 kg/m ⋅ s ) ⎜ −73.304
0.0600
m
(
)
⎟
⎛
⎞
N
⎝
0.0002 m
s ⎠
⎜
2 ⎟
kg
m/s
⋅
⎝
⎠
= 397.445 N ⋅ m ≅ 397. N ⋅ m
where we have rounded to three significant digits. We repeat for various other values
of rotation rate, and summarize the results in the table below.
(b) The FlowLab template was run with the same values of ωi. The results are
compared with the manual calculations in the table. The agreement between
manual and CFD calculations is excellent for all rotation rates. The relationship
between torque and rotation rate is linear, as predicted by theory.
z
Solution (from solutions manual - continued)
Analytical
Agreement between
analytical and CFD
results is excellent
FlowLab
Discussion Since
the gap here is very
small compared to
the radii of the
cylinders, the linear
velocity profile
approximation is
actually quite good,
yielding excellent
agreement between
theory and CFD.
However, if the gap
were much larger,
the agreement
would not be so
good.
z
Another end-of-chapter homework problem, Chap. 2
2-91
This is the next problem in this series
Consider the rotating viscometer of the previous problem. We make an
approximation that the gap (distance between the inner and outer cylinders)
is very small. Consider an experiment in which the inner cylinder radius is
Ri = 0.0600 m, rotating at a constant angular rotation rate of 300 rpm. The
fluid viscosity is 0.799 kg/m⋅s, and the length L of the viscometer is 1.00 m.
Everything is held constant in the experiment except that different diameter
outer cylinders are used. The gap distance between inner and outer cylinders
is h = Ro – Ri. (a) Calculate the torque in N⋅m for the following gaps:
0.0002, 0.0015, 0.0075, 0.02, and 0.04 m. (b) Run FlowLab with the
template Concentric_gap. Set the gap to the same values as in Part (a), and
calculate the torque on the inner cylinder for all cases. Compare to the
approximate values of Part (a), and calculate a percentage error for each
case, assuming that the CFD results are “exact”. Discuss. In particular, how
good is the small-gap approximation? Note: Use absolute value of torque to
avoid sign inconsistencies.
This time we vary gap size at a fixed rpm
z
Solution (from solutions manual)
2-91 (a) First we convert the rotation rate from rpm to radians per second so that the
units are proper,
rot ⎞⎛ 2π rad ⎞⎛ 1 min ⎞
rad
⎛
=
ωi = ⎜ 300
31.416
⎟⎜
⎟⎜
⎟
min ⎠⎝ rot ⎠⎝ 60 s ⎠
s
⎝
When h = 0.0002 m, the torque is calculated (using the equation derived in the
previous problem). Note, however, that since we are calculating the torque of the
fluid acting on the cylinder, the sign is opposite to that of the previous problem,
2π Lμωi Ri 3
2π Lμωi Ri 3
We run various gap size cases,
T=−
Ro − Ri
=−
h
both manually and with CFD
rad ⎞
3
⎛
2π (1.00 m )( 0.799 kg/m ⋅ s ) ⎜ 31.416
0.0600
m
(
)
⎟
⎛
⎞
N
s ⎠
⎝
=−
⎜
2 ⎟
⋅
0.0002 m
kg
m/s
⎝
⎠
= −170.336 N ⋅ m ≅ −170. N ⋅ m
where we have rounded to three significant digits. We repeat for various other values
of gap distance h, and summarize the results in the table below.
(b) The FlowLab template was run with the same values of h. The results are
compared with the manual calculations in the table and plot shown below. Note: We
use absolute value of torque for comparison without worrying about the sign.
z
Solution (from solutions manual - continued)
The agreement between
analysis and CFD is
great for small gap sizes
But the agreement is not so good
for the larger gap sizes
z
Solution (from solutions manual - continued)
The agreement between manual and CFD calculations is excellent for
very small gaps (the percentage error is less than half a percent for the
smallest gap). However, as the gap thickness increases, the agreement gets
worse. By the time the gap is 0.04 m, the agreement is worse than 50%. Why
such disagreement? Remember that we are assuming that the gap is very
small and are approximating the velocity profile in the gap as linear.
Apparently, the linear approximation breaks down as the gap gets larger.
Discussion
We used a log scale for torque so that the differences
between manual calculations and CFD could be more clearly seen.
Students realize that their simple small-gap approximation
breaks down as the gap gets larger. At this point in their study
of fluid mechanics, they do not know how to calculate this
flow exactly for arbitrary gap size and rpm – that is not
learned until Chapter 9, the differential equations chapter.
Examples: New homework & templates, Ed. 2
z
End-of-chapter homework problem, Chap. 9
This is a follow-up problem to those of Chapter 2 just discussed
9-92 An incompressible Newtonian liquid is
confined between two concentric circular
cylinders of infinite length – a solid inner cylinder
of radius Ri and a hollow, stationary outer cylinder
of radius Ro. (see figure; the z axis is out of the
page.) The inner cylinder rotates at angular
velocity ωi. The flow is steady, laminar, and twodimensional in the r-θ plane. The flow is also
rotationally symmetric, meaning that nothing is a
function of coordinate θ (uθ and P are functions of
radius r only). The flow is also circular, meaning
that velocity component ur = 0 everywhere.
Generate an exact expression for velocity
component uθ as a function of radius r and the
other parameters in the problem. You may ignore
gravity. Hint: The result of Problem 9-91 is useful.
Now we advance to
Chapter 9 problems
Ro
Ri
ωi
Fluid: ρ, μ
First, an analytical
solution
Rotating
inner cylinder
Stationary outer cylinder
z
Solution (from solutions manual)
9-92 The solution is fairly long and not repeated in its entirety here. The NavierStokes equations are solved analytically for this simple geometry, and the boundary
conditions are applied. Here are the last few lines of the solution:
The solution:
uθ = C1
r C2
+
2 r
Apply one boundary condition:
R C
0 = C1 o + 2
2 Ro
Apply another boundary condition:
or
Ri C2
Ri
Ro 2
Riωi = C1 +
= C1 − C1
2 Ri
2
2 Ri
Solve for the constants of integration:
−2 Ri 2ωi
C1 = 2
Ro − Ri 2
The final equation is
⎛ Ro 2
⎞
−r⎟
⎜
⎝ r
⎠
Ri 2ωi
uθ = 2
Ro − Ri 2
Ro 2
C2 = −C1
2
Ro 2 Ri 2ωi
C2 = 2
Ro − Ri 2
Analytical
solution for any
gap with
This is a closed-form analytical solution. In the next problem, wesize
compare
CFD.
z
Another end-of-chapter homework problem, Chap. 9
9-93
This is the next problem in this series
Glycerin (ρ = 1259.9 kg/m3, and μ = 0.799 kg/m·s) flows between two
concentric cylinders as in the previous problem. The inner radius is 0.060 m,
and the inner cylinder rotates at 300 rpm. The outer cylinder is stationary.
Recall from Chapter 2 that when the gap between the cylinders is small, the
tangential velocity of the fluid in the gap is nearly linear. When the gap is
large, however, we expect the linear approximation to fail. Run FlowLab with
the template Concentric_gap. Run two cases: (a) a small gap of 0.001 m and
(b) a large gap of 0.060 m. For each case, plot and save the velocity profile
data. Compare to the analytical prediction for both cases. Is there good
agreement? How good is the linear approximation? Discuss.
Now we use FlowLab (actually the same template as in Chapter 2) to
compare CFD-generated velocity profiles to those generated
analytically. We do this for two gaps, a small gap and a large gap.
z
Solution (from solutions manual)
9-93 (a) Small gap (gap = 0.001 m): We apply the equation from the previous
problem to calculate the tangential velocity as a function of radius,
⎞
Ri 2ωi ⎛ Ro 2
uθ = 2
−r⎟
2 ⎜
Ro − Ri ⎝ r
⎠
and we plot the velocity profile, uθ as a function of r, in the plot below. We
run FlowLab for the same geometry and conditions, and plot the velocity
profile on the same plot for comparison. The agreement is excellent (less
than 0.02% error at any radius). This is not surprising since the flow is
laminar, steady, etc. CFD does a very good job in this kind of situation. The
small errors are due to lack of complete convergence and a mesh that could
be a little finer. The profile is nearly linear as expected since the gap is
small.
Students compare the analytical (exact) solutions to those obtained
by FlowLab for both cases, small gap and large gap.
z
Solution (from solutions manual - continued)
The small gap results show excellent agreement as expected, and the
velocity profile is nearly linear since the gap is so small.
z
Solution (from solutions manual - continued)
(b) Large gap (gap = 0.06 m): We repeat for the larger gap case. The plot is
shown below. Again the agreement is excellent, with errors less than 0.1%
for all radii, but the profile is not linear – the linear approximation
breaks down when the gap can no longer be considered small.
This time, the large gap results
show excellent agreement as
well since we have not made a
small-gap approximation; but
the profile is not linear.
z
Solution (from solutions manual - continued)
Discussion
Problems such as this in which a known analytical solution
exists are great for testing CFD codes. The fluid properties did not enter into
the calculations – viscosity affects only the transient solution, not the final
flow field.
• Note how this one simple problem yields several
homework problems – even across chapters.
• Students get a feel for using CFD and compare the
results with analytical analysis.
• They see where their simplified analysis works well
and where it breaks down (e.g., small gap
approximation breaks down when the gap is too large).
• These types of analytical/FlowLab problems have
been added to nearly all the chapters in Ed. 2.
FlowLab Details
for this problem
Here is the
mesh that
FlowLab
generates for
the same
geometry as in
the exact
analysis.
Residual
plot
(iteration
takes only
a couple
minutes)
They look
at velocity
magnitude
contours
They plot
velocity
magnitude
vs. radial
position.
They save
these data
points to
an Excel
file.
Live FlowLab Demonstration
We will demonstrate the templates called
“Concentric_gap”
and “Submerged_plate_angle”
[These templates will have corresponding endof-chapter homework problems in Ed. 2 of the
Çengel-Cimbala undergraduate fluids textbook.]
If time, also show some other templates “live”.
Summary
z It is possible to introduce the fundamentals of CFD
into an undergraduate fluids course
(I do it in only one class period, plus homework)
z FlowLab software enables students to experience
thedetails
key – can
CFD without getting boggedHomework
down inisthe
introduce
students to CFD
z Each FlowLab exercise has two
objectives:
without taking much class time
– Enhance understanding of fluid mechanics
– Teach the capabilities and limitations of CFD
z Most of the new templates in Ed. 2 of the fluids
textbook by Çengel and Cimbala compare analytical
solutions to those obtained with CFD for enhanced
learning and good exposure to CFD
How to Integrate CFD into an
Undergraduate Fluids Course
zDevelop the continuity and Navier-Stokes
equations for fluid flow, as usual
zShow how to solve simple problems
analytically (solve N-S equations):
– Couette flow between plates
This
Thisisiswhat
whatisis
– Fully developed pipe flow
new
normally
– added
done
to in
the
an course.
introductory
– Etc.
fluid mechanics
waycourse.
to do the
zThen, introduce CFD as a
same thing, but with a computer.
How to Integrate CFD into an
Undergraduate Fluids Course
zThe CFD lecture takes only about one
class period, where we briefly explain:
– Computational domain and types of grids
– Boundary conditions and initial guesses
– The concept of residuals and iteration
– Post-processing (contour plots, etc.)
zIn-class “live” demonstration of FlowLab
zAssign homework requiring FlowLab
The homework is where students get hands-on CFD practice
Sample lecture notes from
Fall 2005, Penn State
(the lecture where CFD was
presented for the first time)
These notes are directly from my lecture notes, given
using a tablet PC, and posted on the Internet for
students to download
Still-Slide Back-Up to
Live Demonstration of
FlowLab template
“Diffuser_angle”
Example: Flow through a conical
diffuser
z Fluid
Mechanics Learning Objective:
Compare pressure recovery in conical
diffusers of half-angle 5° to 90°
z CFD Objective: Observe streamline
patterns and flow separation as diffuser
half-angle increases; compute pressure
recovery for all cases
Flow through a conical diffuser
θ
V
D2
D1
x
L1
L2
Wall
Wall
Pout
Pin
V
Geometry and
dimensions
x
Axis
Computational
domain, assuming
axisymmetric flow
User Interface for FlowLab
Operation
options
Main working
window
Result
table
Overview
window
Graphical display
window
Display
options
Flow through a conical diffuser
Diffuser section
x
Hybrid mesh for the 5o half-angle
conical diffuser
Flow through a conical diffuser (continued)
X-Y plot of
residuals for
the conical
diffuser case,
θ = 5o
Flow through a conical diffuser
(a) θ = 5o
x
(g) θ = 20o
x
(b) θ = 7.5o
x
(h) θ = 25o
x
(c) θ = 10o
x
(i) θ = 30o
x
(d) θ = 12.5o
x
(j) θ = 45o
x
(e) θ = 15o
x
(k) θ = 60o
x
(f) θ = 17.5o
x
(l) θ = 90o
x
Streamlines through conical diffusers of various half-angles
Flow through a conical diffuser
Pressure difference from inlet to
outlet of a conical diffuser as a
function of diffuser half-angle
θ
ΔP
5
7.5
10
12.5
15
17.5
20
25
30
32.5
35
37.5
45
60
75
90
-49.1371
-47.7787
-44.9927
-42.4013
-39.6981
-37.6431
-36.0981
-32.7173
-29.9919
-23.2118
-21.6434
-21.0490
-19.6571
-18.7252
-18.1364
-18.3018
Flow through a conical diffuser
-10.0
Pressure difference
from inlet to outlet
of a conical diffuser
as a function of
diffuser half-angle
-20.0
ΔP
(Pa)
-30.0
-40.0
-50.0
0
50
θ (degrees)
100
Flow through a conical diffuser
(a) θ = 5o
(b) θ = 30o
(c) θ = 45o
Pressure contours through a conical diffuser of three
different half-angles. Colors range from dark blue at
-60 Pa to bright red at 0 Pa gage pressure.
Flow through a conical diffuser
(a) θ = 5o
(b) θ = 30o
(c) θ = 45o
Contours of turbulent kinetic energy through a conical
diffuser of three different half-angles. Colors range from dark
blue at 0 m2/s2 to bright red at 3.5 m2/s2
Still-Slide Back-Up to
Live Demonstration of
FlowLab template
“Block_mesh”
Example: Flow over a rectangular block
z Fluid
Mechanics Learning Objective:
Compare drag coefficient with empirical
results
z CFD Objective: Learn to refine a mesh
until grid independence is achieved