Question 16.21: Obtain an explicit finite difference scheme for the solution...

Obtain an explicit finite difference scheme for the solution of following variable coefficient problem

\frac{\partial u}{\partial t}=\frac{\partial^2 u}{\partial x^2}+x \frac{\partial u}{\partial x} \quad 0 \leq x \leq 1, t \geq 0

with following initial and boundary conditions

u(x, 0) = x(2 − x)

u(0,t) = 0, u(1,t) = 1

Replace temporal derivative term with forward difference and spatial derivative terms by central differences. Use this scheme for the solution over a rectangular grid defined by spacing Δx = 0.2 and Δt = 0.005. Solve up to t = 0.02 only.

The blue check mark means that this solution has been answered and checked by an expert. This guarantees that the final answer is accurate.
Learn more on how we answer questions.

The spacing is Δx = 0.2 for 0 ≤ x ≤ 1; so, our node points are given by

x_0=0, x_1=0.2, x_2=0.4, x_3=0.6, x_4=0.8, x_5=1

Let u_{i, j}=u\left(x_i, t_j\right) . The initial condition is u(x,0) = x(2 − x), so we have

\begin{aligned} &u_{0,0}=u\left(x_0, t_0\right)=u(0,0)=0(2-0)=0 \\ &u_{1,0}=u\left(x_1, t_0\right)=u(0.2,0)=0.2(2-0.2)=0.36 \\ &u_{2,0}=u\left(x_2, t_0\right)=u(0.4,0)=0.4(2-0.4)=0.64 \\ &u_{3,0}=u\left(x_3, t_0\right)=u(0.6,0)=0.6(2-0.6)=0.84 \\ &u_{4,0}=u\left(x_4, t_0\right)=u(0.8,0)=0.8(2-0.8)=0.96 \end{aligned}

u_{5,0}=u\left(x_5, t_0\right)=u(1,0)=1(2-1)=1             (16.95)

Similarly, boundary conditions are u(0,t) = 0 and u(1,t) =1 . This implies

u_{0, j}=u\left(x_0, t_j\right)=u(0, t)=0

u_{5, j}=u\left(x_5, t_j\right)=u(1, t)=1 ; \quad \text { for } \forall j=0,1,2,3, \cdots          (16.96)

The following table shows the initial (16.95) and boundary (16.96) conditions.

5(1) 4(0.8) 3(0.6) 2(0.4) 1(0.2) 0(0) j(t)     \     i(x)
1 0.96 0.84 0.64 0.36 0 0(0)
1 0 1(0.005)
1 0 2(0.01)
1 0 3(0.015)
1 0 4(0.02)

Let the value of u(x, t) at point \left(x_i, t_j\right) \text { be } u_{i, j} \text { i.e. } u\left(x_i, t_j\right)=u_{i, j} Discretizing the given variable coefficient problem at point \left(x_i, t_j\right) , we get

\left.\frac{\partial u}{\partial t}\right|_{\left(x_i, t_j\right)}=\left.\frac{\partial^2 u}{\partial x^2}\right|_{\left(x_i, t_j\right)}+\left.x \frac{\partial u}{\partial x}\right|_{\left(x_i, t_j\right)}           (16.97)

The following forward difference (for time derivative term) and central difference (for space derivative terms) formulas can be used to generate the explicit scheme

\begin{aligned} &\frac{\partial u\left(x_i, t_j\right)}{\partial t}=\frac{u_{i, j+1}-u_{i, j}}{\Delta t}+O(\Delta t) \\ &\frac{\partial u\left(x_i, t_j\right)}{\partial x}=\frac{u_{i+1, j}-u_{i-1, j}}{2(\Delta x)}+O\left(\Delta x^2\right) \end{aligned}

\frac{\partial^2 u\left(x_i, t_j\right)}{\partial x^2}=\frac{u_{i+1, j}-2 u_{i, j}+u_{i-1, j}}{(\Delta x)^2}+O\left(\Delta x^2\right)          (16.98)

Putting the finite differences (16.98) in Eq. (16.97) and neglecting the error terms in discretization, we have

\frac{u_{i, j+1}-u_{i, j}}{\Delta t}=\frac{u_{i+1, j}-2 u_{i, j}+u_{i-1, j}}{(\Delta x)^2}+x_i \frac{u_{i+1, j}-u_{i-1, j}}{2(\Delta x)}

On rearranging the terms, we have following explicit scheme

u_{i, j+1}=\frac{\Delta t}{2(\Delta x)^2}\left(\left(2+x_i(\Delta x)\right) u_{i+1, j}+\left(2-x_i(\Delta x)\right) u_{i-1, j}\right)+\left\lgroup 1-\frac{2(\Delta t)}{(\Delta x)^2} \right\rgroup u_{i, j}

Using Δx = 0.2 and Δt = 0.005 , we have

u_{i, j+1}=0.0625\left(\left(2+0.2 x_i\right) u_{i+1, j}+\left(2-0.2 x_i\right) u_{i-1, j}\right)+0.75 u_{i, j}            (16.99)

For j = 0, we get

u_{i, 1}=0.0625\left(\left(2+0.2 x_i\right) u_{i+1,0}+\left(2-0.2 x_i\right) u_{i-1,0}\right)+0.75 u_{i, 0}

Computing the values for i = 1, 2, 3 and 4, we get

\begin{aligned} &u_{1,1}=0.0625\left(\left(2+0.2 x_1\right) u_{2,0}+\left(2-0.2 x_1\right) u_{0,0}\right)+0.75 u_{1,0}=0.351600 \\ &u_{2,1}=0.0625\left(\left(2+0.2 x_2\right) u_{3,0}+\left(2-0.2 x_2\right) u_{1,0}\right)+0.75 u_{2,0}=0.632400 \\ &u_{3,1}=0.0625\left(\left(2+0.2 x_3\right) u_{4,0}+\left(2-0.2 x_3\right) u_{2,0}\right)+0.75 u_{3,0}=0.832400 \\ &u_{4,1}=0.0625\left(\left(2+0.2 x_4\right) u_{5,0}+\left(2-0.2 x_i\right) u_{3,0}\right)+0.75 u_{4,0}=0.951600 \end{aligned}

These values give the second row of the table.
Proceeding in a similar manner, for j = 1, 2, and 3, we will get different rows of the table.
The results are presented in the following table (only six decimal digits)

5(1) 4(0.8) 3(0.6) 2(0.4) 1(0.2) 0(0) j(t)  \  i(x)
1 0.96 0.84 0.64 0.36 0 0(0)
1 0.951600 0.832400 0.632400 0.351600 0 1(0.005)
1 0.944426 0.824694 0.624704 0.344331 0 2(0.01)
1 0.938159 0.817060 0.617058 0.337898 0 3(0.015)
1 0.932581 0.809605 0.609559 0.332098 0 4(0.02)
31

Related Answered Questions