How to limit processing demand simulating electromagnetic trajectory

DivergentSpectrum
Messages
149
Reaction score
15
so suppose i have a wire given parametrically by C(t)=x(t),y(t),z(t), and i run a current of I amps through it. to find the total B field i would sum up the contributions over the length of the wire, and (please tell me if I am wrong) the total B field due to the wire at point p=xp,yp,zp would be

B=\frac{mI}{4\pi}\int\frac{\hat{C}'(t)χ(p-C(t))}{|p-C(t)|^{3}}dt

where \hat{C}'(t) is the unit vector tangeant to C and m is the permeability of free space, and the bounds of the integral would be t0 and t1 where the curve begins and ends.

So here's the problem:
while i was programming to find the trajectory of a charged particle due to a current through the wire, i realized that i need to calculate the integral(numerically) on every time step to find the B field at that point in space. this is very inefficient and, with my computer, impossible. I was wondering if there is any way i can calculate the integral only once and be able to use that to find the magnetic field at all points in space?
thanks.

edit: i just noticed i posted this in the wrong forum can mods please move this?
 
Last edited:
Physics news on Phys.org
Why every time step? Does your wire move?

Depending on the shape of the wire, you might be able to exploit some symmetry or be able to neglect some parts. If that does not work, in general it is very tricky to save some time on those integrals. Do you really need the magnetic field everywhere?
 
The wire is stationary, its kind of hard to explain why i have to do the integral at every time step, but ill try

warning really messy math.
Im basically doing 3 integrals here:
B_{x}=\frac{mI}{4\pi}\int\frac{y'*(z_{p}-z)-z'*(y_{p}-y )}{((x_{p}-x )^{2}+(y_{p}-y )^{2}+(z_{p}-z )^{2})^{3/2}*\sqrt{x'^{2}+y'^{2}+z'^{2}}}dt


B_{y}=\frac{mI}{4\pi}\int\frac{z'*(x_{p}-x)-x'*(z_{p}-z )}{((x_{p}-x )^{2}+(y_{p}-y )^{2}+(z_{p}-z )^{2})^{3/2}*\sqrt{x'^{2}+y'^{2}+z'^{2}}}dt


B_{z}=\frac{mI}{4\pi}\int\frac{x'*(y_{p}-y)-y'*(x_{p}-x )}{((x_{p}-x )^{2}+(y_{p}-y )^{2}+(z_{p}-z )^{2})^{3/2}*\sqrt{x'^{2}+y'^{2}+z'^{2}}}dt

now, basically x,y,z and x',y',z' are functions of t, while xp, yp,zp are constants as far as the integration goes, and i want a general numerical solution to the integral for all xp, yp,zp
so, seperating even further, i get
B_{x}=\frac{mI(a*z_{p}-b-c*y_{p}+d)}{4\pi}
B_{y}=\frac{mI(c*x_{p}-i-e*z_{p}+f)}{4\pi}
B_{z}=\frac{mI(e*y_{p}-g-a*x_{p}+h)}{4\pi}

where
a=\int\frac{y'}{((x_{p}-x )^{2}+(y_{p}-y )^{2}+(z_{p}-z )^{2})^{3/2}*\sqrt{x'^{2}+y'^{2}+z'^{2}}} dt

b=\int\frac{y'*z}{((x_{p}-x )^{2}+(y_{p}-y )^{2}+(z_{p}-z )^{2})^{3/2}*\sqrt{x'^{2}+y'^{2}+z'^{2}}} dt


c=\int\frac{z'}{((x_{p}-x )^{2}+(y_{p}-y )^{2}+(z_{p}-z )^{2})^{3/2}*\sqrt{x'^{2}+y'^{2}+z'^{2}}} dt

d=\int\frac{z'*y}{((x_{p}-x )^{2}+(y_{p}-y )^{2}+(z_{p}-z )^{2})^{3/2}*\sqrt{x'^{2}+y'^{2}+z'^{2}}} dt

e=\int\frac{x'}{((x_{p}-x )^{2}+(y_{p}-y )^{2}+(z_{p}-z )^{2})^{3/2}*\sqrt{x'^{2}+y'^{2}+z'^{2}}}dt

f=\int\frac{x'*z}{((x_{p}-x )^{2}+(y_{p}-y )^{2}+(z_{p}-z )^{2})^{3/2}*\sqrt{x'^{2}+y'^{2}+z'^{2}}} dt

g=\int\frac{x'*y}{((x_{p}-x )^{2}+(y_{p}-y )^{2}+(z_{p}-z )^{2})^{3/2}*\sqrt{x'^{2}+y'^{2}+z'^{2}}} dt

h=\int\frac{y'*x}{((x_{p}-x )^{2}+(y_{p}-y )^{2}+(z_{p}-z )^{2})^{3/2}*\sqrt{x'^{2}+y'^{2}+z'^{2}}} dt

i=\int\frac{z'*x}{((x_{p}-x )^{2}+(y_{p}-y )^{2}+(z_{p}-z )^{2})^{3/2}*\sqrt{x'^{2}+y'^{2}+z'^{2}}} dt

these are definite integrals (im still getting the hang of this latex thing lol)
the idea is i could sum all of these up, multiply some of them by xp or yp or zp, and get the field at all points, but unfortunately, i have those pesky p's on the bottom of the fraction, so i can't figure out a way to separate them. if i knew a general way to deal with this i could simply do several integrals only once which isn't so bad.

Damn physics for making force a function of distance! :P
 
Last edited:
note: I am beginning to think the sqrt(x'2+y'2+z'2) term doesn't belong there. i really wish there were more people here to help me :(
 
I don't see where that sqrt term comes from either. Your integral is (or should be) the Biot-Savart law.

If (!) you need to know the field at "all" points in space, then yes, you'll have to calculate many integrals. How many, depends on the required precision for the fields. You can pre-calculate x', y', z'(t) because it is the same in every integration.
And I don't see any time-dependence here.
 
damn. i wonder if i could approximate the curve over small intervals with a polynomial, then (provided the B field due to the approximation of the wire is an elementary integral), i could add up the field due to the approximating segments.
it seems like the best choice.

ive been looking around and found this thing called "bezier curves", I've never heard of them before, so I am trying to figure out how they work, and if theyll work with this problem

the sqrt term shouldn't be there (my mistake), but i still have the same problem. really i only need to find the field at the locations where a particle will be at some time, but that still requires doing an integral at each time step
 
Last edited:
Bump
 
Also, noticed another possible problem. does the force depend upon the thickness of the wire?
 
Back
Top