Refactor B_multiple --> B_field
Update B_field function with raster function
This commit is contained in:
parent
66892a0ad2
commit
dc1e81ee2f
@ -38,7 +38,7 @@ wire_width = 1
|
|||||||
wire_height = 2.6
|
wire_height = 2.6
|
||||||
|
|
||||||
|
|
||||||
B_z, B_x = bf.B_multiple(I,HH,R_inner,d_coils,layers,windings,wire_width, wire_height, x_m,z_m)
|
B_z, B_x = bf.B_field(I, HH, R_inner, d_coils, layers, windings, wire_width, wire_height, x_m, z_m)
|
||||||
#B_test = B_field_ideal_AHH(layers*windings,I,R_inner*1e-3,d_coils*1e-3,z_m)
|
#B_test = B_field_ideal_AHH(layers*windings,I,R_inner*1e-3,d_coils*1e-3,z_m)
|
||||||
|
|
||||||
#B_x = np.concatenate((-np.flip(B_r),B_r[1:len(B_r)]))
|
#B_x = np.concatenate((-np.flip(B_r),B_r[1:len(B_r)]))
|
||||||
|
@ -25,10 +25,10 @@ percentage = 0.05
|
|||||||
absolut = 5
|
absolut = 5
|
||||||
diff = percentage*0.01*5+ absolut *1e-3
|
diff = percentage*0.01*5+ absolut *1e-3
|
||||||
print(diff)
|
print(diff)
|
||||||
Bz1, Bx = HH_Coil.B_multiple(5, x, z)
|
Bz1, Bx = HH_Coil.B_field(5, x, z)
|
||||||
|
|
||||||
|
|
||||||
Bz2, Bx = HH_Coil.B_multiple(5+ diff, x, z)
|
Bz2, Bx = HH_Coil.B_field(5 + diff, x, z)
|
||||||
print(Bz2[1500]-Bz1[1500])
|
print(Bz2[1500]-Bz1[1500])
|
||||||
print(" ")
|
print(" ")
|
||||||
|
|
||||||
@ -38,7 +38,7 @@ diff = percentage*0.01*5+ absolut *1e-3
|
|||||||
print(diff)
|
print(diff)
|
||||||
|
|
||||||
|
|
||||||
Bz2, Bx = HH_Coil.B_multiple(5+ diff, x, z)
|
Bz2, Bx = HH_Coil.B_field(5 + diff, x, z)
|
||||||
print(Bz2[1500]-Bz1[1500])
|
print(Bz2[1500]-Bz1[1500])
|
||||||
print((Bz2[1500]-Bz1[1500])/Bz2[1500])
|
print((Bz2[1500]-Bz1[1500])/Bz2[1500])
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ HH_Coil_44 = BC.BCoil(HH, 44 ,44, 6, 2, wire_width = 1.7, wire_height= 2.6)
|
|||||||
|
|
||||||
#Coil from first sketch
|
#Coil from first sketch
|
||||||
HH_Coil_y = BC.BCoil(HH, 55.2 ,44, 6, 2, wire_width = 1.7, wire_height= 2.6)
|
HH_Coil_y = BC.BCoil(HH, 55.2 ,44, 6, 2, wire_width = 1.7, wire_height= 2.6)
|
||||||
B_z_y, B_x_y = HH_Coil_y.B_multiple(6.5,x,z)
|
B_z_y, B_x_y = HH_Coil_y.B_field(6.5, x, z)
|
||||||
B_z_y_curv = BC.BCoil.curv(B_z_y, z)
|
B_z_y_curv = BC.BCoil.curv(B_z_y, z)
|
||||||
|
|
||||||
d_coils_2 = 55.2
|
d_coils_2 = 55.2
|
||||||
@ -58,10 +58,10 @@ HH_Coil_78 = BC.BCoil(1,54,37,4, 4, 1,1)
|
|||||||
|
|
||||||
#HH_Coil_44.Bz_plot_HH_comp(HH_Coil_54,I,x,z)
|
#HH_Coil_44.Bz_plot_HH_comp(HH_Coil_54,I,x,z)
|
||||||
|
|
||||||
B_z, B_x = HH_Coil_44.B_multiple(I,x,z)
|
B_z, B_x = HH_Coil_44.B_field(I, x, z)
|
||||||
B_z_2, B_x_2 = HH_Coil_54.B_multiple(I,x,z)
|
B_z_2, B_x_2 = HH_Coil_54.B_field(I, x, z)
|
||||||
|
|
||||||
B_z_3,B_x_3 = HH_Coil_78.B_multiple(-0.72,x,z)
|
B_z_3,B_x_3 = HH_Coil_78.B_field(-0.72, x, z)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ HH_Coil_78 = BC.BCoil(-1,54,37,4, 4, 1,1)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
B_z,B_x = HH_Coil_78.B_multiple(1,x,z)
|
B_z,B_x = HH_Coil_78.B_field(1, x, z)
|
||||||
|
|
||||||
#B_x = np.concatenate((-np.flip(B_x),B_x))
|
#B_x = np.concatenate((-np.flip(B_x),B_x))
|
||||||
#x = np.concatenate((-np.flip(r),r))
|
#x = np.concatenate((-np.flip(r),r))
|
||||||
|
@ -25,7 +25,7 @@ HH_Coil.set_R_outer(49.3)
|
|||||||
HH_Coil.set_d_min(49.8)
|
HH_Coil.set_d_min(49.8)
|
||||||
HH_Coil.print_info()
|
HH_Coil.print_info()
|
||||||
|
|
||||||
Bz, Bx = HH_Coil.B_multiple(I_current,x,z,raster = 50)
|
Bz, Bx = HH_Coil.B_field(I_current, x, z, raster = 50)
|
||||||
Bz_curv = BC.BCoil.curv(Bz, z)
|
Bz_curv = BC.BCoil.curv(Bz, z)
|
||||||
HH_Coil.cooling(I_current,30)
|
HH_Coil.cooling(I_current,30)
|
||||||
print(f"B_z(0) = {Bz[1]:.2f} G")
|
print(f"B_z(0) = {Bz[1]:.2f} G")
|
||||||
@ -42,7 +42,7 @@ for width in array_width:
|
|||||||
HH_Coil.set_d_min(49.8)
|
HH_Coil.set_d_min(49.8)
|
||||||
#HH_Coil.print_info()
|
#HH_Coil.print_info()
|
||||||
|
|
||||||
Bz, Bx = HH_Coil.B_multiple(I_current,x,z,raster = 30)
|
Bz, Bx = HH_Coil.B_field(I_current, x, z, raster = 30)
|
||||||
Bz_curv = BC.BCoil.curv(Bz, z)
|
Bz_curv = BC.BCoil.curv(Bz, z)
|
||||||
HH_Coil.cooling(I_current,30)
|
HH_Coil.cooling(I_current,30)
|
||||||
B.append(Bz[5])
|
B.append(Bz[5])
|
||||||
|
@ -27,7 +27,7 @@ HH_Coil.set_R_outer(49.3)
|
|||||||
HH_Coil.set_d_min(49.8)
|
HH_Coil.set_d_min(49.8)
|
||||||
|
|
||||||
HH_Coil.print_info()
|
HH_Coil.print_info()
|
||||||
Bz, Bx = HH_Coil.B_multiple(I_current,x,z,raster = 10)
|
Bz, Bx = HH_Coil.B_field(I_current, x, z, raster = 10)
|
||||||
Bz_curv = BC.BCoil.curv(Bz, z)
|
Bz_curv = BC.BCoil.curv(Bz, z)
|
||||||
HH_Coil.cooling(I_current)
|
HH_Coil.cooling(I_current)
|
||||||
|
|
||||||
@ -43,7 +43,7 @@ print(x[500])
|
|||||||
# HH_Coil.set_d_min(49.8)
|
# HH_Coil.set_d_min(49.8)
|
||||||
|
|
||||||
# HH_Coil.print_info()
|
# HH_Coil.print_info()
|
||||||
# Bz, Bx = HH_Coil.B_multiple(I_current,x,z,raster = 50)
|
# Bz, Bx = HH_Coil.B_field(I_current,x,z,raster = 50)
|
||||||
# Bz_curv = BC.BCoil.curv(Bz, z)
|
# Bz_curv = BC.BCoil.curv(Bz, z)
|
||||||
# HH_Coil.cooling(I_current)
|
# HH_Coil.cooling(I_current)
|
||||||
|
|
||||||
@ -65,8 +65,8 @@ I_HH = 5
|
|||||||
I_comp = -1.4
|
I_comp = -1.4
|
||||||
|
|
||||||
#calculate field
|
#calculate field
|
||||||
B_z, B_x = HH_Coil.B_multiple(I_HH,x,z)
|
B_z, B_x = HH_Coil.B_field(I_HH, x, z)
|
||||||
B_z_comp,B_x_comp = HH_Coil_comp.B_multiple(I_comp,x,z)
|
B_z_comp,B_x_comp = HH_Coil_comp.B_field(I_comp, x, z)
|
||||||
|
|
||||||
#Calculate curvature
|
#Calculate curvature
|
||||||
B_z_curv = BC.BCoil.curv(B_z, z)
|
B_z_curv = BC.BCoil.curv(B_z, z)
|
||||||
|
@ -28,7 +28,7 @@ AHH_Coil.set_R_outer(49.3)
|
|||||||
|
|
||||||
#AHH_Coil.print_info()
|
#AHH_Coil.print_info()
|
||||||
|
|
||||||
#B_z,B_x = AHH_Coil.B_multiple(1,x,z)
|
#B_z,B_x = AHH_Coil.B_field(1,x,z)
|
||||||
|
|
||||||
#B_z_grad = BC.BCoil.Bgrad(B_z, z)
|
#B_z_grad = BC.BCoil.Bgrad(B_z, z)
|
||||||
#B_x_grad = BC.BCoil.Bgrad(B_x,x)
|
#B_x_grad = BC.BCoil.Bgrad(B_x,x)
|
||||||
@ -49,7 +49,7 @@ AHH_Coil.print_info()
|
|||||||
#B = AHH_Coil.B_multiple_3d(10, x,z,raster=2)
|
#B = AHH_Coil.B_multiple_3d(10, x,z,raster=2)
|
||||||
AHH_Coil.cooling(10)
|
AHH_Coil.cooling(10)
|
||||||
|
|
||||||
B_z,B_x = AHH_Coil.B_multiple(10,x,z)
|
B_z,B_x = AHH_Coil.B_field(10, x, z)
|
||||||
#B_z = B[:,150,1]
|
#B_z = B[:,150,1]
|
||||||
#B_x = B[150,:,0]
|
#B_x = B[150,:,0]
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ HH_Coil.set_R_outer(49.3)
|
|||||||
HH_Coil.set_d_min(49.8)
|
HH_Coil.set_d_min(49.8)
|
||||||
|
|
||||||
HH_Coil.print_info()
|
HH_Coil.print_info()
|
||||||
#Bz, Bx = HH_Coil.B_multiple(I_current,x,z,raster = 10)
|
#Bz, Bx = HH_Coil.B_field(I_current,x,z,raster = 10)
|
||||||
B_tot_z, B_tot_x = HH_Coil.B_tot_along_axis(I_current, x, z,raster = 8)
|
B_tot_z, B_tot_x = HH_Coil.B_tot_along_axis(I_current, x, z,raster = 8)
|
||||||
|
|
||||||
Bz_curv = BC.BCoil.curv(B_tot_z, z)
|
Bz_curv = BC.BCoil.curv(B_tot_z, z)
|
||||||
|
@ -27,7 +27,7 @@ HH_Coil.set_R_outer(49.3)
|
|||||||
HH_Coil.set_d_min(49.8)
|
HH_Coil.set_d_min(49.8)
|
||||||
|
|
||||||
HH_Coil.print_info()
|
HH_Coil.print_info()
|
||||||
Bz, Bx = HH_Coil.B_multiple(I_current,x,z,raster = 10)
|
Bz, Bx = HH_Coil.B_field(I_current, x, z, raster = 10)
|
||||||
Bz_curv = BC.BCoil.curv(Bz, z)
|
Bz_curv = BC.BCoil.curv(Bz, z)
|
||||||
HH_Coil.cooling(I_current)
|
HH_Coil.cooling(I_current)
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ HH_Coil.cooling(I_current)
|
|||||||
I_HH = 5
|
I_HH = 5
|
||||||
|
|
||||||
#calculate field
|
#calculate field
|
||||||
B_z, B_x = HH_Coil.B_multiple(I_HH,x,z)
|
B_z, B_x = HH_Coil.B_field(I_HH, x, z)
|
||||||
|
|
||||||
#Calculate curvature
|
#Calculate curvature
|
||||||
B_z_curv = BC.BCoil.curv(B_z, z)
|
B_z_curv = BC.BCoil.curv(B_z, z)
|
||||||
|
@ -28,7 +28,7 @@ HH_Coil.set_R_outer(49.3)
|
|||||||
HH_Coil.set_d_min(49.8)
|
HH_Coil.set_d_min(49.8)
|
||||||
|
|
||||||
HH_Coil.print_info()
|
HH_Coil.print_info()
|
||||||
Bz, Bx = HH_Coil.B_multiple(I_current,x,z,raster = 4)
|
Bz, Bx = HH_Coil.B_field(I_current, x, z, raster = 4)
|
||||||
Bz_curv = BC.BCoil.curv(Bz, z)
|
Bz_curv = BC.BCoil.curv(Bz, z)
|
||||||
|
|
||||||
B = HH_Coil.B_multiple_3d(I_current, x, z,raster = 2)
|
B = HH_Coil.B_multiple_3d(I_current, x, z,raster = 2)
|
||||||
@ -54,7 +54,7 @@ print(f"Diff B 1 mm: {Bz[16000] - Bz[15000]}, relative: {(Bz[16000] - Bz[15000])
|
|||||||
I_HH = 5
|
I_HH = 5
|
||||||
|
|
||||||
#calculate field
|
#calculate field
|
||||||
B_z, B_x = HH_Coil.B_multiple(I_HH,x,z)
|
B_z, B_x = HH_Coil.B_field(I_HH, x, z)
|
||||||
|
|
||||||
#Calculate curvature
|
#Calculate curvature
|
||||||
B_z_curv = BC.BCoil.curv(B_z, z)
|
B_z_curv = BC.BCoil.curv(B_z, z)
|
||||||
|
@ -28,7 +28,7 @@ HH_Coil.set_R_inner(40.5)
|
|||||||
|
|
||||||
|
|
||||||
HH_Coil.print_info()
|
HH_Coil.print_info()
|
||||||
Bz, Bx = HH_Coil.B_multiple(I_current,x,z,raster = 10)
|
Bz, Bx = HH_Coil.B_field(I_current, x, z, raster = 10)
|
||||||
Bz_curv = BC.BCoil.curv(Bz, z)
|
Bz_curv = BC.BCoil.curv(Bz, z)
|
||||||
HH_Coil.cooling(I_current)
|
HH_Coil.cooling(I_current)
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ print(f"Diff B 0.5 mm: {Bz[15500] - Bz[15000]}, relative: {(Bz[15500] - Bz[15000
|
|||||||
I_HH = 5
|
I_HH = 5
|
||||||
|
|
||||||
#calculate field
|
#calculate field
|
||||||
B_z, B_x = HH_Coil.B_multiple(I_HH,x,z)
|
B_z, B_x = HH_Coil.B_field(I_HH, x, z)
|
||||||
|
|
||||||
#Calculate curvature
|
#Calculate curvature
|
||||||
B_z_curv = BC.BCoil.curv(B_z, z)
|
B_z_curv = BC.BCoil.curv(B_z, z)
|
||||||
|
@ -29,9 +29,9 @@ HH_Coil.set_d_min(48.8)
|
|||||||
print(f"height = {HH_Coil.get_coil_height()}")
|
print(f"height = {HH_Coil.get_coil_height()}")
|
||||||
HH_Coil.print_info()
|
HH_Coil.print_info()
|
||||||
|
|
||||||
Bz, Bx = HH_Coil.B_multiple(I_current,x,z,raster = 10)
|
Bz, Bx = HH_Coil.B_field(I_current, x, z, raster = 10)
|
||||||
|
|
||||||
B_tot_z, B_tot_x = HH_Coil.B_multiple(I_current, x, z,raster = 10)
|
B_tot_z, B_tot_x = HH_Coil.B_field(I_current, x, z, raster = 10)
|
||||||
|
|
||||||
Bz_curv = BC.BCoil.curv(Bz, z)
|
Bz_curv = BC.BCoil.curv(Bz, z)
|
||||||
HH_Coil.cooling(I_current,28)
|
HH_Coil.cooling(I_current,28)
|
||||||
|
@ -37,7 +37,7 @@ print(HH_Coil.resistance(22))
|
|||||||
print(HH_Coil.induct_perry())
|
print(HH_Coil.induct_perry())
|
||||||
|
|
||||||
HH_Coil.print_info()
|
HH_Coil.print_info()
|
||||||
#Bz, Bx = HH_Coil.B_multiple(I_current,x,z,raster = 10)
|
#Bz, Bx = HH_Coil.B_field(I_current,x,z,raster = 10)
|
||||||
B_tot_z, B_tot_x = HH_Coil.B_tot_along_axis(I_current, x, z,raster = 8)
|
B_tot_z, B_tot_x = HH_Coil.B_tot_along_axis(I_current, x, z,raster = 8)
|
||||||
|
|
||||||
Bz_curv = BC.BCoil.curv(B_tot_z, z)
|
Bz_curv = BC.BCoil.curv(B_tot_z, z)
|
||||||
|
@ -25,10 +25,10 @@ percentage = 0.05
|
|||||||
absolut = 5
|
absolut = 5
|
||||||
diff = percentage*0.01*5+ absolut *1e-3
|
diff = percentage*0.01*5+ absolut *1e-3
|
||||||
print(diff)
|
print(diff)
|
||||||
Bz1, Bx = HH_Coil.B_multiple(5, x, z)
|
Bz1, Bx = HH_Coil.B_field(5, x, z)
|
||||||
|
|
||||||
|
|
||||||
Bz2, Bx = HH_Coil.B_multiple(5+ diff, x, z)
|
Bz2, Bx = HH_Coil.B_field(5 + diff, x, z)
|
||||||
print(Bz2[1500]-Bz1[1500])
|
print(Bz2[1500]-Bz1[1500])
|
||||||
print(" ")
|
print(" ")
|
||||||
|
|
||||||
@ -38,7 +38,7 @@ diff = percentage*0.01*5+ absolut *1e-3
|
|||||||
print(diff)
|
print(diff)
|
||||||
|
|
||||||
|
|
||||||
Bz2, Bx = HH_Coil.B_multiple(5+ diff, x, z)
|
Bz2, Bx = HH_Coil.B_field(5 + diff, x, z)
|
||||||
print(Bz2[1500]-Bz1[1500])
|
print(Bz2[1500]-Bz1[1500])
|
||||||
print((Bz2[1500]-Bz1[1500])/Bz2[1500])
|
print((Bz2[1500]-Bz1[1500])/Bz2[1500])
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ print(f"R = {R} ")
|
|||||||
#B = AHH_Coil.B_multiple_3d(10, x,z,raster=2)
|
#B = AHH_Coil.B_multiple_3d(10, x,z,raster=2)
|
||||||
AHH_Coil.cooling(I,30)
|
AHH_Coil.cooling(I,30)
|
||||||
|
|
||||||
B_z,B_x = AHH_Coil.B_multiple(I,x,z)
|
B_z,B_x = AHH_Coil.B_field(I, x, z)
|
||||||
#B_z = B[:,150,1]
|
#B_z = B[:,150,1]
|
||||||
#B_x = B[150,:,0]
|
#B_x = B[150,:,0]
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ print(f"R = {R} ")
|
|||||||
#B = AHH_Coil.B_multiple_3d(10, x,z,raster=2)
|
#B = AHH_Coil.B_multiple_3d(10, x,z,raster=2)
|
||||||
AHH_Coil.cooling(I,30)
|
AHH_Coil.cooling(I,30)
|
||||||
|
|
||||||
B_z,B_x = AHH_Coil.B_multiple(I,x,z)
|
B_z,B_x = AHH_Coil.B_field(I, x, z)
|
||||||
#B_z = B[:,150,1]
|
#B_z = B[:,150,1]
|
||||||
#B_x = B[150,:,0]
|
#B_x = B[150,:,0]
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ distance = np.arange(80,95,2)
|
|||||||
for d in distance:
|
for d in distance:
|
||||||
print(d)
|
print(d)
|
||||||
AHH_Coil = BC.BCoil(HH = -1, distance = d ,radius = 46.875 ,layers = 4, windings = 4 , wire_width= 1, wire_height= 2 ,layers_spacing = 0.25, windings_spacing= 0.25)
|
AHH_Coil = BC.BCoil(HH = -1, distance = d ,radius = 46.875 ,layers = 4, windings = 4 , wire_width= 1, wire_height= 2 ,layers_spacing = 0.25, windings_spacing= 0.25)
|
||||||
B_z,B_x = AHH_Coil.B_multiple(I,x,z)
|
B_z,B_x = AHH_Coil.B_field(I, x, z)
|
||||||
B_z_grad = BC.BCoil.Bgrad(B_z, z)
|
B_z_grad = BC.BCoil.Bgrad(B_z, z)
|
||||||
B_x_grad = BC.BCoil.Bgrad(B_x,x)
|
B_x_grad = BC.BCoil.Bgrad(B_x,x)
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ AHH_Coil.print_info()
|
|||||||
AHH_Coil.cooling(I, 30)
|
AHH_Coil.cooling(I, 30)
|
||||||
print(f"R (30 degree C)= {AHH_Coil.resistance(30)}")
|
print(f"R (30 degree C)= {AHH_Coil.resistance(30)}")
|
||||||
|
|
||||||
B_z,B_x = AHH_Coil.B_multiple(I,x,z)
|
B_z,B_x = AHH_Coil.B_field(I, x, z)
|
||||||
|
|
||||||
B_z_grad = BC.BCoil.Bgrad(B_z, z)
|
B_z_grad = BC.BCoil.Bgrad(B_z, z)
|
||||||
B_x_grad = BC.BCoil.Bgrad(B_x,x)
|
B_x_grad = BC.BCoil.Bgrad(B_x,x)
|
||||||
|
@ -48,7 +48,7 @@ print(f"R = {R} ")
|
|||||||
#B = AHH_Coil.B_multiple_3d(10, x,z,raster=2)
|
#B = AHH_Coil.B_multiple_3d(10, x,z,raster=2)
|
||||||
AHH_Coil.cooling(I,30)
|
AHH_Coil.cooling(I,30)
|
||||||
|
|
||||||
B_z,B_x = AHH_Coil.B_multiple(I,x,z)
|
B_z,B_x = AHH_Coil.B_field(I, x, z)
|
||||||
#B_z = B[:,150,1]
|
#B_z = B[:,150,1]
|
||||||
#B_x = B[150,:,0]
|
#B_x = B[150,:,0]
|
||||||
|
|
||||||
|
@ -45,8 +45,8 @@ print("Not cutting optical axis:")
|
|||||||
AHH_comp.print_info()
|
AHH_comp.print_info()
|
||||||
|
|
||||||
|
|
||||||
Bz_opt, Bx_opt = AHH_opt.B_multiple(I,x,z)
|
Bz_opt, Bx_opt = AHH_opt.B_field(I, x, z)
|
||||||
Bz_comp, Bx_comp = AHH_comp.B_multiple(I, x, z)
|
Bz_comp, Bx_comp = AHH_comp.B_field(I, x, z)
|
||||||
|
|
||||||
|
|
||||||
#B_z = B[:,150,1]
|
#B_z = B[:,150,1]
|
||||||
|
@ -48,7 +48,7 @@ print(f"R = {R} ")
|
|||||||
#B = AHH_Coil.B_multiple_3d(10, x,z,raster=2)
|
#B = AHH_Coil.B_multiple_3d(10, x,z,raster=2)
|
||||||
AHH_Coil.cooling(I,30)
|
AHH_Coil.cooling(I,30)
|
||||||
|
|
||||||
B_z,B_x = AHH_Coil.B_multiple(I,x,z)
|
B_z,B_x = AHH_Coil.B_field(I, x, z)
|
||||||
#B_z = B[:,150,1]
|
#B_z = B[:,150,1]
|
||||||
#B_x = B[150,:,0]
|
#B_x = B[150,:,0]
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ print(f"R = {R} ")
|
|||||||
#B = AHH_Coil.B_multiple_3d(10, x,z,raster=2)
|
#B = AHH_Coil.B_multiple_3d(10, x,z,raster=2)
|
||||||
AHH_Coil.cooling(I,30)
|
AHH_Coil.cooling(I,30)
|
||||||
|
|
||||||
B_z,B_x = AHH_Coil.B_multiple(I,x,z)
|
B_z,B_x = AHH_Coil.B_field(I, x, z)
|
||||||
#B_z = B[:,150,1]
|
#B_z = B[:,150,1]
|
||||||
#B_x = B[150,:,0]
|
#B_x = B[150,:,0]
|
||||||
|
|
||||||
|
@ -29,9 +29,9 @@ HH_Coil = BC.BCoil(HH = -1, distance = d ,radius = 46.875 ,layers = 4, windings
|
|||||||
|
|
||||||
HH_Coil.print_info()
|
HH_Coil.print_info()
|
||||||
|
|
||||||
Bz, Bx = HH_Coil.B_multiple(I_current,x,z,raster = 10)
|
Bz, Bx = HH_Coil.B_field(I_current, x, z, raster = 10)
|
||||||
|
|
||||||
B_tot_z, B_tot_x = HH_Coil.B_multiple(I_current, x, z,raster = 10)
|
B_tot_z, B_tot_x = HH_Coil.B_field(I_current, x, z, raster = 10)
|
||||||
|
|
||||||
Bz = BC.BCoil.Bgrad(Bz, z)
|
Bz = BC.BCoil.Bgrad(Bz, z)
|
||||||
HH_Coil.cooling(I_current,28)
|
HH_Coil.cooling(I_current,28)
|
||||||
|
@ -29,7 +29,7 @@ print(diff)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
Bz2, Bx = HH_Coil.B_multiple(I+ diff, x, z)
|
Bz2, Bx = HH_Coil.B_field(I+ diff, x, z)
|
||||||
print(Bz2[1500]-Bz1[1500])
|
print(Bz2[1500]-Bz1[1500])
|
||||||
print(" ")
|
print(" ")
|
||||||
"""
|
"""
|
||||||
@ -38,8 +38,8 @@ absolut = 0.125
|
|||||||
diff = percentage*0.01*5+ absolut *1e-3
|
diff = percentage*0.01*5+ absolut *1e-3
|
||||||
print(diff)
|
print(diff)
|
||||||
|
|
||||||
Bz1, Bx = HH_Coil.B_multiple(I, x, z)
|
Bz1, Bx = HH_Coil.B_field(I, x, z)
|
||||||
Bz2, Bx = HH_Coil.B_multiple(I+ diff, x, z)
|
Bz2, Bx = HH_Coil.B_field(I + diff, x, z)
|
||||||
print(Bz2[1500]-Bz1[1500])
|
print(Bz2[1500]-Bz1[1500])
|
||||||
print((Bz2[1500]-Bz1[1500])/Bz2[1500])
|
print((Bz2[1500]-Bz1[1500])/Bz2[1500])
|
||||||
#print(100e-6/10)
|
#print(100e-6/10)
|
||||||
|
@ -28,7 +28,7 @@ HH_Coil.set_R_outer(49.3)
|
|||||||
HH_Coil.set_d_min(49.8)
|
HH_Coil.set_d_min(49.8)
|
||||||
|
|
||||||
HH_Coil.print_info()
|
HH_Coil.print_info()
|
||||||
Bz, Bx = HH_Coil.B_multiple(I_current,x,z,raster = 10)
|
Bz, Bx = HH_Coil.B_field(I_current, x, z, raster = 10)
|
||||||
Bz_curv = BC.BCoil.curv(Bz, z)
|
Bz_curv = BC.BCoil.curv(Bz, z)
|
||||||
HH_Coil.cooling(I_current)
|
HH_Coil.cooling(I_current)
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ print(f"Diff B 0.5 mm: {Bz[15500] - Bz[15000]}, relative: {(Bz[15500] - Bz[15000
|
|||||||
I_HH = I_current
|
I_HH = I_current
|
||||||
|
|
||||||
#calculate field
|
#calculate field
|
||||||
B_z, B_x = HH_Coil.B_multiple(I_HH,x,z)
|
B_z, B_x = HH_Coil.B_field(I_HH, x, z)
|
||||||
|
|
||||||
#Calculate curvature
|
#Calculate curvature
|
||||||
B_z_curv = BC.BCoil.curv(B_z, z)
|
B_z_curv = BC.BCoil.curv(B_z, z)
|
||||||
|
@ -39,7 +39,7 @@ wire_height = 2.6
|
|||||||
|
|
||||||
HH_Coil1 = BC.BCoil(HH, d_coils ,R_mid, layers, windings, wire_width, wire_height)
|
HH_Coil1 = BC.BCoil(HH, d_coils ,R_mid, layers, windings, wire_width, wire_height)
|
||||||
#HH_Coil1.print_info()
|
#HH_Coil1.print_info()
|
||||||
#B_z_sim, B_x_sim = HH_Coil1.B_multiple(5, x, z)
|
#B_z_sim, B_x_sim = HH_Coil1.B_field(5, x, z)
|
||||||
|
|
||||||
#B_z, B_x = bf.B_multiple_raster(I,HH,R_inner,d_coils,layers,windings,wire_width, wire_height, x_m,z_m)
|
#B_z, B_x = bf.B_multiple_raster(I,HH,R_inner,d_coils,layers,windings,wire_width, wire_height, x_m,z_m)
|
||||||
|
|
||||||
|
@ -43,8 +43,8 @@ HH_Coil_54 = BC.BCoil(HH, d_coils_2 ,R_mid, layers, windings, wire_width, wire_h
|
|||||||
|
|
||||||
#HH_Coil_44.Bz_plot_HH_comp(HH_Coil_54,I,x,z)
|
#HH_Coil_44.Bz_plot_HH_comp(HH_Coil_54,I,x,z)
|
||||||
|
|
||||||
B_z, B_x = HH_Coil_44.B_multiple(I,x,z)
|
B_z, B_x = HH_Coil_44.B_field(I, x, z)
|
||||||
B_z_2, B_x_2 = HH_Coil_54.B_multiple(I,x,z)
|
B_z_2, B_x_2 = HH_Coil_54.B_field(I, x, z)
|
||||||
|
|
||||||
B_z_curvature = np.gradient(np.gradient(B_z,z),z)*1e2
|
B_z_curvature = np.gradient(np.gradient(B_z,z),z)*1e2
|
||||||
B_z_curvature_2 = np.gradient(np.gradient(B_z_2,z),z)*1e2
|
B_z_curvature_2 = np.gradient(np.gradient(B_z_2,z),z)*1e2
|
||||||
|
@ -88,8 +88,10 @@ class BCoil:
|
|||||||
def get_coil_width(self):
|
def get_coil_width(self):
|
||||||
if self.winding_offset:
|
if self.winding_offset:
|
||||||
if self.is_round:
|
if self.is_round:
|
||||||
log.info("Be aware of the fact that this is an idealized situation of coil winding (slope of windings changes each layer)")
|
log.info(
|
||||||
return self.layers * self.get_tot_wire_width() - (self.layers-1) * (2 - np.sqrt(3)) *self.get_tot_wire_width()/2 #width is reduced due to winding offset
|
"Be aware of the fact that this is an idealized situation of coil winding (slope of windings changes each layer)")
|
||||||
|
return self.layers * self.get_tot_wire_width() - (self.layers - 1) * (
|
||||||
|
2 - np.sqrt(3)) * self.get_tot_wire_width() / 2 # width is reduced due to winding offset
|
||||||
return self.get_tot_wire_width() * self.layers
|
return self.get_tot_wire_width() * self.layers
|
||||||
|
|
||||||
def get_zmin(self):
|
def get_zmin(self):
|
||||||
@ -223,6 +225,9 @@ class BCoil:
|
|||||||
f"HH = {self.HH}, Distance = {self.distance * 1e3} mm, z_min = {self.get_zmin() * 1e3} mm, z_max = {self.get_zmax() * 1e3} mm")
|
f"HH = {self.HH}, Distance = {self.distance * 1e3} mm, z_min = {self.get_zmin() * 1e3} mm, z_max = {self.get_zmax() * 1e3} mm")
|
||||||
print(
|
print(
|
||||||
f"Radius = {self.radius * 1e3} mm, Radius_inner = {self.get_R_inner() * 1e3} mm, Radius_outer = {self.get_R_outer() * 1e3:.2f} mm")
|
f"Radius = {self.radius * 1e3} mm, Radius_inner = {self.get_R_inner() * 1e3} mm, Radius_outer = {self.get_R_outer() * 1e3:.2f} mm")
|
||||||
|
print(
|
||||||
|
f"Coil width = {self.get_coil_width() * 1e3} mm, Coil height = {self.get_coil_height() * 1e3} mm"
|
||||||
|
)
|
||||||
print(
|
print(
|
||||||
f"layers = {self.layers}, windings = {self.windings}, wire_width = {self.wire_width * 1e3}, wire_height = {self.wire_height * 1e3} mm, round wire = {self.is_round} ")
|
f"layers = {self.layers}, windings = {self.windings}, wire_width = {self.wire_width * 1e3}, wire_height = {self.wire_height * 1e3} mm, round wire = {self.is_round} ")
|
||||||
print(" ")
|
print(" ")
|
||||||
@ -269,14 +274,15 @@ class BCoil:
|
|||||||
B_r *= 1e4 # conversion to gauss
|
B_r *= 1e4 # conversion to gauss
|
||||||
return B_r
|
return B_r
|
||||||
|
|
||||||
def B_multiple(self, I_current, x, z, raster=10):
|
def B_field(self, I_current, x, z, raster=10):
|
||||||
|
pass
|
||||||
"""
|
"""
|
||||||
Returns B_z along z-axis and B_x along x-axis,
|
Returns B_z along z-axis and B_x along x-axis,
|
||||||
HH = +1 --> Helmholtz configuration, HH = -1 --> Anti Helmholtz configuration
|
HH = +1 --> Helmholtz configuration, HH = -1 --> Anti Helmholtz configuration
|
||||||
"""
|
"""
|
||||||
|
|
||||||
z_start = self.get_zmin() + self.wire_height / 2 # (distance_coils/2 - windings * wire_height/2 + wire_height/2)*1e-3
|
# z_start = self.get_zmin() + self.wire_height / 2 # (distance_coils/2 - windings * wire_height/2 + wire_height/2)*1e-3
|
||||||
R_start = self.get_R_inner() + self.wire_width / 2 # (R_inner + wire_width/2 )*1e-3
|
# R_start = self.get_R_inner() + self.wire_width / 2 # (R_inner + wire_width/2 )*1e-3
|
||||||
|
|
||||||
# Convert axis to SI units
|
# Convert axis to SI units
|
||||||
x_SI = x * 1e-3
|
x_SI = x * 1e-3
|
||||||
@ -290,34 +296,34 @@ class BCoil:
|
|||||||
B_z = np.zeros(len(z))
|
B_z = np.zeros(len(z))
|
||||||
B_x_pos = np.zeros(len(x_pos))
|
B_x_pos = np.zeros(len(x_pos))
|
||||||
B_x_neg = np.zeros(len(x_neg))
|
B_x_neg = np.zeros(len(x_neg))
|
||||||
B_x_zero = x_zero # If there is a zero in the x-array it is assured that the x component of the field at this point is zero
|
B_x_zero = x_zero # 0 in x-array --> field is zero at this position
|
||||||
|
|
||||||
# dividing each wire into 10 x 10 raster
|
calc_raster = self.full_raster(raster)
|
||||||
|
|
||||||
I_current /= raster ** 2
|
if self.get_N() != len(calc_raster):
|
||||||
|
log.error("N is not equal length of raster")
|
||||||
|
|
||||||
for xx in range(0, self.layers):
|
rastering_value = len(calc_raster[0])
|
||||||
for zz in range(0, self.windings):
|
|
||||||
for xx_in in range(0, raster):
|
|
||||||
for zz_in in range(0, raster):
|
|
||||||
z_pos = z_start + zz * (
|
|
||||||
self.wire_height + self.windings_spacing) - self.wire_height / 2 + zz_in * self.wire_height / (
|
|
||||||
raster - 1)
|
|
||||||
R_pos = R_start + xx * (
|
|
||||||
self.wire_width + self.layers_spacing) - self.wire_width / 2 + xx_in * self.wire_width / (
|
|
||||||
raster - 1)
|
|
||||||
# TODO: fix z_pos, R_pos, either by raster or by spacing
|
|
||||||
|
|
||||||
B_z += BCoil.B_z_loop(I_current, R_pos, z_pos, 0, z_SI) + BCoil.B_z_loop(self.HH * I_current,
|
I_current /= rastering_value # divide current into smaller currents for mapping the whole wire
|
||||||
R_pos, -z_pos, 0, z_SI)
|
start = time.time()
|
||||||
B_x_pos += BCoil.B_r_loop(I_current, R_pos, z_pos, x_pos, 0) + BCoil.B_r_loop(
|
for wire in range(0, self.get_N()):
|
||||||
self.HH * I_current, R_pos, -z_pos, x_pos, 0)
|
for ii in range(0, rastering_value):
|
||||||
B_x_neg += BCoil.B_r_loop(I_current, R_pos, z_pos, x_neg, 0) + BCoil.B_r_loop(
|
# extract position information out of raster
|
||||||
self.HH * I_current, R_pos, -z_pos, x_neg, 0)
|
z_pos = calc_raster[wire, ii, 0]
|
||||||
|
r_pos = calc_raster[wire, ii, 1]
|
||||||
|
|
||||||
|
B_z += BCoil.B_z_loop(I_current, r_pos, z_pos, 0, z_SI) + BCoil.B_z_loop(self.HH * I_current,
|
||||||
|
r_pos, -z_pos, 0, z_SI)
|
||||||
|
B_x_pos += BCoil.B_r_loop(I_current, r_pos, z_pos, x_pos, 0) + BCoil.B_r_loop(
|
||||||
|
self.HH * I_current, r_pos, -z_pos, x_pos, 0)
|
||||||
|
B_x_neg += BCoil.B_r_loop(I_current, r_pos, z_pos, x_neg, 0) + BCoil.B_r_loop(
|
||||||
|
self.HH * I_current, r_pos, -z_pos, x_neg, 0)
|
||||||
|
|
||||||
B_x_neg *= -1 # B_x_neg is pointing in opposite x_direction
|
B_x_neg *= -1 # B_x_neg is pointing in opposite x_direction
|
||||||
B_x = np.concatenate((B_x_neg, B_x_zero, B_x_pos))
|
B_x = np.concatenate((B_x_neg, B_x_zero, B_x_pos))
|
||||||
|
end = time.time()
|
||||||
|
print(f"time = {end - start} s")
|
||||||
return B_z, B_x
|
return B_z, B_x
|
||||||
|
|
||||||
def B_tot_along_axis(self, I_current, x, z, raster=10):
|
def B_tot_along_axis(self, I_current, x, z, raster=10):
|
||||||
@ -354,10 +360,10 @@ class BCoil:
|
|||||||
for xx_in in range(0, raster):
|
for xx_in in range(0, raster):
|
||||||
for zz_in in range(0, raster):
|
for zz_in in range(0, raster):
|
||||||
z_pos = z_start + zz * (
|
z_pos = z_start + zz * (
|
||||||
self.wire_height + self.windings_spacing) - self.wire_height / 2 + zz_in * self.wire_height / (
|
self.wire_height + self.insulation_thickness * 2) - self.wire_height / 2 + zz_in * self.wire_height / (
|
||||||
raster - 1)
|
raster - 1)
|
||||||
R_pos = R_start + xx * (
|
R_pos = R_start + xx * (
|
||||||
self.wire_width + self.layers_spacing) - self.wire_width / 2 + xx_in * self.wire_width / (
|
self.wire_width + self.insulation_thickness * 2) - self.wire_width / 2 + xx_in * self.wire_width / (
|
||||||
raster - 1)
|
raster - 1)
|
||||||
# TODO: fix z_pos, R_pos, either by raster or by spacing
|
# TODO: fix z_pos, R_pos, either by raster or by spacing
|
||||||
|
|
||||||
@ -377,11 +383,12 @@ class BCoil:
|
|||||||
|
|
||||||
B_x_neg *= -1 # B_x_neg is pointing in opposite x_direction
|
B_x_neg *= -1 # B_x_neg is pointing in opposite x_direction
|
||||||
|
|
||||||
B_x_x = np.zeros(len(x_SI))
|
# B_x_x = np.zeros(len(x_SI))
|
||||||
B_x_x = np.concatenate((B_x_neg, B_x_zero, B_x_pos))
|
|
||||||
|
|
||||||
B_tot_x = np.sqrt(B_x_x ** 2 + B_z_x ** 2)
|
B_tot_x = np.sqrt(B_x_x ** 2 + B_z_x ** 2)
|
||||||
|
|
||||||
|
B_x_x = np.concatenate((B_x_neg, B_x_zero, B_x_pos))
|
||||||
|
|
||||||
return B_tot_z, B_tot_x
|
return B_tot_z, B_tot_x
|
||||||
|
|
||||||
def B_multiple_3d(self, I_current, x, z, raster=4):
|
def B_multiple_3d(self, I_current, x, z, raster=4):
|
||||||
@ -458,7 +465,7 @@ class BCoil:
|
|||||||
return np.gradient(B_field, z) * 1e1
|
return np.gradient(B_field, z) * 1e1
|
||||||
|
|
||||||
def Bz_plot_HH(self, I_current, x, z):
|
def Bz_plot_HH(self, I_current, x, z):
|
||||||
B_z, B_x = self.B_multiple(I_current, x, z)
|
B_z, B_x = self.B_field(I_current, x, z)
|
||||||
|
|
||||||
B_z_curvature = np.gradient(np.gradient(B_z, z), z)
|
B_z_curvature = np.gradient(np.gradient(B_z, z), z)
|
||||||
|
|
||||||
@ -491,8 +498,8 @@ class BCoil:
|
|||||||
plt.show()
|
plt.show()
|
||||||
|
|
||||||
def Bz_plot_HH_comp(self, Coil2, I_current, x, z):
|
def Bz_plot_HH_comp(self, Coil2, I_current, x, z):
|
||||||
B_z, B_x = self.B_multiple(I_current, x, z)
|
B_z, B_x = self.B_field(I_current, x, z)
|
||||||
B_z_2, B_x_2 = Coil2.B_multiple(I_current, x, z)
|
B_z_2, B_x_2 = Coil2.B_field(I_current, x, z)
|
||||||
|
|
||||||
B_z_curvature = np.gradient(np.gradient(B_z, z), z) * 1e2
|
B_z_curvature = np.gradient(np.gradient(B_z, z), z) * 1e2
|
||||||
B_z_curvature_2 = np.gradient(np.gradient(B_z_2, z), z) * 1e2
|
B_z_curvature_2 = np.gradient(np.gradient(B_z_2, z), z) * 1e2
|
||||||
@ -590,14 +597,25 @@ class BCoil:
|
|||||||
return BCoil.resistivity_copper(T) * self.get_wire_length() / self.get_wire_area()
|
return BCoil.resistivity_copper(T) * self.get_wire_length() / self.get_wire_area()
|
||||||
|
|
||||||
|
|
||||||
#HH_Coil = BCoil(HH=1, distance=50, radius=40, layers=4, windings=4, wire_height=0.4, wire_width=0.4,insulation_thickness=0.1, is_round=False, winding_offset=False)
|
def main():
|
||||||
#HH_Coil.set_R_outer(70)
|
HH_Coil = BCoil(HH=-1, distance=50, radius=40, layers=4, windings=8, wire_height=0.4, wire_width=0.4,
|
||||||
#HH_Coil.print_info()
|
insulation_thickness=0.1, is_round=True, winding_offset=False)
|
||||||
|
x = np.linspace(-50, 50, 200)
|
||||||
#raster = HH_Coil.plot_raster(10)
|
z = np.linspace(-50, 50, 200)
|
||||||
|
# Bz, Bx = HH_Coil.B_tot_along_axis(1.25, x, z)
|
||||||
#print(raster[:,:,0])
|
Bz, Bx = HH_Coil.B_field(1.25, x, z)
|
||||||
|
print(Bx)
|
||||||
|
print(Bz)
|
||||||
|
plt.plot(x,Bx,label = "Bx")
|
||||||
|
plt.plot(z,Bz, label = "Bz")
|
||||||
|
plt.legend()
|
||||||
|
plt.show()
|
||||||
|
|
||||||
|
HH_Coil.plot_raster(3)
|
||||||
|
ras = HH_Coil.full_raster(10)
|
||||||
|
|
||||||
|
|
||||||
|
main()
|
||||||
|
# if __name__ == "__main__":
|
||||||
|
# print("g")
|
||||||
|
# main()
|
||||||
|
Loading…
Reference in New Issue
Block a user