You are on page 1of 52

SC07 Education Program

Desktop to Grid Parallel Session

November 10, 2007

Jim Giuliani
Client and Technology Support Manager
Ohio Supercomputer Center

Introduction to Fluid Dynamics

Computational Fluid Dynamics Motivation & Processes

State of the Art in CFD and its Role in Education

CFD Tools
•Java Applets
•MATLAB Application

• A brief introduction will be given to the field of Fluid
Mechanics and the types of physical systems that can
be modeled
• Computational Fluid Dynamics (CFD):
– Why CFD
– How it is applied
– What is the current state of the art
• CFD’s role in Education
– Design Tool for the…???
– Educational tool for understanding
physical phenomena
“The story behind the simulation”
• Applications will be explored that allow computers to
help convey fundamental concepts in fluid dynamics
that allow for increased knowledge discovery

What is Fluid Dynamics
• Roughly defined: Fluid Mechanics is the study of
a system in which a fluid is the working medium
• Other fields
– Solid mechanics
– Thermodynamics
• Statics is the study of
systems at rest
• Dynamics is the study
of systems in motion

Classification of Fluid Mechanics
Continuum Fluid Mechanics
• Inviscid
• Viscous
– Laminar
– Turbulent
• Compressible/Incompressible

Classification of Fluid Mechanics
Problems are also classified in terms of the number
of dimensions of the problem
• 1-Dimensional
• 2-Dimensional
• 3-Dimensional
Most problems are 3-D,
but analysis based on
fewer dimensions is
often meaningful

Differential vs. Integral Approach
Differential Equations
– Equations formulated in terms of infinitesimal control volumes
– Solution of differential equations determines the detailed, point
by point, behavior of the flow
Integral Equations
– System under study does not require a detailed knowledge of
the flow
– Equations formulated in terms of finite systems and control
– Often easier to treat analytically

Navier-Stokes Equations
Du ∂p ∂  2  ∂u ∂v ∂w  ∂   ∂u ∂v  ∂   ∂w ∂u 
ρ = ρg x − +  µ  2 − −  +  µ  +  +  µ  + 
Dt ∂x ∂x  3  ∂x ∂y ∂z  ∂y   ∂y ∂x  ∂z   ∂x ∂z 

Dv ∂p ∂   ∂v ∂u  ∂  2  ∂v ∂u ∂w  ∂   ∂v ∂w 
ρ = ρg y − +  µ  +  +  µ  2 − −  +  µ  + 
Dt ∂y ∂x   ∂x ∂y  ∂y  3  ∂y ∂x ∂z  ∂z   ∂z ∂y 

Dw ∂p ∂   ∂w ∂u  ∂   ∂v ∂w  ∂  2  ∂w ∂u ∂v 
ρ = ρg z − +  µ  +  +  µ  +  +  µ  2 − − 
Dt ∂z ∂x   ∂x ∂z  ∂y   ∂z ∂y  ∂z  3  ∂z ∂x ∂y 

Assumptions/simplifications allow us to reduce complexity

•For an inviscid flow, where we neglect viscosity, we
simplify the equations to the Euler equations
•For an incompressible, constant viscosity flow, the
viscous terms simplify significantly (more applicable to
gasses than fluids)
Why Computational Fluid Dynamics
• Once we have classified our problem, we can derive equations that
describe the fluid system
• Due to complex geometries, or lack of realistic analytical equations, we
use numerical methods to approximate the fluid equations
• CFD uses computers to develop
solutions to fluid mechanic
– Ability to solve more complex
– Ability investigate regions of the
flow where sensors cannot be

The CFD Process
• Once the governing equations for a problem have been
derived, the task of solving them numerically can be started
• A fundamental aspect of CFD is to discretize the spatial
domain into small cells to form a volume mesh or grid
• A suitable algorithm to solve the equations is then applied
• Implicit tech.
solve the eqns.
• Time marching
explicit tech.

The CFD Process: Gridding

• Only 1.5” gap between belly and ground

