6-Diffusion Equation - C

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 23

Lecture 6: A First Look at the Diffusion

Equation (cont’d)
Last Time…

We looked at
z Conjugate heat transfer
z Source term linearization
z Under-relaxation
This Time…

z Revisit linear solvers – tridiagonal matrix algorithm


(TDMA), line-by-line (TDMA)
z Start looking at unsteady conduction
Linear Solvers

z Let’s re-visit linear solvers for 2D structured meshes


z Consider 1D discrete equation for point P
Linear Solvers

z Recast using slightly different notation

aiφi = biφi +1 + ciφi −1 + d i


z One equation like this for each grid point i=1,2,3, …, N
z For i=1, c1 =0.
z Also bN =0
Tri-Diagonal Matrix Algorithm (TDMA)

z For ith grid point:

aiφi = biφi +1 + ciφi −1 + d i


⎡x x ⎤
z For boundary points: c1=0; bN=0
⎢x x x ⎥
⎢ ⎥
z Using equation for point 1 write φ1 = f(φ2). ⎢ x x x⎥
⎢ ⎥
z Substitute into equation for φ2 to eliminate φ1 and ⎣ x x⎦
write φ2 = f(φ3 )
z Repeat procedure until Nth equation is reached; find
φN
z Back substitute to find φN-1 …. φ1
z Equivalent to direct solution (Gaussian elimination)
TDMA (cont’d)

z Formalizing this, define factors Pi , Qi such that:

z Easy to show that:

z P1 = b1/a1; PN =0
z φN = QN
TDMA (cont’d)

Procedure:
z In the forward sweep, find Pi , Qi, i=1,2…N
z Find φN = QN
z In the reverse sweep, use

Known
Find
z Sweep points in reverse order to find φN-1 , … ,φ1
Line-By-Line TDMA

z Used for multi-dimensional problems on structured meshes


z Assume values on lines on either side temporarily known
z On each line, use TDMA to solve linear system
z Sweep across lines over and over until convergence.
z “TDMA traverse” is the direction in which TDMA is applied
z “Sweep” is the direction along which lines are solved
sequentially
z Sometimes also called Line Gauss Seidel (LGS)
Line-By-Line TDMA

aijφij = bijφij +1 + cijφij −1 + g ij +


d ijφi*+1 j + eijφi*−1 j
TDMA along
each line
Can do the same in
the J direction

I Sweep line to line


Line-By-Line TDMA

Which TDMA traverse and sweep directions would you


choose in the following cases?

T3
Adiabatic

Adiabatic
T1 T2 T1

Adiabatic T2
Unsteady Diffusion

z Governing equation:

z Integrate over control volume and time step


Unsteady Term

z Write unsteady term in terms of current value (1) and


old value (0):

z Assume:

z Unsteady term becomes:


Flux Term

z Consider flux integral

z Write term as:

z How to perform integral? Assume flux varies linearly


over time step.
Flux Term
z At each time level, discretize flux term.
z Current time:

z Old time:
Source Term

z Need to evaluate

z For spatial part, approximate as :

z Again, assume source varies linearly over time step:


Discrete Equation Set

z Dropping superscript (1) for


compactness
z Notice old values in discrete
equation
z To make sense of this
equation, we will look at
particular values of time
interpolation factor f (f = 0,
1, 0.5)
Explicit Scheme

z Explicit scheme is derived by assuming f=0

φ1 Profile
φ assumption
over time
step
φ0

t0 t1 t
Explicit Scheme: Discrete Equations

z RHS only a
function of old-
time values
z Consequences?
Properties of Explicit Scheme

z RHS is known from previous time (initial conditions)


z No need to solve linear algebraic set to find φP
z When steady state is reached, φP= φ0P. In this limit,
steady discrete equations are recovered.
» Steady state does not depend on history of time
stepping
z Will show later that truncation error is O (∆t)
Properties (cont’d)

z What if
z Would need to choose grid size/time-step to give

z Yields (in 1D) Can show this


more formally
through Von
Neumann stability
analysis
Stability Limits for Explicit Scheme

z Explicit scheme has stability limits (Von Neumann


Limit):

1-D

2-D

3-D

Quadratic dependence on grid size strongly


limits utility on practical meshes!
Closure

In this lecture, we
z Looked at the TDMA, which is a direct method for
solving tridiagonal systems
z Saw how it could be used to create an iterative
method for solving multidimensional systems
z Started looking at unsteady diffusion problems

You might also like