This commit is contained in:
schoener 2021-11-09 10:00:44 +01:00
parent c22e00c0df
commit 67f2588f60
28 changed files with 233 additions and 150 deletions

View File

@ -74,33 +74,33 @@ rel_diff_Bx_grad = (B_x_grad-B_x_sim_grad)/B_x_grad
plt.figure(1,figsize=(20,18)) plt.figure(1,figsize=(20,18))
plt.rcParams.update({'font.size': 15}) plt.rcParams.update({'font.size': 15})
plt.suptitle("Helmholtz coil field B_z along z-axis, comparison of simulations", fontsize=30) plt.suptitle("Helmholtz coil field Bz along z-axis, comparison of simulations", fontsize=30)
#Field plot #Field plot
########################## ##########################
plt.subplot(3,2,1) plt.subplot(3,2,1)
plt.plot(z,B_z,linestyle = "solid", label = r"$B_z$: Result via elliptic integrals") plt.plot(z,B_z,linestyle = "solid", label = r"$Bz$: Result via elliptic integrals")
plt.plot(z,B_z_sim,linestyle = "dashdot", label = r"$B_{z, sim}$: Numerical Matlab simulation") plt.plot(z,B_z_sim,linestyle = "dashdot", label = r"$B_{z, sim}$: Numerical Matlab simulation")
plt.plot(z,(B_z-B_z_sim), label = r"$B_z - B_{z, sim}$") plt.plot(z,(B_z-B_z_sim), label = r"$Bz - B_{z, sim}$")
#plt.xlim(-0.01,0.01) #plt.xlim(-0.01,0.01)
plt.title("B-field" ,fontsize = 30) plt.title("B-field" ,fontsize = 30)
plt.ylabel(r"$B_z$ [G]") plt.ylabel(r"$Bz$ [G]")
plt.xlabel("z-axis [mm]") plt.xlabel("z-axis [mm]")
plt.legend() plt.legend()
############################# #############################
plt.subplot(3,2,3) plt.subplot(3,2,3)
plt.plot(z,(B_z-B_z_sim), label = r"$B_z - B_{z, sim}$") plt.plot(z,(B_z-B_z_sim), label = r"$Bz - B_{z, sim}$")
plt.ylabel("absolute deviation [G]") plt.ylabel("absolute deviation [G]")
plt.xlabel("z-axis [mm]") plt.xlabel("z-axis [mm]")
plt.legend() plt.legend()
############################# #############################
plt.subplot(3,2,5) plt.subplot(3,2,5)
plt.plot(z,1000*rel_diff_Bz, label = "$(B_z - B_{z, sim}) / B_z$") plt.plot(z,1000*rel_diff_Bz, label = "$(Bz - B_{z, sim}) / Bz$")
plt.ylabel("relative deviation [‰]") plt.ylabel("relative deviation [‰]")
plt.xlabel("z-axis [mm]") plt.xlabel("z-axis [mm]")
plt.legend() plt.legend()
@ -110,11 +110,11 @@ plt.legend()
################ ################
plt.subplot(3,2,2) plt.subplot(3,2,2)
plt.plot(z,B_z_grad,linestyle = "solid", label = r"$\nabla_z^2 B_z$: Result via elliptic integrals") plt.plot(z,B_z_grad,linestyle = "solid", label = r"$\nabla_z^2 Bz$: Result via elliptic integrals")
plt.plot(z,B_z_sim_grad,linestyle = "dashdot", label = r"$\nabla_z^2 B_{z, sim}$: Numerical Matlab sim.") plt.plot(z,B_z_sim_grad,linestyle = "dashdot", label = r"$\nabla_z^2 B_{z, sim}$: Numerical Matlab sim.")
plt.plot(z,(B_z_grad-B_z_sim_grad), label = r"$\nabla_z^2 B_z - \nabla_z^2 B_{z, sim}$") plt.plot(z,(B_z_grad-B_z_sim_grad), label = r"$\nabla_z^2 Bz - \nabla_z^2 B_{z, sim}$")
plt.ylabel(r"$\nabla_z^2 B_z [G/cm^2]$") plt.ylabel(r"$\nabla_z^2 Bz [G/cm^2]$")
plt.xlabel("z-axis [mm]") plt.xlabel("z-axis [mm]")
plt.title("Curvature of B-field",fontsize = 30) plt.title("Curvature of B-field",fontsize = 30)
plt.legend(loc='lower right') plt.legend(loc='lower right')
@ -123,14 +123,14 @@ plt.legend(loc='lower right')
################# #################
plt.subplot(3,2,4) plt.subplot(3,2,4)
plt.plot(z,(B_z_grad-B_z_sim_grad), label = r"$\nabla_z^2 B_z - \nabla_z^2 B_{z, sim}$") plt.plot(z,(B_z_grad-B_z_sim_grad), label = r"$\nabla_z^2 Bz - \nabla_z^2 B_{z, sim}$")
plt.ylabel(r"absolute deviation $[G/cm^2]$") plt.ylabel(r"absolute deviation $[G/cm^2]$")
plt.xlabel("z-axis [mm]") plt.xlabel("z-axis [mm]")
plt.legend() plt.legend()
##################### #####################
plt.subplot(3,2,6) plt.subplot(3,2,6)
plt.plot(z,1000*rel_diff_Bz_grad, label = r"$(\nabla_z^2 B_z - \nabla_z^2 B_{z, sim}) / \nabla_z^2 B_z$") plt.plot(z,1000*rel_diff_Bz_grad, label = r"$(\nabla_z^2 Bz - \nabla_z^2 B_{z, sim}) / \nabla_z^2 Bz$")
#plt.ylim(-57,10) #plt.ylim(-57,10)
plt.ylabel("relative deviation [‰]") plt.ylabel("relative deviation [‰]")
plt.xlabel("z-axis [mm]") plt.xlabel("z-axis [mm]")
@ -143,7 +143,7 @@ plt.show()
############### relative deviation with averaging by the mean not the individual value ######################################## ############### relative deviation with averaging by the mean not the individual value ########################################
plt.figure(2) plt.figure(2)
plt.plot(z,1000*rel_diff_Bz_grad_mean, label = r"$(\nabla_z^2 B_z - \nabla_z^2 B_{z, sim}) / mean(\nabla_z^2 B_z)$") plt.plot(z,1000*rel_diff_Bz_grad_mean, label = r"$(\nabla_z^2 Bz - \nabla_z^2 B_{z, sim}) / mean(\nabla_z^2 Bz)$")
#plt.ylim(-57,10) #plt.ylim(-57,10)
plt.ylabel("relative deviation [‰]") plt.ylabel("relative deviation [‰]")
plt.xlabel("z-axis [mm]") plt.xlabel("z-axis [mm]")

View File

