3
$\begingroup$

assuming the diffusive motion of a substance $u(x,t)$ depends on a variable $b(u(x,t))$. Fickian Diffusion then reads $$ \frac{\partial u}{\partial t}=\frac{\partial}{\partial x}\left(D(b(u(x,t)))\frac{\partial u}{\partial x}\right) $$ Conversely, the Fokker-Planck equation reads $$ \frac{\partial u}{\partial t}=\frac{\partial^2}{\partial x^2}\left(D(b(u(x,t)))u(x,t)\right) $$ I am searching for a numerical scheme for my problem. I can‘t use implicit methods like Crank-Nicholson as $D$ is time dependent and I don’t know the values for the next time step. So, I think I am left with explicit methods. Is this right? Would you have any recommendation for FP?

EDIT: I know how implicit methods work in general. Let me clarify the point I am struggling with. Crank-Nicholson for spatially varying Diffusion coefficient reads $$ \frac{u_k^{t+1}-u_k^t}{\Delta t}=\frac{1}{2\Delta x^2}\left(u_{k+1}^{t+1}D_{k+1}-2u_k^{t+1}D_k+u_{k-1}^{t+1}D_{k-1}+u_{k+1}^{t}D_{k+1}-2u_k^{t}D_k+u_{k-1}^{t}D_{k-1}\right) $$ We can rewrite this as $$ \matrix{A}(\vec{u^{t+1}}\vec{D})=\matrix{B}(\vec{u^{t}}\vec{D}) $$ where $\matrix{A}$ and $\matrix{B}$ are tridiagonal $n\times n$ matrices. Now, we solve for $\vec{u^{t+1}}$. However, in case of time- $\textit{and}$ space-dependent diffusion coefficient, which we effectively have, the system of equations reads $$ \matrix{A}(\vec{u^{t+1}}\vec{D^{t+1}})=\matrix{B}(\vec{u^{t}}\vec{D^{t}}) $$ meaning that we have $n$ equations but $2n$ unknowns. This is why I need another method. Or am I wrong?

$\endgroup$
4
  • $\begingroup$ Are you open to sampling methods? $\endgroup$
    – Brick
    Sep 13, 2018 at 15:06
  • $\begingroup$ What do you mean with that? I am open for any idea. $\endgroup$
    – gumpel
    Sep 13, 2018 at 15:19
  • $\begingroup$ Usually you solve FP for a probability distribution. There are integration techniques for that situation that involve sampling from the distribution, propagating the samples, and then using that to estimate the density at a later time. "Sampling methods". $\endgroup$
    – Brick
    Sep 13, 2018 at 15:20
  • $\begingroup$ In my case this means that I would rewrite the equation to the SDE $dX=\mu dt +\sqrt{2D}dW$, right? I don‘t have a drift term, correct? Does sampling mean that I use eg milsteijn method for integrating the SDE and use the propability distribution of $n$ samples after $m$ time steps and take this as the spatial distribution after $m$ time steps? $\endgroup$
    – gumpel
    Sep 13, 2018 at 15:49

2 Answers 2

1
$\begingroup$

If I understand the question I think you should in fact be able to use an implicit method such as the Crank-Nicolson. Whenever such a method is used, we do not know the value at the next time-step, but we set up a system of equations which we can solve to find the value. The non-linearity you have does not prevent you from using an implicit method but it might make it slow to do so, as you will possibly have to invert an $N$ by $N$ matrix at each timestep (Where $N$ is the number of lattice points in your spatial discretisation).


In your FP example you have some operator which acts on $u$ to give you the time derivative. Let's give that operator a symbol to make things easier to understand:

$$ F(u) \equiv \frac{\partial^2}{\partial x^2}\left(D(b(u(x,t)))u(x,t)\right) $$

The Crank-Nicolson method is then:

$$\frac{u^{t+1} - u^t}{dt} = \frac{1}{2}\left(F^{t+1}(u) + F^{t}\right(u))$$

Where the superscripts denote which the timestep (and I haven't written in anything to do with the spatial position but it will be involved in the finite difference scheme for the spatial derivatives). I take it your confusion arises from the term $F^{t+1}(u)$? You do not know it at this timestep so how can you use it? The answer is that you don't straightforwardly use it, it is part of what you are calculating. By setting up the finite difference scheme you will end up with a matrix with loads of unknown elements in it, but this is fine. You take all of those elements over to the left hand side and then solve for everything all at once using some linear algebra software. This is what makes the method implicit, the fact that you have to invert this matrix.


Edit:

In order to solve for the time evolution of $D$ it depends on how exactly $D$ behaves.

Option 1

Your original post made it sound as if it is simply a function of $u$, (via some variable $b(u)$), perhaps something like $D = au(t)^2$ or something. If this is the case then simply solve for $u(t)$ and you can calculate $D$.

Option 2

If however $D$ has its own distinct time dynamics then they will need to be specified. You didn't mention that you had an expression for $dD/dt$ so I assumed you were in the option 1 case. If you have an expression for the time evolution then you can then set up a CN scheme for $D$ too - combining this with the one you have for $u$ will give you a $2N$ by $2N$ matrix to invert. You will end up with something vaguely like:

$$\begin{pmatrix} P & Q \\ R & S\\ \end{pmatrix} \begin{pmatrix} u^{t+1} \\ D^{t+1} \\ \end{pmatrix} = \begin{pmatrix} G(u^{t}) \\ H(D^{t}) \\ \end{pmatrix}$$

Although the exact details of the matrices involved will depend on the form of the time evolution.

Option 3

If you do not know exactly $D$ varies in time and it can't be calculated from other variables then you cannot know how the system will evolve.

$\endgroup$
2
  • $\begingroup$ Thanks for the answer and sorry for not responding earlier. I edited the question to clarify my problem. Am I wrong somewhere? $\endgroup$
    – gumpel
    Sep 13, 2018 at 19:10
  • $\begingroup$ @Merlin I see the problem - I've edited my answer. $\endgroup$
    – Stuart
    Sep 13, 2018 at 19:48
1
$\begingroup$

You can use an implicit scheme if you iterate each time step.

  • Start by estimating $u^{t+1}$ somehow from the previously computed data - at worst, you could take $u^{t+1} = u^t$, or (probably better, after you have done the first time step) extrapolate from $u^t$ and $u^{t-1}$.

  • Use the estimated value of $u^{t+1}$ to calculate an estimate for $D^{t+1}$.

  • Do a Crank-Nicholson step using the estimate for to $D^{t+1}$ to get an updated estimate for $u^{t+1}$.

  • Repeat until $u^{t+1}$ converges.

I don't have any experience with the Fokker-Planck equation, but for a mildly nonlinear equation and/or small enough time steps the iteration will often converge in 2 or 3 passes. Since the time steps for an implicit method are usually much bigger than those for an explicit method, to get the same accuracy, doing a few iterations per step is still a win in terms of computation time.

The next level of sophistication is to take variable-sized time steps, depending on how the solution is behaving. If the general form of the solution is some sort of "transient" behaviour depending on the boundary conditions, superimposed on a "steady state" solution, you can use what you know about the "transient" behaviour to help to choose a good way to vary the time steps. For example in the classic application of Crank-Nicholson to a convection-diffusion equation, the "transient" part of the solution is typically a decaying exponential function of time, and successive time steps can increase in a geometric progression without losing accuracy.

For severely nonlinear problems, it may be worth using this iterative approach with a backward-difference scheme in time, which will improve the numerical stability of the solution at the expense of reducing the accuracy. This can be an improvement over a forward-difference (explicit) solution in situations where the forward-difference time steps are limited by stability, not by accuracy.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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