• To properly represent flow through any gap, should have at least 5 cells between wall surfaces
• Turbulence modeling requires first layer of cells on road and body to be ~0.5”
– This leaves only ~0.5” for remaining 3 layers; results in very high aspect ratio cells and misrepresented
ground/vehicle boundary layer interaction

Boundary layer cells 0.5”

Boundary layer cells 0.5”

State of the Art in CFD
• Large companies understand the impact of numerical
simulations on R&D and are leading the charge
– SC07 Masterworks series
• Advances in mesh generation allow complex CAD
geometries to reliably be meshed from solid models
• Node and element counts in the 10 to 100 million range
BASE – 0.34
(Cd = Drag coefficient)

XV1 – 0.21

State of the Art in CFD
• Many commercial CFD applications now support
distributed memory parallel processing
• Production runs common in the 50 to 500 processor
• Leading edge runs in the 1000 to 5000 processor
• Example: Virtual wind tunnel
Solution driven by velocity inlets on
domain walls

Flow exits domain through

pressure outlet

Roll of CFD in Education
• Fluid mechanics courses are in many undergraduate
• Computational techniques, specifically visualization, offer
many educational benefits in helping convey fundamental
fluid mechanic
• Computer
simulations can
allow some lab
experiments to be
replaced with
on-line tutorials
• CFD courses are
mostly found at the
graduate level
Case Studies
• We will consider several fundamental problems in fluid
mechanics and examine how different computational
tools can be used to solved the problem and highlight
• Applying the different tools to the same problem will help
compare an contrast the capabilities of the different
• Flow over a cylinder is a fundamental fluid mechanics
problem of practical importance. The flow field over the
cylinder is symmetric at low values of Reynolds number.
As the Reynolds number increases, flow begins to
separate behind the cylinder causing vortex shedding
which is an unsteady phenomenon (and a COOL

CFD Tools Overview
Three tools will be discussed in the workshop
• Java applications and Java applets
– Programs written in the Java programming language and
often integrated with on-line web pages
– Commercial software package for general mathematical
– FlowLab (educational product) integrates commercial mesh
generator (GAMBIT) and solver (FLUENT) with simplified
GUIs for students

While only scratching the surface, these applications

cover the range of simulation ability, from simple Java
app, to cutting edge parallel CFD solver

Java Applets
Java is a very useful tool for education
– Applets allow for easy integration into web based lecture
material and on line exercises.
– Interactive and often include graphics
– Excellent portability and distribution
– Many good applets already exist (some funded by NSF)

– High degree of programming effort
– Java is not fast enough for many computational tasks

Java Applets - Example
– NSF funded project at Virginia Tech

– Fluid Dynamics
– Statics
– Dynamics
Applications that automate
calculations with data
visualization allow
students to interact with
science, not just observe

Java Applets – Ideal Flow Machine
Ideal Flow Machine
– Ideal Flow Machine is designed for students learning the
foundations of fluid mechanics
– The term ‘ideal flow' describes the way in which a fluid (liquid
or gas) moves when the effects of compressibility and
viscosity are negligible
– Removing these terms from the Navier-Stokes equations
reduces the problem to one that can be solved analytically or
• Go to the engAPPLET web page
• Click on Ideal Flow Machine, which is in the left hand
• Click on “Launch Ideal Flow Machine”

Java Applets – Ideal Flow Machine

We will use
the following
options from
the pull
down menu
to examine
flow around
a cylinder:
•Free stream
•Vortex 20
Java Applets – Ideal Flow Machine
• Choose the Free Stream option from the pull down
• Type in 10.0 in the Strength input box
• Click anywhere on the mesh. An arrow will appear
on the left hand side showing the free stream
• Choose the Circle option from the pull down menu
• Click on one of the cross hairs and hold down the
mouse button
• Pull the mouse to the neighboring cross hare and
• You should see a green circle appear on the mesh

Java Applets – Ideal Flow Machine
• Choose the “Draw Streamline” option from the pull down
• Click anywhere
on the mesh
and you will
see a
from that point

