This PR updates the treatment of cosmology in MHDCT. This fix does three things:
1.) Now uses the Comoving magnetic field thorughout with MHDCT. Prior incarnations used a semi-comoving field (B_semi = B_comoving*sqrt(a)) in order to make CT work with the expansion. Now the field is switched to comoving almost everywhere, so the treatment is identical between both MHD methods. The semi-comoving field is used only within Grid_MHD_UpdateMagneticField and the ElectricField variable.
2.) This also fixes an error with the gas pressure computation. Now that the field is comoving almost everywhere, it's not wrong. (For the half-comoving field, there needed to be a 1/a on the B^2 term. This is no longer the case)
3.) Updates the higher order CT methods to work with cosmology. This did not work previously, and using cosmology with MHD_CT_Method > 1 would result in fascinating explosions.
These primary changes can be seen in Grid_MHD_UpdateMagneticField, Grid_SolveHydroEquations and Grid_SolveMHD_Li
This comes with a documentation update.
Other secondary updates that were necessary along the way:
1.) A few minor improvements to Grid_ComputePressure for 1- and 2-D sims with Dedner and MHD
2.) Fixes Grid_MHDBlastInitializeGrid to work with Dual Energy
3.) Fixes to the Zeldovich Pancake to make it work with MHD, and to regularize the velocity issues for 1d MHD sims.
4.) Fixes an odd bug in MHDBlaseInitialize.C
Edit 1 of 2:
Updated the reading of SmallT and the like to get Dedner and CT to give similar answers. Previously SmallT was not being read properly, so always was set to the default value.
Edit 2 of 2:
Now this incorporates new tests for MHDCT and Cosmology.
This passes the push suite at commit ac882e4. That said, I'm not that surprised - I don't think that there are any MHD cosmology tests, and certainly not in the push suite. @dcollins4096 , one specific suggestion I have is perhaps adding the Zeldovich pancake MHD test to the push suite so that we can test MHD cosmology in the future. What do you think?
I've added four tests: Two Adiabatic Expansion tests, using both MHD methods, and two Zeldovich Pancake tests, with both MHD methods. I decided upon adding a new MHDZeldovich test for Dedner since it tests different reconstruction and rieman solvers, and runs without Dual Energy. The parameters were chosen to give reasonable agreement between the two methods, since not all Riemann solvers or Reconstruction methods are the same between the two methods, and Dual Energy is done in different enough ways that comparison is difficult. (This should be rectified, but it's beyond the scope of this PR.)
This looks very good to me, modulo a few very minor comments I gave in the code. I think the change to B makes using cosmology + MHDCT much nicer (it does invalidate one small bit of the method paper but this is noted in the documentation).
I have not run the test problems -- can somebody (Dave?) verify that the B field evolution is correct in the expansion test?
Thanks for your time and eyes, I appreciate it! I've addressed your comments and will update the PR momentarily.
In my development I did check that B(a) = B(1)a^-2 as one expects, in both AMR and Unigrid. Additionally the Zeldovich Pancake gives similar results to both HydroMethod=4 (using the new tests) and older method papers.
This passes the push suite at revision 52f9a22. That said, the merge of the cosmic ray PR seems to have introduce a conflict in Grid_ComputePressure.C . @dcollins4096 , could you please resolve that merge conflict? I still need to look through the code, but a quick glance at the new tests indicates everything looks good!
One further note: I finished looking through the code, other than the couple of notes I put in everything looks great. I'm ready to hit 'accept' following the fix of the merge conflict, and maybe the addition of extra panels to the MHD zeldovich pancake tests.