WarpX
WarpX copied to clipboard
Initial B-field loading gives non divergence free field
When using an openPMD file to load an initial B-field, WarpX interpolates from the openPMD file's grid to the WarpX grid. This can lead to loss of the divergence free aspect of the B-field as demonstrated in the plot below where an FRC is loaded into WarpX:
Instead, the vector potential could be interpolated onto the WarpX grid (with staggering matching the E-field) and the B-field calculated as the curl of that field which ensures a divergence free B-field (up to machine precision):
Another alternative would be to perform some divergence cleaning of the B-field after interpolation.