Professional Documents
Culture Documents
xT x xT ! (D ) xt xx xx
Here the diffusion constant is a function of T:
5/2
D ! OT
xz D! xT
Or equivalently,
z ! (1 f )O T 7/2
with constant f = 5/7.
xT x xz xT ! ( ) xt xx xT xx
The RHS is then turned into the Laplacian of function z:
xT x 2 z ! 2 xt xx
Now split both sides at the nth time step, we get:
Let s look at the stability requirement. By simple algebra we get the time step for this scheme to be stable is:
(x 2 (t e 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:
It can be proven that by using this implicit method, the scheme becomes unconditionally stable for any step size chosen. Now let s do the back substitution. It should be:
n n Ti n 1 Ti n (1 f )O Ti 1 1(7/ 2) 2(1 f )O Ti n 1(7/ 2) (1 f )O Ti 1 1(7/ 2) ! (t (x 2
Instead of stability issues, it requires us to solve a complicated nonlinear equation system at each time step. But there s 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:
xz xT
i,n
w we make the n+1 dependence on the RHS linear. Do the substitution, we get:
ai
bi
ci
r i
where
(x 2 h! O(t
* taken from Numerical Recipies This matrix can easily be solved by back substitution scheme, which can be found in any elementary numerical method book.
xT x xT x xT ! (D ) (D ) xt xx xx xy xy
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:
ai
bi
ci
n n ! f [(Ti 1, j )7/2 2(Ti ,nj )7/2 (Ti 1, j )7/2 ] h(Ti ,nj )
ri
where
2 (x 2 h! O(t
(x 2 g! 2 (y
Step 2. evolve another half time step on y direction with x direction variance attached.
(Ti ,nj1/ 2 )5/2 Ti ,nj11 (2(Ti ,nj1/ 2 )5/ 2 h)Ti ,nj1 (Ti ,nj1/2 )5/ 2 Ti ,nj11 1 1
ai
bi
ci
! f [(Ti ,nj1/2 )7/2 2(Ti ,nj1/2 )7/2 (Ti ,nj1/2 )7/2 ] h(Ti ,nj1/2 ) 1 1
n n g (1 f )[(Ti 1,1/2 )7/2 2(Ti ,nj1/2 )7/2 (Ti 1,1/2 )7/2 ] j j
ri
where
2 (y 2 h! O(t
(y 2 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.