@ -55,23 +55,23 @@ B_x_grad = np.gradient(B_x,x_m)/100
#try plot #try plot
plt.figure(1) plt.figure(1)
plt.plot(z_2,B_z,linestyle = "solid", label = r"$B_z$: Result via elliptic integrals") plt.plot(z_2,B_z,linestyle = "solid", label = r"$Bz$: Result via elliptic integrals")
plt.plot(z,B_z_sim,linestyle = "dashdot", label = r"$B_{z, sim}$: Numerical Matlab simulation") plt.plot(z,B_z_sim,linestyle = "dashdot", label = r"$B_{z, sim}$: Numerical Matlab simulation")
#plt.plot(z,(B_z-B_z_sim), label = r"$B_z - B_{z, sim}$") #plt.plot(z,(Bz-B_z_sim), label = r"$Bz - B_{z, sim}$")
#plt.xlim(-0.01,0.01) #plt.xlim(-0.01,0.01)
plt.title("B-field" ,fontsize = 30) plt.title("B-field" ,fontsize = 30)
plt.ylabel(r"$B_z$ [G]") plt.ylabel(r"$Bz$ [G]")
plt.xlabel("z-axis [mm]") plt.xlabel("z-axis [mm]")
plt.legend() plt.legend()
plt.show() plt.show()
plt.figure(2) plt.figure(2)
plt.plot(z_2,B_z_grad,linestyle = "solid", label = r"$\nabla_z^2 B_z$: Result via elliptic integrals") plt.plot(z_2,B_z_grad,linestyle = "solid", label = r"$\nabla_z^2 Bz$: Result via elliptic integrals")
plt.plot(z,B_z_sim_grad,linestyle = "dashdot", label = r"$\nabla_z^2 B_{z, sim}$: Numerical Matlab sim.") plt.plot(z,B_z_sim_grad,linestyle = "dashdot", label = r"$\nabla_z^2 B_{z, sim}$: Numerical Matlab sim.")
#plt.plot(z,(B_z_grad-B_z_sim_grad), label = r"$\nabla_z^2 B_z - \nabla_z^2 B_{z, sim}$") #plt.plot(z,(B_z_grad-B_z_sim_grad), label = r"$\nabla_z^2 Bz - \nabla_z^2 B_{z, sim}$")
plt.ylabel(r"$\nabla_z^2 B_z [G/cm^2]$") plt.ylabel(r"$\nabla_z^2 Bz [G/cm^2]$")
plt.xlabel("z-axis [mm]") plt.xlabel("z-axis [mm]")
plt.title("Curvature of B-field",fontsize = 30) plt.title("Curvature of B-field",fontsize = 30)
plt.legend(loc='lower right') plt.legend(loc='lower right')
@ -88,33 +88,33 @@ rel_diff_Bx_grad = (B_x_grad-B_x_sim_grad)/B_x_grad
plt.figure(figsize=(20,18)) plt.figure(figsize=(20,18))
plt.rcParams.update({'font.size': 15}) plt.rcParams.update({'font.size': 15})
plt.suptitle("Helmholtz coil field B_z along z-axis, comparison of simulations", fontsize=30) plt.suptitle("Helmholtz coil field Bz along z-axis, comparison of simulations", fontsize=30)
#Field plot #Field plot
########################## ##########################
plt.subplot(3,2,1) plt.subplot(3,2,1)
plt.plot(z,B_z,linestyle = "solid", label = r"$B_z$: Result via elliptic integrals") plt.plot(z,B_z,linestyle = "solid", label = r"$Bz$: Result via elliptic integrals")
plt.plot(z,B_z_sim,linestyle = "dashdot", label = r"$B_{z, sim}$: Numerical Matlab simulation") plt.plot(z,B_z_sim,linestyle = "dashdot", label = r"$B_{z, sim}$: Numerical Matlab simulation")
plt.plot(z,(B_z-B_z_sim), label = r"$B_z - B_{z, sim}$") plt.plot(z,(B_z-B_z_sim), label = r"$Bz - B_{z, sim}$")
#plt.xlim(-0.01,0.01) #plt.xlim(-0.01,0.01)
plt.title("B-field" ,fontsize = 30) plt.title("B-field" ,fontsize = 30)
plt.ylabel(r"$B_z$ [G]") plt.ylabel(r"$Bz$ [G]")
plt.xlabel("z-axis [mm]") plt.xlabel("z-axis [mm]")
plt.legend() plt.legend()
############################# #############################
plt.subplot(3,2,3) plt.subplot(3,2,3)
plt.plot(z,(B_z-B_z_sim), label = r"$B_z - B_{z, sim}$") plt.plot(z,(B_z-B_z_sim), label = r"$Bz - B_{z, sim}$")
plt.ylabel("absolute deviation [G]") plt.ylabel("absolute deviation [G]")
plt.xlabel("z-axis [mm]") plt.xlabel("z-axis [mm]")
plt.legend() plt.legend()
############################# #############################
plt.subplot(3,2,5) plt.subplot(3,2,5)
plt.plot(z,1000*rel_diff_Bz, label = "$(B_z - B_{z, sim}) / B_z$") plt.plot(z,1000*rel_diff_Bz, label = "$(Bz - B_{z, sim}) / Bz$")
plt.ylabel("relative deviation [‰]") plt.ylabel("relative deviation [‰]")
plt.xlabel("z-axis [mm]") plt.xlabel("z-axis [mm]")
plt.legend() plt.legend()
@ -124,11 +124,11 @@ plt.legend()
################ ################
plt.subplot(3,2,2) plt.subplot(3,2,2)
plt.plot(z,B_z_grad,linestyle = "solid", label = r"$\nabla_z^2 B_z$: Result via elliptic integrals") plt.plot(z,B_z_grad,linestyle = "solid", label = r"$\nabla_z^2 Bz$: Result via elliptic integrals")
plt.plot(z,B_z_sim_grad,linestyle = "dashdot", label = r"$\nabla_z^2 B_{z, sim}$: Numerical Matlab sim.") plt.plot(z,B_z_sim_grad,linestyle = "dashdot", label = r"$\nabla_z^2 B_{z, sim}$: Numerical Matlab sim.")
plt.plot(z,(B_z_grad-B_z_sim_grad), label = r"$\nabla_z^2 B_z - \nabla_z^2 B_{z, sim}$") plt.plot(z,(B_z_grad-B_z_sim_grad), label = r"$\nabla_z^2 Bz - \nabla_z^2 B_{z, sim}$")
plt.ylabel(r"$\nabla_z^2 B_z [G/cm^2]$") plt.ylabel(r"$\nabla_z^2 Bz [G/cm^2]$")
plt.xlabel("z-axis [mm]") plt.xlabel("z-axis [mm]")
plt.title("Curvature of B-field",fontsize = 30) plt.title("Curvature of B-field",fontsize = 30)
plt.legend(loc='lower right') plt.legend(loc='lower right')
@ -137,14 +137,14 @@ plt.legend(loc='lower right')
################# #################
plt.subplot(3,2,4) plt.subplot(3,2,4)
plt.plot(z,(B_z_grad-B_z_sim_grad), label = r"$\nabla_z^2 B_z - \nabla_z^2 B_{z, sim}$") plt.plot(z,(B_z_grad-B_z_sim_grad), label = r"$\nabla_z^2 Bz - \nabla_z^2 B_{z, sim}$")
plt.ylabel(r"absolute deviation $[G/cm^2]$") plt.ylabel(r"absolute deviation $[G/cm^2]$")
plt.xlabel("z-axis [mm]") plt.xlabel("z-axis [mm]")
plt.legend() plt.legend()
##################### #####################
plt.subplot(3,2,6) plt.subplot(3,2,6)
plt.plot(z,1000*rel_diff_Bz_grad, label = r"$(\nabla_z^2 B_z - \nabla_z^2 B_{z, sim}) / \nabla_z^2 B_z$") plt.plot(z,1000*rel_diff_Bz_grad, label = r"$(\nabla_z^2 Bz - \nabla_z^2 B_{z, sim}) / \nabla_z^2 Bz$")
plt.ylim(-57,10) plt.ylim(-57,10)
plt.ylabel("relative deviation [‰]") plt.ylabel("relative deviation [‰]")
plt.xlabel("z-axis [mm]") plt.xlabel("z-axis [mm]")

View File

@ -55,23 +55,23 @@ B_x_grad = np.gradient(B_x,x_m)/100
#try plot #try plot
plt.figure(1) plt.figure(1)
plt.plot(z_2,B_z,linestyle = "solid", label = r"$B_z$: Result via elliptic integrals") plt.plot(z_2,B_z,linestyle = "solid", label = r"$Bz$: Result via elliptic integrals")
plt.plot(z,B_z_sim,linestyle = "dashdot", label = r"$B_{z, sim}$: Numerical Matlab simulation") plt.plot(z,B_z_sim,linestyle = "dashdot", label = r"$B_{z, sim}$: Numerical Matlab simulation")
#plt.plot(z,(B_z-B_z_sim), label = r"$B_z - B_{z, sim}$") #plt.plot(z,(Bz-B_z_sim), label = r"$Bz - B_{z, sim}$")
#plt.xlim(-0.01,0.01) #plt.xlim(-0.01,0.01)
plt.title("B-field" ,fontsize = 30) plt.title("B-field" ,fontsize = 30)
plt.ylabel(r"$B_z$ [G]") plt.ylabel(r"$Bz$ [G]")
plt.xlabel("z-axis [mm]") plt.xlabel("z-axis [mm]")
plt.legend() plt.legend()
plt.show() plt.show()
plt.figure(2) plt.figure(2)
plt.plot(z_2,B_z_grad,linestyle = "solid", label = r"$\nabla_z^2 B_z$: Result via elliptic integrals") plt.plot(z_2,B_z_grad,linestyle = "solid", label = r"$\nabla_z^2 Bz$: Result via elliptic integrals")
plt.plot(z,B_z_sim_grad,linestyle = "dashdot", label = r"$\nabla_z^2 B_{z, sim}$: Numerical Matlab sim.") plt.plot(z,B_z_sim_grad,linestyle = "dashdot", label = r"$\nabla_z^2 B_{z, sim}$: Numerical Matlab sim.")
#plt.plot(z,(B_z_grad-B_z_sim_grad), label = r"$\nabla_z^2 B_z - \nabla_z^2 B_{z, sim}$") #plt.plot(z,(B_z_grad-B_z_sim_grad), label = r"$\nabla_z^2 Bz - \nabla_z^2 B_{z, sim}$")
plt.ylabel(r"$\nabla_z^2 B_z [G/cm^2]$") plt.ylabel(r"$\nabla_z^2 Bz [G/cm^2]$")
plt.xlabel("z-axis [mm]") plt.xlabel("z-axis [mm]")
plt.title("Curvature of B-field",fontsize = 30) plt.title("Curvature of B-field",fontsize = 30)
plt.legend(loc='lower right') plt.legend(loc='lower right')
@ -88,33 +88,33 @@ rel_diff_Bx_grad = (B_x_grad-B_x_sim_grad)/B_x_grad
plt.figure(figsize=(20,18)) plt.figure(figsize=(20,18))
plt.rcParams.update({'font.size': 15}) plt.rcParams.update({'font.size': 15})
plt.suptitle("Helmholtz coil field B_z along z-axis, comparison of simulations", fontsize=30) plt.suptitle("Helmholtz coil field Bz along z-axis, comparison of simulations", fontsize=30)
#Field plot #Field plot
########################## ##########################
plt.subplot(3,2,1) plt.subplot(3,2,1)
plt.plot(z,B_z,linestyle = "solid", label = r"$B_z$: Result via elliptic integrals") plt.plot(z,B_z,linestyle = "solid", label = r"$Bz$: Result via elliptic integrals")
plt.plot(z,B_z_sim,linestyle = "dashdot", label = r"$B_{z, sim}$: Numerical Matlab simulation") plt.plot(z,B_z_sim,linestyle = "dashdot", label = r"$B_{z, sim}$: Numerical Matlab simulation")
plt.plot(z,(B_z-B_z_sim), label = r"$B_z - B_{z, sim}$") plt.plot(z,(B_z-B_z_sim), label = r"$Bz - B_{z, sim}$")
#plt.xlim(-0.01,0.01) #plt.xlim(-0.01,0.01)
plt.title("B-field" ,fontsize = 30) plt.title("B-field" ,fontsize = 30)
plt.ylabel(r"$B_z$ [G]") plt.ylabel(r"$Bz$ [G]")
plt.xlabel("z-axis [mm]") plt.xlabel("z-axis [mm]")
plt.legend() plt.legend()
############################# #############################
plt.subplot(3,2,3) plt.subplot(3,2,3)
plt.plot(z,(B_z-B_z_sim), label = r"$B_z - B_{z, sim}$") plt.plot(z,(B_z-B_z_sim), label = r"$Bz - B_{z, sim}$")
plt.ylabel("absolute deviation [G]") plt.ylabel("absolute deviation [G]")
plt.xlabel("z-axis [mm]") plt.xlabel("z-axis [mm]")
plt.legend() plt.legend()
############################# #############################
plt.subplot(3,2,5) plt.subplot(3,2,5)
plt.plot(z,1000*rel_diff_Bz, label = "$(B_z - B_{z, sim}) / B_z$") plt.plot(z,1000*rel_diff_Bz, label = "$(Bz - B_{z, sim}) / Bz$")
plt.ylabel("relative deviation [‰]") plt.ylabel("relative deviation [‰]")
plt.xlabel("z-axis [mm]") plt.xlabel("z-axis [mm]")
plt.legend() plt.legend()
@ -124,11 +124,11 @@ plt.legend()
################ ################
plt.subplot(3,2,2) plt.subplot(3,2,2)
plt.plot(z,B_z_grad,linestyle = "solid", label = r"$\nabla_z^2 B_z$: Result via elliptic integrals") plt.plot(z,B_z_grad,linestyle = "solid", label = r"$\nabla_z^2 Bz$: Result via elliptic integrals")
plt.plot(z,B_z_sim_grad,linestyle = "dashdot", label = r"$\nabla_z^2 B_{z, sim}$: Numerical Matlab sim.") plt.plot(z,B_z_sim_grad,linestyle = "dashdot", label = r"$\nabla_z^2 B_{z, sim}$: Numerical Matlab sim.")
plt.plot(z,(B_z_grad-B_z_sim_grad), label = r"$\nabla_z^2 B_z - \nabla_z^2 B_{z, sim}$") plt.plot(z,(B_z_grad-B_z_sim_grad), label = r"$\nabla_z^2 Bz - \nabla_z^2 B_{z, sim}$")
plt.ylabel(r"$\nabla_z^2 B_z [G/cm^2]$") plt.ylabel(r"$\nabla_z^2 Bz [G/cm^2]$")
plt.xlabel("z-axis [mm]") plt.xlabel("z-axis [mm]")
plt.title("Curvature of B-field",fontsize = 30) plt.title("Curvature of B-field",fontsize = 30)
plt.legend(loc='lower right') plt.legend(loc='lower right')
@ -137,14 +137,14 @@ plt.legend(loc='lower right')
################# #################
plt.subplot(3,2,4) plt.subplot(3,2,4)
plt.plot(z,(B_z_grad-B_z_sim_grad), label = r"$\nabla_z^2 B_z - \nabla_z^2 B_{z, sim}$") plt.plot(z,(B_z_grad-B_z_sim_grad), label = r"$\nabla_z^2 Bz - \nabla_z^2 B_{z, sim}$")
plt.ylabel(r"absolute deviation $[G/cm^2]$") plt.ylabel(r"absolute deviation $[G/cm^2]$")
plt.xlabel("z-axis [mm]") plt.xlabel("z-axis [mm]")
plt.legend() plt.legend()
##################### #####################
plt.subplot(3,2,6) plt.subplot(3,2,6)
plt.plot(z,1000*rel_diff_Bz_grad, label = r"$(\nabla_z^2 B_z - \nabla_z^2 B_{z, sim}) / \nabla_z^2 B_z$") plt.plot(z,1000*rel_diff_Bz_grad, label = r"$(\nabla_z^2 Bz - \nabla_z^2 B_{z, sim}) / \nabla_z^2 Bz$")
plt.ylim(-57,10) plt.ylim(-57,10)
plt.ylabel("relative deviation [‰]") plt.ylabel("relative deviation [‰]")
plt.xlabel("z-axis [mm]") plt.xlabel("z-axis [mm]")

