I downloaded the 2D example of the magnetostatic problem at https://modules.freefem.org/modules/magnetostatic/ and I have added a few lines to compute By = dy(Az) and plot its values in 2D. According to the sign of the currents the value of By at the center should be positive, but it turns out to be negative when i run the script. Also, if I plot the current obtained from J = dx(Hy) - dy(Hx) to check for self-consistency, i see that the currents are exactly opposite with respect to the ones set at the beginning. Also, I think the signs of the weak form of the equation are correct.
Could somebody explain this behavior to me?
Thank you very much,