How to limit processing demand simulating electromagnetic trajectory

Click For Summary

Discussion Overview

The discussion revolves around the computational challenges of simulating the magnetic field generated by a current-carrying wire and its effect on a charged particle's trajectory. Participants explore the mathematical formulation of the magnetic field using the Biot-Savart law and consider ways to optimize the numerical integration required to compute the field at various points in space.

Discussion Character

  • Exploratory
  • Technical explanation
  • Mathematical reasoning
  • Debate/contested

Main Points Raised

  • One participant presents a mathematical formulation for calculating the magnetic field at a point due to a wire defined parametrically, using an integral that sums contributions along the wire's length.
  • Another participant questions the necessity of recalculating the magnetic field at every time step, suggesting that the wire is stationary and that symmetry might be exploited to simplify calculations.
  • A participant elaborates on the complexity of the integrals involved, providing detailed expressions for the components of the magnetic field and expressing a desire for a general numerical solution applicable to all points in space.
  • Concerns are raised about the inclusion of a square root term in the integrals, with one participant suggesting it may not belong in the context of the Biot-Savart law.
  • Another participant proposes approximating the wire's curve with polynomials or Bezier curves to simplify the integration process, while still acknowledging the need to compute the field at specific locations over time.
  • A later post introduces a question about whether the thickness of the wire affects the force experienced by the charged particle.

Areas of Agreement / Disagreement

Participants express differing views on the necessity of recalculating the magnetic field at every time step, the appropriateness of certain mathematical terms, and the potential for approximations. The discussion remains unresolved regarding the best approach to efficiently compute the magnetic field.

Contextual Notes

Participants note the complexity of the integrals involved and the potential for simplifying assumptions, but no consensus is reached on the best method to handle the calculations or the implications of wire thickness on the magnetic field.

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?
 

Similar threads

  • · Replies 16 ·
Replies
16
Views
4K
  • · Replies 11 ·
Replies
11
Views
4K
Replies
3
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 5 ·
Replies
5
Views
1K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 0 ·
Replies
0
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
3K