View File

@ -61,33 +61,33 @@ rel_diff_Bx_grad = (B_x_grad-B_x_sim_grad)/B_x_grad
plt.figure(figsize=(20,18)) plt.figure(figsize=(20,18))
plt.rcParams.update({'font.size': 15}) plt.rcParams.update({'font.size': 15})
plt.suptitle("Helmholtz coil field B_z along z-axis, comparison of simulations", fontsize=30) plt.suptitle("Helmholtz coil field Bz along z-axis, comparison of simulations", fontsize=30)
#Field plot #Field plot
########################## ##########################
plt.subplot(3,2,1) plt.subplot(3,2,1)
plt.plot(z,B_z,linestyle = "solid", label = r"$B_z$: Result via elliptic integrals") plt.plot(z,B_z,linestyle = "solid", label = r"$Bz$: Result via elliptic integrals")
plt.plot(z,B_z_sim,linestyle = "dashdot", label = r"$B_{z, sim}$: Numerical Matlab simulation") plt.plot(z,B_z_sim,linestyle = "dashdot", label = r"$B_{z, sim}$: Numerical Matlab simulation")
plt.plot(z,(B_z-B_z_sim), label = r"$B_z - B_{z, sim}$") plt.plot(z,(B_z-B_z_sim), label = r"$Bz - B_{z, sim}$")
#plt.xlim(-0.01,0.01) #plt.xlim(-0.01,0.01)
plt.title("B-field" ,fontsize = 30) plt.title("B-field" ,fontsize = 30)
plt.ylabel(r"$B_z$ [G]") plt.ylabel(r"$Bz$ [G]")
plt.xlabel("z-axis [mm]") plt.xlabel("z-axis [mm]")
plt.legend() plt.legend()
############################# #############################
plt.subplot(3,2,3) plt.subplot(3,2,3)
plt.plot(z,(B_z-B_z_sim), label = r"$B_z - B_{z, sim}$") plt.plot(z,(B_z-B_z_sim), label = r"$Bz - B_{z, sim}$")
plt.ylabel("absolute deviation [G]") plt.ylabel("absolute deviation [G]")
plt.xlabel("z-axis [mm]") plt.xlabel("z-axis [mm]")
plt.legend() plt.legend()
############################# #############################
plt.subplot(3,2,5) plt.subplot(3,2,5)
plt.plot(z,1000*rel_diff_Bz, label = "$(B_z - B_{z, sim}) / B_z$") plt.plot(z,1000*rel_diff_Bz, label = "$(Bz - B_{z, sim}) / Bz$")
plt.ylabel("relative deviation [‰]") plt.ylabel("relative deviation [‰]")
plt.xlabel("z-axis [mm]") plt.xlabel("z-axis [mm]")
plt.legend() plt.legend()
@ -97,11 +97,11 @@ plt.legend()
################ ################
plt.subplot(3,2,2) plt.subplot(3,2,2)
plt.plot(z,B_z_grad,linestyle = "solid", label = r"$\nabla_z^2 B_z$: Result via elliptic integrals") plt.plot(z,B_z_grad,linestyle = "solid", label = r"$\nabla_z^2 Bz$: Result via elliptic integrals")
plt.plot(z,B_z_sim_grad,linestyle = "dashdot", label = r"$\nabla_z^2 B_{z, sim}$: Numerical Matlab sim.") plt.plot(z,B_z_sim_grad,linestyle = "dashdot", label = r"$\nabla_z^2 B_{z, sim}$: Numerical Matlab sim.")
plt.plot(z,(B_z_grad-B_z_sim_grad), label = r"$\nabla_z^2 B_z - \nabla_z^2 B_{z, sim}$") plt.plot(z,(B_z_grad-B_z_sim_grad), label = r"$\nabla_z^2 Bz - \nabla_z^2 B_{z, sim}$")
plt.ylabel(r"$\nabla_z^2 B_z [G/cm^2]$") plt.ylabel(r"$\nabla_z^2 Bz [G/cm^2]$")
plt.xlabel("z-axis [mm]") plt.xlabel("z-axis [mm]")
plt.title("Curvature of B-field",fontsize = 30) plt.title("Curvature of B-field",fontsize = 30)
plt.legend(loc='lower right') plt.legend(loc='lower right')
@ -110,14 +110,14 @@ plt.legend(loc='lower right')
################# #################
plt.subplot(3,2,4) plt.subplot(3,2,4)
plt.plot(z,(B_z_grad-B_z_sim_grad), label = r"$\nabla_z^2 B_z - \nabla_z^2 B_{z, sim}$") plt.plot(z,(B_z_grad-B_z_sim_grad), label = r"$\nabla_z^2 Bz - \nabla_z^2 B_{z, sim}$")
plt.ylabel(r"absolute deviation $[G/cm^2]$") plt.ylabel(r"absolute deviation $[G/cm^2]$")
plt.xlabel("z-axis [mm]") plt.xlabel("z-axis [mm]")
plt.legend() plt.legend()
##################### #####################
plt.subplot(3,2,6) plt.subplot(3,2,6)
plt.plot(z,1000*rel_diff_Bz_grad, label = r"$(\nabla_z^2 B_z - \nabla_z^2 B_{z, sim}) / \nabla_z^2 B_z$") plt.plot(z,1000*rel_diff_Bz_grad, label = r"$(\nabla_z^2 Bz - \nabla_z^2 B_{z, sim}) / \nabla_z^2 Bz$")
plt.ylim(-57,10) plt.ylim(-57,10)
plt.ylabel("relative deviation [‰]") plt.ylabel("relative deviation [‰]")
plt.xlabel("z-axis [mm]") plt.xlabel("z-axis [mm]")

View File

@ -32,9 +32,9 @@ I = 64 / HH_Coil.get_N() * 1.25
HH_Coil.set_R_outer(50.5 - HH_Coil.get_tot_wire_width()*1e3) HH_Coil.set_R_outer(50.5 - HH_Coil.get_tot_wire_width()*1e3)
HH_Coil.set_d_min(47.15) HH_Coil.set_d_min(47.15)
# HH_Coil.B_quick_plot(I) HH_Coil.B_quick_plot(I)
# HH_Coil.B_curv_quick_plot(I) HH_Coil.B_curv_quick_plot(I)
# HH_Coil.plot_raster() HH_Coil.plot_raster()
HH_Coil.print_info() HH_Coil.print_info()
D_max = 2 * (HH_Coil.get_R_inner()*1e3 - 1) * np.tan(np.radians(41.11)) D_max = 2 * (HH_Coil.get_R_inner()*1e3 - 1) * np.tan(np.radians(41.11))

View File

@ -36,7 +36,7 @@ print(f"R = {R} ")
AHH_Coil.cooling(I,30) AHH_Coil.cooling(I,30)
B_z,B_x = AHH_Coil.B_field(I, x, z) B_z,B_x = AHH_Coil.B_field(I, x, z)
#B_z = B[:,150,1] #Bz = B[:,150,1]
#B_x = B[150,:,0] #B_x = B[150,:,0]
B_tot_z, B_tot_x = AHH_Coil.B_tot_along_axis(I, x, z) B_tot_z, B_tot_x = AHH_Coil.B_tot_along_axis(I, x, z)
@ -52,7 +52,7 @@ print((B_0- B_z_grad[6700])/B_0)
plt.subplot(2,1,1) plt.subplot(2,1,1)
plt.plot(z,B_z,linestyle = "solid", label = f"$B_z$, d = {d} mm") plt.plot(z,B_z,linestyle = "solid", label = f"$Bz$, d = {d} mm")
plt.plot(z,B_tot_z, label = "B_tot_z") plt.plot(z,B_tot_z, label = "B_tot_z")
plt.plot(x,B_x, label = f"$B_x$, d = {d} mm") plt.plot(x,B_x, label = f"$B_x$, d = {d} mm")
plt.plot(z,B_tot_x, label = "B_tot_x") plt.plot(z,B_tot_x, label = "B_tot_x")
@ -64,7 +64,7 @@ plt.xlabel("z-axis / x-axis [mm]")
plt.legend() plt.legend()
plt.subplot(2,1,2) plt.subplot(2,1,2)
plt.plot(z,B_z_grad,linestyle = "solid", label = r"$\nabla_z B_z$") plt.plot(z,B_z_grad,linestyle = "solid", label = r"$\nabla_z Bz$")
plt.plot(x,B_x_grad,linestyle = "solid", label = r"$\nabla_x B_x$") plt.plot(x,B_x_grad,linestyle = "solid", label = r"$\nabla_x B_x$")
plt.ylabel(r"$\nabla_i B_i [G/cm]$") plt.ylabel(r"$\nabla_i B_i [G/cm]$")

View File

@ -39,7 +39,7 @@ print(f"R = {R} ")
AHH_Coil.cooling(I,30) AHH_Coil.cooling(I,30)
B_z,B_x = AHH_Coil.B_field(I, x, z) B_z,B_x = AHH_Coil.B_field(I, x, z)
#B_z = B[:,150,1] #Bz = B[:,150,1]
#B_x = B[150,:,0] #B_x = B[150,:,0]
B_tot_z, B_tot_x = AHH_Coil.B_tot_along_axis(I, x, z) B_tot_z, B_tot_x = AHH_Coil.B_tot_along_axis(I, x, z)

