Sei sulla pagina 1di 90

ME 608

Numerical Methods for Heat, Mass


and Momentum Transfer
Jayathi Y. Murthy
Professor, School of Mechanical Engineering
Purdue University
jmurthy@ecn.purdue.edu

Spring 2006
Lecture 1: Introduction to ME 608
Conservation Equations
Outline of Lecture

z Course organization
z Introduction to CFD
z Conservation equations, general scalar transport equation
z Conservation form
Motivation

Huge variety of industrial flows:


•Rotating machinery
•Compressible/incompressible
aerodynamics
•Manifolds, piping
•Extrusion, mixing
•Reacting flows, combustion ….
Impossible to solve Navier-Stokes
equations analytically for these
applications!
History
z Earliest “CFD” work by L.F. Richardson
(1910)
» Used human computers
» Iterative solutions of Laplace’s eqn
using finite-difference methods, flow
over cylinder etc.
» Error estimates, extrapolation to Lewis F. Richardson
zero error (1881-1953)

“So far I have paid piece rates for the Also researched mathematical
operation (Laplacian) of about n/18 models for causes of war :
pence per coordinate point, n being the
number of digits … one of the quickest Generalized Foreign Politics
boys averaged 2000 operations (1939)
(Laplacian) per week for numbers of 3
digits, those done wrong being Arms and Insecurity(1949)
discounted …” Statistics of Deadly Quarrels
(1950)
Richardson, 1910
History
z Relaxation methods (1920’s-50’s)
z Landmark paper by Courant, Friedrichs and
John
Lewy for hyperbolic equations (1928)
z Von Neumann stability criteria for parabolic von Neumann
problems (1950) (1903-1957)
z Harlow and Fromm (1963) computed unsteady
vortex street using a digital computer.
z They published a Scientific American article
(1965) which ignited interest in modern CFD
and the idea of computer experiments
z Boundary-layer codes developed in the 1960-
1970’s (GENMIX by Patankar and Spalding in
1972 for eg.)
z Solution techniques for incompressible flows
published through the 1970’s (SIMPLE family of
algorithms by Patankar and Spalding for eg.) Richard Courant
(1888-1972)
z Jameson computed Euler flow over complete
aircraft (1981)
z Unstructured mesh methods developed in
1990’s
Conservation Equations

z Nearly all physical processes of interest to us are governed by


conservation equations
» Mass, momentum energy conservation
z Written in terms of specific quantities (per unit mass basis)
» Momentum per unit mass (velocity)
» Energy per unit mass e
z Consider a specific quantity φ
» Could be momentum per unit mass, energy per unit mass..
z Write conservation statement for φ for control volume of size
∆x x ∆y x ∆z
Conservation Equations (cont’d)

Accumulation of φ in control volume over time step ∆t =


Net influx of φ into control volume
- Net efflux of φ out of control volume
+ Net generation of φ inside control volume
Conservation Equations (cont’d)

Accumulation:

Generation:

Influx and Efflux:


Diffusion and Convection Fluxes

Diffusion Flux

Convection
Flux

Net flux

Velocity Vector

Diffusion coefficient Γ
Combining…

Taking limit as ∆x, ∆y, ∆z -> 0


General Scalar Transport Equation

Or, in vector form:


Conservation Form

Consider steady state. The conservation form of the


scalar transport equation is:

Non-Conservation Form

Finite volume methods always start with the conservation


form
General Scalar Transport Equation

Storage Convection Diffusion Generation

Recall: φ is a specific quantity (energy per unit mass


say)
V : velocity vector
Γ: Diffusion coefficient
ρ: density
S: Source term (Generation per unit volume W/m3)
Continuity Equation

∂ρ
+ ∇ ⋅ ( ρV ) = 0
∂t

Here,
φ= 1
Γ= 0
S=0
Energy Equation

h = sensible enthalpy per unit mass, J/kg


k = thermal conductivity
Sh = energy generation W/m3

