ME 608

Numerical Methods for Heat, Mass and Momentum Transfer
Jayathi Y. Murthy Professor, School of Mechanical Engineering Purdue University

Spring 2006

Lecture 1: Introduction to ME 608 Conservation Equations

Outline of Lecture
Course organization Introduction to CFD Conservation equations, general scalar transport equation Conservation form


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!

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 zero error “So far I have paid piece rates for the operation (Laplacian) of about n/18 pence per coordinate point, n being the number of digits … one of the quickest boys averaged 2000 operations (Laplacian) per week for numbers of 3 digits, those done wrong being discounted …” Richardson, 1910

Lewis F. Richardson (1881-1953)

Also researched mathematical models for causes of war : Generalized Foreign Politics (1939) Arms and Insecurity(1949) Statistics of Deadly Quarrels (1950)

Relaxation methods (1920’s-50’s) Landmark paper by Courant, Friedrichs and Lewy for hyperbolic equations (1928) Von Neumann stability criteria for parabolic problems (1950) Harlow and Fromm (1963) computed unsteady vortex street using a digital computer. They published a Scientific American article (1965) which ignited interest in modern CFD and the idea of computer experiments Boundary-layer codes developed in the 19601970’s (GENMIX by Patankar and Spalding in 1972 for eg.) Solution techniques for incompressible flows published through the 1970’s (SIMPLE family of algorithms by Patankar and Spalding for eg.) Jameson computed Euler flow over complete aircraft (1981) Unstructured mesh methods developed in 1990’s
John von Neumann (1903-1957)

Richard Courant (1888-1972)

Conservation Equations
Nearly all physical processes of interest to us are governed by conservation equations » Mass, momentum energy conservation Written in terms of specific quantities (per unit mass basis) » Momentum per unit mass (velocity) » Energy per unit mass e Consider a specific quantity φ » Could be momentum per unit mass, energy per unit mass.. 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)


Influx and Efflux:

Diffusion and Convection Fluxes
Diffusion Flux Convection Flux Net flux

Velocity Vector Diffusion coefficient



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





Recall: say)

φ is a specific quantity (energy per unit mass

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, φ= u Γ= µ

⎛ ∂ui ∂u j ⎞ τ ij = µ ⎜ + ⎟ ⎜ ∂x ⎟ ∂xi ⎠ j ⎝
S is good “dumping ground” for everything that doesn’t fit into the other terms

∂p S = Su ∂x

Species Transport Equation

Yi = kg of specie i /kg of mixture Γi = diffusion coefficient of i in mixture i Ri = reaction source

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…

Wrote conservation statement for a control volume Derived a general scalar transport equation Discovered that all transport processes commonalities » Storage » Diffusion » Convection » Generation

This time…
Examine important classes of partial differential equations and understand their behavior See how this knowledge applies to the general scalar transport equation Start a general overview of the main elements of all numerical methods

General Scalar Transport Equation





Recall: say)

φ is a specific quantity (energy per unit mass

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 D=0 D>0 Elliptic PDE Parabolic PDE Hyperbolic PDE

Elliptic PDEs
Consider 1-D heat conduction in a plane wall with constant thermal conductivity

Boundary conditions


Elliptic PDE’s

To • T(x) is influenced by both

boundaries • 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 in a slab with constant properties:
T0 Ti T0

Boundary and initial conditions


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


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
Geometry creation Domain discretization (mesh generation) Discretization of governing equations Solution of discrete equations; accounting for nonlinearities and inter-equation coupling Visualization and post-processing

Solution Process
Analytical solution gives us φ(x,y,z,t). Numerical solution gives us φ only at discrete grid points. The process of converting the governing partial differential equation into discrete algebraic equations is call discretization. Discretization involves » Discretization of space using mesh generation » Discretization of governing equations to yield sets of algebraic equations

Mesh Types

Regular and body-fitted meshes

Stair-stepped representation of complex geometry

Mesh types (cont’d)

Blockstructured meshes

Unstructured meshes

Mesh Types
Cell shapes

Nonconformal 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: Step 1: Discretize domain using a mesh. Unknowns are located at nodes Step 2: Expand φ in Taylor series about point 2

Subtracting equations yields

Finite Difference Method (cont’d)
Step 3: Adding equations yields

Drop truncated terms:

Second order truncation error

Step 4: Evaluate source term at point 2:

Finite Difference Method (cont’d)
Step 5: Assemble discrete equation

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:

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 This does not guarantee accuracy, however. The process of discretization yields a flux balance involving face values of the diffusion flux, for example:

⎛ ∂φ ⎞ −Γ e ⎜ ⎟ ⎝ ∂x ⎠e
Profile assumptions for φ and S need not be the same.

Comments (cont’d)
As with finite difference method, we need to solve a set of coupled algebraic equations 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

In this lecture we Considered different canonical PDEs and examined their behavior Understood how these model equations relate to our general scalar transport equations Started an overview of the important elements of any numerical method 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…
Examined important classes of partial differential equations and understood their behavior Saw how this knowledge would apply to the general scalar transport equation Started an overview of numerical methods including mesh terminology and finite difference methods

This time…
We will continue the overview and examine Finite difference, finite volume and finite element methods Accuracy, consistency, stability and convergence of a numerical scheme

Overview of Finite Element Method
Consider diffusion equation Let φ be an approximation to φ

Since φ is an approximation, it does not satisfy the diffusion equation, and leaves a residual R:

d 2φ Γ 2 +S = R dx
Galerkin finite element method minimizes R with respect to a weight function:

Finite Element Method (cont’d)
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 Element i-1 wi Element i i+1

Finite Element Method (cont’d)
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 nonzero only in the vicinity of node i => “local basis”
Ni-1 i-1 Element i-1 i Element i Ni i+1

Finite Element Method (cont’d)
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
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
All three yield discrete algebraic equation sets which must be solved Local basis – only near-neighbor dependence Finite volume method is conservative; the others are not 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
Linear equation set has two important characteristics » Matrix is sparse, may be banded » Coefficients are provisional for non-linear problems Two different approaches » Direct methods » Iterative methods Approach defines “path to solution” » Final answer only determined by discretization

Direct Methods
All discretization schemes lead to

Here φ is solution vector [φ1 , φ2 ,…, φN]T. Can invert: 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)
Large storage and operation count » For N grid points, must store NxN matrix » Only store non-zero entries and fill pattern For non-linear problems, A is provisional and is usually updated as a part of an outer loop » Not worth solving system too “exactly” As a result, direct methods not usually preferred in CFD today

