Skip to content

MHD#123

Open
adamdempsey90 wants to merge 24 commits intodevelopfrom
dempsey/mhd
Open

MHD#123
adamdempsey90 wants to merge 24 commits intodevelopfrom
dempsey/mhd

Conversation

@adamdempsey90
Copy link
Copy Markdown
Collaborator

Background

This adds ideal MHD. It should work with AMR and all coordinate systems. I have tested on the magnetized blast problem in cartesian/cylindrical coordinates with/without AMR (modified the existing pgen), the Orszag-Tang vortex (new pgen), and the Brio-Wu shock tube (new input file).

The outline of new features/changed things:

  • Added current unit scaling parameter and $\mu_0$.
  • LLF/HLLE modified to compute the MHD fluxes.
  • Added HLLD (this is horrible btw) basically from Athena++
  • Two new tasks in the driver to compute the edge EMFs from the magnetic face fluxes and then a task to update the face fields from the edge EMFs.
  • New prolongation/restriction operators for edge and face fields.
  • New PostInitialization hook that sets primitive B from face B. Face B is set in the pgens.
  • New edge geometry quantities.
  • Changes are threaded through dual energy.
  • New documentation

Overall, it's not too many new things and there isn't much in the input file that needed to change.

Some things I'm not too happy with that we might want to change:

  • For speed I choose to just use the Alfven speed in the timestep determination, rather that the max of all the fast magnetosonic speeds one could calculate at all the faces. But obviously, if we take fewer timesteps at the cost of a more expensive EstimateTimeStep kernel, it is probably worth it.
  • HLLD is a mess but I don't know of any other way to do it.
  • I'm sure there are BC things we need to add, but I'm not sure at the moment. It's on the pgen to do what it needs to do.

This was done in concert with GPT.

I haven't tested on GPUs yet or anything high res. Initial testing looks pretty good though, I added a diagnostic div(B) field at that remains at machine epsilon even through AMR in cylindrical/cartesian coordinates.

Description of Changes

Closes #122

Checklist

  • New features are documented
  • Tests added for bug fixes and new features
  • (@lanl.gov employees) Update copyright on changed files
  • Any contribution that was created or modified with the assistance of generative AI must have a comment disclosing this such as // This file was created in part or in whole by generative AI

@adamdempsey90 adamdempsey90 requested a review from pdmullen March 31, 2026 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MHD

1 participant