Note: h in convection and storage terms


T in diffusion terms
How to cast in the form of the general scalar transport
equation?
Energy Equation (cont’d)

Equation of State

Substitute to Find

Here,
φ= h
Γ= k/Cp
S = Sh
Momentum Equation

X-Momentum Equation

Here, ⎛ ∂ui ∂u j ⎞
τ ij = µ ⎜ + ⎟⎟
⎜ ∂x
φ= u ⎝ j ∂xi ⎠
Γ= µ
∂p S is good “dumping ground” for
S = Su - everything that doesn’t fit into
∂x the other terms
Species Transport Equation

Yi = kg of specie i /kg of mixture


Γi = diffusion coefficient of i in mixture i
Ri = reaction source
Closure

z In this lecture we
» Developed the procedure for developing the governing
equation for the transport of a scalar φ
» Recognized the commonality of transport of
– Mass, momentum, energy, species
» Casting all these different equations into this single form is
very useful
» Can devise a single method to solve this class of governing
equation
Lecture 2: The General Scalar Transport
Equation
Overview of Numerical Methods
Last time…

z Wrote conservation statement for a control volume


z Derived a general scalar transport equation
z Discovered that all transport processes commonalities
» Storage
» Diffusion
» Convection
» Generation
This time…

z Examine important classes of partial differential equations and


understand their behavior
z See how this knowledge applies to the general scalar transport
equation
z Start a general overview of the main elements of all numerical
methods
General Scalar Transport Equation

Storage Convection Diffusion Generation

Recall: φ is a specific quantity (energy per unit mass


say)
V : velocity vector
Γ: Diffusion coefficient
ρ: density
S: Source term (Generation per unit volume W/m3)
Classification of PDEs

Consider the second-order partial differential equation for


φ (x,y):

Coefficients a,b,c,d,e,f are linear -- not functions of


φ, but can be functions of (x,y)

Discriminant

D<0 Elliptic PDE


D=0 Parabolic PDE
D>0 Hyperbolic PDE
Elliptic PDEs

Consider 1-D heat conduction in a


plane wall with constant thermal
conductivity

To

TL
Boundary conditions

Solution:
Elliptic PDE’s

To
• T(x) is influenced by both
boundaries TL

• In the absence of source terms,


T(x) is bounded by the values on
both boundaries
•Can we devise numerical
schemes which preserve these
properties?
Parabolic PDEs

Consider 1D unsteady conduction T0 T0


Ti
in a slab with constant properties:

Boundary and initial conditions Solution:


Parabolic PDEs (cont’d)

T0 Ti T0

• The solution at T(x,t) is influenced by the boundaries, just as with elliptic PDEs
•We need only initial condtions T(x,0). We do not need future conditions
•Initial conditions only affect future conditions, not past conditions
• Initial conditions affect all spatial points in the future
• A steady state is reached as t->∞. In this limit we recover the elliptic PDE.
•In the absence of source terms, the temperature is bounded by initial and
boundary conditions
•Marching solutions are possible
Hyperbolic PDEs

Consider the convection of a step


change in temperature:

Initial and boundary conditions

Solution:
Hyperbolic PDEs (cont’d)
Hyperbolic PDEs (cont’d)

• Upstream conditions can


potentially affect the solution at a
point x; downstream conditions do
not
• Inlet conditions propagate at a
finite speed U
•Inlet condition is not felt at location
x until a time x/U
Relation to Scalar Transport Equation

• Contains all three canonical PDE terms


• If Re is low and situation is steady, we get an elliptic
equation
• If diffusion coefficient is zero , we get a hyperbolic equation
• If Re is low and situation is unsteady, we get a parabolic
equation
• For mixed regimes, we get mixed behavior
Components of CFD Solution

z Geometry creation
z Domain discretization (mesh generation)
z Discretization of governing equations
z Solution of discrete equations; accounting for non-
linearities and inter-equation coupling
z Visualization and post-processing
Solution Process

