Consider the equation

$$\frac{\partial}{\partial t}v(t,x)=\frac{\partial}{\partial x}v(t,x)$$,

for $t,x\in\mathbb{R}$.

I'd like to solve this equation forward in space and backward in time, updating in space given the initial condition in space: $v(t,0)=f(t)$.

Now, we can discretise in time and take the backward difference of the time derivative, which yields

$$\frac{\mathrm{d}}{\mathrm{d}x}v^n(x)=\frac{v^n(x)-v^{n-1}(x)}{\Delta t}\qquad(1)$$

Then the Crank-Nicolson scheme gives

$$\frac{v^n_{i+1}-v^n_i}{\Delta x}=\frac{1}{2}\left[G^n(x_{i+1})+G^n(x_{i})\right],\qquad(2)$$ where $G^n(x)$ is the RHS of equation $(1)$.

Then $(2)$ becomes

$$\frac{v^n_{i+1}-v^n_i}{\Delta x}=\frac{1}{2}\frac{v^n_{i+1}-v^{n-1}_{i+1}}{\Delta t}+\frac{1}{2}\frac{v^n_i-v^{n-1}_i}{\Delta t}$$ i.e. $$\left(\frac{1}{\Delta x}-\frac{1}{2\Delta t}\right)v^n_{i+1}+\frac{1}{2\Delta t}v^{n-1}_{i+1}=\left(\frac{1}{\Delta x}-\frac{1}{2\Delta t}\right)v^n_{i}+\frac{1}{2\Delta t}v^{n-1}_{i}$$ so that $$\mathrm{A}\vec{v}_{i+1}+\frac{1}{2\Delta t}\mathrm{B}\vec{v}_{i+1}=\mathrm{A}\vec{v}_{i}+\frac{1}{2\Delta t}\mathrm{B}\vec{v}_{i}$$ for $\mathrm{A},\mathrm{B}$ matrices yet to be specified.

However, this implies that


which would appear to be nonsense. Have I done something wrong?

  • 1
    $\begingroup$ Time can go forwards or backwards (in this case). First you must discretise spatially and then in time (using Crank-Nicholson). The initial condition you mentioned is not an initial condition. It seems that you've changed t by x. Could you clarify me what I am not understanding? $\endgroup$
    – HBR
    Jul 29 '17 at 23:20
  • $\begingroup$ @HBR The "initial condition" is then a boundary condition at the point $x=0$. I call it an "initial condition" because this is the point where we initialise our algorithm and then we want to update in space. Can we not discretise in time and then use Crank-Nicolson with respect to space? Discretising in time using Crank-Nicolson would imply a forward in time scheme. $\endgroup$
    – Jason Born
    Jul 30 '17 at 12:52
  • 1
    $\begingroup$ @JasonBorn Think about this another way: write out the forward-in-time CN scheme for $v_t + v_x = 0$ in matrix form (one row per time step). Then take the conjugate transpose of that matrix. You will end up with a method that solves the adjoint equation $v_t - v_x = 0$ (your PDE) backward in time, which (as far as I understand it) is what you wanted. $\endgroup$
    – GoHokies
    Jul 30 '17 at 14:35
  • $\begingroup$ @GoHokies Yes, but to solve $v_t-v_x=0$ backward in time I would need a final time condition. I am trying to solve the equation under the assumption that I only know $v(t,0)=f(t)$, where $f(t)$ is known. Additionally, I am trying to formulate a scheme which updates in space whereas your proposal still involves updating in time (albeit backwards). $\endgroup$
    – Jason Born
    Jul 30 '17 at 15:07
  • $\begingroup$ then I'm not sure I understand your original question. You say: I'd like to solve this equation forward in space and backward in time, updating in space given the initial condition in space. To do the integration backwards in time, you will need a final time condition to start from. But your choice of "initial condition" in space indicates that you have changed the meaning of the time and space variables, as @HBR said (which is completely OK to do btw as long as you stick to it throughout the entire integration) $\endgroup$
    – GoHokies
    Jul 31 '17 at 7:16

Your Answer

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

Browse other questions tagged or ask your own question.