Magnetohydrodynamics (MHD)
Solve fluid-electromagnetic coupling problems in plasma physics and astrophysics
Overview
Magnetohydrodynamics (MHD) studies electrically conducting fluids where fluid flow and magnetic fields interact. iTensor provides numerical solvers designed specifically for MHD problems in astrophysics, fusion research, and plasma physics.
The MHD module combines fluid dynamics equations with Maxwell's electromagnetic equations to model systems like stellar magnetospheres, accretion disks, and laboratory plasmas.
iTensor's MHD solver seamlessly connects with its tensor infrastructure, allowing calculations in arbitrary coordinate systems and curved spacetime metrics.
Core MHD Equations
The MHD module implements the following coupled partial differential equations:
Mass Conservation
Where ρ is mass density and v is fluid velocity. This equation tracks the flow of mass in the system.
Momentum Equation
This equation balances fluid acceleration against pressure gradients (∇p), Lorentz forces (J×B), and gravitational forces (ρg).
Induction Equation
Describes magnetic field evolution. In ideal MHD (η = 0), field lines are "frozen" into the fluid.
Magnetic Divergence Constraint
States that magnetic field lines have no sources or sinks (no magnetic monopoles).
MHD Solver Types
iTensor implements several types of MHD solvers, each optimized for different regimes:
Ideal MHD
Assumes perfect conductivity (η = 0). Field lines are frozen into the fluid, making this suitable for many large-scale astrophysical phenomena.
MHDSolver(type='ideal')
Resistive MHD
Includes finite resistivity (η > 0), allowing magnetic reconnection and Ohmic dissipation. Essential for studying magnetic energy conversion to heat.
MHDSolver(type='resistive', eta=1e-3)
Hall MHD
Includes the Hall term for systems where ion and electron dynamics decouple. Important for small-scale plasma phenomena where ion inertia matters.
MHDSolver(type='hall', ion_skin_depth=0.1)
Relativistic MHD
For systems with relativistic fluid velocities, like jets from black holes or neutron stars. Handles Lorentz transformations automatically.
MHDSolver(type='relativistic')
Numerical Methods
iTensor's MHD solvers use specialized numerical techniques to maintain stability and accuracy:
- Finite Volume Method - Ensures conservation of mass, momentum, and energy
- Constrained Transport - Maintains ∇·B = 0 to machine precision
- Riemann Solvers - Computes accurate fluxes at cell interfaces
- HLLD solver for MHD-specific shock capturing
- Roe solver for accurate treatment of all wave modes
- Adaptive Mesh Refinement - Concentrates resolution where needed
- Strong Stability Preserving Time Integration - RK3-SSP for robustness
Method Selection
Choose different numerical methods based on your problem requirements:
Examples
Orszag-Tang Vortex
A standard test problem for MHD codes that develops complex turbulent flows from simple initial conditions:
Initial Density
Intermediate Stage
Final State
Magnetic Reconnection
Simulation of magnetic field line reconnection in a current sheet:
Boundary Conditions
iTensor supports multiple boundary condition types for MHD simulations:
Physical Boundaries
outflow
- Zero-gradient for all variablesreflecting
- Mirrors velocity, preserves normal Bconducting_wall
- Enforces B·n = 0 (perfect conductor)fixed
- Holds variables at specified values
Periodic Boundaries
Wraps the computational domain, connecting opposite edges. Useful for studying instabilities and turbulence without boundary artifacts.
solver.set_boundary('periodic', ['x', 'y'])
Analysis Tools
The MHD module includes specialized diagnostics for plasma analysis:
Field Quantities
current_density
- J = ∇×Bvorticity
- ω = ∇×vmagnetic_pressure
- pm = |B|²/2beta
- β = p/pm (plasma beta)alfven_speed
- vA = |B|/√ρ
Integral Diagnostics
total_energy()
- Sum of kinetic, thermal, magnetic energymagnetic_helicity()
- Hm = ∫A·B dVcross_helicity()
- Hc = ∫v·B dVreconnection_rate()
- Rate of flux reconnection
Use these tools to verify that your simulation is behaving physically, conserving appropriate quantities, and correctly resolving important MHD phenomena.
Applications
Solar Physics
Model solar flares, coronal mass ejections, and magnetic field evolution in the solar atmosphere.
Accretion Disks
Investigate magnetorotational instability and angular momentum transport around compact objects.
Fusion Research
Simulate plasma instabilities in tokamak and stellarator configurations for fusion energy research.
Astrophysical Jets
Study the formation and propagation of relativistic jets from active galactic nuclei and stellar objects.