0% found this document useful (0 votes)
52 views9 pages

T T D T X X: The 1D Diffusion Problem Is

The Crank-Nicholson scheme is an implicit finite difference method for solving the diffusion equation. It allows for larger time steps while maintaining stability compared to explicit methods. For the 1D case, it involves averaging the diffusion term between the current and next time steps. This results in an unconditionally stable tridiagonal system that can be efficiently solved. The method can be extended to 2D and higher dimensions using operator splitting, where it is applied sequentially along each dimension.

Uploaded by

ratchagar a
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
52 views9 pages

T T D T X X: The 1D Diffusion Problem Is

The Crank-Nicholson scheme is an implicit finite difference method for solving the diffusion equation. It allows for larger time steps while maintaining stability compared to explicit methods. For the 1D case, it involves averaging the diffusion term between the current and next time steps. This results in an unconditionally stable tridiagonal system that can be efficiently solved. The method can be extended to 2D and higher dimensions using operator splitting, where it is applied sequentially along each dimension.

Uploaded by

ratchagar a
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 9

Solving Diffusion Problem Crank Nicholson Scheme The 1D Diffusion Problem is:

T T ( D ) t x x
Here the diffusion constant is a function of T:

John Crank 1916 2006

Phyllis Nicolson 1917 1968

D T
z D T
Or equivalently,

5/2

We first define a function that is the integral of D:

7 /2 z ( 1 f) T

with constant f = 5/7.

Insert z back into the diffusion equation we find:

T z T ( ) t x T x
The RHS is then turned into the Laplacian of function z:

T 2z 2 t x
Now split both sides at the nth time step, we get:
n 1 n n n n T T z 2 z z i i i 1 i i 1 2 t x

If we substitute z back we get an expression for the function value at n+1 time step ... ? But wait

Lets look at the stability requirement. By simple algebra we get the time step for this scheme to be stable is:

x2 t 2D
This is roughly the diffusion time across one cell. A domain containing hundreds of cells would require enormous time for the diffusion to cause some noticeable effect. Thus we need some scheme that allows us to take larger time steps but retains stability. The trick here is to link the function value at n-th time step with n+1 th time step. We write the differencing scheme as:
n 1 n n 1 n 1 n 1 T T z 2 z z i i i 1 i i 1 2 t x

This graph shows how this scheme works:

It can be proven that by using this implicit method, the scheme becomes unconditionally stable for any step size chosen. Now lets do the back substitution. It should be:

n 1 n n 1 ( 7 / 2 ) n 1 ( 7 / 2 ) n 1 ( 7 / 2 ) T T ( 1 f ) T 2 ( 1 f ) T ( 1 f ) T i i 1 i i 1 i 2 t x

Instead of stability issues, it requires us to solve a complicated nonlinear equation system at each time step. But theres a way to get around this problem. We can write the integral of D at the n+1 th time step, which causes the nonlinearity as:

z n 1 n 1 n n 1 n z z ( T ) z ( T )( T T ) i i i i i T i , n
n n 1 n n z ( T )( T T )( D T i i i i)

w we make the n+1 dependence on the RHS linear. Do the substitution, we get:

n 5 / 21 n n 5 / 2 n 1 n 5 / 21 n ( T ) T ( 2 ( Th ) ) T ( T ) T i 1 i 1 i i i 1 i 1

ai

bi

ci

n 7 / 2 n 7 / 2 n 7 / 2 n f [ () T 2 ( T ) () T ]( h T ) i 1 i i 1 i

ri
where

x2 h t

We define the coefficients as above then the equation becomes:


n 1 n 1 n 1 a T b T c T r ii 1 ii ii 1 i

The problem is then transformed into solving a tridiagonal matrix:

* taken from Numerical Recipies This matrix can easily be solved by back substitution scheme, which can be found in any elementary numerical method book. Go 2D Now consider the 2D diffusion problem.

T T T ( D ) ( D ) t x x y y
The 2D Crank-Nicholson scheme is essentially the same as the 1D version, we simply use the operator splitting technique to extend the method to higher dimensions. Explicitly, the scheme looks like this:

1. evolve half time step on x direction with y direction variance attached


n 5 / 2 n 1 / 2 n 5 / 2 n 1 / 2 n 5 / 2 n 1 / 2 () T T ( 2 ( T ) h ) T () T T ij 1 , ij 1 , i , j i , j ij 1 , ij 1 ,

ai

bi

ci

n7 / 2 n 7 / 2 n7 / 2 n f [ ( T ) 2 ( T ) ( T ) ]( h T ) i 1 , j i , j i 1 , j i , j n7 / 2 n 7 / 2 n7 / 2 g ( 1 fT ) [ ( ) 2 ( T ) ( T ) i ,1 j i , j i ,1 j ]

ri
where

2x2 h t

x2 g 2 y

Step 2. evolve another half time step on y direction with x direction variance attached.
n 1 / 2 5 / 2 n 1 n 1 / 2 5 / 2 n 1 n 1 / 2 5 / 2 n 1 ( T ) T ( 2 ( T ) h ) T ( T ) T i , j 1 i , j 1 i , j i , j i , j 1 i , j 1

ai

bi

ci

n 1 / 2 7 / 2 n 1 / 2 7 / 2 n 1 / 2 7 / 2 n 1 / 2 f [ ( T ) 2 ( T ) ( T ) ] h ( T i ,1 j i , j i ,1 j i , j ) n 1 / 2 7 / 2 n 1 / 2 7 / 2 n 1 / 2 7 / 2 g ( 1 fT ) [ ( ) 2 ( T ) ( T ) ] i 1 , j i , j i 1 , j

ri
where

2y2 h t

y2 g 2 x

Since the sweeps on different directions are identical, it is possible to solve a multidimensional diffusion problem by a single subroutine.

In solving Euler equation with diffusion, we can use operator splitting: solve the usual Euler equation by splitting on different directions thru time step dt to get the density, velocity and pressure. Then from the pressure at each grid, find the temperature distribution, do a Crank-Nicholson calculation with the same time step dt (here we still need to split dt) to find a new temperature distribution. Then use this temperature distribution to find pressure distribution again. This is the actual pressure distribution at dt. Then go on to the next time step.

You might also like