Java Applets – Ideal Flow Machine
• Choose Vortex from the pull down menu and
click anywhere on the mesh to add in a vortex
(flow circulating around a point)
• Click on Draw Streamline to visualize the
new flow
• Click on New Flow
and redo the
exercise but with
10.0 strength
and 10.0 angl

Java Applets - Example
• NASA Glenn Research Center – “The Beginner’s
Guide to Aeronautics”
• Java applications for:
– Aerodynamics
• FoilSim Interactive Simulator (very good)
• CurveBall Interactive Simulator
• Atmosphere Modeler
– Propulsion
– Hypersonics
– Model Rockets

FoilSim Choose between ideal flow
and flow with separation

Sliders allow students to

dynamically change the
orientation and design of the
airfoil and see real time 25
the ideal
by adding
real world
Students to change spin of ball and see
curve balls
possible) (lbs of force, change in streamlines)
as well as qualitative results
26 (ball / strike)
• Graphical User Interfaces can be designed to lead
students through exercises
• Good quality and easy to implement graphics
• Software can be used for other academic purposes
• Not as fast as native code
• Software has a financial cost to students

Navier2d – Example MATLAB CFD
• Navier2d is a set of MATLAB functions designed to
simulate the motion of incompressible fluids via
numerical solution of the 2D, unsteady Navier-Stokes
• Available from the MATLAB Central file exchange
– Go to
– Click on User Community
– Type Navier2d in the search box and click Search
• Solver reads in mesh, which allows flexibility to solve
different problems
• Mesh generator is available in a separate MATLAB

• Graphical User Interface designed into the
application to lead the student through the
different steps of the solution
– Allows for easy step-by-step example problems
– Separate mesh generator allow students to go
beyond the “caned” examples
• Allows students to gain experiences with the
terminology and work flow of computational
fluid dynamics, while still learning about the
flow problem at hand

Navier2d – How to Run
• Download the zip file and unpack on your local
• Start up MATLAB and in the Current Directory
window, move to the
directory where
Navier2d resides
• Right click on
Navier2d.m and
click Run
• You should see the
applications main

Navier2d - Mesh
Rather than build a mesh from scratch, we will use a pre-
defined mesh of a cylinder in a free stream
• In the “Mesh Options”
window, click Load
• In the file browser
that pops up, select
and Open
• Click View to see
the mesh

Navier2d – Boundary Conditions
• To set boundary conditions, click the
Velocity/Pressure button in the
Boundary Conditions window
• To set boundary conditions, click the Select
• With your mouse, drag a box around the
nodes you want to select and then press the
right mouse button when done
• With the nodes highlighted in red, click the
Set button to apply the boundary condition to
those nodes.

Navier2d – Boundary Conditions
• For this example, we will choose the following initial
and boundary conditions
– Inlet (left hand side)
• Velocity B/C
• U=5m/s, V=0m/s
– Top and bottom
• Velocity B/C
• U=5m/s, V=0m/s
– Outlet (right side)
• Outflow
– Surface of cylinder
• Velocity B/C
• U=0m/s, V=0m/s
• Click File->Close
when done

Navier2d – Initial and Solver
• Under Integration Settings, click on Initial and
set the U velocity to the initial value of 5m/s
• Under Integration Settings, click on Set to set
solver options
• Accept defaults, but change Maximum number of
steps to 2000 and then click OK
• Click Run to begin the solution
• Watch the vortex structure form as the simulation

Navier2d - Results

• One of the leading CFD
applications for research
and product development
• A wide range of physical
systems and processes can
be simulated using numerous
techniques and equations
– Compressible/Incompressible
– Combustion
– Porous media
– Flow with heat transfer
– Adaptive mesh refinement
– Parallel solver
FLUENT Capabilities

Simulation of a 1
gallon milk
container being
formed by blow
includes the
arison extrusion,
pinch-off, mold
closing and
inflation steps

