Computational Fluid Dynamics
Problem Statement :
Given a rod of Length L ,with boundary conditions,boundary conditions as follows :
$T(0,t) = 0^{\circ}C $
$T(1,t) = 0^{\circ}C $
Also the initial conditions are as follows:
$T(x,0) = 0^{\circ}C $
Find the Temperature distribution for the complete length of the rod for a time period of 300s.
Governing Equations:
The physical equation is as follows from the below heat conduction equation.
$ \frac{\delta T}{\delta t} = \alpha \frac{\delta ^2 T}{\delta x^2}$
Now we are applying FTCS scheme to the above equation we get:
$T_{i}^{n+1} = T_{i}^{n} + \alpha \Delta t \frac{(T_{i+1}^n - 2T_{i}^n + T_{i-1}^n)}{(\Delta x)^2}$
Pseudo code :
- Initialize the variables $\alpha ,\Delta t,T,\Delta x,N_x,L$.
(Note here T is a matrix with $N_x$ columns ,and $20/(\Delta t) +1= N_y$ rows) - For n = 2 to $N_y$ execute the statements 3 and 4.
- For i = 2 to $N_x-1$ execute statement 4.
- $T[i][n+1] = T[i][n] + \frac{\alpha \Delta t}{(\Delta x)^2} (T[i+1][n] - 2T[i][n] + T[i-1][n] )$
- end
Stability of scheme :
Let $\gamma = \alpha \frac{\Delta t}{ \Delta x^2}$.
Scheme is stable if $\gamma$ < $\frac{1}{2} $
Derivation :
$$e(n,x) = A_n e^{ikx}$$
Here $k$ is the wave number , $i = (-1)^{0.5}$
Therefore substituting this in the finite difference scheme we get
$$ \frac{A_{n+1}}{A_{n}} = 1 + \frac{\alpha \Delta t}{\Delta x^2}\left ( e^{i k \Delta x} -2 + e^{-i k \Delta x} \right )$$
Derivation :
$$e(n,x) = A_n e^{ikx}$$
Here $k$ is the wave number , $i = (-1)^{0.5}$
Therefore substituting this in the finite difference scheme we get
$$ \frac{A_{n+1}}{A_{n}} = 1 + \frac{\alpha \Delta t}{\Delta x^2}\left ( e^{i k \Delta x} -2 + e^{-i k \Delta x} \right )$$
$$ \frac{A_{n+1}}{A_{n}} = 1 + \frac{\alpha \Delta t}{\Delta x^2}\left (-4 sin^2 (k \frac{\Delta x}{2} )\right )$$
$$ \left \vert \frac{A_{n+1}}{A_{n}} \right \vert \leq 1$$
$$ -1 \leq 1 + \frac{\alpha \Delta t}{\Delta x^2} \left (-4 sin ^2 (k \frac{\Delta x}{2} ) \right ) $$
Finally we get the required criterion.
$$ \left \vert \frac{A_{n+1}}{A_{n}} \right \vert \leq 1$$
$$ -1 \leq 1 + \frac{\alpha \Delta t}{\Delta x^2} \left (-4 sin ^2 (k \frac{\Delta x}{2} ) \right ) $$
Finally we get the required criterion.
No comments:
Post a Comment