Unable to match simulation results with Biot-Savart law #601
-
Hey, I am attempting to model a Helmholtz coil using Magpylib. As a sanity check, I modelled two coils of single windings. However, the result don't seem to match up. Is this expected? My thinking was that for a single wind, the simulation shouldn't actually be adding any insight because there are no (unique) approximations being made by the Biot-Savart analysis such as averaging the coil radii, so the results should be identical. Instead, the simulation yields a result approximately 20% lower than the analytical model. Perhaps I am wrong about this? I am wondering if this deviation is expected. I've attached my code and a pdf detailing the differences in solutions. I apologize if this is below the normal level of rigor or the wrong style of question for this forum - its my first time posting on Github.
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You question is well formatted, ty :) - so here is what i think: Are you sure this is the correct Biot-Savart solution ? You have two times the same term in the denominator. What you should get is two times this instead this is from hyperphysics, and Second thing: You have this line in your code but you compute the field already with Third thing: In your code you compute the field at different positions using a loop.
This is very inefficient, because the field computation function is called multiple times. Here one should make use of vectorization, i.e. provide the function with all positions at one time
this gives the same result, but is at least 100 times faster. Vectorization is key to scientific programming with numpy, Matlab and a lot of other languages. Here is a reference did this help ? |
Beta Was this translation helpful? Give feedback.
hi @conradtj1993
You question is well formatted, ty :) - so here is what i think:
Are you sure this is the correct Biot-Savart solution ? You have two times the same term in the denominator. What you should get is two times this instead
this is from hyperphysics, and
magpylib.Loop
should give exactly this.Second thing: You have this line in your code
but you compute the field already with
getH
. So your field is already in kA/m. My guess is that you got the biot-savart right, but this is where your 20% come from.Third thing:
In your code you compute the field at different positions using a loop.