32
Discretization Methods Chapter 2

Discretization Methods Chapter 2. Training Manual May 15, 2001 Inventory #001478 2-2 Discretization Methods Topics Equations and The Goal Brief overview

Embed Size (px)

Citation preview

Page 1: Discretization Methods Chapter 2. Training Manual May 15, 2001 Inventory #001478 2-2 Discretization Methods Topics Equations and The Goal Brief overview

Discretization Methods

Chapter 2

Page 2: Discretization Methods Chapter 2. Training Manual May 15, 2001 Inventory #001478 2-2 Discretization Methods Topics Equations and The Goal Brief overview

May 15, 2001Inventory

#0014782-2

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

Training ManualDiscretization Methods Topics

• Equations and The Goal

• Brief overview of Finite Difference and Finite Volume Methods

• Finite Element Method of FLOTRAN

– Transient Terms

– Source Terms

– Non-Linear Advection Terms

– Diffusion Terms

– The FLOTRAN Pressure Equation

Page 3: Discretization Methods Chapter 2. Training Manual May 15, 2001 Inventory #001478 2-2 Discretization Methods Topics Equations and The Goal Brief overview

May 15, 2001Inventory

#0014782-3

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

Training ManualDifferent Approaches

• Finite Difference

– Original CFD Technique

– Based on Difference Equations

– Mesh and Cell Limitations

• Finite Volume

– Popular CFD technique

– Based on Flow in and out of volumes

• Finite Elements (FLOTRAN)

– Galerkin’s Method of Weighted Residuals

– A discipline of ANSYS Multiphysics

Page 4: Discretization Methods Chapter 2. Training Manual May 15, 2001 Inventory #001478 2-2 Discretization Methods Topics Equations and The Goal Brief overview

May 15, 2001Inventory

#0014782-4

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

Training Manual

)y

φΓ(

y)

x

