I am trying to solve parabolic pde

$$ \frac{\partial U}{\partial t} = \frac{\partial^2 U}{\partial x^2}$$

$U=x^2$ is the initial condition distribution, $0 \leq x \leq 1 $ ($U$ is in dimensionless form.)

Discretizing the pde using central difference method and assuming $u$ as the exact solution,

$$\frac{u_{i,j+1}-u_{i,j-1}}{2k} = \frac{u_{i+1,j}-2u_{i,j}+u_{i-1,j}}{h^2}$$ $t=ik, x=jh$, where $i,j=0,1,2,3,...n$ Simplifying,

$$u_{i,j+1}=ru_{i-1,j}-2ru_{i,j}+ru_{i+1,j}+u_{i,j-1}$$ Where, $r=2k/h^2$

I have question in terms $u_{i,j-1}$ and $u_{i+1,j}$

  • When $t=0$, what should be value of $u_{i,j-1}$? How valid is it to assume it as zero?
  • What happens at $x=1$? What should be value of $u_{i+1,j}$ as this quantity will lie outside the domain.

Can someone comment on these questions?

  • $\begingroup$ You need some boundary conditions associated with $x=0,1$ $\endgroup$ – parsiad Sep 26 '17 at 0:48
  • $\begingroup$ and also, this a very bad method for the heat equation. Your finite difference equation is reversible, the PDE is not. This will lead to instability. $\endgroup$ – Philip Roe Sep 26 '17 at 0:52
  • $\begingroup$ Use Crank-Nicolson instead: en.wikipedia.org/wiki/Crank%E2%80%93Nicolson_method $\endgroup$ – parsiad Sep 26 '17 at 0:53
  1. You cannot make assumptions for $u_{i,j-1}$ at t=0. Use a forward difference in time not a central difference. i.e., represent the time derivative by $$\frac{u_{i,j+1}-u_{i,j}}{k}$$. It has the added benefit that the scheme will be stable (for small enough values of $\frac{k}{h^2}$). If you want to take largest steps in time without losing stability, use an implicit scheme like the Crank Nicholson that parsiad mentions.

  2. If you have boundary conditions (either $U$ or $U_x$ specified at x=0 and x=1 for all 0 < t < T ), then you only solve the function values at $j=1,...,n-1$. Since $j=0$ and $j=n$ are not evaluated, no problem with the central spatial difference.

  3. But you don't have the boundary conditions. You need to specify them.

  • $\begingroup$ Thanks for your answer. I do not understand why we can't assume $u_{i,j-1}=0$ at $t=0$. Is that because we do not have this information? Or is there some other reason? $\endgroup$ – ccdq23 Oct 1 '17 at 0:43
  • $\begingroup$ That's right. You can intuitively see that there is problem if you look at some point (say x=0.5). Then at t=0, we're saying U has a specific value $(0.5^2)$, but just before that, at $t=-\Delta t$, we are saying it was zero. Artificially induced "badness"! $\endgroup$ – Mathemagical Oct 1 '17 at 0:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.