-
Notifications
You must be signed in to change notification settings - Fork 5
Description
I would like to propose adding support for differentiation matrices of arbitrary order (higher than second order) in the Grid infrastructure of Psecas.
Motivation
In several physically relevant problems, higher-order spatial derivatives appear naturally in the linearized equations. A concrete example is linearized MHD with viscosity, where viscous terms can introduce fourth-order derivatives of the velocity field components. At present, the grid infrastructure is limited to first- and second-order differentiation matrices, which makes these problems harder to formulate cleanly and consistently within Psecas.
Supporting higher-order derivatives at the grid level would make the framework more general and better suited for a wider class of linear stability and eigenvalue problems.
Implementation – grid-agnostic higher-order derivatives
I have implemented a grid-agnostic mechanism for arbitrary-order differentiation matrices, available in the following branch:
https://github.com/gkowal/psecas/tree/grid/higher-order-derivatives
Higher-order differentiation matrices are created automatically when required. Orders higher than second are constructed by sequential multiplication of the first-order differentiation matrix. This is intended as a generic and conservative solution; if a more precise or grid-specific implementation is desired, it can be implemented on top of this mechanism without changing the public interface.
Parsing support for higher-order derivatives
I have also implemented support for parsing higher-order derivatives at the equation level in a separate branch:
https://github.com/gkowal/psecas/tree/solver/higher-order-derivative-parsing
This introduces a new derivative operator dz(f, n), where n is the order of the derivative of the field f. This allows higher-order derivatives to be expressed explicitly in the symbolic formulation of the equations, without nesting differentiation operators. This second branch depends on the grid-level support described above, so the intended workflow would be to open two pull requests, with the grid changes merged first.
If this functionality fits the scope of Psecas, I would be happy to prepare pull requests for these two branches and adapt the implementation as needed.
Finally, thank you, Thomas, for mentioning my papers in the README. Those works were developed with substantial help from Psecas, and I very much appreciate the acknowledgment.