Try   HackMD

磁場與安培定律

東華大學_普通物理_葉旺奇作業

tags: physis
普通物理AF-410621205-郭新拳-磁場與安培定律

Work1-長直導線的磁場

其中 B 是磁場,向量 r 是從路徑元素到場的位置向量,r 的長度為此向量的大小,μ0 是真空磁導率,i 是電流,ds 是電流的微小路徑元素。
必歐-沙伐公式:

dB⃗ =μ04πids⃗ ×r⃗ r3

參考資料
如果已知電流密度
J
可將公式改成

dB=μ04πJi×ri|r|2 dv

向量
Ji
的長度代表電流強度,方向代表電流方向

其中dv 代表著 將長直導線分割成許多微小長方形的體積

畫出B-R關係圖,磁場隨著測量點遠離線圈的變化

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

  • 瓶頸:
    如果測試點在長直導線內,則會有誤差,如何解釋

    我認為是經由高斯定律推廣而得

    ->需要做規避
  • 解決方法

向量修正法

rho.x=coil.x rho.y=coil.y rho.z=0
​​​​    得到rho方向的向量,其中coil.x 和 coil.y 為分割成許多微小長方體的x,y座標
rho=rho.norm() X=dP*rho Y=(Jdirection.cross(rho)).norm() Y*=r*dtheta Z=dL*Jdirection

定出微小長方體,三個方向的向量
dp

每次測量點距離z軸所增加的長度
dL
每次測量點往z軸上升所增加的長度
dtheta
每次測量點所增加的角度
Jdirection
電流方向

if p<line.radius: if abs(dot(R,X))/X.mag<X.mag and dot(R,X)>0: if abs(dot(R,Y))/Y.mag<Y.mag and dot(R,Y)>0: if abs(dot(R,Z))/Z.mag< Z.mag and dot(R,Z)>0: continue

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

  • 比較正射影長是否有超過 微小長方體邊長且內積結果須微零

對角線修正法

​​​​  如果R向量長度小於diagonal則省略不計算此直
​​​​  缺點無法判別是否處於微小長方體內部或外部
diagonal=sqrt(dP*dP+dL*dL+(dtheta*r)*(dtheta*r))

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

驗證結果

1.測試點距離和所受磁場強度成正比

e.g. 距離變為
2
倍,則磁場強度變為
12

2.磁場方向為切線方向


Work2-安培定律

CBd\boldsymbol=μ0Ienc

CBd\boldsymbolμ0IencC
參考資料

作圖

X軸代表距離線圈多少公尺,Y軸代表封閉路徑內索圍住的線圈電流乘上
μ0
磁常數

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

code:

作業1:

from visual import* from visual.graph import* #from math import* scene=display(width=1000,height=800,background=color.white,center=(0,1,0))#畫視窗&背景 dots=sphere(color=color.red,radius=0.01,pos=(0,0,3)) line=cylinder(color=color.blue,radius=0.1,pos=(0,0,0),axis=(0,0,6),Length=6) coil=vector(0,0,0) f=gdots(color=color.red) f1=gdots(color=color.green) #J=I/A current density Jdirection=vector(0,0,1) J=Jdirection*1/(pi*line.radius*line.radius) mui=4*pi*10**-7 R=vector(0,0,0) dL=line.length/100 dP=line.radius/20 dtheta=2*pi/20 B=vector(0,0,0) X=vector(0,0,0) Y=vector(0,0,0) Z=vector(0,0,0) row=vector(0,0,0) i=0 for p in arange(0.0,4*line.radius,2*line.radius/50): i=i+1 dots.pos.x=p*cos(pi/4) dots.pos.y=p*sin(pi/4) B.x=0 B.y=0 B.z=0 #直角坐標轉圓柱座標 B1=vector(0,0,0) check=0 for r in arange(0.01,line.radius,dP): for theta in arange(0,2*pi,dtheta): for L in arange(0.0,line.Length,dL): coil.x=r*cos(theta) coil.y=r*sin(theta) coil.z=L R=dots.pos-coil diagonal=sqrt(dP*dP+dL*dL+(dtheta*r)*(dtheta*r)) row.x=coil.x row.y=coil.y row.z=0 row=row.norm() X=dP*row Y=(Jdirection.cross(row)).norm() Y*=r*dtheta Z=dL*Jdirection if p<line.radius: if abs(dot(R,X))/X.mag<X.mag and dot(R,X)>0: if abs(dot(R,Y))/Y.mag<Y.mag and dot(R,Y)>0: if abs(dot(R,Z))/Z.mag< Z.mag and dot(R,Z)>0: continue B+=cross(J,(R.norm()))*dP*dtheta*dL*r/R.mag2 #B+=cross( R, dL*line.pos.norm() )/R.mag2 #Rx dline /R^2 B*=mui/(4*pi) f.plot(pos=(p,B.mag)) #for phi in arange(0,2*pi,dtheta): #a=arrow(pos=sun.pos,color=color.black,axis=B) #scene,center forward

作業2:

from visual import* from visual.graph import* from math import* scene=display(width=1000,height=800,background=color.white,center=(0,1,0))#畫視窗&背景 dots=sphere(color=color.red,radius=0.01,pos=(0,0,3)) line=cylinder(color=color.blue,radius=0.1,pos=(0,0,0),axis=(0,0,6),Length=6) coil=vector(0,0,0) f=gdots(color=color.red) f1=gdots(color=color.green) #J=I/A current density Jdirection=vector(0,0,1) J=Jdirection*1/(pi*line.radius*line.radius) mui=4*pi*10**-7 R=vector(0,0,0) dL=0.05 dP=line.radius/20 dtheta=2*pi/20 B=vector(0,0,0) X=vector(0,0,0) Y=vector(0,0,0) Z=vector(0,0,0) row=vector(0,0,0) i=0 for p in arange(0.0,2*line.radius,2*line.radius/50): s=0 for phi in arange(0,2*pi,dtheta): dots.pos.x=p*cos(phi) dots.pos.y=p*sin(phi) B.x=0 B.y=0 B.z=0 #直角坐標轉圓柱座標 for r in arange(0.001,line.radius,dP): for theta in arange(0,2*pi,dtheta): for L in arange(0.0,line.Length,dL): coil.x=r*cos(theta) coil.y=r*sin(theta) coil.z=L R=dots.pos-coil diagonal=sqrt(dP*dP+dL*dL+(dtheta*r)*(dtheta*r)) row.x=coil.x row.y=coil.y row.z=0 row=row.norm() X=dP*row Y=(Jdirection.cross(row)).norm() Y*=r*dtheta Z=dL*Jdirection if p<line.radius: if abs(dot(R,X))/X.mag<X.mag and dot(R,X)>0: if abs(dot(R,Y))/Y.mag<Y.mag and dot(R,Y)>0: if abs(dot(R,Z))/Z.mag< Z.mag and dot(R,Z)>0: continue B+=cross(J,(R.norm()))*dP*dtheta*dL*r/R.mag2 #B+=cross( R, dL*line.pos.norm() )/R.mag2 #Rx dline /R^2 B*=mui/(4*pi) s+=dot(B,p*10/pi*B.norm() ) f.plot(pos=(p,s)) rate(1000) #for phi in arange(0,2*pi,dtheta): #a=arrow(pos=sun.pos,color=color.black,axis=B) #scene,center forward