### Author Topic: Magnetic field generated bar magnet  (Read 18425 times)

#### Fu-Kwun Hwang

• Hero Member
• Posts: 3062
##### Magnetic field generated bar magnet
« on: August 13, 2008, 09:43:04 am »
Registed user can get files related to this applet for offline access.
Problem viewing java?Add http://www.phy.ntnu.edu.tw/ to exception site list

You can drag the magnetic neddle to generate another sets of magnetic field line when the simulation is in pause state (when it finish generate the field line or click pause button).

Registed user can get files related to this applet for offline access.
Problem viewing java?Add http://www.phy.ntnu.edu.tw/ to exception site list

#### lookang

• Hero Member
• Posts: 1772
• http://weelookang.blogspot.com
##### Re: Magnetic field generated bar magnet
« Reply #1 on: August 13, 2008, 07:07:21 pm »
my journey:

1. added mbar.gif graphics into folder _data/mbar.gif
so now i can compile it n it works nicely.

question:

can explain is this the Biotâ€“Savart law you used to model the magnetic feild lines?

compare it with the code
double r2,r3,f;
// caluclate magnetic field at point xp,yp use Biot-Savart Law Fproportional to dlXr/r^3
public double calFx (double xp,double yp) {
f=0;
for(int i=0;i  for(int j=0;j  r2=(xp-xc[j])*(xp-xc[j])+(yp-yc[i])*(yp-yc[i])+zc[i]*zc[i];
r3=r2*Math.sqrt(r2);
f-=(yc[i]*(yp-yc[i])-zc[i]*zc[i])/r3;
}
}
return f;
}
public double calFy (double xp,double yp) {
f=0;
for(int i=0;i  for(int j=0;j  r2=(xp-xc[j])*(xp-xc[j])+(yp-yc[i])*(yp-yc[i])+zc[i]*zc[i];
r3=r2*Math.sqrt(r2);
f+=yc[i]*(xp-xc[j])/r3;
}
}
return f;
}

it looks different, sorry it is difficult to follow, as Biot-Savart Law i don't have a deep understanding

i am usuallly on MSN microsoft messager : lookang , can add me as frd then maybe we can arrange to discuss the applet?
« Last Edit: August 13, 2008, 07:11:25 pm by lookang »

#### Fu-Kwun Hwang

• Hero Member
• Posts: 3062
##### Re: Magnetic field generated bar magnet
« Reply #2 on: August 15, 2008, 12:53:27 am »
Original form for Biot-Savart Law is
\$dvec{B}=frac{mu_0}{4pi} frac{I,dvec{l}   imeshat{r}} {r^2}\$

For the calculation in the code. I use another variable(cst) to represent \$frac{mu_o, I}{4pi}\$
And transform \$frac{I,dvec{l}   imeshat{r}}{r^2}\$ into \$frac{I,dvec{l}   imesvec{r}}{r^3}\$
Where \$hat{r}= frac{vec{r}}{r}\$.

\$vec{l}\$ is in y-z plane. corresponds to (yc,zc) in the code.
and \$vec{r}\$ corresponds to (xp-xc,yp-yc,zc)
Then calculate the cross product for the above two vector.

The integration is done by sum of components from all the coil segments.

#### lookang

• Hero Member
• Posts: 1772
• http://weelookang.blogspot.com
##### Re: Magnetic field generated bar magnet
« Reply #3 on: September 24, 2009, 03:23:56 am »
good sharing by W. K. Adams, Co-Director PhET Interactive Simulations University of Colorado, Boulder, USA
http://www.fisica.uniud.it/URDF/mptl14/dtlprogramme.htm

most popular hit
http://www.walter-fendt.de/ph14e/mfbar.htm

Gold mine find written by Wolfgang Christian, Francisco Esquembre, and Anne Cox