zwicker-group / py-pde

Python package for solving partial differential equations using finite differences.
https://py-pde.readthedocs.io
MIT License
408 stars 52 forks source link

Implementing 1d Klein-Gordon Equation: Evolution operator #375

Closed gotencoder closed 1 year ago

gotencoder commented 1 year ago

Hi there,

I am looking to implement the 1D Klein-Gordon equation $u{tt} - u{xx} + V = 0$ using the py-pde package but I am having some issues, specifically as the evolution operator is a second order derivative in time. I have looked at the tutorials and examples but they all seem to have an LHS as a first order derivative in time. Is there a method to do this in py-pde? Thanks

david-zwicker commented 1 year ago

Yes, the package only supports first-order derivatives in time, but you can easily introduce an auxiliary field, $f=\partial_t c$, to turn your equations into a coupled system with first-order time derivatives.