Modifying MHD equations #552
-
Hi All, I'm new to the code. I'm wondering in which source files can I modify the MHD equations? More specifically I wish to add dynamo terms in GRMHD simulations. Best regards, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The short answer is that the code does not have any easy way to modify the magnetic field, by design. Athena is extremely careful to evolve the field correctly, without ever adding a magnetic divergence, and tampering with this can easily break the code. If you truly want to add a source term for the induction equation, the place to do it is You can modify the edge-centered electric fields however you want after the code sets them, and the resulting magnetic field evolution will be divergence-free. An alpha dynamo prescription would look like adding to All that said, there is another danger with relativity. Simply maintaining a divergence-free field is not sufficient to guarantee the code will work. Many of the non-ideal MHD terms one sees in Newtonian MHD are in fact parabolic, but relativity demands, both for physical and for numerical reasons, that the equations be strictly hyperbolic. If you want to put a subgrid dynamo into GRMHD, you have to make sure your prescription is truly hyperbolic. I'm not sure I've ever seen such a thing, and in general it is an open question how to correctly add non-ideal terms to relativistic fluid dynamics. |
Beta Was this translation helpful? Give feedback.
The short answer is that the code does not have any easy way to modify the magnetic field, by design. Athena is extremely careful to evolve the field correctly, without ever adding a magnetic divergence, and tampering with this can easily break the code.
If you truly want to add a source term for the induction equation, the place to do it is
src/field/calculate_corner_e.cpp
. The function in that file has two steps. First, it calculates a cell-centered electric field from the cell-centered magnetic field and other quantities. The precise formulas depend on Newtonian/SR/GR. Second, it combines the cell-centered electric fields with the face-centered electric fields returned by the Riemann s…