5

There is a difference between the requirements for a hyperbolic pde like $$ u_t + a u_x = 0 $$ and for a purely parabolic pde like $$ u_t = u_{xx} $$ Suppose the solutions are smooth and you approximate them by some finite difference method. Then in case of hyperbolic problem, the maximum error in the numerical solution depends on the time interval of ...


3

The choice of $k$ is restricted also by the discretization of the source term. To see it, rewrite your scheme to \begin{equation} u_m^{n+1} = \left(1 - \frac{k(1-x_m)}{h} - k(1-x_m)\right) u_m^n + \frac{k (1-x_m)}{h} u_{m+1}^n \,. \end{equation} You need $$ 1 - \frac{k(1-x_m)}{h} - k(1-x_m) \ge 0 $$ for all $x_m$. Taking $x_m=0$ (the worst case scenario) you ...


2

I've identified a few "problems": Your analytical solution isn't quite correct. The correct analytical solution to the "infinite domain" advection equation is supposed to be $u(t,x) = u_0(x-at)$. Because you have periodic boundaries, you need to properly account for this by making sure $x-at$ is properly wrapped. I replaced your ...


1

I found a few issues with your implmentation: you should replace $t$ by $dt$ in your discrete equation (both in your code and in the question), otherwise it makes no sense ! the second part of your equation (with $a$) seems incomplete or wrong, and there's a mix between $F$ and $f$. Moreover, you flux evaluation is wrong: Fplus should read 0.5*Up**2 for ...


Only top voted, non community-wiki answers of a minimum length are eligible