Home Sign Errors and Debugging

Sign Errors and Debugging

MHD Debugging

My implementation of constrained transport was complicated and hard to maintain so I refactored the main loop. Primarily I just unrolled the innermost loop over the x,y,z directions. This eliminated a bunch of complicated math using modulos to compute indices etc. Now it’s much cleaner and easier to maintain. This helped me find multiple errors in the VL+CT paper (Stone & Gardiner 2009) that affected my results. I found them by comparing to the Athena codebase.

Now I’m trying to isolate and find the remaining issue. I found that in the case where magnetic fields are constant forcing them to not update made the simulation stable, though still with noisy \( V_y, V_z \) and pressure. This seems to indicate that the issue is in the CT calculations.

Next I implemented a square wave initial condition for testing. You can see the results of that below. It looks like there’s still and issue that is presenting in the y and z velocities but I haven’t found it yet.


  • Applied to Rensselaer Summer Program – Advanced Cyberinfrastructure Training for Modeling Physical Systems
  • Applied to the LSST Data Science Fellowship
  • Watched AMD EPYC Advanced User Training on Expanse
  • Updated the codebase for this website
This post is licensed under CC BY 4.0 by the author.