View File

@ -49,7 +49,7 @@ print(f"R = {R} ")
AHH_Coil.cooling(I,30) AHH_Coil.cooling(I,30)
B_z,B_x = AHH_Coil.B_field(I, x, z) B_z,B_x = AHH_Coil.B_field(I, x, z)
#B_z = B[:,150,1] #Bz = B[:,150,1]
#B_x = B[150,:,0] #B_x = B[150,:,0]
B_tot_z, B_tot_x = AHH_Coil.B_tot_along_axis(I, x, z) B_tot_z, B_tot_x = AHH_Coil.B_tot_along_axis(I, x, z)
@ -65,7 +65,7 @@ print((B_0- B_z_grad[6700])/B_0)
plt.subplot(2,1,1) plt.subplot(2,1,1)
plt.plot(z,B_z,linestyle = "solid", label = f"$B_z$, d = {d} mm") plt.plot(z,B_z,linestyle = "solid", label = f"$Bz$, d = {d} mm")
#plt.plot(z,B_tot_z, label = "B_tot_z") #plt.plot(z,B_tot_z, label = "B_tot_z")
plt.plot(x,B_x, label = f"$B_x$, d = {d} mm") plt.plot(x,B_x, label = f"$B_x$, d = {d} mm")
#plt.plot(z,B_tot_x, label = "B_tot_x") #plt.plot(z,B_tot_x, label = "B_tot_x")
@ -77,7 +77,7 @@ plt.xlabel("z-axis / x-axis [mm]")
plt.legend() plt.legend()
plt.subplot(2,1,2) plt.subplot(2,1,2)
plt.plot(z,B_z_grad,linestyle = "solid", label = r"$\nabla_z B_z$") plt.plot(z,B_z_grad,linestyle = "solid", label = r"$\nabla_z Bz$")
plt.plot(x,B_x_grad,linestyle = "solid", label = r"$\nabla_x B_x$") plt.plot(x,B_x_grad,linestyle = "solid", label = r"$\nabla_x B_x$")
plt.ylabel(r"$\nabla_i B_i [G/cm]$") plt.ylabel(r"$\nabla_i B_i [G/cm]$")

View File

@ -49,7 +49,7 @@ Bz_opt, Bx_opt = AHH_opt.B_field(I, x, z)
Bz_comp, Bx_comp = AHH_comp.B_field(I, x, z) Bz_comp, Bx_comp = AHH_comp.B_field(I, x, z)
#B_z = B[:,150,1] #Bz = B[:,150,1]
#B_x = B[150,:,0] #B_x = B[150,:,0]
#B_tot_z, B_tot_x = AHH_Coil.B_tot_along_axis(I, x, z) #B_tot_z, B_tot_x = AHH_Coil.B_tot_along_axis(I, x, z)

View File

@ -49,7 +49,7 @@ print(f"R = {R} ")
AHH_Coil.cooling(I,30) AHH_Coil.cooling(I,30)
B_z,B_x = AHH_Coil.B_field(I, x, z) B_z,B_x = AHH_Coil.B_field(I, x, z)
#B_z = B[:,150,1] #Bz = B[:,150,1]
#B_x = B[150,:,0] #B_x = B[150,:,0]
B_tot_z, B_tot_x = AHH_Coil.B_tot_along_axis(I, x, z) B_tot_z, B_tot_x = AHH_Coil.B_tot_along_axis(I, x, z)
@ -65,7 +65,7 @@ print((B_0- B_z_grad[6700])/B_0)
plt.subplot(2,1,1) plt.subplot(2,1,1)
plt.plot(z,B_z,linestyle = "solid", label = f"$B_z$, d = {d} mm") plt.plot(z,B_z,linestyle = "solid", label = f"$Bz$, d = {d} mm")
#plt.plot(z,B_tot_z, label = "B_tot_z") #plt.plot(z,B_tot_z, label = "B_tot_z")
plt.plot(x,B_x, label = f"$B_x$, d = {d} mm") plt.plot(x,B_x, label = f"$B_x$, d = {d} mm")
#plt.plot(z,B_tot_x, label = "B_tot_x") #plt.plot(z,B_tot_x, label = "B_tot_x")
@ -77,7 +77,7 @@ plt.xlabel("z-axis / x-axis [mm]")
plt.legend() plt.legend()
plt.subplot(2,1,2) plt.subplot(2,1,2)
plt.plot(z,B_z_grad,linestyle = "solid", label = r"$\nabla_z B_z$") plt.plot(z,B_z_grad,linestyle = "solid", label = r"$\nabla_z Bz$")
plt.plot(x,B_x_grad,linestyle = "solid", label = r"$\nabla_x B_x$") plt.plot(x,B_x_grad,linestyle = "solid", label = r"$\nabla_x B_x$")
plt.ylabel(r"$\nabla_i B_i [G/cm]$") plt.ylabel(r"$\nabla_i B_i [G/cm]$")

View File

@ -49,7 +49,7 @@ print(f"R = {R} ")
AHH_Coil.cooling(I,30) AHH_Coil.cooling(I,30)
B_z,B_x = AHH_Coil.B_field(I, x, z) B_z,B_x = AHH_Coil.B_field(I, x, z)
#B_z = B[:,150,1] #Bz = B[:,150,1]
#B_x = B[150,:,0] #B_x = B[150,:,0]
B_tot_z, B_tot_x = AHH_Coil.B_tot_along_axis(I, x, z) B_tot_z, B_tot_x = AHH_Coil.B_tot_along_axis(I, x, z)

View File

@ -0,0 +1,71 @@
import matplotlib.pyplot as plt
import numpy as np
import matplotlib
#matplotlib.use('Qt5Agg')
from src import coil_class as BC
scale = 1000
lim = 15
nr_points = (2 * lim) * scale + 1
x = np.linspace(-lim,lim,nr_points)
z = np.linspace(-lim,lim,nr_points)
def mu_it(x_pos):
it = nr_points//2 + x_pos
return it
Wire_1 = [2, 0.568]
#I_current = 0.94
HH_Coil = BC.BCoil(HH = 1, distance = 54, radius = 48, layers = 8, windings = 8, wire_height = Wire_1[0],
wire_width = Wire_1[0], insulation_thickness=(Wire_1[1] - Wire_1[0]) / 2, is_round = True,
winding_scheme= 2)
print(f"HH N = {HH_Coil.get_N()}")
I_current = 10
# set radius plus distance
HH_Coil.set_R_inner(34.83)
HH_Coil.set_d_min(177.2)
#x_lim = 50
#z_lim = 50
#nr_points = 200
#x = np.linspace(-x_lim, x_lim, nr_points)
#z = np.linspace(-z_lim, z_lim, nr_points)
Bz, B_x = HH_Coil.B_tot_along_axis(I_current, x, z, raster = 3)
Bz_curv = BC.BCoil.curv(Bz,z)
plt.figure(11)
plt.plot(z, Bz, linestyle="solid", label=r"$B_{tot}$ along x-axis")
plt.plot(x, B_x, label=r"$B_{tot}$ along y/z-axis")
plt.title("B-field, Coil along x - axis")
plt.ylabel(r"B-field [G]")
plt.xlabel("x-axis / z-axis [mm]")
plt.legend()
plt.show()
print(f"B_z(0) = {Bz[15000]} G")
print(f"B_z_curvature(0) = {Bz_curv[15000]:.10f} G/cm^2")
print(f"B_z(1 μm) = {Bz[15001]}")
print(f"B_z(1 mm) = {Bz[16000]}")
print(f"Diff B 1 μm: {Bz[15001] - Bz[15000]}, relative: {(Bz[15001] - Bz[15000])/Bz[15000]}")
print(f"Diff B 0.5 mm: {Bz[15500] - Bz[15000]}, relative: {(Bz[15500] - Bz[15000])/Bz[15000]}")
print(f"Diff B 1 mm: {Bz[16000] - Bz[15000]}, relative: {(Bz[16000] - Bz[15000])/Bz[15000]}")
print(f"Diff B 15 mm: {Bz[30000] - Bz[15000]}, relative: {(Bz[30000] - Bz[15000])/Bz[15000]}")
HH_Coil.cooling(I_current,25)
#HH_Coil.B_curv_quick_plot(I_current)
#HH_Coil.plot_raster()

View File

