This example demonstrates a "Multi-Physics Monad" approach for coupling General Relativity with Magnetohydrodynamics using DeepCausality's monadic composition.
From the root of the deep_causality project, run:
cargo run -p physics_examples --example grmhd_exampleSimulating extreme environments (Black Holes, Neutron Stars) requires coupling:
- General Relativity: Gravity and Spacetime Curvature
- Magnetohydrodynamics: Plasma and Electromagnetic Fields
This architecture ensures that the simulation adapts its mathematical foundation to the physical conditions, preventing validity errors in extreme regimes.
[Step 1] GR Solver → Spacetime Metric (g_uv) → Curvature Intensity
↓
[Step 2] Coupling Layer → Select Metric (Euclidean vs Minkowski)
↓
[Step 3] MHD Solver → Lorentz Force (F = J · B)
↓
[Step 4] Stability Analysis → Confinement Status
Uses CausalTensor and the Applicative HKT to compute the Einstein tensor:
G_uv ≈ R * g_uv (Simplified Einstein Field Equations)Dynamically selects the metric based on curvature intensity:
- High Curvature (> 0.05): Minkowski(4) - Relativistic 4D spacetime
- Low Curvature (≤ 0.05): Euclidean(3) - Classical 3D space
Uses CausalMultiVector to compute the Lorentz force:
F = J · B (Inner product of current and magnetic field)Interprets the force direction:
- Negative Force: Relativistic Reversal - Frame dragging effect
- Positive Force: Standard stable confinement
The example demonstrates how different mathematical structures (Tensors, MultiVectors) can be composed monadically to model complex multi-physics systems. Each step in the causal chain transforms state through pure functions, maintaining referential transparency while handling sophisticated physics.