WarpX
WarpX copied to clipboard
[WIP] Magnetostatic solver refactor and bug fixes
This PR introduces a major refactor of the magnetostatic solver primarily with three goals:
- Allow the magnetostatic solver to be used with either the explicit or semi-implicit electrostatic potential solvers.
- 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.
Example of non-zero B-field divergence introduced with the current magnetostatic solver implementation.
Same simulation as above but with the fixes from this PR included (note the colorbar range)
- Add the inductive electric field term ($E_{ind} = -\frac{dA}{dt}$) during ES+MS evolution.
This PR builds on and requires first merging:
- [ ] #5079.