WarpX icon indicating copy to clipboard operation
WarpX copied to clipboard

Initial B-field loading gives non divergence free field

Open roelof-groenewald opened this issue 1 year ago • 0 comments

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: image

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): image

Another alternative would be to perform some divergence cleaning of the B-field after interpolation.

roelof-groenewald avatar Oct 10 '23 17:10 roelof-groenewald