FlowLab – Academic Interface for
• Integrates the following three steps:
– Preprocessor
• Meshing the object or domain to be analyzed
• Applying boundary conditions
• Set application/solver control parameters
• Usually graphic intensive
– Solver
• Read in the mesh and supporting input files and solve
• Longest step, usually CPU, memory and disk intensive
– Post Processor
• Read in solution and visually display data
• X – Y plots, histograms, contour plots, animations

• Provides a virtual fluids lab for teaching and virtually
reinforcing concepts in fluid flow and heat transfer
• Acquaints students with the following:
– Terminology of CFD
– Basics of geometry and mesh generation
– Setting up a problem
– Concepts of accuracy and convergence
– Post processing
• Several fluid mechanics text books include FlowLab

FLUENT – High Performance Computing
• Now that we have seen examples of CFD on the
desktop, let’s examine a larger application
• Motivation
– Examine more complex flow systems
– Experience the full modeling process
• Pre-processing
• Solving
• Post-processing
– Introduce the concept of parallel processing
• Solve models quicker
• Solve bigger models

o *
Mixing Problem in 90 Elbow
A cold fluid at 20 C flows
into the pipe through a
large inlet, and mixes
with a warmer fluid at
40oC that enters through
a smaller inlet located at
the elbow
• Heat transfer, 3-D,
Turbulent flow
• Will run in parallel on
4 processors

* Fluent 6.3 Tutorial Guide

FLUENT – High Performance Computing

• Workshop accounts will be

provided for access to Ohio
Supercomputer Centers
IBM 1350 Opteron cluster
• Due to network load, slow graphic
performance is very possible
1. Open up a CYGWIN terminal
2. SSH to the Opteron cluster:

ssh –X

where you will replace ### with the number given to you

First Steps – Starting a Remote
• To run parallel FLUENT, we are going to request 1 machine
and all 4 processors within that machine
• A graphics window will return after we start FLUENT
– It is possible to do perform tasks through menu interface
– For speed, we will type in most commands
• To request 4 processors
qsub –I –V –l walltime=1:00:00 –l nodes=1:ppn=4
• To start FLUENT In this exercise,
text in a bubble as
module load fluent seen here are
rm -f pnodes commands you will
type into the
cat $PBS_NODEFILE | sort > pnodes FLUENT command
setenv ncpus `cat pnodes | wc -l` window.
fluent 3d -t$ncpus -pinfiniband.ofed -cnf=pnodes

FLUENT Command Window

Read in Model and Partition
parallel partition auto use-case-file-method
rc elbow3.cas.gz
Solve initialize initialize-flow

Display Parallel Decomposition
(NOTE: These are mouse/keyboard commands)
• Click on Display
• Click on Contours
• Change “Contours of” selection
to “Cell Info…”
• Chose “Active Cell Partition”
from the box below
• Change “Levels” to 4, which
is the number of processors
we are using for this run
• Choose “symmetry” from
the “Surfaces” selection
• Click Display
• Click Close

Parallel Decomposition

Set Initial Conditions
(NOTE: These are mouse/keyboard commands)
Type command:
file write-case elbow4
Click on Solve
Click on Initialize
Click on Initialize
Choose “velicity-inlet-5”
from “Compute From”
Change “Y velocity” to 0
Click INIT
Click OK

Solve the Model
solve iterate 200
(when finished)
file write-data elbow5
parallel timer usage

Display Results
(NOTE: These are mouse/keyboard commands)
Click on Display
Click on Contours
Change “Contours of” selection
to “Custom Field Functions…”
Chose “dynamic-head”
from the box below
Change “Levels” to 80
Choose “symmetry” from
the “Surfaces” selection
Click Display
Click Close

Simulation Results

FLUENT Observations
• Many problems have static solutions
• Students not familiar with Fluid Mechanics seem to like the
interactive process and obtaining the solution, as long as
step-by-step instructions are given
• Students with Fluid Mechanic behavior will benefit from
being able to interact with solution results and see system
characteristics that have been covered in lecture
• High school students can handle geometry design and
meshing, along with setting initial and boundary conditions
• Junior undergraduate students are able to develop and
solve complete models