# Tag Info

## Hot answers tagged finite-difference

3

Regarding performance, Python is definitely the bottleneck. I have experienced the same issue with a 2D Euler code I had developed, even with vectorised operations everywhere possible. It was actually even worse, as I was using solve_ivp time schemes which reallocated memory at every step... You can try and profile your code to see where the bottlenecks are. ...

2

I am by no means experienced with the wave equation, but I think the issue comes from the imposition of the periodic BCs. The periodic boundary conditions can be imposed by using ghost points: you do as if you were considering an extended system which, in Python terms, would have the state vector: u_extend=[u[-1], u[0], u[1], ..., u[M-1], u[M], u[0]] The ...

1

The way I computed the solution in the linked answer is the classical one: I just took a reference solution (assuming the code was correct, i.e. the numerical solution I found is the right one) with a small enough step size $h$, say $h=10^{-9}$. Then I computed the solution with smaller $h$s and for each one of those $h$ I computed the $|| e_h ||$ in a ...

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