z Analytical solution gives us φ(x,y,z,t). Numerical


solution gives us φ only at discrete grid points.
z The process of converting the governing partial
differential equation into discrete algebraic equations
is call discretization.
z Discretization involves
» Discretization of space using mesh generation
» Discretization of governing equations to yield sets
of algebraic equations
Mesh Types

Regular and Stair-stepped


body-fitted representation of
meshes complex geometry
Mesh types (cont’d)

Block- Unstructured
structured meshes
meshes
Mesh Types

Cell
shapes

Non-
conformal
mesh

Hybrid mesh
Mesh Terminology

• Node-based finite volume scheme: φ stored at vertex


• Cell-based finite volume scheme: φ stored at cell centroid
Overview of Finite Difference Method

Consider diffusion equation:

z Step 1: Discretize domain using


a mesh.
Unknowns are located at nodes
z Step 2: Expand φ in Taylor series
about point 2

z Subtracting equations yields


Finite Difference Method (cont’d)

z Step 3: Adding equations yields

Second order
z Drop truncated terms: truncation error

z Step 4: Evaluate source term at point 2:


Finite Difference Method (cont’d)

z Step 5: Assemble discrete equation

z Comments
» We can write one such equation for each grid point
» Boundary conditions give us boundary values
» Second-order accurate
» Need to find a way to solve couple algebraic equation set
Overview of Finite Volume Method

Consider the diffusion equation:

Step 1: Integrate over control volume


Finite Volume Scheme (cont’d)

Step 2: Make linear profile


assumption between cell
centroids for φ. Assume S varies
linearly over CV
Step 3: Collect terms and cast into
algebraic equation:
Comments
z Process starts with conservation statement over cell.
We find φ such that it satisfies conservation. Thus,
regardless of how coarse the mesh is, the finite
volume scheme always gives perfect conservation
z This does not guarantee accuracy, however.
z The process of discretization yields a flux balance
involving face values of the diffusion flux, for example:
⎛ ∂φ ⎞
−Γ e ⎜ ⎟
⎝ ∂x ⎠e
z Profile assumptions for φ and S need not be the same.
Comments (cont’d)

z As with finite difference method, we need to solve a


set of coupled algebraic equations
z Though finite difference and finite volume schemes
use different procedures to obtain discrete equations,
we can use the same solution techniques to solve the
discrete equations
Closure

In this lecture we
z Considered different canonical PDEs and examined their
behavior
z Understood how these model equations relate to our general
scalar transport equations
z Started an overview of the important elements of any numerical
method
z In the next lecture we will complete this overview and start
looking more closely at the finite volume method for diffusion
problems.
Lecture 3: Overview of Numerical
Methods
Last time…

z Examined important classes of partial differential


equations and understood their behavior
z Saw how this knowledge would apply to the general
scalar transport equation
z Started an overview of numerical methods including
mesh terminology and finite difference methods
This time…
We will continue the overview and examine
z Finite difference, finite volume and finite element
methods
z Accuracy, consistency, stability and convergence of a
numerical scheme
Overview of Finite Element Method

z Consider diffusion equation

z Let φ be an approximation to φ
z Since φ is an approximation, it does not satisfy the diffusion
equation, and leaves a residual R:
d 2φ
Γ 2 +S = R
dx
z Galerkin finite element method minimizes R with respect to a
weight function:
Finite Element Method (cont’d)

z A family of weight functions Wi, I = 1,…N, (N: number of grid


points) is used. This generates N discrete equations for the N
unknowns:

Weight function is local


– i.e. zero everywhere
except close to i
i-1 i wi i+1

Element i-1 Element i


Finite Element Method (cont’d)

z In addition a local shape function Ni is used to discretize R.


Under a Galerkin formulation, the weight and shape functions are
chosen to be the same.
Shape function is non-
zero only in the vicinity
of node i => “local
basis”