φΓ(

xS

y

)φvρ(

x

)φuρ(

t

)ρφ(φφφ

Basic Equations

• Transport Equations– Navier-Stokes– Turbulence– Energy

• Basic Form– Unknown: Φ– Generalized Diffusion Coefficient: ΓΦ

• Types of Terms– Transient, Advection, Source, Diffusion

Page 5: Discretization Methods Chapter 2. Training Manual May 15, 2001 Inventory #001478 2-2 Discretization Methods Topics Equations and The Goal Brief overview

May 15, 2001Inventory

#0014782-5

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

Training Manual

bxA

The Goal

• Transform the Governing Partial Differential Equations (P.D.E.s) into sets of algebraic equations of the form:

• Treat each type of term separately

• Difficulties

– Equations are Non-Linear

– First Order Terms are difficult to handle

Page 6: Discretization Methods Chapter 2. Training Manual May 15, 2001 Inventory #001478 2-2 Discretization Methods Topics Equations and The Goal Brief overview

May 15, 2001Inventory

#0014782-6

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

Training Manual

.....x

φ

2

x

φxΔφφ

j

2

22

jj1j

.....x

φ

2

x

φxΔφφ

j

2

22

jj1j

j+1jj-1

Δx Δx

Finite Difference

• Based on Taylor Series expansions

• Consider the following grid in One Dimension:

Page 7: Discretization Methods Chapter 2. Training Manual May 15, 2001 Inventory #001478 2-2 Discretization Methods Topics Equations and The Goal Brief overview

May 15, 2001Inventory

#0014782-7

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

Training ManualFinite Difference

• Adding and re-arrange to get the second derivative

• Subtract and re-arrange to get the first derivative

• Expressions approximate because higher terms neglected

21jj1j

2

2

φφ2φ

x

φ

xΔ2

φφ

x

φ 1j1j

Page 8: Discretization Methods Chapter 2. Training Manual May 15, 2001 Inventory #001478 2-2 Discretization Methods Topics Equations and The Goal Brief overview

May 15, 2001Inventory

#0014782-8

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

Training ManualFinite Volume

• Control Volume Based Finite Difference Method

• Integrate the P.D.E. over a control volume centered about the jth node

• The Integrals are approximated as a flux difference across the control volume faces

J-1J

J+1

Control Volume

Page 9: Discretization Methods Chapter 2. Training Manual May 15, 2001 Inventory #001478 2-2 Discretization Methods Topics Equations and The Goal Brief overview

May 15, 2001Inventory

#0014782-9

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

Training ManualFinite Volume

• Expressions evaluated at the Control Volume Faces

• Second derivative

• First derivative

2

1j

2

1j

2

2

x

φ

x

φ

x

φ

2

1j

2

1j

φφx

φ

Page 10: Discretization Methods Chapter 2. Training Manual May 15, 2001 Inventory #001478 2-2 Discretization Methods Topics Equations and The Goal Brief overview

May 15, 2001Inventory

#0014782-10

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

Training Manual

• Galerkin’s Method of Weighted Residuals

• Divide problem domain into elements with nodes at corners

• Consider an element in two dimensional space

• Express the value of Φ anywhere inside the element as a function of the nodal values...

i j

kl

llkkjjiie φ)y,x(Wφ)y,x(Wφ)y,x(Wφ)y,x(W)y,x(φ

Finite Element Approach

Page 11: Discretization Methods Chapter 2. Training Manual May 15, 2001 Inventory #001478 2-2 Discretization Methods Topics Equations and The Goal Brief overview

May 15, 2001Inventory

#0014782-11

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

Training ManualFinite Element Weighting Functions

• The weighting function W for a node equals 1.0 at its node and 0.0 at the other nodes…

• The variation can be linear or higher order

• For Bi-Linear quadrilaterals, for example:

• There is a waiting function for each node.

• Generally a local coordinate system is used and a transformation exists for global coordinates.

xydycxba)y,x(W iiiii

Page 12: Discretization Methods Chapter 2. Training Manual May 15, 2001 Inventory #001478 2-2 Discretization Methods Topics Equations and The Goal Brief overview

May 15, 2001Inventory

#0014782-12

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

Training ManualProblem Domain and Assembly

• Consider the following simple problem domain

• The Matrix used to solve for the variable Φ would be 12x12

Page 13: Discretization Methods Chapter 2. Training Manual May 15, 2001 Inventory #001478 2-2 Discretization Methods Topics Equations and The Goal Brief overview

May 15, 2001Inventory

#0014782-13

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

Training ManualAssembly

• Each element matrix is 4x4 (for bi-linear quadrilateral elements…)

• Element 1, in this example would contribute to rows 1,3,10,11 at columns 1,3,10,11

• The matrix is sparse, and FLOTRAN only reserves places for non-zero numbers.

• Each element potentially has contributions from

– Transient

– Advection

– Diffusion

– Source

• Each of these contributions are calculated separately.

Page 14: Discretization Methods Chapter 2. Training Manual May 15, 2001 Inventory #001478 2-2 Discretization Methods Topics Equations and The Goal Brief overview

May 15, 2001Inventory

#0014782-14

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

Training ManualGalerkin’s Method

• The weighted residual formation is as follows…

• The Weighting function W is the same form as previously discussed.

• The weighted residual is formed on an element basis.

• Each type of term will now be discussed

0dA)}y

φΓ(

y)

x

