ME 608
ME 608
Numerical Methods for Heat, Mass
Numerical Methods for Heat, Mass
and Momentum Transfer
and Momentum Transfer
Jay
Jayathathii Y. Y. MurMurthythy
Professor, School of Mechanical Engineering Professor, School of Mechanical Engineering
Purdue University Purdue University jmurthy@ecn.purdue.edu jmurthy@ecn.purdue.edu Spring 2006 Spring 2006
Lecture 1: Introduction to ME 608
Lecture 1: Introduction to ME 608
Conservation Equations
Conservation Equations
Outline of Lecture
Outline of Lecture
Course organizationCourse organization
Introduction to CFDIntroduction to CFD
Conservation equations, general scalar transport equationConservation equations, general scalar transport equation
Motivation
Motivation
Huge variety of industrial flows: Huge variety of industrial flows: •Rotating machinery •Rotating machinery •Compressible/incompressible •Compressible/incompressible aerodynamics aerodynamics •Manifolds, piping •Manifolds, piping •Extrusion, mixing •Extrusion, mixing
•Reacting flows, combustion …. •Reacting flows, combustion …. Impossible to solve Navier-Stokes Impossible to solve Navier-Stokes equations
equations analytically analytically for for thesethese applications!
History
History
EarliEarliest “Cest “CFD”FD” work by work by L.F. RiL.F. Richardchardsonson
(1910) (1910)
»
» UsUseed hd huumaman cn comompuputetersrs »
» ItItereratativive soe solulutitionons os of Laf Laplplacace’e’ss eqeqnn using finite-difference methods, flow using finite-difference methods, flow over cylinder etc.
over cylinder etc. »
» ErErroror esr estitimamatetes, es, extxtrarapopolalatition ton too zero error
zero error
“So far I have paid
“So far I have paid piece rates for thepiece rates for the operation (Laplacian) of about n/18 operation (Laplacian) of about n/18 pence per coordinate point, n being the pence per coordinate point, n being the numbe
number of digr of digits …its … one of tone of the quihe quickesckestt boys
boys averaged averaged 2000 2000 operationsoperations (Laplacian)
(Laplacian) per week per week for numbfor numbers of ers of 33 digits, those done wrong being
digits, those done wrong being discounted …”
discounted …”
Richardson, 1910 Richardson, 1910
Also researched mathematical Also researched mathematical models for causes of war : models for causes of war : Generalized Foreign Politics Generalized Foreign Politics (1939)
(1939)
Arms and Insecurity(1949) Arms and Insecurity(1949) Statistics of Deadly Quarrels Statistics of Deadly Quarrels (1950) (1950) Lewis F. Richardson Lewis F. Richardson (1881-1953) (1881-1953)
History
History
Relaxation methods (1920’s-50’s)Relaxation methods (1920’s-50’s)
LandmLandmark papark paper by Courer by Courant, Friant, Friedricedrichshs andand
Lewy
Lewy for hypfor hyperbolerbolic equaic equationtions (1928s (1928))
Von Neumann stability criteria for parabolicVon Neumann stability criteria for parabolic
problems (1950) problems (1950)
HarloHarlow and Fromw and Frommm (1963(1963) compu) computed unsted unsteadyteady
vortex street using a
vortex street using a digital computer.digital computer.
They published a Scientific American articleThey published a Scientific American article
(1965) which ignited interest in modern CFD (1965) which ignited interest in modern CFD and the idea of computer experiments
and the idea of computer experiments
Boundary-layer codes developed in the 1960-Boundary-layer codes developed in the
1960-1970’s (G
1970’s (GENMIX by PENMIX by Patankatankarar and Spaland Spalding inding in 1972 for eg.)
1972 for eg.)
Solution techniques for incompressible flowsSolution techniques for incompressible flows
published through the 1970’s (SIMPLE family of published through the 1970’s (SIMPLE family of algor
algorithms bithms by Patanky Patankarar and Spaand Spalding folding for eg.)r eg.)
Jameson Jameson computed computed Euler Euler flow flow over cover completeomplete
aircraft (1981) aircraft (1981)
Unstructured mesh methods developed inUnstructured mesh methods developed in
1990’s 1990’s John John von Neumann von Neumann (1903-1957) (1903-1957) Richard Courant Richard Courant (1888-1972) (1888-1972)
Conservation Equations
Conservation Equations
Nearly all physical processes of interest to us Nearly all physical processes of interest to us are governed byare governed by
conservation equations conservation equations
»
» MasMass, s, mommomententum um eneenergy rgy conconserservatvationion
WrittWritten in terms of speen in terms of specificcific quantiquantities (per unities (per unit mass basist mass basis))
»
» MMoommeennttuum m ppeer r uunniit t mmaasss s ((vveelloocciittyy)) »
» EnEnerergy gy pper er ununit it mmasass es e
Consider a specific quantityConsider a specific quantity
φφ
»
» CouCould be mold be momenmentum ptum per uner unit mait mass, ess, enernergy pegy per unir unit mast mass..s..
Write conservation statement forWrite conservation statement for
φφ
for control volume of sizefor control volume of size∆
Conservation Equations (cont’d)
Conservation Equations (cont’d)
Accumulation of
Accumulation of
φφ
in in control control volume volume over over time time stepstep∆
∆
t =t = Net influx ofNet influx of
φφ
into control volumeinto control volume -- NeNet et efffflulux ox offφφ
out of control volumeout of control volume + Net generation ofConservation Equations (cont’d)
Conservation Equations (cont’d)
Accumulation: Accumulation:
Generation: Generation:
Influx and Efflux: Influx and Efflux:
Diffusion and Convection Fluxes
Diffusion and Convection Fluxes
Diffusion Flux
Diffusion Flux
Convection
Convection
Flux
Flux
Net flux
Net flux
Velocity Vector
Velocity Vector
Diffusion coefficient
Diffusion coefficient
Γ ΓCombining…
Combining…
Taking limit as
General Scalar Transport Equation
General Scalar Transport Equation
Or, in vector form:
Or, in vector form:
Conservation Form
Conservation Form
Consider steady state. The conservation form of the
Consider steady state. The conservation form of the
scalar transport equation is:
scalar transport equation is:
Non-Conservation Form
Non-Conservation Form
Finite volume methods always start wit
Finite volume methods always start with the conservation
h the conservation
form
General Scalar Transport Equation
General Scalar Transport Equation
Storage
Storage Convection Convection Diffusion Diffusion Generation Generation
Recall:
Recall:
φφ
is a is a specific specific quantity quantity (energy per (energy per unit masunit masss say)say)
V : velocity vector V : velocity vector
Γ
Γ
: Diffusion coefficient: Diffusion coefficientρρ
: density: densityS: Source term (Generation per unit volume W/m S: Source term (Generation per unit volume W/m33))
Continuity Equation
Continuity Equation
0 0 )) ((==
⋅⋅
∇
∇
++
∂∂
∂∂
V Vρ
ρ
ρ
ρ
t tHere,
Here,
φφ
= 1
= 1
Γ
Γ
= 0
= 0
S = 0
S = 0
Energy Equation
Energy Equation
h = sensible enthalpy per unit mass, J/kg h = sensible enthalpy per unit mass, J/kg k = thermal conductivity
k = thermal conductivity S
Shh = energy generation W/m= energy generation W/m33
Note:
Note: h ih in conn convection vection and sand storage torage termsterms T in diffusion terms
T in diffusion terms How to cast in the form
How to cast in the form of the general scalar transportof the general scalar transport equation?
Energy Equation (cont’d)
Energy Equation (cont’d)
Equation of State
Equation of State
Substitute to Find
Substitute to Find
Here,
Here,
φφ
= h
= h
Γ
Γ
= k/C
= k/C
p pS = S
S = S
h hMomentum Equation
Momentum Equation
X-Momentum Equation
X-Momentum Equation
j j ii ij ij j j iiu
u
u
u
x
x
x
x
τ
τ
=
=
µ
µ
⎛
⎛
⎜
⎜
⎜
⎜
∂∂
++
∂∂
⎞⎞
⎟⎟
⎟⎟
∂
∂
∂∂
⎝
⎝
⎠⎠
Here,
Here,
φφ
= u
= u
Γ
Γ
=
=
µ µS = S
S = S
u u-
-
p
p
x
x
∂∂
∂∂
S is gooS is good “dumd “dumpinping grog groundund”” forfor everything
everything that that doesn’t doesn’t fit fit intointo the other terms
Species Transport Equation
Species Transport Equation
Y
Yii = kg of specie i /kg of mixture= kg of specie i /kg of mixture
Γ
Γ
ii = diffusion coefficient of i in mixture i= diffusion coefficient of i in mixture i RClosure
Closure
In this lecture weIn this lecture we
»
» DevDeveloeloped tped the prhe proceocedurdure for dee for develvelopioping the gng the goveovernirningng equation for the transport of a
equation for the transport of a scalarscalar
φφ
»» ReRecocogngnizized ed ththe ce comommomonanalility ty of of trtrananspsporort ot off
–
– MasMass, mos, momenmentumtum, ener, energy, sgy, specpeciesies
»
» CastiCasting ang all tll these hese differdifferent ent equatiequations ons into into this this singlsingle fore form ism is very useful
very useful »
» Can dCan devievise a sinse a single mgle methethod to sood to solve thlve this clis class oass of govef governirningng equation
Lecture 2: The General Scalar Transport
Lecture 2: The General Scalar Transport
Equation
Equation
Overview of Numerical Methods
Overview of Numerical Methods
Last time…
Last time…
Wrote conservation statement for a control volumeWrote conservation statement for a control volume
Derived a general scalar transport equationDerived a general scalar transport equation
Discovered that all transport processes commonalitiesDiscovered that all transport processes commonalities
» » SSttoorraaggee » » DDiiffffuussiioonn » » CCoonnvveeccttiioonn » » GGeenneerraattiioonn
This time…
This time…
Examine important classes of partial differential equations andExamine important classes of partial differential equations and
understand their behavior understand their behavior
See how this knowledge applies to the general scalar transportSee how this knowledge applies to the general scalar transport
equation equation
Start a general overview of the main elements of all numericalStart a general overview of the main elements of all numerical
methods methods
General Scalar Transport Equation
General Scalar Transport Equation
Storage
Storage Convection Convection Diffusion Diffusion Generation Generation
Recall:
Recall:
φφ
is a is a specific specific quantity quantity (energy per (energy per unit masunit masss say)say)
V : velocity vector V : velocity vector
Γ
Γ
: Diffusion coefficient: Diffusion coefficientρρ
: density: densityS: Source term (Generation per unit volume W/m S: Source term (Generation per unit volume W/m33))
Classification of PDEs
Classification of PDEs
Consider
Consider the
the second-orde
second-order
r partial d
partial differential
ifferential equation
equation for
for
φφ
(x,y):
(x,y):
Co
Coef
effi
fici
cien
ents
ts a,
a,b,
b,c,
c,d,
d,e,
e,ff ar
are
e lin
linea
ear
r --
-- no
not
t fu
func
ncti
tion
ons
s of
of
φφ
, but can be functions of (x,y)
, but can be functions of (x,y)
Discriminant
Discriminant
D
D <
< 0
0
Elliptic
Elliptic PDE
PDE
D=0
D=0
Parabolic
Parabolic PDE
PDE
D>0
Elliptic PDEs
Elliptic PDEs
Consider 1-D heat conduction in a Consider 1-D heat conduction in a plane wall with constant thermal plane wall with constant thermal conductivity conductivity Boundary conditions Boundary conditions Solution: Solution: T T o o T T LL
Elliptic PDE’s
Elliptic PDE’s
T T o o T T LL •• T(x) is influenced by bothT(x) is influenced by bothboundaries boundaries
•• In thIn the abse absence ence of soof source urce termsterms,, T(x) is bounded by the values on T(x) is bounded by the values on both boundaries
both boundaries
•Can we devise numerical •Can we devise numerical
schemes which preserve these schemes which preserve these properties?
Parabolic PDEs
Parabolic PDEs
Consider 1D unsteady conduction Consider 1D unsteady conduction in a slab with constant properties: in a slab with constant properties:
Boundary and initial conditions
Boundary and initial conditions Solution:Solution:
T T 0 0 T T i i T T 0 0
Pa
Para
rabo
bolic
lic PD
PDEs
Es (c
(con
ont’
t’d)
d)
T T 0 0 T T i i T T 0 0
•• The solution at T(x,t) The solution at T(x,t) is influenced by is influenced by the boundaries, justhe boundaries, just as with elliptit as with elliptic PDEsc PDEs •We need onl
•We need only initial y initial condtionscondtions T(x,0). We do T(x,0). We do not need future not need future conditionsconditions •Initial conditions only affect future conditions, not past conditions
•Initial conditions only affect future conditions, not past conditions •• Initial coInitial conditions affenditions affect all ct all spatial pspatial points in oints in the futurethe future
•• A steaA steady stady state is rete is reacheached as t->d as t->∞∞. In this limit we recover the elliptic PDE.. In this limit we recover the elliptic PDE. •In the absence of source terms, the temperature is bounded by initial and •In the absence of source terms, the temperature is bounded by initial and boundary conditions
boundary conditions
•Marching solutions are possible •Marching solutions are possible
Hyperbolic PDEs
Hyperbolic PDEs
Consider the convection of a step Consider the convection of a step change in temperature:
change in temperature:
Initial and boundary conditions Initial and boundary conditions
Solution: Solution:
Hy
Hy
Hype
perb
rbol
olic P
ic PDE
DEss (c
(con
ont’
t’d)
d)
•• UpstrUpstream eam condiconditions tions cancan
potentially affect the solution at a potentially affect the solution at a point x; downstream conditions do point x; downstream conditions do not
not
•• InleInlet condt conditionitions props propagate agate at aat a finite speed U
finite speed U
•Inlet condition is not felt at
•Inlet condition is not felt at locationlocation x until a time x/U
Relation to Scalar Transport Equation
Relation to Scalar Transport Equation
•• ContaContains all tins all three cahree canonicnonical PDE teal PDE termsrms
•• If Re is lIf Re is low and situaow and situation is stetion is steady, we get ady, we get an elliptican elliptic equation
equation
•• If diffusion If diffusion coefficient is coefficient is zero , we zero , we get a hyperbolget a hyperbolic equationic equation •• If Re is lIf Re is low and situaow and situation is unstion is unsteady, we get teady, we get a parabolica parabolic equation
equation
Components of CFD Solution
Components of CFD Solution
Geometry creation
Geometry creation
Doma
Domain di
in discre
scretizatio
tization
n (mes
(mesh ge
h genera
neration)
tion)
Discr
Discretiza
etization
tion of
of gove
governing
rning equa
equations
tions
Solution of discrete equations; accounting for non-
Solution of discrete equations; accounting for
non-linea
linearities
rities and
and inter
inter-equa
-equation
tion coup
coupling
ling
Solution Process
Solution Process
Analytical solution gives us
Analytical solution gives us
φφ
(x,y,z,t). Numerical
(x,y,z,t). Numerical
solution gives us
solution gives us
φφ
only at
only at discrete
discrete grid points.
grid points.
The process of converting the governing partial
The process of converting the governing partial
differential equation into discrete
differential equation into discrete algebraic equations
algebraic equations
is call
is call discretization.
discretization.
Discretization
Discretization involves
involves
»
» Di
Disc
scre
reti
tiza
zatio
tion
n of sp
of spac
ace us
e usin
ing me
g mesh ge
sh gene
nera
ratio
tion
n
»
» Dis
Discre
cretiz
tizati
ation
on of
of gov
govern
erning
ing eq
equat
uation
ions t
s to y
o yield
ield set
sets
s
of algebraic equations
Mesh Types
Mesh Types
Regular and
Regular and
body-fitted
body-fitted
meshes
meshes
Stair-stepped
Stair-stepped
representation of
representation of
complex geometry
complex geometry
Mesh types (cont’d)
Mesh types (cont’d)
Block-structured
structured
meshes
meshes
Unstructured
Unstructured
meshes
meshes
Mesh Types
Mesh Types
Non-conformal
conformal
mesh
mesh
Hybrid mesh
Hybrid mesh
Cell
Cell
shapes
shapes
Mesh Terminology
Mesh Terminology
••
Node-based finite volume scheme
Node-based finite volume scheme
::
φφ
stored at vertex
stored at vertex
Overview of Finite Difference Method
Overview of Finite Difference Method
Step Step 1: D1: Discreiscretizetize domadomain uin usingsing
a mesh. a mesh.
Unknowns are located at nodes Unknowns are located at nodes
Step 2: ExpandStep 2: Expand
φφ
in Taylor seriesin Taylor seriesabout point 2 about point 2
Subtracting equations yieldsSubtracting equations yields
Consider diffusion equation: Consider diffusion equation:
Finite Difference Method (cont’d)
Finite Difference Method (cont’d)
Step 3: Adding equations yieldsStep 3: Adding equations yields
Drop truncated terms:Drop truncated terms:
Step 4: Evaluate source term at point 2:Step 4: Evaluate source term at point 2:
Second order Second order truncation error truncation error
Finite Difference Method (cont’d)
Finite Difference Method (cont’d)
Step 5: Assemble discrete equationStep 5: Assemble discrete equation
CommentsComments
»
» We cWe can wan writrite one one sue such eqch equatuation ion for efor each ach grigrid poid pointnt »
» BouBoundandary cry condonditiitions ons givgive us e us bouboundandary vry valualueses »
» SeSecocondnd-o-ordrder er acaccucuraratete »
Overview of Finite Volume Method
Overview of Finite Volume Method
Consider the diffusion equation:
Consider the diffusion equation:
Step 1: Integrate over control
Finite Volume Scheme (cont’d)
Finite Volume Scheme (cont’d)
Step 2: Make linear profile Step 2: Make linear profile
assumption between cell assumption between cell ce
centntroroididss foforr
φφ
. Assume S varies. Assume S varies linearly over CVlinearly over CV
Step 3: Collect terms and cast into Step 3: Collect terms and cast into
algebraic equation: algebraic equation:
Comments
Comments
Process starts with conservation statement over cell.
Process starts with conservation statement over cell.
We find
We find
φφ
such that it
such that it satisfies conservation. Thus,
satisfies conservation. Thus,
regardless of how coarse the mesh is, the finite
regardless of how coarse the mesh is, the finite
volume scheme always gives perfect conservation
volume scheme always gives perfect conservation
This does not guarantee accuracy, however.
This does not guarantee accuracy, however.
The pr
The proces
ocess of discr
s of discretiza
etization
tion yield
yields a flux bala
s a flux balance
nce
involving face values of the diffusion flux, for example:
involving face values of the diffusion flux, for example:
Profile assumptions for
Profile assumptions for
φφ
and S need not be the same.
and S need not be the same.
e e e e x x
φ
φ
∂∂
⎛
⎛
⎞⎞
−Γ
−Γ ⎜ ⎜ ⎟⎟
∂∂
⎝
⎝
⎠⎠
Comments (cont’d)
Comments (cont’d)
As with finite difference method, we need to solve a
As with finite difference method, we need to solve a
set of coupled algebraic equations
set of coupled algebraic equations
Though finite difference and finite
Though finite difference and finite volume schemes
volume schemes
use different procedures to obtain discrete equations,
use different procedures to obtain discrete equations,
we can use the same solution techniques to solve the
we can use the same solution techniques to solve the
discrete equations
Closure
Closure
In this lecture we In this lecture we
ConsiConsidered difdered different caferent canonicanonical PDEsl PDEs and examiand examined theirned their
behavior behavior
Understood how these model equations relate to Understood how these model equations relate to our generalour general
scalar transport equations scalar transport equations
Started an overview of the Started an overview of the important elements of any numericalimportant elements of any numerical
method method
In the next lecture we will In the next lecture we will complete this overview and startcomplete this overview and start
looking more closely at the
looking more closely at the finite volume method for diffusionfinite volume method for diffusion problems.
Lecture 3: Overview of Numerical
Lecture 3: Overview of Numerical
Methods
Methods
Last time…
Last time…
Examined important classes of partial differential
Examined important classes of partial differential
equations and understood their behavior
equations and understood their behavior
Saw how this knowledge would apply to the general
Saw how this knowledge would apply to the general
scalar transport equation
scalar transport equation
Started an overview of numerical
Started an overview of numerical methods including
methods including
mesh terminology and finite difference methods
mesh terminology and finite difference methods
This time…
This time…
We
We will
will continue
continue the
the overview
overview and
and examine
examine
Finite difference, finite volume and finite element
Finite difference, finite volume and finite element
methods
methods
Accuracy, consistency, stability and convergence of a
Accuracy, consistency, stability and convergence of a
numerical scheme
numerical scheme
Overview of Finite Element Method
Overview of Finite Element Method
Consider diffusion equationConsider diffusion equation
Let Let be be an an approximation approximation toto φφ
SSiincncee iis s aan n aapppprrooxxiimmaattioionn, , iit t ddoeoes s nnoot t ssaattiissffy y tthhe e ddiiffffuussiioonn
equation, and leaves a residual R: equation, and leaves a residual R:
GalerGalerkinkin finitfinite element me element method miethod minimizenimizes R with res R with respect tspect to ao a
weight function: weight function: φ φ φ φ 2 2 2 2 d d S S RR dx dx
φ
φ
Γ
Γ
+
+ =
=
Finite Element Method (cont’d)
Finite Element Method (cont’d)
A family of weight functions WA family of weight functions Wii, I = 1,…N, (N: number of grid, I = 1,…N, (N: number of grid
points) is used. This generates N discrete equations for the N points) is used. This generates N discrete equations for the N unknowns:
unknowns:
Weight function is local Weight function is local –
– i.i.e. zee. zero evro evererywywhehere re except close to i
except close to i
i+1 i+1 w w i i Element i Element i Element i-1 Element i-1 i i i-1 i-1
Finite Element Method (cont’d)
Finite Element Method (cont’d)
In addition a local shape function NIn addition a local shape function Nii is used is used to dto disciscretretizeize R.R.
Under a G
Under a Galerkialerkinn formuformulationlation, the weigh, the weight and shape fut and shape functionctions arens are chosen to be the same.
chosen to be the same.
N N i i
Shape function is non- Shape function is non- zero only in the vicinity zero only in the vicinity of node i => “local of node i => “local basis” basis” N N i-1i-1 i+1 i+1 i-1
i-1 i i
Element i Element i Element i-1
Finite Element Method (cont’d)
Finite Element Method (cont’d)
The disThe discreticretizationzation procesprocess again les again leads to a seads to a set of alget of algebraicbraic
equations of the form: equations of the form:
CommentsComments
»
» NotNote how e how the uthe use of se of a loca local baal basis rsis restestricricts thts the rele relatiationsonshiphip between a point i and its neighbors to only nearest neighbors between a point i and its neighbors to only nearest neighbors »
» AgAgaiain, wn, we hae have ve an aan alglgebebraraic eic equaquatition son set et to to sosolvlve –e – cacan un usese the same solvers as for finite
the same solvers as for finite volume and finite differencevolume and finite difference methods methods , , , , 1 1 1 1 , , 1 1 , , 11 i i i i i i i i i i i i i i i i i i i i ii
a
a
φ
φ
a
a
φ
φ
a
a
φ
φ
b
b
+ + ++ −− −−=
=
+
+
+
+
Comparison of methods
Comparison of methods
All three yield discrete algebraic equation sets which must beAll three yield discrete algebraic equation sets which must be
solved solved
Local Local basis basis –– only only near-nenear-neighbor ighbor dependedependencence
Finite volume method is conservative; the others are notFinite volume method is conservative; the others are not
Order or accuracy of scheme depends onOrder or accuracy of scheme depends on
»
» TayTaylor slor serieries tes trunruncatcation iion in finn finite ite difdifferferencence sce schemhemeses »
» ProProfilfile e assassumpumptiotions ns in in finfinite ite voluvolume me schschemeemess »
Solution of Linear Equations
Solution of Linear Equations
Linear equation set has Linear equation set has two important characteristicstwo important characteristics
»
» MaMatrtrix iix is ss spaparsrse, e, mamay by be bae bandndeded »
» CoeCoeffifficiecients nts are are proprovisivisional onal for for nonnon-lin-linear ear probproblemlemss
Two different approachesTwo different approaches
»
» DDiirreecct t mmeetthhooddss »
» IItteerraattiivve me meetthohoddss
Approach defines “path to solution”Approach defines “path to solution”
»
Direct Methods
Direct Methods
All d
All disc
iscret
retiza
izatio
tion
n sch
scheme
emes lea
s lead to
d to
Here
Here
φ
φ
is solution vector [
is solution vector [
φ
φ
11,,
φ
φ
22,…,
,…,
φ
φ
NN]]
TT..
Can invert
Can invert
::
Inversion is O(N
Inversion is O(N
33) operation. Other more efficient
) operation. Other more efficient
methods exist.
methods exist.
»
» Tak
Take adv
e advant
antage o
age of ban
f band str
d struct
ucture i
ure if it ex
f it exist
ists
s
»
Direct Methods (cont’d)
Direct Methods (cont’d)
Large storage and operation countLarge storage and operation count
»
» FoFor N r N grgrid id popoinintsts, m, musust st stotore re NxNxNN mamatrtrixix »
» OnlOnly sy stortore ne non-on-zerzero eo entrntries ies and and filfill pl pattatternern
For non-linear problems,For non-linear problems, AA is provisional and is usually updatedis provisional and is usually updated
as a part of an outer loop as a part of an outer loop
»
» NoNot wot wortrth soh solvlving ing sysyststem tem too “oo “exexacactltly”y”
Iterative Methods
Iterative Methods
Guess and correct philosophyGuess and correct philosophy
Gauss-Seidel scheme is typical:Gauss-Seidel scheme is typical:
»
» ViVisisit t eaeach ch grgrid id popoinintt Update using
Update using »
» SweSweep reep repeapeatedtedly tly throuhrough grgh grid poid pointints uns until ctil convonvergeergencence criterion is met
criterion is met »
» In eaIn each swch sweepeep, poi, points ants alrelready vady visitisited haed have neve new vaw valueslues; poi; pointsnts not yet visited have old values
Iterative Methods (cont’d)
Iterative Methods (cont’d)
JacobiJacobi scheme scheme is similis similar to Gaar to Gauss-Suss-Seidel sceidel scheme but dheme but does notoes not
use latest available values use latest available values
»
» All All valvalues ues are are updaupdated ted simsimultultaneoaneouslusly at y at end end of sof sweeweep.p.
Iterative are not guaranteed to converge to a solution unlessIterative are not guaranteed to converge to a solution unless
Scarborough criterion
Scarborough Criterion
Scarborough Criterion
Scarborough criterion states that convergence of an iterativeScarborough criterion states that convergence of an iterative
scheme is guaranteed if: scheme is guaranteed if:
Gauss-Seidel Scheme
Gauss-Seidel Scheme
No need to store coefficient matrixNo need to store coefficient matrix
Operation count per sweep scales Operation count per sweep scales as O(N)as O(N)
However, convergence, even when guaranteed, is slow for largeHowever, convergence, even when guaranteed, is slow for large
meshes meshes
Accuracy
Accuracy
While looking at finite difference methods, we wrote:While looking at finite difference methods, we wrote:
Halving grid size reduces error Halving grid size reduces error by factor of four for second-orderby factor of four for second-order
scheme scheme
CannoCannot say what at say what absolutbsolute error is –e error is – truncatruncation errtion error only giveor only givess
rate of decrease rate of decrease Second- Second- order order truncation truncation error error
Accuracy
Accuracy
OrdOrder of discer of discretretizaizatiotionn schscheme iseme is n n if if truncation truncation error error is is O(O(∆∆xxnn ))
When more than one term is involved, the order of theWhen more than one term is involved, the order of the
discr
discretizatetizationion schemscheme is e is that that of tof thehe lowest order lowest order term.term.
AccurAccuracy is a properacy is a property of the discrty of the discretizaetizationtion schemscheme, not the pathe, not the path
to solution to solution
Consistency
Consistency
A A discrediscretizatitizationon schemscheme ie is cs consistonsistent ent if if the the trunctruncation ation errorerror
vanishes as
vanishes as ∆∆x ->0x ->0
Does not always happen: What Does not always happen: What if truncation error is O(if truncation error is O(∆∆x/ x/ ∆∆t) ?t) ?
ConsiConsistencstency is a property of the disy is a property of the discreticretizationzation schemscheme, not thee, not the
path to solution path to solution
Convergence
Convergence
Two uses of the termTwo uses of the term
»
» ConConververgengence tce to a meo a mesh-sh-indeindependpendent ent solsolutiution ton throhrough mugh meshesh refinement
refinement »
» ConConververgengence of ce of an itan iteraerativtive sce schemheme to e to a fia final unal unchnchanganginging answer (or one meeting convergence criterion)
answer (or one meeting convergence criterion)
Stability
Stability
Property of the path to solutionProperty of the path to solution
Typically used to characterize iterative schemesTypically used to characterize iterative schemes
Depending on the characteristics of Depending on the characteristics of the coefficient matrix, errorsthe coefficient matrix, errors
may either be damped or may grow during iteration may either be damped or may grow during iteration
An iterative An iterative scheme scheme is unstable is unstable if it if it fails to fails to produce a produce a solution tosolution to
the discrete equation set the discrete equation set
Stability
Stability
Also possible to speak of the
Also possible to speak of the stability of unsteady
stability of unsteady
schemes
schemes
»
» Unstable
Unstable : when solving a time-dependent problem,
: when solving a time-dependent problem,
the solution “blows up”
the solution “blows up”
Von-Neumann (and other) stability analyses determine
Von-Neumann (and other) stability analyses determine
whether linear systems stable under various
whether linear systems stable under various
iteration/time-stepping schemes
iteration/time-stepping schemes
For non-linear/coupled problems, stability analysis is
For non-linear/coupled problems, stability analysis is
difficult and not much used
difficult and not much used
»
» Tak
Take guid
e guidanc
ance from l
e from line
inear ana
ar analys
lysis in ap
is in appro
propri
priate
ate
parameter range; intuition
Closure
Closure
This time we completed an overview of the numericalThis time we completed an overview of the numerical
dis
discrecretiztizatiationon and soluand solutiotion procesn processs »
» DDomomaiain din discscreretitizazatitionon »
» DiDiscscreretitizazatitionon of of gogovevernrnining g eqequauatitiononss »
» SoSolulutition oon of lif linenear aar alglgebebraraic sic setet »
» PrPropeopertrtieies os of f didiscscreretitizazatitionon anand pd patath th to so soluolutitionon
–
– AccuAccuracy, racy, consconsistenistency, cy, conveconvergencrgence, se, stabiltabilityity
Next timNext time, we will stare, we will start looking at finit looking at finite volume diste volume discreticretizationzation ofof
diffusion equation diffusion equation
Lect
Lecture
ure 4: T
4: The D
he Diffu
iffusion
sion Equ
Equati
ation –
on – A
A
First Look
Last Time…
Last Time…
We completed an overview of the numerical
We completed an overview of the numerical
dis
discre
cretiz
tizati
ation
on and so
and solut
lution pr
ion proce
ocess
ss
»
» Do
Doma
main d
in dis
iscr
cret
etiz
izat
atio
ion
n
»
» Di
Disc
scre
reti
tiza
zati
tion
on of
of go
gove
vern
rnin
ing
g eq
equa
uati
tion
ons
s –
– fi
fini
nite
te
difference, finite volume, finite element
difference, finite volume, finite element
»
» So
Solu
luti
tion o
on of li
f line
near a
ar alg
lgeb
ebra
raic s
ic set
et
»
» Pr
Prop
oper
erti
ties
es of d
of dis
iscr
cret
etiz
izat
atio
ion
n an
and p
d pat
ath to
h to so
solu
luti
tion
on
–
This Time…
This Time…
We will
We will
Apply the finite volume scheme to the
Apply the finite volume scheme to the steady diffusion
steady diffusion
equation on Cartesian structured meshes
equation on Cartesian structured meshes
Examine the properties of the
Examine the properties of the resulting discretization
resulting discretization
2D Steady Diffusion
2D Steady Diffusion
•• Con
Consid
sider st
er stead
eady dif
y diffus
fusion w
ion with a
ith a
source term:
source term:
••
Here
Here
•• Int
Integr
egrate o
ate over
ver con
contro
trol vo
l volum
lume to
e to
yield
2D Steady Diffusion
2D Steady Diffusion
Discrete Flux Balance
Discrete Flux Balance
••
Writing integral over control volume:
Writing integral over control volume:
•Compactly:
•Compactly:
Discrete Flux Balance (cont’d)
Discrete Flux Balance (cont’d)
Area vectors given by:
Area vectors given by:
Discretization
Discretization
AssumeAssume φφ varies linearlyvaries linearly
between cell centroids between cell centroids
Note:Note:
»
» SySymmmemettry ry of of ((P, P, E ) E ) anandd (P,W) in flux expression (P,W) in flux expression »
» OOpppposositite se sigigns ns on on ((P,P,EE)) and (P,W) terms
Source Linearization
Source Linearization
Source term must be
Source term must be
liline
near
ariize
zed
d as
as::
Assume S
Assume S
PP<0
<0
Final Discrete Equation
Final Discrete Equation
P P N N S S E E W W
Comments
Comments
Discrete equation reflects balance of flux*area with
Discrete equation reflects balance of flux*area with
generation inside control volume
generation inside control volume
As in 1-D case, we need fluxes at cell faces
As in 1-D case, we need fluxes at cell faces
These
These are wr
are written
itten in term
in terms of ce
s of cell-ce
ll-centroid
ntroid value
values usin
s using
g
profile assumptions.
profile assumptions.
Comments (cont’d)
Comments (cont’d)
Formulation is conservative: Discrete equation was
Formulation is conservative: Discrete equation was
derived by enforcing conservation. Fluxes balance
derived by enforcing conservation. Fluxes balance
source term regardless of mesh density
source term regardless of mesh density
For a structured mesh, each point P is coupled to its
For a structured mesh, each point P is coupled to its
four nearest neighbors. Corner points do not enter the
four nearest neighbors. Corner points do not enter the
formulation.
Properties of Discretization
Properties of Discretization
a
a
PP, a
, a
nbnbhave same sign: This implies that if neighbor
have same sign: This implies that if neighbor φ
φ
goes up,
goes up, φ
φ
PPalso goes up
also goes up
If S=0:
If S=0:
Thus
Thus φ
φ
is bounded by neighbor values, in keeping with
is bounded by neighbor values, in keeping with
properties of elliptic partial differential equations
properties of elliptic partial differential equations
Pr
Prope
operti
rties o
es of Di
f Discr
screti
etizat
zation
ion (co
(cont’
nt’d)
d)
What about
What about Scarborough Criterion ?
Scarborough Criterion ?
Satisfied in
Satisfied in
the equality
the equality
What about
What about
this?
this?
Boundary Conditions
Boundary Conditions
Flux Balance Flux Balance
Different boundary conditions Different boundary conditions require different representations require different representations of
of JJ
b b
D
Diirriicch
hlleett B
BC
Css
DirDirichichletlet bounboundardary condy conditiition:on:
φ
φbb == φφgivengiven
Put in the requisite flux into thePut in the requisite flux into the
near-boundary cell balance near-boundary cell balance
Di
Diri
rich
chle
lett BC
BC’s (c
’s (con
ont’
t’d)
d)
P P nbnb nb nb a a
>
>
∑
∑
aa For near-boundary For near-boundary cells: cells: Satisfies Scarborough Satisfies Scarborough Criterion ! Criterion ! Also,Also, φφPP bounded bybounded by interior neighbors and interior neighbors and boundary value in the boundary value in the absence of source terms absence of source terms
Neumann BC’s
Neumann BC’s
Neumann boundary
Neumann boundary
conditions : q
conditions : q
bbgiven
given
Replace J
Replace J
bbin cell
in cell
balance with given flux
balance with given flux
Neumann BC’s (cont’d)
Neumann BC’s (cont’d)
P P nbnb nb nb a a=
=
∑
∑
aaFor Neumann boundaries For Neumann boundaries
So inequality constraint in So inequality constraint in Scarborough criterion is not Scarborough criterion is not satisfied
satisfied Also,
Also, φφPPis not boundedis not bounded by interior neighbors and by interior neighbors and boundary value even in boundary value even in the absence of source the absence of source te
termrms s –– ththis is is is isis ffininee because of the added because of the added flux at the boundary flux at the boundary
Boundary Values and Fluxes
Boundary Values and Fluxes
Once we solve for the interior values of
Once we solve for the interior values of φ
φ, we can
, we can
recover the boundary value of the flux for Dirichlet
recover the boundary value of the flux for Dirichlet
boundary conditions using
boundary conditions using
Similarly, for Neumann boundary conditions, we can
Similarly, for Neumann boundary conditions, we can find
find
the boundary value of
Closure
Closure
In this lecture we
In this lecture we
»
» De
Desc
scri
ribe
bed
d th
the
e di
disc
scre
reti
tiza
zati
tion
on pr
proc
oced
edur
ure
e fo
for
r th
the
e
diffusion equation on Cartesian meshes
diffusion equation on Cartesian meshes
»
» Sa
Saw t
w tha
hat t
t the
he re
resu
sult
ltin
ing d
g dis
iscr
cret
etiz
izat
atio
ion
n pr
proc
oces
ess
s
preserves the properties of elliptic equations
preserves the properties of elliptic equations
»
» Si
Sinc
nce w
e we ge
e get d
t dia
iago
gona
nal do
l domi
mina
nanc
nce w
e wit
ith D
h Dir
iric
ichl
hlet
et bc
bc,,
the di
the discret
scretizati
ization
on allow
allows us to
s us to use it
use iterati
erative sol
ve solvers
vers