Ni-1 Ni
i+1
i-1 i
Element i-1 Element i
Finite Element Method (cont’d)

z The discretization process again leads to a set of algebraic


equations of the form:

ai ,iφi = ai ,i +1φi +1 + ai ,i −1φi ,i −1 + bi


z Comments
» Note how the use of a local basis restricts the relationship
between a point i and its neighbors to only nearest neighbors
» Again, we have an algebraic equation set to solve – can use
the same solvers as for finite volume and finite difference
methods
Comparison of methods
z All three yield discrete algebraic equation sets which must be
solved
z Local basis – only near-neighbor dependence
z Finite volume method is conservative; the others are not
z Order or accuracy of scheme depends on
» Taylor series truncation in finite difference schemes
» Profile assumptions in finite volume schemes
» Order of shape functions in finite element schemes
Solution of Linear Equations

z Linear equation set has two important characteristics


» Matrix is sparse, may be banded
» Coefficients are provisional for non-linear problems
z Two different approaches
» Direct methods
» Iterative methods
z Approach defines “path to solution”
» Final answer only determined by discretization
Direct Methods
z All discretization schemes lead to

Here φ is solution vector [φ1 , φ2 ,…, φN]T.


z Can invert:

z Inversion is O(N3 ) operation. Other more efficient


methods exist.
» Take advantage of band structure if it exists
» Take advantage of sparsity
Direct Methods (cont’d)

z Large storage and operation count


» For N grid points, must store NxN matrix
» Only store non-zero entries and fill pattern
z For non-linear problems, A is provisional and is usually updated
as a part of an outer loop
» Not worth solving system too “exactly”
z As a result, direct methods not usually preferred in CFD today
Iterative Methods

z Guess and correct philosophy


z Gauss-Seidel scheme is typical:
» Visit each grid point

Update using

» Sweep repeatedly through grid points until convergence


criterion is met
» In each sweep, points already visited have new values; points
not yet visited have old values
Iterative Methods (cont’d)

z Jacobi scheme is similar to Gauss-Seidel scheme but does not


use latest available values
» All values are updated simultaneously at end of sweep.
z Iterative are not guaranteed to converge to a solution unless
Scarborough criterion is satisfied
Scarborough Criterion

z Scarborough criterion states that convergence of an iterative


scheme is guaranteed if:

z This means that coefficient matrix must be diagonally dominant


Gauss-Seidel Scheme

z No need to store coefficient matrix


z Operation count per sweep scales as O(N)
z However, convergence, even when guaranteed, is slow for large
meshes
z Will examine alternatives later in course
Accuracy

z While looking at finite difference methods, we wrote:

Second-
order
truncation
error

z Halving grid size reduces error by factor of four for second-order


scheme
z Cannot say what absolute error is – truncation error only gives
rate of decrease
Accuracy

z Order of discretization scheme is n if truncation error is O(∆xn )


z When more than one term is involved, the order of the
discretization scheme is that of the lowest order term.
z Accuracy is a property of the discretization scheme, not the path
to solution
Consistency

z A discretization scheme is consistent if the truncation error


vanishes as ∆x ->0
z Does not always happen: What if truncation error is O(∆x/∆t) ?
z Consistency is a property of the discretization scheme, not the
path to solution
Convergence

z Two uses of the term


» Convergence to a mesh-independent solution through mesh
refinement
» Convergence of an iterative scheme to a final unchanging
answer (or one meeting convergence criterion)
z We will usually use the latter meaning
Stability

z Property of the path to solution


z Typically used to characterize iterative schemes
z Depending on the characteristics of the coefficient matrix, errors
may either be damped or may grow during iteration
z An iterative scheme is unstable if it fails to produce a solution to
the discrete equation set
Stability

z Also possible to speak of the stability of unsteady


schemes
» Unstable: when solving a time-dependent problem,
the solution “blows up”
z Von-Neumann (and other) stability analyses determine
whether linear systems stable under various
iteration/time-stepping schemes
z For non-linear/coupled problems, stability analysis is
difficult and not much used
» Take guidance from linear analysis in appropriate
parameter range; intuition
Closure