Iterative Methods
Guess and correct philosophy 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)
Jacobi scheme is similar to Gauss-Seidel scheme but does not use latest available values » All values are updated simultaneously at end of sweep. Iterative are not guaranteed to converge to a solution unless Scarborough criterion is satisfied

Scarborough Criterion
Scarborough criterion states that convergence of an iterative scheme is guaranteed if:

This means that coefficient matrix must be diagonally dominant

Gauss-Seidel Scheme
No need to store coefficient matrix Operation count per sweep scales as O(N) However, convergence, even when guaranteed, is slow for large meshes Will examine alternatives later in course

While looking at finite difference methods, we wrote: Secondorder truncation error Halving grid size reduces error by factor of four for second-order scheme Cannot say what absolute error is – truncation error only gives rate of decrease

Order of discretization scheme is n if truncation error is O(∆xn ) When more than one term is involved, the order of the discretization scheme is that of the lowest order term. Accuracy is a property of the discretization scheme, not the path to solution

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

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) We will usually use the latter meaning

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

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

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

Next time, we will start looking at finite volume discretization of diffusion equation

Lecture 4: The Diffusion Equation – A First Look

Last Time…
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 Apply the finite volume scheme to the steady diffusion equation on Cartesian structured meshes Examine the properties of the resulting discretization 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
Apply divergence theorem to yield

Discrete Flux Balance
• Writing

integral over control volume:


Discrete Flux Balance (cont’d)
Area vectors given by:

Fluxes given by

Assume φ varies linearly between cell centroids

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

Source Linearization
Source term must be linearized as:

Assume SP <0 More on this later!

Final Discrete Equation





Discrete equation reflects balance of flux*area with generation inside control volume As in 1-D case, we need fluxes at cell faces These are written in terms of cell-centroid values using profile assumptions.

Comments (cont’d)
Formulation is conservative: Discrete equation was derived by enforcing conservation. Fluxes balance source term regardless of mesh density For a structured mesh, each point P is coupled to its four nearest neighbors. Corner points do not enter the formulation.

Properties of Discretization
aP, anb have same sign: This implies that if neighbor φ goes up, φP also goes up If S=0:

Thus φ is bounded by neighbor values, in keeping with properties of elliptic partial differential equations

Properties of Discretization (cont’d)
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
Dirichlet boundary condition: φb = φgiven

Put in the requisite flux into the near-boundary cell balance

Dirichlet BC’s (cont’d)
For near-boundary cells:

aP > ∑ anb

Satisfies Scarborough Criterion ! Also, φP bounded by interior neighbors and boundary value in the absence of source terms

Neumann BC’s
Neumann boundary conditions : qb given

Replace Jb in cell balance with given flux

Neumann BC’s (cont’d)
For Neumann boundaries

aP = ∑ anb

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
Once we solve for the interior values of φ, we can recover the boundary value of the flux for Dirichlet boundary conditions using

Similarly, for Neumann boundary conditions, we can find the boundary value of φ using

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 Next time, we will look at one more boundary condition (Robbins or mixed bc), source linearization and conjugate heat transfer

Sign up to vote on this title
UsefulNot useful

Master Your Semester with Scribd & The New York Times

Special offer for students: Only $4.99/month.

Master Your Semester with a Special Offer from Scribd & The New York Times

Cancel anytime.