astronomix._fluid_equations._eigen_mhd_iso

astronomix._fluid_equations._eigen_mhd_iso#

Computations of the eigenvalues and eigenvectors for the isothermal MHD equations.

The eigenstructure was extracted from the HOW-MHD Fortran code (isothermal variant), with altered variable names for clarity and altered numerical safeguards.

Isothermal MHD has 6 waves (no entropy wave) and 6 conserved variables (density, 3 momenta, 2 tangential magnetic field components; Bx is constant). The sound speed cs is a fixed parameter rather than being derived from pressure.

Module Contents#

Functions#

diff_safe_sqrt

Square root with a small floor, so its derivative stays finite at x = 0.

API#

astronomix._fluid_equations._eigen_mhd_iso.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.