WarpX icon indicating copy to clipboard operation
WarpX copied to clipboard

[WIP] Magnetostatic solver refactor and bug fixes

Open roelof-groenewald opened this issue 5 months ago • 0 comments

This PR introduces a major refactor of the magnetostatic solver primarily with three goals:

  1. Allow the magnetostatic solver to be used with either the explicit or semi-implicit electrostatic potential solvers.
  2. Fix a bug in the calculation of B from A. Currently the AMReX gradient function is used to get $\nabla A$ on a grid matching the E-field staggering; this field is then interpolated to match the B-field staggering for each component needed in calculating $B = \nabla \times A$. However, this interpolation causes significant non-zero B-field divergence as is shown in the plot below. Instead, now $A$ is interpolated to match the E-field staggering and B is calculated directly from that A-field using the standard FD curl calculation.

image Example of non-zero B-field divergence introduced with the current magnetostatic solver implementation.

image Same simulation as above but with the fixes from this PR included (note the colorbar range)

  1. Add the inductive electric field term ($E_{ind} = -\frac{dA}{dt}$) during ES+MS evolution.

This PR builds on and requires first merging:

  • [ ] #5079.

roelof-groenewald avatar Aug 27 '24 18:08 roelof-groenewald