I am currently coding a solution to the following PDE:

$\frac{\partial T }{\partial t} =\frac{\partial}{\partial \theta}(A(\theta ,\phi )\frac{\partial T }{\partial \theta}) +\frac{\partial }{\partial \phi}(B(\theta ,\phi )\frac{\partial T}{\partial \phi}) + F(\theta ,\phi)T$ with periodic boundary conditions in polar coordinates.

I have been able to get some code which solves the PDE via the Crank-Nicolson method and matrix inversion, the only problem that I have is with the accuracy of the method, according to Wikipedia, the Crank-Nicolson method is unconditionally stable but ''the approximate solutions can still contain (decaying) spurious oscillations if the ratio of time step $\Delta t$ times the thermal diffusivity to the square of space step, $\Delta x^2 $, is large (typically, larger than 1/2 per Von Neumann stability analysis).''.

How can I check the accuracy of my method in a similar way that Wikipedia has done? Obviously taking a small timestep would improve the method, but would also increase runtime, so I'd rather only increase it if my method's accuracy is worse than say 1% from the actual answer. I am also unsure whether the periodic boundary conditions aid or detriment to the accuracy of my solution as a whole.

I hope someone can point me in the right direction.

edit: I have reposted this from math.stackexchange as I was told there was a higher chance of getting an answer here. I will cross post any useful answers between the 2.

edit: I have gone with the Backward Euler method, thanks to @David for the help though.

  • 4
    $\begingroup$ To avoid the issue that the wikipedia article is referring to, use an L-stable time discretization. This is explained in any standard text on numerical methods (e.g. Hairer & Wanner vol. 2, or LeVeque's book on finite difference methods). It will only be important if your solution includes components that have a short wavelength relative to your grid. $\endgroup$ Commented Feb 13, 2023 at 7:01


Your Answer

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