φΓ(

x

Sy

)φvρ(

x

)φuρ(

t

)ρφ({W

φφ

φ

Page 15: Discretization Methods Chapter 2. Training Manual May 15, 2001 Inventory #001478 2-2 Discretization Methods Topics Equations and The Goal Brief overview

May 15, 2001Inventory

#0014782-15

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

Training Manual

• Lumped Mass Approach (4x4 diagonal matrix)

• Contributions for nodes j,k,l exist as well

• Second Order Backward Difference

– k is the current time level

dAt

ρφWT i

ei

dAWt

φρT i

iiei

tΔ2

)φρ(3)φρ(4)φρ(

t

φρ kii

1kii

2kiiii

Transient Term

Page 16: Discretization Methods Chapter 2. Training Manual May 15, 2001 Inventory #001478 2-2 Discretization Methods Topics Equations and The Goal Brief overview

May 15, 2001Inventory

#0014782-16

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

Training ManualAdvection Terms

• FLOTRAN Techniques include

– MSU (Monotone Streamline Upwind Method)

– SUPG (Streamline Upwind Petrov-Galerkin Method)

• Difficulties

– Stability

– Bounded Solution

– Numerical Diffusion (accuracy)

– Robustness

Page 17: Discretization Methods Chapter 2. Training Manual May 15, 2001 Inventory #001478 2-2 Discretization Methods Topics Equations and The Goal Brief overview

May 15, 2001Inventory

#0014782-17

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

Training Manual

ttanconss

φuρ S

WdV}s

φuρ{dV}

z

φwρ

y

φvρ

x

φuρ{W S

MSU

• Assume for pure advection, over an element, in streamwise coordinates:

• Therefore, over an element:

• The derivative expressed in terms of the unknown values at the nodes….

Page 18: Discretization Methods Chapter 2. Training Manual May 15, 2001 Inventory #001478 2-2 Discretization Methods Topics Equations and The Goal Brief overview

May 15, 2001Inventory

#0014782-18

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

Training ManualMSU (continued)

• Use a difference equation based upon the streamlines from the previous iteration….

• Each element has one downstream node

• Upstream value based on where the streamline enters the element….

– This value is expressed in terms of that at the neighboring nodes

WdVsΔ

)uρuρ( downstreams

upstreams

Page 19: Discretization Methods Chapter 2. Training Manual May 15, 2001 Inventory #001478 2-2 Discretization Methods Topics Equations and The Goal Brief overview

May 15, 2001Inventory

#0014782-19

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

Training ManualSUPG Method

• Application of the Galerkin Method to the Advection terms results in the following type of term (similar ones exist for Y and Z):

• However, when the mesh is not very fine, spatial oscillations and local inaccuracy result.

• The Solution is to add a perturbation term which provides additional diffusion in the flow direction

}φ{dVx

W}uρ{WdV}

x

φuρ{W i

ei

ei

Page 20: Discretization Methods Chapter 2. Training Manual May 15, 2001 Inventory #001478 2-2 Discretization Methods Topics Equations and The Goal Brief overview

May 15, 2001Inventory

#0014782-20

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

Training ManualSUPG (continued)

• The Perturbation term has the following form (2D)

• Where

– C2τ is a global coefficient (typically 1.0)

– h is the distance through the element in the flow direction

– z is a function of the local Peclet Number

– UMag is the magnitude of the velocity

• The finer the mesh, the smaller the perturbation term

dV}y

)ρφ(v

x

)ρφ(u}{

y

Wv

x

Wu{

U2

zhC

Magτ2

Page 21: Discretization Methods Chapter 2. Training Manual May 15, 2001 Inventory #001478 2-2 Discretization Methods Topics Equations and The Goal Brief overview

May 15, 2001Inventory

#0014782-21

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

Training ManualDiffusion Terms

• Stable terms involving second derivatives

• Standard Treatment

– Multiply by weighting function

– Integrate by parts

– Shown is the X term integrated over a volume

• The element surface integral terms add to zero in the interior…

• The surface integral terms on the exterior represent mass flux across the boundary of the problem domain

dA}n

φΓ{WdV

x

φΓ

x

WdV}

x

φΓ

x{W s

φφφ

Page 22: Discretization Methods Chapter 2. Training Manual May 15, 2001 Inventory #001478 2-2 Discretization Methods Topics Equations and The Goal Brief overview

May 15, 2001Inventory

#0014782-22

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

Training ManualDiffusion Term

• The gradients are evaluated in terms of the nodal values

• The nodal values are constants..

}φ{x

W}

x

φ{ i

ii

dA}n

φΓ{W}φ{dV

x

x

WdV}

x

φΓ

x{W s

φiej

φi

φi

Page 23: Discretization Methods Chapter 2. Training Manual May 15, 2001 Inventory #001478 2-2 Discretization Methods Topics Equations and The Goal Brief overview

May 15, 2001Inventory

#0014782-23

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

Training ManualSource Terms

• SΦ May include

– Pressure gradient

– Body forces

– Distributed Resistances

– Some boundary condition contributions

• Each element contributes an element vector of sources

dASW φi

Page 24: Discretization Methods Chapter 2. Training Manual May 15, 2001 Inventory #001478 2-2 Discretization Methods Topics Equations and The Goal Brief overview

May 15, 2001Inventory

#0014782-24

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

Training ManualContinuity and the Pressure

• Momentum Equations provide force balance that yields the velocities

• Therefore the Pressure must be determined from the Conservation of Mass

– The Continuity Equation does not contain pressure!

• The SIMPLER Method is a segregated solution method that yields an expression for pressure.

– Semi-Implicit Method for Pressure Linked Equations (Revised)

– Originally developed by Patankar for finite volume approaches

Page 25: Discretization Methods Chapter 2. Training Manual May 15, 2001 Inventory #001478 2-2 Discretization Methods Topics Equations and The Goal Brief overview

May 15, 2001Inventory

#0014782-25

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

Training ManualGoal

• Find an expression of pressure gradient in terms of velocity to use in the continuity equation

• First rearrange the continuity equation so that it is in terms of velocities, not their gradients (I.e. integrate by parts)

• Now consider that we are in an iterative loop, solving the momentum equation and then the continuity (pressure) equation.

• Return to the momentum equation and develop an expression for velocity in terms of a pressure gradient.

– After the momentum equation has been solved, treat the nodal velocity and pressure as unknowns.

• Insert the resulting expression into the continuity equation.

Page 26: Discretization Methods Chapter 2. Training Manual May 15, 2001 Inventory #001478 2-2 Discretization Methods Topics Equations and The Goal Brief overview

May 15, 2001Inventory

#0014782-26

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

Training ManualThe Pressure Equation

• Integrate the Continuity Equation by Parts:

(Include X and Y components only for clarity)

• Superscripts

– “e” implies operation over an element volume

– “s” implies operation on an element surface

• The surface integral terms sum to zero in the interior of the domain. On the surface they are mass flux boundary conditions.

dA}vρ{WdA}uρ{WdVy

W}vρ{dV

x

W}uρ{

dV}y

)vρ(

x

)uρ({W

sseeee

ee

Page 27: Discretization Methods Chapter 2. Training Manual May 15, 2001 Inventory #001478 2-2 Discretization Methods Topics Equations and The Goal Brief overview

May 15, 2001Inventory

#0014782-27

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

Training ManualPressure Equation (continued)

• Now develop an expression for the velocities in terms of the pressure gradient.

• At this point in the computational loop the velocities have already been determined.

• Consider the discretized equation resulting from momentum conservation in the X . Remove the pressure gradient term from the assembled source terms:

• Similar equations exist in the Y and Z directions

eNi

1i

Ee

1eikik }dV

x

pW{bua

Page 28: Discretization Methods Chapter 2. Training Manual May 15, 2001 Inventory #001478 2-2 Discretization Methods Topics Equations and The Goal Brief overview

May 15, 2001Inventory

#0014782-28

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

Training ManualPressure Equation

• Rearrange:

• Where:

• Treat the Ui as unknown, and Uk as knowns.

ee

ii

Λ

ii dV}x

pW{

a

1uu

ii

ikki

ik

i

Λ

a

bua

u

Page 29: Discretization Methods Chapter 2. Training Manual May 15, 2001 Inventory #001478 2-2 Discretization Methods Topics Equations and The Goal Brief overview

May 15, 2001Inventory

#0014782-29

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

Training ManualPressure Coefficient

• Assume the pressure gradient is constant over the element and define a pressure coefficient.

• The element integrals of the Weighting function “W” have been assembled into a vector

x

pKuu ii

Λ

i

iii a

WdVK

Page 30: Discretization Methods Chapter 2. Training Manual May 15, 2001 Inventory #001478 2-2 Discretization Methods Topics Equations and The Goal Brief overview

May 15, 2001Inventory

#0014782-30

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

Training ManualPressure Equation

• Substitute these expressions into the continuity equation (2D)

• Becomes

dA}vρ{WdA}uρ{WdVy

W}vρ{dV

x

W}uρ{

dV}y

)vρ(

x

)uρ({W

sseeee

ee

0dA}vρ{WdA}uρ{W

dVy

W}

y

PKρvρ{dV

x

W}

x

PKρuρ{

ssss

evi

Λ

ieu

i

Λ

i

Page 31: Discretization Methods Chapter 2. Training Manual May 15, 2001 Inventory #001478 2-2 Discretization Methods Topics Equations and The Goal Brief overview

May 15, 2001Inventory

#0014782-31

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

AD

VA

NC

ED

CFD

5.7

Training ManualFinal Pressure Equation

• Re-arrange and express the Pressure Gradient in terms of the weighting function and nodal values to get the final form.

• For incompressible problems the resulting matrix is positive definite and symmetric

eiΛ

iei

Λ

iss

iss

i

iejiv

iiejiu

i

dVy

W}vρ{dV

x

W}uρ{dA}vρ{WdA}uρ{W

}P{dVy

W

y

WKρ}P{dV

x

W

x

WKρ

Page 32: Discretization Methods Chapter 2. Training Manual May 15, 2001 Inventory #001478 2-2 Discretization Methods Topics Equations and The Goal Brief overview