@ -76,7 +76,7 @@ B_tot_curv = BC.BCoil.curv(B_tot, z)
plt.figure(300) plt.figure(300)
plt.suptitle("Helmholtz coil field B_z along z-axis, comparison to field yesterday") plt.suptitle("Helmholtz coil field Bz along z-axis, comparison to field yesterday")
#Field plot #Field plot
@ -88,7 +88,7 @@ plt.plot(z,B_z_2,linestyle = "solid", label = r"$B_{z,1}$, d = 54 mm, R = 48.8 m
#plt.xlim(-0.01,0.01) #plt.xlim(-0.01,0.01)
plt.title("B-field" ) plt.title("B-field" )
plt.ylabel(r"$B_z$ [G]") plt.ylabel(r"$Bz$ [G]")
plt.xlabel("z-axis [mm]") plt.xlabel("z-axis [mm]")
plt.legend() plt.legend()
@ -98,7 +98,7 @@ plt.plot(z,B_z_curvature_2,linestyle = "solid", label = r"$\nabla_z^2 B_{z,1}$,
#plt.plot(z,B_z_curv_3,linestyle = "solid", label = r"$\nabla_z^2 B_{z,2}$, d = 54 mm, R = 37 mm, I = -0.7 A") #plt.plot(z,B_z_curv_3,linestyle = "solid", label = r"$\nabla_z^2 B_{z,2}$, d = 54 mm, R = 37 mm, I = -0.7 A")
#plt.plot(z,B_tot_curv,linestyle = "solid", label = r"$\nabla_z^2 B_{z,1} + B_{z,2}$") #plt.plot(z,B_tot_curv,linestyle = "solid", label = r"$\nabla_z^2 B_{z,1} + B_{z,2}$")
plt.ylabel(r"$\nabla_z^2 B_z [G/cm^2]$") plt.ylabel(r"$\nabla_z^2 Bz [G/cm^2]$")
plt.xlabel("z-axis [mm]")#plt.xlim(-10,10) plt.xlabel("z-axis [mm]")#plt.xlim(-10,10)
plt.title("Curvature of B-field") plt.title("Curvature of B-field")
plt.legend(loc='lower right') plt.legend(loc='lower right')
@ -109,7 +109,7 @@ plt.show()
plt.figure(200,figsize=(15,13)) plt.figure(200,figsize=(15,13))
plt.rcParams.update({'font.size': 15}) plt.rcParams.update({'font.size': 15})
plt.suptitle("Helmholtz coil field B_z along z-axis") plt.suptitle("Helmholtz coil field Bz along z-axis")
#Field plot #Field plot
@ -122,7 +122,7 @@ plt.plot(z,B_tot,linestyle = "solid", label = r"$B_{z,1} + B_{z,2}$")
#plt.xlim(-0.01,0.01) #plt.xlim(-0.01,0.01)
plt.title("B-field" ) plt.title("B-field" )
plt.ylabel(r"$B_z$ [G]") plt.ylabel(r"$Bz$ [G]")
plt.xlabel("z-axis [mm]") plt.xlabel("z-axis [mm]")
plt.legend()#bbox_to_anchor=(1.05, 1), loc='upper left') plt.legend()#bbox_to_anchor=(1.05, 1), loc='upper left')
@ -132,7 +132,7 @@ plt.plot(z,B_z_curvature_2,linestyle = "solid", label = r"$\nabla_z^2 B_{z,1}$,
plt.plot(z,B_z_curv_3,linestyle = "solid", label = r"$\nabla_z^2 B_{z,2}$, d = 54 mm, R = 37 mm, I = -0.7 A") plt.plot(z,B_z_curv_3,linestyle = "solid", label = r"$\nabla_z^2 B_{z,2}$, d = 54 mm, R = 37 mm, I = -0.7 A")
plt.plot(z,B_tot_curv,linestyle = "solid", label = r"$\nabla_z^2 B_{z,1} + B_{z,2}$") plt.plot(z,B_tot_curv,linestyle = "solid", label = r"$\nabla_z^2 B_{z,1} + B_{z,2}$")
plt.ylabel(r"$\nabla_z^2 B_z [G/cm^2]$") plt.ylabel(r"$\nabla_z^2 Bz [G/cm^2]$")
plt.xlabel("z-axis [mm]")#plt.xlim(-10,10) plt.xlabel("z-axis [mm]")#plt.xlim(-10,10)
plt.title("Curvature of B-field") plt.title("Curvature of B-field")
plt.legend()#bbox_to_anchor=(1.05, 1), loc='upper left') plt.legend()#bbox_to_anchor=(1.05, 1), loc='upper left')

View File

@ -42,7 +42,7 @@ plt.suptitle("Anti Helmholtz coil field, I = 1 A, d = 54 mm, R = 37 mm ", fontsi
#Field plot #Field plot
########################## ##########################
plt.subplot(2,1,1) plt.subplot(2,1,1)
plt.plot(z,B_z,linestyle = "solid", label = r"$B_z$, d = 54 mm, R = 37 mm") plt.plot(z,B_z,linestyle = "solid", label = r"$Bz$, d = 54 mm, R = 37 mm")
plt.plot(x,B_x, label = r"$B_x$, d = 54 mm, R = 37 mm") plt.plot(x,B_x, label = r"$B_x$, d = 54 mm, R = 37 mm")
#plt.xlim(-0.01,0.01) #plt.xlim(-0.01,0.01)
plt.title("B-field" ) plt.title("B-field" )
@ -52,7 +52,7 @@ plt.xlabel("z-axis / x-axis [mm]")
plt.legend() plt.legend()
plt.subplot(2,1,2) plt.subplot(2,1,2)
plt.plot(z,B_z_grad,linestyle = "solid", label = r"$\nabla_z B_z$, d = 54 mm, R = 37 mm") plt.plot(z,B_z_grad,linestyle = "solid", label = r"$\nabla_z Bz$, d = 54 mm, R = 37 mm")
plt.plot(x,B_x_grad,linestyle = "solid", label = r"$\nabla_x B_x$, d = 54 mm, R = 37 mm") plt.plot(x,B_x_grad,linestyle = "solid", label = r"$\nabla_x B_x$, d = 54 mm, R = 37 mm")
plt.ylabel(r"$\nabla_i B_i [G/cm]$") plt.ylabel(r"$\nabla_i B_i [G/cm]$")

View File

@ -31,7 +31,7 @@ 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)
print(f"B_z(0) = {Bz[150]:.2f} G") print(f"Bz(0) = {Bz[150]:.2f} G")
print(f"B_z_curvature(0) = {Bz_curv[150]:.4f} G/cm^2") print(f"B_z_curvature(0) = {Bz_curv[150]:.4f} G/cm^2")
@ -47,7 +47,7 @@ print(x[500])
# Bz_curv = BC.BCoil.curv(Bz, z) # Bz_curv = BC.BCoil.curv(Bz, z)
# HH_Coil.cooling(I_current) # HH_Coil.cooling(I_current)
# print(f"B_z(0) = {Bz[150]:.2f} G") # print(f"Bz(0) = {Bz[150]:.2f} G")
# print(f"B_z_curvature(0) = {Bz_curv[150]:.4f} G/cm^2") # print(f"B_z_curvature(0) = {Bz_curv[150]:.4f} G/cm^2")
@ -91,7 +91,7 @@ plt.plot(z,B_tot,linestyle = "solid", label = r"$B_{z,1} + B_{z,2}$")
#plt.xlim(-0.01,0.01) #plt.xlim(-0.01,0.01)
plt.title("B-field" ) plt.title("B-field" )
plt.ylabel(r"$B_z$ [G]") plt.ylabel(r"$Bz$ [G]")
plt.xlabel("z-axis [mm]") plt.xlabel("z-axis [mm]")
plt.legend()#bbox_to_anchor=(1.05, 1), loc='upper left') plt.legend()#bbox_to_anchor=(1.05, 1), loc='upper left')
@ -101,7 +101,7 @@ plt.plot(z,B_z_comp_curv,linestyle = "solid", label = r"$\nabla_z^2 B_{z,1}$, d
plt.plot(z,B_tot_curv,linestyle = "solid", label = r"$\nabla_z^2 B_{z,1} + B_{z,2}$") plt.plot(z,B_tot_curv,linestyle = "solid", label = r"$\nabla_z^2 B_{z,1} + B_{z,2}$")
plt.ylabel(r"$\nabla_z^2 B_z [G/cm^2]$") plt.ylabel(r"$\nabla_z^2 Bz [G/cm^2]$")
plt.xlabel("z-axis [mm]")#plt.xlim(-10,10) plt.xlabel("z-axis [mm]")#plt.xlim(-10,10)
plt.title("Curvature of B-field") plt.title("Curvature of B-field")
plt.legend()#bbox_to_anchor=(1.05, 1), loc='upper left') plt.legend()#bbox_to_anchor=(1.05, 1), loc='upper left')

View File

@ -28,9 +28,9 @@ AHH_Coil.set_R_outer(49.3)
#AHH_Coil.print_info() #AHH_Coil.print_info()
#B_z,B_x = AHH_Coil.B_field(1,x,z) #Bz,B_x = AHH_Coil.B_field(1,x,z)
#B_z_grad = BC.BCoil.grad(B_z, z) #B_z_grad = BC.BCoil.grad(Bz, z)
#B_x_grad = BC.BCoil.grad(B_x,x) #B_x_grad = BC.BCoil.grad(B_x,x)
plt.figure(1,figsize=(10,13)) plt.figure(1,figsize=(10,13))
@ -50,7 +50,7 @@ AHH_Coil.print_info()
AHH_Coil.cooling(10) AHH_Coil.cooling(10)
B_z,B_x = AHH_Coil.B_field(10, x, z) B_z,B_x = AHH_Coil.B_field(10, x, z)
#B_z = B[:,150,1] #Bz = B[:,150,1]
#B_x = B[150,:,0] #B_x = B[150,:,0]
B_z_grad = BC.BCoil.grad(B_z, z) B_z_grad = BC.BCoil.grad(B_z, z)
@ -58,7 +58,7 @@ B_x_grad = BC.BCoil.grad(B_x, x)
plt.subplot(2,1,1) plt.subplot(2,1,1)
plt.plot(z,B_z,linestyle = "solid", label = f"$B_z$, d = {d} mm") plt.plot(z,B_z,linestyle = "solid", label = f"$Bz$, d = {d} mm")
plt.plot(x,B_x, label = f"$B_x$, d = {d} mm") plt.plot(x,B_x, label = f"$B_x$, d = {d} mm")
#plt.xlim(-0.01,0.01) #plt.xlim(-0.01,0.01)
plt.title("B-field" ) plt.title("B-field" )
@ -68,7 +68,7 @@ plt.xlabel("z-axis / x-axis [mm]")
plt.legend() plt.legend()
plt.subplot(2,1,2) plt.subplot(2,1,2)
plt.plot(z,B_z_grad,linestyle = "solid", label = r"$\nabla_z B_z$") plt.plot(z,B_z_grad,linestyle = "solid", label = r"$\nabla_z Bz$")
plt.plot(x,B_x_grad,linestyle = "solid", label = r"$\nabla_x B_x$") plt.plot(x,B_x_grad,linestyle = "solid", label = r"$\nabla_x B_x$")
plt.ylabel(r"$\nabla_i B_i [G/cm]$") plt.ylabel(r"$\nabla_i B_i [G/cm]$")

View File

@ -74,7 +74,7 @@ plt.figure(300)
#Field plot #Field plot
########################## ##########################
plt.subplot(2,1,1) plt.subplot(2,1,1)
#plt.plot(z,B_totz,linestyle = "solid", label = r"$B_z along z-axis") #plt.plot(z,B_totz,linestyle = "solid", label = r"$Bz along z-axis")
#plt.plot(x,Bx,label = "B_x along x") #plt.plot(x,Bx,label = "B_x along x")
plt.plot(z,B_tot_z, label = "New B_tot along z-axis") plt.plot(z,B_tot_z, label = "New B_tot along z-axis")
plt.plot(x,B_tot_x, label = "B_tot along x-axis") plt.plot(x,B_tot_x, label = "B_tot along x-axis")
@ -84,7 +84,7 @@ plt.plot(x,B_tot_x, label = "B_tot along x-axis")
#plt.xlim(-0.01,0.01) #plt.xlim(-0.01,0.01)
plt.title("B-field" ) plt.title("B-field" )
plt.ylabel(r"$B_z$ [G]") plt.ylabel(r"$Bz$ [G]")
plt.xlabel("z-axis [mm]") plt.xlabel("z-axis [mm]")
plt.legend()#bbox_to_anchor=(1.05, 1), loc='upper left') plt.legend()#bbox_to_anchor=(1.05, 1), loc='upper left')
@ -95,7 +95,7 @@ plt.plot(x,Bx_curv,label = "B_x_curv")
#plt.plot(z,B_tot_curv,linestyle = "solid", label = r"$\nabla_z^2 B_{z,1} + B_{z,2}$") #plt.plot(z,B_tot_curv,linestyle = "solid", label = r"$\nabla_z^2 B_{z,1} + B_{z,2}$")
plt.ylabel(r"$\nabla_z^2 B_z [G/cm^2]$") plt.ylabel(r"$\nabla_z^2 Bz [G/cm^2]$")
plt.xlabel("z-axis [mm]")#plt.xlim(-10,10) plt.xlabel("z-axis [mm]")#plt.xlim(-10,10)
plt.title("Curvature of B-field") plt.title("Curvature of B-field")
plt.legend()#bbox_to_anchor=(1.05, 1), loc='upper left') plt.legend()#bbox_to_anchor=(1.05, 1), loc='upper left')

View File

@ -57,7 +57,7 @@ plt.plot(z,B_z,linestyle = "solid", label = r"$B_{ref}$, reference, optimal HH-c
#plt.xlim(-0.01,0.01) #plt.xlim(-0.01,0.01)
plt.title("B-field" ) plt.title("B-field" )
plt.ylabel(r"$B_z$ [G]") plt.ylabel(r"$Bz$ [G]")
plt.xlabel("z-axis [mm]") plt.xlabel("z-axis [mm]")
plt.legend()#bbox_to_anchor=(1.05, 1), loc='upper left') plt.legend()#bbox_to_anchor=(1.05, 1), loc='upper left')
@ -67,7 +67,7 @@ plt.plot(z,B_z_curv,linestyle = "solid", label = r"$\nabla_z^2 B_{ref}$, d = 44
#plt.plot(z,B_tot_curv,linestyle = "solid", label = r"$\nabla_z^2 B_{z,1} + B_{z,2}$") #plt.plot(z,B_tot_curv,linestyle = "solid", label = r"$\nabla_z^2 B_{z,1} + B_{z,2}$")
plt.ylabel(r"$\nabla_z^2 B_z [G/cm^2]$") plt.ylabel(r"$\nabla_z^2 Bz [G/cm^2]$")
plt.xlabel("z-axis [mm]")#plt.xlim(-10,10) plt.xlabel("z-axis [mm]")#plt.xlim(-10,10)
plt.title("Curvature of B-field") plt.title("Curvature of B-field")
plt.legend()#bbox_to_anchor=(1.05, 1), loc='upper left') plt.legend()#bbox_to_anchor=(1.05, 1), loc='upper left')

View File

@ -38,12 +38,12 @@ HH_Coil.cooling(I_current)
HH_Coil.plot_3d(I_current, 80, 80) HH_Coil.plot_3d(I_current, 80, 80)
""" """
print(f"B_z(0) = {Bz[15000]} G") print(f"Bz(0) = {Bz[15000]} G")
print(f"B_z_curvature(0) = {Bz_curv[15000]:.4f} G/cm^2") print(f"B_z_curvature(0) = {Bz_curv[15000]:.4f} G/cm^2")
print(f"B_z(1 μm) = {Bz[15001]}") print(f"Bz(1 μm) = {Bz[15001]}")
print(f"B_z(1 mm) = {Bz[16000]}") print(f"Bz(1 mm) = {Bz[16000]}")
print(f"Diff B 1 μm: {Bz[15001] - Bz[15000]}, relative: {(Bz[15001] - Bz[15000])/Bz[15000]}") print(f"Diff B 1 μm: {Bz[15001] - Bz[15000]}, relative: {(Bz[15001] - Bz[15000])/Bz[15000]}")
@ -79,7 +79,7 @@ plt.plot(x,B_tot[len(z)//2,:],label = "B_tot_x")
#plt.xlim(-0.01,0.01) #plt.xlim(-0.01,0.01)
plt.title("B-field" ) plt.title("B-field" )
plt.ylabel(r"$B_z$ [G]") plt.ylabel(r"$Bz$ [G]")
plt.xlabel("z-axis [mm]") plt.xlabel("z-axis [mm]")
plt.legend()#bbox_to_anchor=(1.05, 1), loc='upper left') plt.legend()#bbox_to_anchor=(1.05, 1), loc='upper left')
@ -89,7 +89,7 @@ plt.plot(z,B_z_curv,linestyle = "solid", label = r"$\nabla_z^2 B_{ref}$, d = 44
#plt.plot(z,B_tot_curv,linestyle = "solid", label = r"$\nabla_z^2 B_{z,1} + B_{z,2}$") #plt.plot(z,B_tot_curv,linestyle = "solid", label = r"$\nabla_z^2 B_{z,1} + B_{z,2}$")
plt.ylabel(r"$\nabla_z^2 B_z [G/cm^2]$") plt.ylabel(r"$\nabla_z^2 Bz [G/cm^2]$")
plt.xlabel("z-axis [mm]")#plt.xlim(-10,10) plt.xlabel("z-axis [mm]")#plt.xlim(-10,10)
plt.title("Curvature of B-field") plt.title("Curvature of B-field")
plt.legend()#bbox_to_anchor=(1.05, 1), loc='upper left') plt.legend()#bbox_to_anchor=(1.05, 1), loc='upper left')

View File

@ -32,12 +32,12 @@ 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)
print(f"B_z(0) = {Bz[15000]} G") print(f"Bz(0) = {Bz[15000]} G")
print(f"B_z_curvature(0) = {Bz_curv[15000]:.4f} G/cm^2") print(f"B_z_curvature(0) = {Bz_curv[15000]:.4f} G/cm^2")
print(f"B_z(1 μm) = {Bz[15001]}") print(f"Bz(1 μm) = {Bz[15001]}")
print(f"B_z(1 mm) = {Bz[16000]}") print(f"Bz(1 mm) = {Bz[16000]}")
print(f"Diff B 1 μm: {Bz[15001] - Bz[15000]}, relative: {(Bz[15001] - Bz[15000])/Bz[15000]}") print(f"Diff B 1 μm: {Bz[15001] - Bz[15000]}, relative: {(Bz[15001] - Bz[15000])/Bz[15000]}")
@ -73,7 +73,7 @@ plt.plot(z,B_z,linestyle = "solid", label = r"$B_{ref}$, reference, optimal HH-c
#plt.xlim(-0.01,0.01) #plt.xlim(-0.01,0.01)
plt.title("B-field" ) plt.title("B-field" )
plt.ylabel(r"$B_z$ [G]") plt.ylabel(r"$Bz$ [G]")
plt.xlabel("z-axis [mm]") plt.xlabel("z-axis [mm]")
plt.legend()#bbox_to_anchor=(1.05, 1), loc='upper left') plt.legend()#bbox_to_anchor=(1.05, 1), loc='upper left')
@ -83,7 +83,7 @@ plt.plot(z,B_z_curv,linestyle = "solid", label = r"$\nabla_z^2 B_{ref}$, d = 44
#plt.plot(z,B_tot_curv,linestyle = "solid", label = r"$\nabla_z^2 B_{z,1} + B_{z,2}$") #plt.plot(z,B_tot_curv,linestyle = "solid", label = r"$\nabla_z^2 B_{z,1} + B_{z,2}$")
plt.ylabel(r"$\nabla_z^2 B_z [G/cm^2]$") plt.ylabel(r"$\nabla_z^2 Bz [G/cm^2]$")
plt.xlabel("z-axis [mm]")#plt.xlim(-10,10) plt.xlabel("z-axis [mm]")#plt.xlim(-10,10)
plt.title("Curvature of B-field") plt.title("Curvature of B-field")
plt.legend()#bbox_to_anchor=(1.05, 1), loc='upper left') plt.legend()#bbox_to_anchor=(1.05, 1), loc='upper left')

View File

@ -41,12 +41,12 @@ 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)
print(f"B_z(0) = {Bz[15000]} G") print(f"Bz(0) = {Bz[15000]} G")
print(f"B_z_curvature(0) = {Bz_curv[15000]:.10f} G/cm^2") print(f"B_z_curvature(0) = {Bz_curv[15000]:.10f} G/cm^2")
print(f"B_z(1 μm) = {Bz[15001]}") print(f"Bz(1 μm) = {Bz[15001]}")
print(f"B_z(1 mm) = {Bz[16000]}") print(f"Bz(1 mm) = {Bz[16000]}")
print(f"Diff B 1 μm: {Bz[15001] - Bz[15000]}, relative: {(Bz[15001] - Bz[15000])/Bz[15000]}") print(f"Diff B 1 μm: {Bz[15001] - Bz[15000]}, relative: {(Bz[15001] - Bz[15000])/Bz[15000]}")
@ -68,7 +68,7 @@ plt.figure(300)
#Field plot #Field plot
########################## ##########################
plt.subplot(2,1,1) plt.subplot(2,1,1)
plt.plot(z,Bz,linestyle = "solid", label = r"$B_z along z-axis") plt.plot(z,Bz,linestyle = "solid", label = r"$Bz along z-axis")
plt.plot(z,B_tot_z, linestyle = "dashed", label = "New B_tot along z-axis") plt.plot(z,B_tot_z, linestyle = "dashed", label = "New B_tot along z-axis")
#plt.plot(x,B_tot_x, label = "B_tot along x-axis") #plt.plot(x,B_tot_x, label = "B_tot along x-axis")
#plt.plot(z,B_z_comp,linestyle = "solid", label = r"$B_{z,1}$, d = 54 mm, R = 48.8 mm, I = 5 A, 4 x 4") #plt.plot(z,B_z_comp,linestyle = "solid", label = r"$B_{z,1}$, d = 54 mm, R = 48.8 mm, I = 5 A, 4 x 4")
@ -77,7 +77,7 @@ plt.plot(z,B_tot_z, linestyle = "dashed", label = "New B_tot along z-axis")
#plt.xlim(-0.01,0.01) #plt.xlim(-0.01,0.01)
plt.title("B-field" ) plt.title("B-field" )
plt.ylabel(r"$B_z$ [G]") plt.ylabel(r"$Bz$ [G]")
plt.xlabel("z-axis [mm]") plt.xlabel("z-axis [mm]")
plt.legend()#bbox_to_anchor=(1.05, 1), loc='upper left') plt.legend()#bbox_to_anchor=(1.05, 1), loc='upper left')
@ -87,7 +87,7 @@ plt.plot(z,Bz_curv,linestyle = "solid", label = r"$\nabla_z^2 B_{ref}$, d = 44 m
#plt.plot(z,B_tot_curv,linestyle = "solid", label = r"$\nabla_z^2 B_{z,1} + B_{z,2}$") #plt.plot(z,B_tot_curv,linestyle = "solid", label = r"$\nabla_z^2 B_{z,1} + B_{z,2}$")
plt.ylabel(r"$\nabla_z^2 B_z [G/cm^2]$") plt.ylabel(r"$\nabla_z^2 Bz [G/cm^2]$")
plt.xlabel("z-axis [mm]")#plt.xlim(-10,10) plt.xlabel("z-axis [mm]")#plt.xlim(-10,10)
plt.title("Curvature of B-field") plt.title("Curvature of B-field")
plt.legend()#bbox_to_anchor=(1.05, 1), loc='upper left') plt.legend()#bbox_to_anchor=(1.05, 1), loc='upper left')

View File

@ -53,7 +53,7 @@ plt.figure(300)
#Field plot #Field plot
########################## ##########################
plt.subplot(2,1,1) plt.subplot(2,1,1)
#plt.plot(z,B_totz,linestyle = "solid", label = r"$B_z along z-axis") #plt.plot(z,B_totz,linestyle = "solid", label = r"$Bz along z-axis")
#plt.plot(x,Bx,label = "B_x along x") #plt.plot(x,Bx,label = "B_x along x")
plt.plot(z,B_tot_z, label = r"$B_{{tot}}$ along z-axis") plt.plot(z,B_tot_z, label = r"$B_{{tot}}$ along z-axis")
plt.plot(x,B_tot_x, label = r"$B_{{tot}}$ along x-axis") plt.plot(x,B_tot_x, label = r"$B_{{tot}}$ along x-axis")

View File

@ -32,12 +32,12 @@ 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)
print(f"B_z(0) = {Bz[15000]} G") print(f"Bz(0) = {Bz[15000]} G")
print(f"B_z_curvature(0) = {Bz_curv[15000]:.4f} G/cm^2") print(f"B_z_curvature(0) = {Bz_curv[15000]:.4f} G/cm^2")
print(f"B_z(1 μm) = {Bz[15001]}") print(f"Bz(1 μm) = {Bz[15001]}")
print(f"B_z(1 mm) = {Bz[16000]}") print(f"Bz(1 mm) = {Bz[16000]}")
print(f"Diff B 1 μm: {Bz[15001] - Bz[15000]}, relative: {(Bz[15001] - Bz[15000])/Bz[15000]}") print(f"Diff B 1 μm: {Bz[15001] - Bz[15000]}, relative: {(Bz[15001] - Bz[15000])/Bz[15000]}")
@ -70,7 +70,7 @@ plt.plot(z,B_z,linestyle = "solid", label = r"$B_{ref}$, reference, optimal HH-c
#plt.xlim(-0.01,0.01) #plt.xlim(-0.01,0.01)
plt.title("B-field" ) plt.title("B-field" )
plt.ylabel(r"$B_z$ [G]") plt.ylabel(r"$Bz$ [G]")
plt.xlabel("z-axis [mm]") plt.xlabel("z-axis [mm]")
plt.legend()#bbox_to_anchor=(1.05, 1), loc='upper left') plt.legend()#bbox_to_anchor=(1.05, 1), loc='upper left')
@ -80,7 +80,7 @@ plt.plot(z,B_z_curv,linestyle = "solid", label = r"$\nabla_z^2 B_{ref}$, d = 44
#plt.plot(z,B_tot_curv,linestyle = "solid", label = r"$\nabla_z^2 B_{z,1} + B_{z,2}$") #plt.plot(z,B_tot_curv,linestyle = "solid", label = r"$\nabla_z^2 B_{z,1} + B_{z,2}$")
plt.ylabel(r"$\nabla_z^2 B_z [G/cm^2]$") plt.ylabel(r"$\nabla_z^2 Bz [G/cm^2]$")
plt.xlabel("z-axis [mm]")#plt.xlim(-10,10) plt.xlabel("z-axis [mm]")#plt.xlim(-10,10)
plt.title("Curvature of B-field") plt.title("Curvature of B-field")
plt.legend()#bbox_to_anchor=(1.05, 1), loc='upper left') plt.legend()#bbox_to_anchor=(1.05, 1), loc='upper left')

View File

@ -41,7 +41,7 @@ HH_Coil1 = BC.BCoil(HH, d_coils ,R_mid, layers, windings, wire_width, wire_heigh
#HH_Coil1.print_info() #HH_Coil1.print_info()
#B_z_sim, B_x_sim = HH_Coil1.B_field(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) #Bz, B_x = bf.B_multiple_raster(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)
@ -57,7 +57,7 @@ HH_Coil1.B_quick_plot(I, x, z)
#Calculate gradients/curvature #Calculate gradients/curvature
B_z_sim_grad = np.gradient(np.gradient(B_z_sim,z_m),z_m)/1e4 B_z_sim_grad = np.gradient(np.gradient(B_z_sim,z_m),z_m)/1e4
B_x_sim_grad = np.gradient(B_x_sim,x_m)/100 B_x_sim_grad = np.gradient(B_x_sim,x_m)/100
#B_z_grad = np.gradient(np.gradient(B_z,z_m),z_m)/1e4 #B_z_grad = np.gradient(np.gradient(Bz,z_m),z_m)/1e4
B_z_grad = np.gradient(B_z,z_m)/100 B_z_grad = np.gradient(B_z,z_m)/100
B_z_sim_grad = np.gradient(B_z_grad,z_m)/100 B_z_sim_grad = np.gradient(B_z_grad,z_m)/100
@ -77,33 +77,33 @@ rel_diff_Bz_grad_mean = (B_z_grad-B_z_sim_grad)/np.mean(B_z_grad)
plt.figure(1,figsize=(20,18)) plt.figure(1,figsize=(20,18))
plt.rcParams.update({'font.size': 15}) plt.rcParams.update({'font.size': 15})
plt.suptitle("Helmholtz coil field B_z along z-axis, comparison of simulations", fontsize=30) plt.suptitle("Helmholtz coil field Bz along z-axis, comparison of simulations", fontsize=30)
#Field plot #Field plot
########################## ##########################
plt.subplot(3,2,1) plt.subplot(3,2,1)
plt.plot(z,B_z,linestyle = "solid", label = r"$B_z$: Result via elliptic integrals") plt.plot(z,B_z,linestyle = "solid", label = r"$Bz$: Result via elliptic integrals")
plt.plot(z,B_z_sim,linestyle = "dashdot", label = r"$B_{z, sim}$: Numerical Matlab simulation") plt.plot(z,B_z_sim,linestyle = "dashdot", label = r"$B_{z, sim}$: Numerical Matlab simulation")
plt.plot(z,(B_z-B_z_sim), label = r"$B_z - B_{z, sim}$") plt.plot(z,(B_z-B_z_sim), label = r"$Bz - B_{z, sim}$")
#plt.xlim(-0.01,0.01) #plt.xlim(-0.01,0.01)
plt.title("B-field" ,fontsize = 30) plt.title("B-field" ,fontsize = 30)
plt.ylabel(r"$B_z$ [G]") plt.ylabel(r"$Bz$ [G]")
plt.xlabel("z-axis [mm]") plt.xlabel("z-axis [mm]")
plt.legend() plt.legend()
############################# #############################
plt.subplot(3,2,3) plt.subplot(3,2,3)
plt.plot(z,(B_z-B_z_sim), label = r"$B_z - B_{z, sim}$") plt.plot(z,(B_z-B_z_sim), label = r"$Bz - B_{z, sim}$")
plt.ylabel("absolute deviation [G]") plt.ylabel("absolute deviation [G]")
plt.xlabel("z-axis [mm]") plt.xlabel("z-axis [mm]")
plt.legend() plt.legend()
############################# #############################
plt.subplot(3,2,5) plt.subplot(3,2,5)
plt.plot(z,1000*rel_diff_Bz, label = "$(B_z - B_{z, sim}) / B_z$") plt.plot(z,1000*rel_diff_Bz, label = "$(Bz - B_{z, sim}) / Bz$")
plt.ylabel("relative deviation [‰]") plt.ylabel("relative deviation [‰]")
plt.xlabel("z-axis [mm]") plt.xlabel("z-axis [mm]")
plt.legend() plt.legend()
@ -113,11 +113,11 @@ plt.legend()
################ ################
plt.subplot(3,2,2) plt.subplot(3,2,2)
plt.plot(z,B_z_grad,linestyle = "solid", label = r"$\nabla_z^2 B_z$: Result via elliptic integrals") plt.plot(z,B_z_grad,linestyle = "solid", label = r"$\nabla_z^2 Bz$: Result via elliptic integrals")
plt.plot(z,B_z_sim_grad,linestyle = "dashdot", label = r"$\nabla_z^2 B_{z, sim}$: Numerical Matlab sim.") plt.plot(z,B_z_sim_grad,linestyle = "dashdot", label = r"$\nabla_z^2 B_{z, sim}$: Numerical Matlab sim.")
plt.plot(z,(B_z_grad-B_z_sim_grad), label = r"$\nabla_z^2 B_z - \nabla_z^2 B_{z, sim}$") plt.plot(z,(B_z_grad-B_z_sim_grad), label = r"$\nabla_z^2 Bz - \nabla_z^2 B_{z, sim}$")
plt.ylabel(r"$\nabla_z^2 B_z [G/cm^2]$") plt.ylabel(r"$\nabla_z^2 Bz [G/cm^2]$")
plt.xlabel("z-axis [mm]") plt.xlabel("z-axis [mm]")
plt.title("Curvature of B-field",fontsize = 30) plt.title("Curvature of B-field",fontsize = 30)
plt.legend(loc='lower right') plt.legend(loc='lower right')
@ -126,14 +126,14 @@ plt.legend(loc='lower right')
################# #################
plt.subplot(3,2,4) plt.subplot(3,2,4)
plt.plot(z,(B_z_grad-B_z_sim_grad), label = r"$\nabla_z^2 B_z - \nabla_z^2 B_{z, sim}$") plt.plot(z,(B_z_grad-B_z_sim_grad), label = r"$\nabla_z^2 Bz - \nabla_z^2 B_{z, sim}$")
plt.ylabel(r"absolute deviation $[G/cm^2]$") plt.ylabel(r"absolute deviation $[G/cm^2]$")
plt.xlabel("z-axis [mm]") plt.xlabel("z-axis [mm]")
plt.legend() plt.legend()
##################### #####################
plt.subplot(3,2,6) plt.subplot(3,2,6)
plt.plot(z,1000*rel_diff_Bz_grad, label = r"$(\nabla_z^2 B_z - \nabla_z^2 B_{z, sim}) / \nabla_z^2 B_z$") plt.plot(z,1000*rel_diff_Bz_grad, label = r"$(\nabla_z^2 Bz - \nabla_z^2 B_{z, sim}) / \nabla_z^2 Bz$")
#plt.ylim(-57,10) #plt.ylim(-57,10)
plt.ylabel("relative deviation [‰]") plt.ylabel("relative deviation [‰]")
plt.xlabel("z-axis [mm]") plt.xlabel("z-axis [mm]")
@ -146,7 +146,7 @@ plt.show()
############### relative deviation with averaging by the mean not the individual value ######################################## ############### relative deviation with averaging by the mean not the individual value ########################################
plt.figure(2) plt.figure(2)
plt.plot(z,1000*rel_diff_Bz_grad_mean, label = r"$(\nabla_z^2 B_z - \nabla_z^2 B_{z, sim}) / mean(\nabla_z^2 B_z)$") plt.plot(z,1000*rel_diff_Bz_grad_mean, label = r"$(\nabla_z^2 Bz - \nabla_z^2 B_{z, sim}) / mean(\nabla_z^2 Bz)$")
#plt.ylim(-57,10) #plt.ylim(-57,10)
plt.ylabel("relative deviation [‰]") plt.ylabel("relative deviation [‰]")
plt.xlabel("z-axis [mm]") plt.xlabel("z-axis [mm]")

View File

@ -53,27 +53,27 @@ B_z_curvature_2 = np.gradient(np.gradient(B_z_2,z),z)*1e2
plt.figure(100,figsize=(13,10)) plt.figure(100,figsize=(13,10))
#plt.rcParams.update({'font.size': 15}) #plt.rcParams.update({'font.size': 15})
plt.suptitle("Helmholtz coil field B_z along z-axis") plt.suptitle("Helmholtz coil field Bz along z-axis")
#Field plot #Field plot
########################## ##########################
plt.subplot(2,1,1) plt.subplot(2,1,1)
plt.plot(z,B_z,linestyle = "solid", label = r"$B_z$, d = 44 mm") plt.plot(z,B_z,linestyle = "solid", label = r"$Bz$, d = 44 mm")
plt.plot(z,B_z_2,linestyle = "solid", label = r"$B_{z,2}$, d = 55.2 mm") plt.plot(z,B_z_2,linestyle = "solid", label = r"$B_{z,2}$, d = 55.2 mm")
#plt.xlim(-0.01,0.01) #plt.xlim(-0.01,0.01)
plt.title("B-field" ) plt.title("B-field" )
plt.ylabel(r"$B_z$ [G]") plt.ylabel(r"$Bz$ [G]")
plt.xlabel("z-axis [mm]") plt.xlabel("z-axis [mm]")
plt.legend() plt.legend()
plt.subplot(2,1,2) plt.subplot(2,1,2)
plt.plot(z,B_z_curvature,linestyle = "solid", label = r"$\nabla_z^2 B_z$, d = 44 mm") plt.plot(z,B_z_curvature,linestyle = "solid", label = r"$\nabla_z^2 Bz$, d = 44 mm")
plt.plot(z,B_z_curvature_2,linestyle = "solid", label = r"$\nabla_z^2 B_{z,2}, d = 55.2 mm$") plt.plot(z,B_z_curvature_2,linestyle = "solid", label = r"$\nabla_z^2 B_{z,2}, d = 55.2 mm$")
plt.ylabel(r"$\nabla_z^2 B_z [G/cm^2]$") plt.ylabel(r"$\nabla_z^2 Bz [G/cm^2]$")
plt.xlabel("z-axis [mm]")#plt.xlim(-10,10) plt.xlabel("z-axis [mm]")#plt.xlim(-10,10)
plt.title("Curvature of B-field") plt.title("Curvature of B-field")
plt.legend(loc='lower right') plt.legend(loc='lower right')

View File

@ -41,7 +41,7 @@ def B_r_loop(I_current, R_loop, z_loc, r, z):
return B_r return B_r
def B_multiple(I_current, HH, R_inner, distance_coils, layers, windings, wire_width, wire_height, x, z): def B_multiple(I_current, HH, R_inner, distance_coils, layers, windings, wire_width, wire_height, x, z):
"""Returns B_z along z-axis and B_r along r-axis """Returns Bz along z-axis and B_r along r-axis
HH = +1 --> Helmholtz configuration, HH = -1 --> Anti Helmholtz configuration""" HH = +1 --> Helmholtz configuration, HH = -1 --> Anti Helmholtz configuration"""
z_start = (distance_coils/2 - windings * wire_height/2 + wire_height/2)*1e-3 z_start = (distance_coils/2 - windings * wire_height/2 + wire_height/2)*1e-3
R_start = (R_inner + wire_width/2 )*1e-3 R_start = (R_inner + wire_width/2 )*1e-3
@ -75,7 +75,7 @@ def B_multiple(I_current, HH, R_inner, distance_coils, layers, windings, wire_wi
def B_multiple_raster(I_current, HH, R_inner, distance_coils, layers, windings, wire_width, wire_height, x, z): def B_multiple_raster(I_current, HH, R_inner, distance_coils, layers, windings, wire_width, wire_height, x, z):
"""Returns B_z along z-axis and B_r along r-axis """Returns Bz along z-axis and B_r along r-axis
HH = +1 --> Helmholtz configuration, HH = -1 --> Anti Helmholtz configuration""" HH = +1 --> Helmholtz configuration, HH = -1 --> Anti Helmholtz configuration"""
z_start = (distance_coils/2 - windings * wire_height/2 + wire_height/2)*1e-3 z_start = (distance_coils/2 - windings * wire_height/2 + wire_height/2)*1e-3
R_start = (R_inner + wire_width/2 )*1e-3 R_start = (R_inner + wire_width/2 )*1e-3
@ -112,7 +112,7 @@ def B_multiple_raster(I_current, HH, R_inner, distance_coils, layers, windings,
return B_z,B_x return B_z,B_x
def B_multiple_raster_test(I_current, HH, R_inner, distance_coils, layers, windings, wire_width, wire_height, x, z): def B_multiple_raster_test(I_current, HH, R_inner, distance_coils, layers, windings, wire_width, wire_height, x, z):
"""Returns B_z along z-axis and B_r along r-axis """Returns Bz along z-axis and B_r along r-axis
HH = +1 --> Helmholtz configuration, HH = -1 --> Anti Helmholtz configuration""" HH = +1 --> Helmholtz configuration, HH = -1 --> Anti Helmholtz configuration"""
z_start = (distance_coils/2 - windings * wire_height/2 + wire_height/2)*1e-3 z_start = (distance_coils/2 - windings * wire_height/2 + wire_height/2)*1e-3
R_start = (R_inner + wire_width/2 )*1e-3 R_start = (R_inner + wire_width/2 )*1e-3

View File

@ -347,7 +347,7 @@ class BCoil:
def B_field(self, I_current, x, z, raster=10): def B_field(self, I_current, x, z, raster=10):
""" """
Returns B_z along z-axis and B_x along x-axis, Returns Bz 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
""" """
@ -461,7 +461,7 @@ class BCoil:
self.HH * I_current, r_pos, -z_pos, x_pos, 0) 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( 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) self.HH * I_current, r_pos, -z_pos, x_neg, 0)
# B_z along x-axis: # Bz along x-axis:
B_z_x += BCoil.B_z_loop(I_current, r_pos, z_pos, x_SI, 0) + BCoil.B_z_loop(self.HH * I_current, B_z_x += BCoil.B_z_loop(I_current, r_pos, z_pos, x_SI, 0) + BCoil.B_z_loop(self.HH * I_current,
r_pos, -z_pos, x_SI, 0) r_pos, -z_pos, x_SI, 0)
@ -578,7 +578,7 @@ class BCoil:
B_x = BCoil.grad(B_x, x) B_x = BCoil.grad(B_x, x)
plt.figure(12) plt.figure(12)
plt.plot(z, B_z, linestyle="solid", label=r"z grad of B_z along z-axis") plt.plot(z, B_z, linestyle="solid", label=r"z grad of Bz along z-axis")
plt.plot(x, B_x, label=r"x Grad of B_x along x-axis") plt.plot(x, B_x, label=r"x Grad of B_x along x-axis")
plt.title("Gradient of B-field") plt.title("Gradient of B-field")
plt.ylabel(r"B-field [G/cm]") plt.ylabel(r"B-field [G/cm]")
@ -614,25 +614,25 @@ class BCoil:
plt.figure(100, figsize=(13, 10)) plt.figure(100, figsize=(13, 10))
# plt.rcParams.update({'font.size': 15}) # plt.rcParams.update({'font.size': 15})
plt.suptitle("Helmholtz coil field B_z along z-axis") plt.suptitle("Helmholtz coil field Bz along z-axis")
# Field plot # Field plot
########################## ##########################
plt.subplot(2, 1, 1) plt.subplot(2, 1, 1)
plt.plot(z, B_z, linestyle="solid", label=r"$B_z$") plt.plot(z, B_z, linestyle="solid", label=r"$Bz$")
plt.plot(z, B_z_2, linestyle="solid", label=r"$B_{z2}$") plt.plot(z, B_z_2, linestyle="solid", label=r"$B_{z2}$")
# plt.xlim(-0.01,0.01) # plt.xlim(-0.01,0.01)
plt.title("B-field") plt.title("B-field")
plt.ylabel(r"$B_z$ [G]") plt.ylabel(r"$Bz$ [G]")
plt.xlabel("z-axis [mm]") plt.xlabel("z-axis [mm]")
plt.legend() plt.legend()
plt.subplot(2, 1, 2) plt.subplot(2, 1, 2)
plt.plot(z, B_z_curvature, linestyle="solid", label=r"$\nabla_z^2 B_z$") plt.plot(z, B_z_curvature, linestyle="solid", label=r"$\nabla_z^2 Bz$")
plt.plot(z, B_z_curvature_2, linestyle="solid", label=r"$\nabla_z^2 B_{z2}$") plt.plot(z, B_z_curvature_2, linestyle="solid", label=r"$\nabla_z^2 B_{z2}$")
plt.ylabel(r"$\nabla_z^2 B_z [G/cm^2]$") plt.ylabel(r"$\nabla_z^2 Bz [G/cm^2]$")
plt.xlabel("z-axis [mm]") plt.xlabel("z-axis [mm]")
plt.xlim(-10, 10) plt.xlim(-10, 10)
plt.title("Curvature of B-field") plt.title("Curvature of B-field")

View File

@ -9,15 +9,27 @@ import numpy as np
def main(): def main():
wire_width = 0.568 wire_width = 0.568
ins = 0.068
print(2*wire_width)
r_in = 45.92 + wire_width/2 r_in = 45.92 + wire_width/2
print(2*45.92)
print(r_in*3)
d_in = r_in * 2 d_in = r_in * 2
r_2 = r_in + wire_width for ll in range(0,8):
r_3 = r_2 + wire_width r = r_in + ll * wire_width
r = r_in + 4*wire_width d = 2 * r
res = 2*r print(f"layer {ll+1}: d = {d} mm")
print(d + wire_width/2)
print(8.5*wire_width)
res = 0.568/2
print(res) print(res)
print(np.pi * 2 *47.9)
res = [322.7,367.2]