diff --git a/Benchmarking/comparison_HH_increased_resolution.py b/Benchmarking/comparison_HH_increased_resolution.py index 7c282d6..e5846f0 100644 --- a/Benchmarking/comparison_HH_increased_resolution.py +++ b/Benchmarking/comparison_HH_increased_resolution.py @@ -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.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 ########################## 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-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.title("B-field" ,fontsize = 30) -plt.ylabel(r"$B_z$ [G]") +plt.ylabel(r"$Bz$ [G]") plt.xlabel("z-axis [mm]") plt.legend() ############################# 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.xlabel("z-axis [mm]") plt.legend() ############################# 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.xlabel("z-axis [mm]") plt.legend() @@ -110,11 +110,11 @@ plt.legend() ################ 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_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.title("Curvature of B-field",fontsize = 30) plt.legend(loc='lower right') @@ -123,14 +123,14 @@ plt.legend(loc='lower right') ################# 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.xlabel("z-axis [mm]") plt.legend() ##################### 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.ylabel("relative deviation [‰]") plt.xlabel("z-axis [mm]") @@ -143,7 +143,7 @@ plt.show() ############### relative deviation with averaging by the mean not the individual value ######################################## 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.ylabel("relative deviation [‰]") plt.xlabel("z-axis [mm]") diff --git a/Benchmarking/comparison_HH_increased_resolution_different_z_dimensions.py b/Benchmarking/comparison_HH_increased_resolution_different_z_dimensions.py index 76eb620..ea5562c 100644 --- a/Benchmarking/comparison_HH_increased_resolution_different_z_dimensions.py +++ b/Benchmarking/comparison_HH_increased_resolution_different_z_dimensions.py @@ -55,23 +55,23 @@ B_x_grad = np.gradient(B_x,x_m)/100 #try plot 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-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.title("B-field" ,fontsize = 30) -plt.ylabel(r"$B_z$ [G]") +plt.ylabel(r"$Bz$ [G]") plt.xlabel("z-axis [mm]") plt.legend() plt.show() 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_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.title("Curvature of B-field",fontsize = 30) 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.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 ########################## 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-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.title("B-field" ,fontsize = 30) -plt.ylabel(r"$B_z$ [G]") +plt.ylabel(r"$Bz$ [G]") plt.xlabel("z-axis [mm]") plt.legend() ############################# 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.xlabel("z-axis [mm]") plt.legend() ############################# 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.xlabel("z-axis [mm]") plt.legend() @@ -124,11 +124,11 @@ plt.legend() ################ 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_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.title("Curvature of B-field",fontsize = 30) plt.legend(loc='lower right') @@ -137,14 +137,14 @@ plt.legend(loc='lower right') ################# 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.xlabel("z-axis [mm]") plt.legend() ##################### 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.ylabel("relative deviation [‰]") plt.xlabel("z-axis [mm]") diff --git a/Benchmarking/comparison_HH_increased_resolution_different_z_dimensions1.py b/Benchmarking/comparison_HH_increased_resolution_different_z_dimensions1.py index b33a61b..1436c93 100644 --- a/Benchmarking/comparison_HH_increased_resolution_different_z_dimensions1.py +++ b/Benchmarking/comparison_HH_increased_resolution_different_z_dimensions1.py @@ -55,23 +55,23 @@ B_x_grad = np.gradient(B_x,x_m)/100 #try plot 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-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.title("B-field" ,fontsize = 30) -plt.ylabel(r"$B_z$ [G]") +plt.ylabel(r"$Bz$ [G]") plt.xlabel("z-axis [mm]") plt.legend() plt.show() 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_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.title("Curvature of B-field",fontsize = 30) 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.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 ########################## 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-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.title("B-field" ,fontsize = 30) -plt.ylabel(r"$B_z$ [G]") +plt.ylabel(r"$Bz$ [G]") plt.xlabel("z-axis [mm]") plt.legend() ############################# 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.xlabel("z-axis [mm]") plt.legend() ############################# 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.xlabel("z-axis [mm]") plt.legend() @@ -124,11 +124,11 @@ plt.legend() ################ 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_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.title("Curvature of B-field",fontsize = 30) plt.legend(loc='lower right') @@ -137,14 +137,14 @@ plt.legend(loc='lower right') ################# 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.xlabel("z-axis [mm]") plt.legend() ##################### 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.ylabel("relative deviation [‰]") plt.xlabel("z-axis [mm]") diff --git a/Benchmarking/comparison_HH_normal.py b/Benchmarking/comparison_HH_normal.py index d24bf98..8fc67fa 100644 --- a/Benchmarking/comparison_HH_normal.py +++ b/Benchmarking/comparison_HH_normal.py @@ -61,33 +61,33 @@ rel_diff_Bx_grad = (B_x_grad-B_x_sim_grad)/B_x_grad plt.figure(figsize=(20,18)) 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 ########################## 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-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.title("B-field" ,fontsize = 30) -plt.ylabel(r"$B_z$ [G]") +plt.ylabel(r"$Bz$ [G]") plt.xlabel("z-axis [mm]") plt.legend() ############################# 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.xlabel("z-axis [mm]") plt.legend() ############################# 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.xlabel("z-axis [mm]") plt.legend() @@ -97,11 +97,11 @@ plt.legend() ################ 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_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.title("Curvature of B-field",fontsize = 30) plt.legend(loc='lower right') @@ -110,14 +110,14 @@ plt.legend(loc='lower right') ################# 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.xlabel("z-axis [mm]") plt.legend() ##################### 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.ylabel("relative deviation [‰]") plt.xlabel("z-axis [mm]") diff --git a/Coil_geometry/00_FINAL_coil_geometry.py b/Coil_geometry/00_FINAL_coil_geometry.py index 637f38b..3dd7fce 100644 --- a/Coil_geometry/00_FINAL_coil_geometry.py +++ b/Coil_geometry/00_FINAL_coil_geometry.py @@ -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_d_min(47.15) -# HH_Coil.B_quick_plot(I) -# HH_Coil.B_curv_quick_plot(I) -# HH_Coil.plot_raster() +HH_Coil.B_quick_plot(I) +HH_Coil.B_curv_quick_plot(I) +HH_Coil.plot_raster() HH_Coil.print_info() D_max = 2 * (HH_Coil.get_R_inner()*1e3 - 1) * np.tan(np.radians(41.11)) diff --git a/Coil_geometry/AHH/01_geometry_fixed_AHH.py b/Coil_geometry/AHH/01_geometry_fixed_AHH.py index aa5155f..349735b 100644 --- a/Coil_geometry/AHH/01_geometry_fixed_AHH.py +++ b/Coil_geometry/AHH/01_geometry_fixed_AHH.py @@ -36,7 +36,7 @@ print(f"R = {R} ") AHH_Coil.cooling(I,30) 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_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.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(x,B_x, label = f"$B_x$, d = {d} mm") plt.plot(z,B_tot_x, label = "B_tot_x") @@ -64,7 +64,7 @@ plt.xlabel("z-axis / x-axis [mm]") plt.legend() 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.ylabel(r"$\nabla_i B_i [G/cm]$") diff --git a/Coil_geometry/AHH/02_geometry_fixed_search_distance_plots.py b/Coil_geometry/AHH/02_geometry_fixed_search_distance_plots.py index 078d9fc..cf04fc3 100644 --- a/Coil_geometry/AHH/02_geometry_fixed_search_distance_plots.py +++ b/Coil_geometry/AHH/02_geometry_fixed_search_distance_plots.py @@ -39,7 +39,7 @@ print(f"R = {R} ") AHH_Coil.cooling(I,30) 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_tot_z, B_tot_x = AHH_Coil.B_tot_along_axis(I, x, z) diff --git a/Coil_geometry/AHH/04_final_AHH_coil.py b/Coil_geometry/AHH/04_final_AHH_coil.py index b8c23df..6a9bfcc 100644 --- a/Coil_geometry/AHH/04_final_AHH_coil.py +++ b/Coil_geometry/AHH/04_final_AHH_coil.py @@ -49,7 +49,7 @@ print(f"R = {R} ") AHH_Coil.cooling(I,30) 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_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.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(x,B_x, label = f"$B_x$, d = {d} mm") #plt.plot(z,B_tot_x, label = "B_tot_x") @@ -77,7 +77,7 @@ plt.xlabel("z-axis / x-axis [mm]") plt.legend() 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.ylabel(r"$\nabla_i B_i [G/cm]$") diff --git a/Coil_geometry/AHH/05_comparison_opt_AHH_vs_not_cutting_optical_ax.py b/Coil_geometry/AHH/05_comparison_opt_AHH_vs_not_cutting_optical_ax.py index 2171105..c0c6c13 100644 --- a/Coil_geometry/AHH/05_comparison_opt_AHH_vs_not_cutting_optical_ax.py +++ b/Coil_geometry/AHH/05_comparison_opt_AHH_vs_not_cutting_optical_ax.py @@ -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) -#B_z = B[:,150,1] +#Bz = B[:,150,1] #B_x = B[150,:,0] #B_tot_z, B_tot_x = AHH_Coil.B_tot_along_axis(I, x, z) diff --git a/Coil_geometry/AHH/06_surface_calculation_AHH.py b/Coil_geometry/AHH/06_surface_calculation_AHH.py index 0baa2da..dfaee88 100644 --- a/Coil_geometry/AHH/06_surface_calculation_AHH.py +++ b/Coil_geometry/AHH/06_surface_calculation_AHH.py @@ -49,7 +49,7 @@ print(f"R = {R} ") AHH_Coil.cooling(I,30) 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_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.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(x,B_x, label = f"$B_x$, d = {d} mm") #plt.plot(z,B_tot_x, label = "B_tot_x") @@ -77,7 +77,7 @@ plt.xlabel("z-axis / x-axis [mm]") plt.legend() 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.ylabel(r"$\nabla_i B_i [G/cm]$") diff --git a/Coil_geometry/AHH/07_final_AHH_lowered height.py b/Coil_geometry/AHH/07_final_AHH_lowered height.py index d927ed4..0405318 100644 --- a/Coil_geometry/AHH/07_final_AHH_lowered height.py +++ b/Coil_geometry/AHH/07_final_AHH_lowered height.py @@ -49,7 +49,7 @@ print(f"R = {R} ") AHH_Coil.cooling(I,30) 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_tot_z, B_tot_x = AHH_Coil.B_tot_along_axis(I, x, z) diff --git a/Coil_geometry/Additional coils/00_Test_coil_around viewport.py b/Coil_geometry/Additional coils/00_Test_coil_around viewport.py new file mode 100644 index 0000000..dfe41d8 --- /dev/null +++ b/Coil_geometry/Additional coils/00_Test_coil_around viewport.py @@ -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() + diff --git a/Coil_geometry/HH/01_geometry_HH.py b/Coil_geometry/HH/01_geometry_HH.py index 3a58186..fd339f9 100644 --- a/Coil_geometry/HH/01_geometry_HH.py +++ b/Coil_geometry/HH/01_geometry_HH.py @@ -76,7 +76,7 @@ B_tot_curv = BC.BCoil.curv(B_tot, z) 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 @@ -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.title("B-field" ) -plt.ylabel(r"$B_z$ [G]") +plt.ylabel(r"$Bz$ [G]") plt.xlabel("z-axis [mm]") 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_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.title("Curvature of B-field") plt.legend(loc='lower right') @@ -109,7 +109,7 @@ plt.show() plt.figure(200,figsize=(15,13)) 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 @@ -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.title("B-field" ) -plt.ylabel(r"$B_z$ [G]") +plt.ylabel(r"$Bz$ [G]") plt.xlabel("z-axis [mm]") 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_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.title("Curvature of B-field") plt.legend()#bbox_to_anchor=(1.05, 1), loc='upper left') diff --git a/Coil_geometry/HH/02_geometry_AHH_Try_inside_of_HH_for_compensation.py b/Coil_geometry/HH/02_geometry_AHH_Try_inside_of_HH_for_compensation.py index 301cbb9..1f4cf9f 100644 --- a/Coil_geometry/HH/02_geometry_AHH_Try_inside_of_HH_for_compensation.py +++ b/Coil_geometry/HH/02_geometry_AHH_Try_inside_of_HH_for_compensation.py @@ -42,7 +42,7 @@ plt.suptitle("Anti Helmholtz coil field, I = 1 A, d = 54 mm, R = 37 mm ", fontsi #Field plot ########################## 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.xlim(-0.01,0.01) plt.title("B-field" ) @@ -52,7 +52,7 @@ plt.xlabel("z-axis / x-axis [mm]") plt.legend() 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.ylabel(r"$\nabla_i B_i [G/cm]$") diff --git a/Coil_geometry/HH/05_try_diff_geometry_HH1.py b/Coil_geometry/HH/05_try_diff_geometry_HH1.py index 77143d1..06e65ab 100644 --- a/Coil_geometry/HH/05_try_diff_geometry_HH1.py +++ b/Coil_geometry/HH/05_try_diff_geometry_HH1.py @@ -31,7 +31,7 @@ Bz, Bx = HH_Coil.B_field(I_current, x, z, raster = 10) Bz_curv = BC.BCoil.curv(Bz, z) 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") @@ -47,7 +47,7 @@ print(x[500]) # Bz_curv = BC.BCoil.curv(Bz, z) # 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") @@ -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.title("B-field" ) -plt.ylabel(r"$B_z$ [G]") +plt.ylabel(r"$Bz$ [G]") plt.xlabel("z-axis [mm]") 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.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.title("Curvature of B-field") plt.legend()#bbox_to_anchor=(1.05, 1), loc='upper left') diff --git a/Coil_geometry/HH/06_only_geometry_AHH.py b/Coil_geometry/HH/06_only_geometry_AHH.py index ebf81a0..2700d3c 100644 --- a/Coil_geometry/HH/06_only_geometry_AHH.py +++ b/Coil_geometry/HH/06_only_geometry_AHH.py @@ -28,9 +28,9 @@ AHH_Coil.set_R_outer(49.3) #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) plt.figure(1,figsize=(10,13)) @@ -50,7 +50,7 @@ AHH_Coil.print_info() AHH_Coil.cooling(10) 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_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.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.xlim(-0.01,0.01) plt.title("B-field" ) @@ -68,7 +68,7 @@ plt.xlabel("z-axis / x-axis [mm]") plt.legend() 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.ylabel(r"$\nabla_i B_i [G/cm]$") diff --git a/Coil_geometry/HH/07_02_testing B_tot.py b/Coil_geometry/HH/07_02_testing B_tot.py index 8b6b4ed..4b3c63f 100644 --- a/Coil_geometry/HH/07_02_testing B_tot.py +++ b/Coil_geometry/HH/07_02_testing B_tot.py @@ -74,7 +74,7 @@ plt.figure(300) #Field plot ########################## 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(z,B_tot_z, label = "New B_tot along z-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.title("B-field" ) -plt.ylabel(r"$B_z$ [G]") +plt.ylabel(r"$Bz$ [G]") plt.xlabel("z-axis [mm]") 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.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.title("Curvature of B-field") plt.legend()#bbox_to_anchor=(1.05, 1), loc='upper left') diff --git a/Coil_geometry/HH/08_plotting_07_HH_without_comp1.py b/Coil_geometry/HH/08_plotting_07_HH_without_comp1.py index 6bf3efe..2023320 100644 --- a/Coil_geometry/HH/08_plotting_07_HH_without_comp1.py +++ b/Coil_geometry/HH/08_plotting_07_HH_without_comp1.py @@ -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.title("B-field" ) -plt.ylabel(r"$B_z$ [G]") +plt.ylabel(r"$Bz$ [G]") plt.xlabel("z-axis [mm]") 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.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.title("Curvature of B-field") plt.legend()#bbox_to_anchor=(1.05, 1), loc='upper left') diff --git a/Coil_geometry/HH/09_geometry_HH_check_other_axis.py b/Coil_geometry/HH/09_geometry_HH_check_other_axis.py index e9fdff9..94588a8 100644 --- a/Coil_geometry/HH/09_geometry_HH_check_other_axis.py +++ b/Coil_geometry/HH/09_geometry_HH_check_other_axis.py @@ -38,12 +38,12 @@ HH_Coil.cooling(I_current) 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(1 μm) = {Bz[15001]}") -print(f"B_z(1 mm) = {Bz[16000]}") +print(f"Bz(1 μm) = {Bz[15001]}") +print(f"Bz(1 mm) = {Bz[16000]}") 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.title("B-field" ) -plt.ylabel(r"$B_z$ [G]") +plt.ylabel(r"$Bz$ [G]") plt.xlabel("z-axis [mm]") 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.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.title("Curvature of B-field") plt.legend()#bbox_to_anchor=(1.05, 1), loc='upper left') diff --git a/Coil_geometry/HH/10_comparison_Ilzh_small-bias.py b/Coil_geometry/HH/10_comparison_Ilzh_small-bias.py index 3b06965..b278fc2 100644 --- a/Coil_geometry/HH/10_comparison_Ilzh_small-bias.py +++ b/Coil_geometry/HH/10_comparison_Ilzh_small-bias.py @@ -32,12 +32,12 @@ Bz, Bx = HH_Coil.B_field(I_current, x, z, raster = 10) Bz_curv = BC.BCoil.curv(Bz, z) 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(1 μm) = {Bz[15001]}") -print(f"B_z(1 mm) = {Bz[16000]}") +print(f"Bz(1 μm) = {Bz[15001]}") +print(f"Bz(1 mm) = {Bz[16000]}") 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.title("B-field" ) -plt.ylabel(r"$B_z$ [G]") +plt.ylabel(r"$Bz$ [G]") plt.xlabel("z-axis [mm]") 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.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.title("Curvature of B-field") plt.legend()#bbox_to_anchor=(1.05, 1), loc='upper left') diff --git a/Coil_geometry/HH/11_Final_HH.py b/Coil_geometry/HH/11_Final_HH.py index 4917a8f..968848c 100644 --- a/Coil_geometry/HH/11_Final_HH.py +++ b/Coil_geometry/HH/11_Final_HH.py @@ -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) 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(1 μm) = {Bz[15001]}") -print(f"B_z(1 mm) = {Bz[16000]}") +print(f"Bz(1 μm) = {Bz[15001]}") +print(f"Bz(1 mm) = {Bz[16000]}") 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 ########################## 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(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") @@ -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.title("B-field" ) -plt.ylabel(r"$B_z$ [G]") +plt.ylabel(r"$Bz$ [G]") plt.xlabel("z-axis [mm]") 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.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.title("Curvature of B-field") plt.legend()#bbox_to_anchor=(1.05, 1), loc='upper left') diff --git a/Coil_geometry/HH/12_Final_Plotting.py b/Coil_geometry/HH/12_Final_Plotting.py index 8ff0030..5671c75 100644 --- a/Coil_geometry/HH/12_Final_Plotting.py +++ b/Coil_geometry/HH/12_Final_Plotting.py @@ -53,7 +53,7 @@ plt.figure(300) #Field plot ########################## 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(z,B_tot_z, label = r"$B_{{tot}}$ along z-axis") plt.plot(x,B_tot_x, label = r"$B_{{tot}}$ along x-axis") diff --git a/Noise/01_HH_noise.py b/Noise/01_HH_noise.py index f0b70ba..52643d7 100644 --- a/Noise/01_HH_noise.py +++ b/Noise/01_HH_noise.py @@ -32,12 +32,12 @@ Bz, Bx = HH_Coil.B_field(I_current, x, z, raster = 10) Bz_curv = BC.BCoil.curv(Bz, z) 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(1 μm) = {Bz[15001]}") -print(f"B_z(1 mm) = {Bz[16000]}") +print(f"Bz(1 μm) = {Bz[15001]}") +print(f"Bz(1 mm) = {Bz[16000]}") 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.title("B-field" ) -plt.ylabel(r"$B_z$ [G]") +plt.ylabel(r"$Bz$ [G]") plt.xlabel("z-axis [mm]") 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.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.title("Curvature of B-field") plt.legend()#bbox_to_anchor=(1.05, 1), loc='upper left') diff --git a/Test_class.py b/Test_class.py index f181124..de2ba2e 100644 --- a/Test_class.py +++ b/Test_class.py @@ -41,7 +41,7 @@ HH_Coil1 = BC.BCoil(HH, d_coils ,R_mid, layers, windings, wire_width, wire_heigh #HH_Coil1.print_info() #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) @@ -57,7 +57,7 @@ HH_Coil1.B_quick_plot(I, x, z) #Calculate gradients/curvature 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_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_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.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 ########################## 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-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.title("B-field" ,fontsize = 30) -plt.ylabel(r"$B_z$ [G]") +plt.ylabel(r"$Bz$ [G]") plt.xlabel("z-axis [mm]") plt.legend() ############################# 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.xlabel("z-axis [mm]") plt.legend() ############################# 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.xlabel("z-axis [mm]") plt.legend() @@ -113,11 +113,11 @@ plt.legend() ################ 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_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.title("Curvature of B-field",fontsize = 30) plt.legend(loc='lower right') @@ -126,14 +126,14 @@ plt.legend(loc='lower right') ################# 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.xlabel("z-axis [mm]") plt.legend() ##################### 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.ylabel("relative deviation [‰]") plt.xlabel("z-axis [mm]") @@ -146,7 +146,7 @@ plt.show() ############### relative deviation with averaging by the mean not the individual value ######################################## 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.ylabel("relative deviation [‰]") plt.xlabel("z-axis [mm]") diff --git a/Test_class1.py b/Test_class1.py index b621a41..fcad2b3 100644 --- a/Test_class1.py +++ b/Test_class1.py @@ -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.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 ########################## 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.xlim(-0.01,0.01) plt.title("B-field" ) -plt.ylabel(r"$B_z$ [G]") +plt.ylabel(r"$Bz$ [G]") plt.xlabel("z-axis [mm]") plt.legend() 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.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.title("Curvature of B-field") plt.legend(loc='lower right') diff --git a/src/B_field_calculation.py b/src/B_field_calculation.py index cc471e8..e6942df 100644 --- a/src/B_field_calculation.py +++ b/src/B_field_calculation.py @@ -41,7 +41,7 @@ def B_r_loop(I_current, R_loop, z_loc, r, z): return B_r 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""" z_start = (distance_coils/2 - windings * wire_height/2 + wire_height/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): - """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""" z_start = (distance_coils/2 - windings * wire_height/2 + wire_height/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 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""" z_start = (distance_coils/2 - windings * wire_height/2 + wire_height/2)*1e-3 R_start = (R_inner + wire_width/2 )*1e-3 diff --git a/src/coil_class.py b/src/coil_class.py index 96e0928..7aa1724 100644 --- a/src/coil_class.py +++ b/src/coil_class.py @@ -347,7 +347,7 @@ class BCoil: 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 """ @@ -461,7 +461,7 @@ class BCoil: 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_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, r_pos, -z_pos, x_SI, 0) @@ -578,7 +578,7 @@ class BCoil: B_x = BCoil.grad(B_x, x) 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.title("Gradient of B-field") plt.ylabel(r"B-field [G/cm]") @@ -614,25 +614,25 @@ class BCoil: plt.figure(100, figsize=(13, 10)) # 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 ########################## 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.xlim(-0.01,0.01) plt.title("B-field") - plt.ylabel(r"$B_z$ [G]") + plt.ylabel(r"$Bz$ [G]") plt.xlabel("z-axis [mm]") plt.legend() 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.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.title("Curvature of B-field") diff --git a/untitled0.py b/untitled0.py index 1a12761..a976d5a 100644 --- a/untitled0.py +++ b/untitled0.py @@ -9,15 +9,27 @@ import numpy as np def main(): wire_width = 0.568 + ins = 0.068 + print(2*wire_width) r_in = 45.92 + wire_width/2 + print(2*45.92) + print(r_in*3) d_in = r_in * 2 - r_2 = r_in + wire_width - r_3 = r_2 + wire_width - r = r_in + 4*wire_width - res = 2*r + for ll in range(0,8): + r = r_in + ll * wire_width + d = 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(np.pi * 2 *47.9) + res = [322.7,367.2] + +