RAMSES-CPP aims to provide a functional and physically consistent alternative to the original Fortran implementation while maintaining strict bit-perfect parity in data structures and I/O.
Status: The MHD module is fully integrated with the
AmrGridsystem and is the primary focus of the Phase 2 multi-dimensional expansion. Core physics, Constrained Transport, and adaptive refinement for magnetic gradients are fully operational and verified against standard benchmarks.
The MHD module in RAMSES-CPP provides a robust, divergence-free implementation of ideal magnetohydrodynamics on adaptive grids.
err_grad_b2), essential for capturing MHD shocks and vortices.MhdSolver::cmpflxm to ensure physical consistency in multi-dimensional sweeps.Magnetic fields are stored at the faces of the cells (indices 6-8 for left faces, and $nvar-2$ to $nvar$ for right faces), while hydro variables are stored at cell centers.
The Electromotive Forces (EMFs) are computed at cell edges using electric field components from the Riemann fluxes. The face-centered magnetic fields are then updated using the curl of these EMFs: \(\frac{\partial \mathbf{B}}{\partial t} = -\nabla \times \mathbf{E}\) This staggered update ensures that the divergence $\nabla \cdot B$ remains zero to machine precision throughout the simulation.
To enable MHD, use the following CMake flag:
cmake .. -DRAMSES_USE_MHD=ON
In the namelist, ensure hydro=.true. and appropriate MHD parameters are set in the &HYDRO_PARAMS and &PHYSICS_PARAMS blocks.