z This time we completed an overview of the numerical


discretization and solution process
» Domain discretization
» Discretization of governing equations
» Solution of linear algebraic set
» Properties of discretization and path to solution
– Accuracy, consistency, convergence, stability
z Next time, we will start looking at finite volume discretization of
diffusion equation
Lecture 4: The Diffusion Equation – A
First Look
Last Time…

z We completed an overview of the numerical


discretization and solution process
» Domain discretization
» Discretization of governing equations – finite
difference, finite volume, finite element
» Solution of linear algebraic set
» Properties of discretization and path to solution
– Accuracy, consistency, convergence, stability
This Time…

We will
z Apply the finite volume scheme to the steady diffusion
equation on Cartesian structured meshes
z Examine the properties of the resulting discretization
z Describe how to discretize boundary conditions
2D Steady Diffusion
• Consider steady diffusion with a
source term:
• Here

• Integrate over control volume to


yield
2D Steady Diffusion

z Apply divergence theorem to yield


Discrete Flux Balance

• Writing integral over control volume:

•Compactly:
Discrete Flux Balance (cont’d)

z Area vectors given by:

z Fluxes given by
Discretization
z Assume φ varies linearly
between cell centroids

z Note:
» Symmetry of (P, E ) and
(P,W) in flux expression
» Opposite signs on (P,E)
and (P,W) terms
Source Linearization

z Source term must be


linearized as:

z Assume SP <0
z More on this later!
Final Discrete Equation

W P E

S
Comments

z Discrete equation reflects balance of flux*area with


generation inside control volume
z As in 1-D case, we need fluxes at cell faces
z These are written in terms of cell-centroid values using
profile assumptions.
Comments (cont’d)

z Formulation is conservative: Discrete equation was


derived by enforcing conservation. Fluxes balance
source term regardless of mesh density
z For a structured mesh, each point P is coupled to its
four nearest neighbors. Corner points do not enter the
formulation.
Properties of Discretization

z aP, anb have same sign: This implies that if neighbor φ


goes up, φP also goes up

z If S=0:

z Thus φ is bounded by neighbor values, in keeping with


properties of elliptic partial differential equations
Properties of Discretization (cont’d)

z What about Scarborough Criterion ?


Satisfied in
the equality

What about
this?
Boundary Conditions

Flux Balance

Different boundary conditions


require different representations
of Jb
Dirichlet BCs
z Dirichlet boundary condition:
φb = φgiven

z Put in the requisite flux into the


near-boundary cell balance
Dirichlet BC’s (cont’d)

For near-boundary
cells:
aP > ∑ anb
nb

Satisfies Scarborough
Criterion !

Also, φP bounded by
interior neighbors and
boundary value in the
absence of source terms
Neumann BC’s

z Neumann boundary
conditions : qb given

z Replace Jb in cell
balance with given flux
Neumann BC’s (cont’d)

For Neumann boundaries


aP = ∑ anb
nb

So inequality constraint in
Scarborough criterion is not
satisfied
Also, φP is not bounded
by interior neighbors and
boundary value even in
the absence of source
terms – this is is fine
because of the added
flux at the boundary
Boundary Values and Fluxes

z Once we solve for the interior values of φ, we can


recover the boundary value of the flux for Dirichlet
boundary conditions using

z Similarly, for Neumann boundary conditions, we can find


the boundary value of φ using
Closure

z In this lecture we
» Described the discretization procedure for the
diffusion equation on Cartesian meshes
» Saw that the resulting discretization process
preserves the properties of elliptic equations
» Since we get diagonal dominance with Dirichlet bc,
the discretization allows us to use iterative solvers
z Next time, we will look at one more boundary condition
(Robbins or mixed bc), source linearization and
conjugate heat transfer

Potrebbero piacerti anche