astronomix._fluid_equations._eigen_mhd#
Computations of the eigenvalues and eigenvectors for the MHD equations.
The eigenstructure was extracted from the HOW-MHD Fortran code, with altered variable names for clarity and altered numerical safeguards.
NOTE: Problems for differentiation largely follow from square roots and divisions: The derivative of sqrt(x) is 1/(2*sqrt(x)) and of 1/x is -1/x^2, where both expressions are problematic for small x, especially when multiplying gradients in the backward pass, -> exploding gradients.
Module Contents#
Functions#
Square root with a small floor, so its derivative stays finite at x = 0. |
API#
- astronomix._fluid_equations._eigen_mhd.diff_safe_sqrt(x)[source]#
Square root with a small floor, so its derivative stays finite at x = 0.
The derivative of sqrt(x) is 1 / (2 sqrt(x)), which blows up as x -> 0; clamping the argument to a tiny epsilon keeps the backward pass well-behaved. The floor is tighter under x64 than under x32 to match the available precision.