Compare commits

..

No commits in common. "main" and "def9355f18050016f3538165c6d6b786bca8f6b0" have entirely different histories.

133 changed files with 2070 additions and 5693 deletions

63
.gitignore vendored
View File

@ -1,63 +0,0 @@
# Default ignored files
/shelf/
/workspace.xml
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
# Editor-based HTTP Client requests
/httpRequests/
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
#Gitfiles
.*
# C extensions
*.so
# Distribution / packaging
bin/
build/
develop-eggs/
dist/
eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
.tox/
.coverage
.cache
nosetests.xml
coverage.xml
# Translations
*.mo
# Mr Developer
.mr.developer.cfg
.project
.pydevproject
# Rope
.ropeproject
# Django stuff:
*.log
*.pot
# Sphinx documentation
docs/_build/

View File

@ -0,0 +1,8 @@
[codestyle]
indentation = True
edge_line = True
edge_line_columns = 79
[main]
version = 0.2.0

View File

@ -0,0 +1,5 @@
[codestyle]
indentation = True
edge_line = True
edge_line_columns = 79

View File

@ -0,0 +1,3 @@
[encoding]
text_encoding = utf-8

View File

@ -0,0 +1,4 @@
[vcs]
use_version_control = False
version_control_system =

View File

@ -0,0 +1,6 @@
[workspace]
restore_data_on_startup = True
save_data_on_exit = True
save_history = True
save_non_project_files = False

View File

@ -0,0 +1,6 @@
[encoding]
text_encoding = utf-8
[main]
version = 0.2.0

View File

@ -0,0 +1,7 @@
[vcs]
use_version_control = False
version_control_system =
[main]
version = 0.2.0

View File

@ -0,0 +1,10 @@
[workspace]
restore_data_on_startup = True
save_data_on_exit = True
save_history = True
save_non_project_files = False
[main]
version = 0.2.0
recent_files = ['comparison_HH_increased_resolution.py']

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 Bz along z-axis, comparison of simulations", fontsize=30) plt.suptitle("Helmholtz coil field B_z 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"$Bz$: Result via elliptic integrals") plt.plot(z,B_z,linestyle = "solid", label = r"$B_z$: 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"$Bz - B_{z, sim}$") plt.plot(z,(B_z-B_z_sim), label = r"$B_z - 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"$Bz$ [G]") plt.ylabel(r"$B_z$ [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"$Bz - B_{z, sim}$") plt.plot(z,(B_z-B_z_sim), label = r"$B_z - 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 = "$(Bz - B_{z, sim}) / Bz$") plt.plot(z,1000*rel_diff_Bz, label = "$(B_z - B_{z, sim}) / B_z$")
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 Bz$: Result via elliptic integrals") plt.plot(z,B_z_grad,linestyle = "solid", label = r"$\nabla_z^2 B_z$: 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 Bz - \nabla_z^2 B_{z, 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.ylabel(r"$\nabla_z^2 Bz [G/cm^2]$") plt.ylabel(r"$\nabla_z^2 B_z [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 Bz - \nabla_z^2 B_{z, 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.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 Bz - \nabla_z^2 B_{z, sim}) / \nabla_z^2 Bz$") 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.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 Bz - \nabla_z^2 B_{z, sim}) / mean(\nabla_z^2 Bz)$") 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.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"$Bz$: Result via elliptic integrals") plt.plot(z_2,B_z,linestyle = "solid", label = r"$B_z$: 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,(Bz-B_z_sim), label = r"$Bz - B_{z, sim}$") #plt.plot(z,(B_z-B_z_sim), label = r"$B_z - 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"$Bz$ [G]") plt.ylabel(r"$B_z$ [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 Bz$: Result via elliptic integrals") plt.plot(z_2,B_z_grad,linestyle = "solid", label = r"$\nabla_z^2 B_z$: 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 Bz - \nabla_z^2 B_{z, 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.ylabel(r"$\nabla_z^2 Bz [G/cm^2]$") plt.ylabel(r"$\nabla_z^2 B_z [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 Bz along z-axis, comparison of simulations", fontsize=30) plt.suptitle("Helmholtz coil field B_z 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"$Bz$: Result via elliptic integrals") plt.plot(z,B_z,linestyle = "solid", label = r"$B_z$: 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"$Bz - B_{z, sim}$") plt.plot(z,(B_z-B_z_sim), label = r"$B_z - 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"$Bz$ [G]") plt.ylabel(r"$B_z$ [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"$Bz - B_{z, sim}$") plt.plot(z,(B_z-B_z_sim), label = r"$B_z - 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 = "$(Bz - B_{z, sim}) / Bz$") plt.plot(z,1000*rel_diff_Bz, label = "$(B_z - B_{z, sim}) / B_z$")
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 Bz$: Result via elliptic integrals") plt.plot(z,B_z_grad,linestyle = "solid", label = r"$\nabla_z^2 B_z$: 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 Bz - \nabla_z^2 B_{z, 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.ylabel(r"$\nabla_z^2 Bz [G/cm^2]$") plt.ylabel(r"$\nabla_z^2 B_z [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 Bz - \nabla_z^2 B_{z, 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.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 Bz - \nabla_z^2 B_{z, sim}) / \nabla_z^2 Bz$") 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.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"$Bz$: Result via elliptic integrals") plt.plot(z_2,B_z,linestyle = "solid", label = r"$B_z$: 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,(Bz-B_z_sim), label = r"$Bz - B_{z, sim}$") #plt.plot(z,(B_z-B_z_sim), label = r"$B_z - 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"$Bz$ [G]") plt.ylabel(r"$B_z$ [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 Bz$: Result via elliptic integrals") plt.plot(z_2,B_z_grad,linestyle = "solid", label = r"$\nabla_z^2 B_z$: 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 Bz - \nabla_z^2 B_{z, 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.ylabel(r"$\nabla_z^2 Bz [G/cm^2]$") plt.ylabel(r"$\nabla_z^2 B_z [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 Bz along z-axis, comparison of simulations", fontsize=30) plt.suptitle("Helmholtz coil field B_z 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"$Bz$: Result via elliptic integrals") plt.plot(z,B_z,linestyle = "solid", label = r"$B_z$: 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"$Bz - B_{z, sim}$") plt.plot(z,(B_z-B_z_sim), label = r"$B_z - 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"$Bz$ [G]") plt.ylabel(r"$B_z$ [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"$Bz - B_{z, sim}$") plt.plot(z,(B_z-B_z_sim), label = r"$B_z - 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 = "$(Bz - B_{z, sim}) / Bz$") plt.plot(z,1000*rel_diff_Bz, label = "$(B_z - B_{z, sim}) / B_z$")
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 Bz$: Result via elliptic integrals") plt.plot(z,B_z_grad,linestyle = "solid", label = r"$\nabla_z^2 B_z$: 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 Bz - \nabla_z^2 B_{z, 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.ylabel(r"$\nabla_z^2 Bz [G/cm^2]$") plt.ylabel(r"$\nabla_z^2 B_z [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 Bz - \nabla_z^2 B_{z, 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.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 Bz - \nabla_z^2 B_{z, sim}) / \nabla_z^2 Bz$") 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.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

@ -38,7 +38,7 @@ wire_width = 1
wire_height = 2.6 wire_height = 2.6
B_z, B_x = bf.B_field(I, HH, R_inner, d_coils, layers, windings, wire_width, wire_height, x_m, z_m) B_z, B_x = bf.B_multiple(I,HH,R_inner,d_coils,layers,windings,wire_width, wire_height, x_m,z_m)
#B_test = B_field_ideal_AHH(layers*windings,I,R_inner*1e-3,d_coils*1e-3,z_m) #B_test = B_field_ideal_AHH(layers*windings,I,R_inner*1e-3,d_coils*1e-3,z_m)
#B_x = np.concatenate((-np.flip(B_r),B_r[1:len(B_r)])) #B_x = np.concatenate((-np.flip(B_r),B_r[1:len(B_r)]))
@ -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 Bz along z-axis, comparison of simulations", fontsize=30) plt.suptitle("Helmholtz coil field B_z 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"$Bz$: Result via elliptic integrals") plt.plot(z,B_z,linestyle = "solid", label = r"$B_z$: 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"$Bz - B_{z, sim}$") plt.plot(z,(B_z-B_z_sim), label = r"$B_z - 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"$Bz$ [G]") plt.ylabel(r"$B_z$ [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"$Bz - B_{z, sim}$") plt.plot(z,(B_z-B_z_sim), label = r"$B_z - 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 = "$(Bz - B_{z, sim}) / Bz$") plt.plot(z,1000*rel_diff_Bz, label = "$(B_z - B_{z, sim}) / B_z$")
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 Bz$: Result via elliptic integrals") plt.plot(z,B_z_grad,linestyle = "solid", label = r"$\nabla_z^2 B_z$: 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 Bz - \nabla_z^2 B_{z, 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.ylabel(r"$\nabla_z^2 Bz [G/cm^2]$") plt.ylabel(r"$\nabla_z^2 B_z [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 Bz - \nabla_z^2 B_{z, 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.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 Bz - \nabla_z^2 B_{z, sim}) / \nabla_z^2 Bz$") 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.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

@ -0,0 +1,6 @@
{
"cells": [],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 5
}

View File

@ -1,89 +0,0 @@
import matplotlib.pyplot as plt
import numpy as np
import matplotlib
#matplotlib.use('Qt5Agg')
from src import coil_class as BC
scale = 1000
lim = 1
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
Wires = [[0.45, 0.514],[0.475, 0.543],[0.5, 0.568]]
Wire_1 = Wires[2]
#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 = 1.33 # 64 / AHH_Coil.get_N() * 1.25
print(HH_Coil.resistance(20))
print(HH_Coil.induct_perry())
print(HH_Coil.resistance(190))
# set radius plus distance
HH_Coil.set_R_outer(50.5 - HH_Coil.get_tot_wire_width()*1e3)
HH_Coil.set_d_min(47.15)
print(f"current density = {60*I/(HH_Coil.get_coil_width() * HH_Coil.get_coil_height() * 1e6)}")
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))
print(D_max)
AHH_Coil = BC.BCoil(HH = -1, distance = 54, radius = 48, layers = HH_Coil.get_layers, windings=2 * HH_Coil.get_windings,
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)
AHH_Coil.set_R_inner(HH_Coil.get_R_inner() * 1e3)
AHH_Coil.set_d_max(D_max)
AHH_Coil.print_info()
print(f"AHH N = {AHH_Coil.get_N()}")
I_grad = I - 0.128 # 8 x 9#128 / AHH_Coil.get_N() * I
I_grad = I - 0.15 # 8 x 8
print(f"current @ 6G/cm: {I_grad} A")
AHH_Coil.B_grad_quick_plot(I_grad)
#Bz, Bx = AHH_Coil.B_field(I)
AHH_Coil.cooling(I_grad, 22.5)
#Bz, Bx = AHH_Coil.B_field(I_grad, x, z, raster = 7)
# Bz_grad = BC.BCoil.grad(Bz,z)
# Bx_grad = BC.BCoil.grad(Bx,x)
#AHH_Coil.B_quick_plot(I_grad)
#AHH_Coil.B_grad_quick_plot(I_grad)
#AHH_Coil.plot_raster(raster_value= 11)
HH_Coil.cooling(4, 40)
# zero = mu_it(0)
# print(f"Bz_grad({z[zero]}) = {Bz_grad[zero]} G/cm")
# mu = mu_it(1)
# mm = mu_it(1000)
# mid = mu_it(5000)
# outer = mu_it(15000)
# # Bz0 = Bz_grad[zero]
#
#
#
# print(f"Bz_grad({z[mu]} mm) - Bz_grad (0) = {Bz0 - Bz_grad[mu]}, relative = {(Bz0 - Bz_grad[mu])/Bz0}")
# print(f"Bz_grad({z[mm]} mm) - Bz_grad (0) = {Bz0 - Bz_grad[mm]}, relative = {(Bz0 - Bz_grad[mm])/Bz0}")
# print(f"Bz_grad({z[mid]} mm) - Bz_grad (0) = {Bz0 - Bz_grad[mid]}, relative = {(Bz0 - Bz_grad[mid])/Bz0}")
# print(f"Bz_grad({z[outer]} mm) - Bz_grad (0) = {Bz0 - Bz_grad[outer]}, relative = {(Bz0 - Bz_grad[outer])/Bz0}")

View File

@ -25,10 +25,10 @@ percentage = 0.05
absolut = 5 absolut = 5
diff = percentage*0.01*5+ absolut *1e-3 diff = percentage*0.01*5+ absolut *1e-3
print(diff) print(diff)
Bz1, Bx = HH_Coil.B_field(5, x, z) Bz1, Bx = HH_Coil.B_multiple(5, x, z)
Bz2, Bx = HH_Coil.B_field(5 + diff, x, z) Bz2, Bx = HH_Coil.B_multiple(5+ diff, x, z)
print(Bz2[1500]-Bz1[1500]) print(Bz2[1500]-Bz1[1500])
print(" ") print(" ")
@ -38,7 +38,7 @@ diff = percentage*0.01*5+ absolut *1e-3
print(diff) print(diff)
Bz2, Bx = HH_Coil.B_field(5 + diff, x, z) Bz2, Bx = HH_Coil.B_multiple(5+ diff, x, z)
print(Bz2[1500]-Bz1[1500]) print(Bz2[1500]-Bz1[1500])
print((Bz2[1500]-Bz1[1500])/Bz2[1500]) print((Bz2[1500]-Bz1[1500])/Bz2[1500])

View File

@ -1,32 +0,0 @@
import matplotlib.pyplot as plt
import numpy as np
import matplotlib
#matplotlib.use('Qt5Agg')
from src import coil_class as BC
scale = 1000
lim = 1
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
Wires = [[0.45, 0.514],[0.475, 0.543],[0.5, 0.568]]
Wire_1 = Wires[2]
#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)
R = HH_Coil.resistance(25)
I = 2
print(f"U ={I*R*2}")
print(f"resistance {R}")

View File

@ -40,7 +40,7 @@ HH_Coil_44 = BC.BCoil(HH, 44 ,44, 6, 2, wire_width = 1.7, wire_height= 2.6)
#Coil from first sketch #Coil from first sketch
HH_Coil_y = BC.BCoil(HH, 55.2 ,44, 6, 2, wire_width = 1.7, wire_height= 2.6) HH_Coil_y = BC.BCoil(HH, 55.2 ,44, 6, 2, wire_width = 1.7, wire_height= 2.6)
B_z_y, B_x_y = HH_Coil_y.B_field(6.5, x, z) B_z_y, B_x_y = HH_Coil_y.B_multiple(6.5,x,z)
B_z_y_curv = BC.BCoil.curv(B_z_y, z) B_z_y_curv = BC.BCoil.curv(B_z_y, z)
d_coils_2 = 55.2 d_coils_2 = 55.2
@ -53,15 +53,15 @@ HH_Coil_54.cooling(5)
#Compensation Coil #Compensation Coil
HH_Coil_78 = BC.BCoil(1,54,37,4, 4, 1,1) HH_Coil_78 = BC.BCoil(1,54,37,4, 4, 1,1)
#HH_Coil_44.B_quick_plot(I,x,z) #HH_Coil_44.Bz_plot_HH(I,x,z)
#HH_Coil_44.Bz_plot_HH_comp(HH_Coil_54,I,x,z) #HH_Coil_44.Bz_plot_HH_comp(HH_Coil_54,I,x,z)
B_z, B_x = HH_Coil_44.B_field(I, x, z) B_z, B_x = HH_Coil_44.B_multiple(I,x,z)
B_z_2, B_x_2 = HH_Coil_54.B_field(I, x, z) B_z_2, B_x_2 = HH_Coil_54.B_multiple(I,x,z)
B_z_3,B_x_3 = HH_Coil_78.B_field(-0.72, x, z) B_z_3,B_x_3 = HH_Coil_78.B_multiple(-0.72,x,z)
@ -76,7 +76,7 @@ B_tot_curv = BC.BCoil.curv(B_tot, z)
plt.figure(300) plt.figure(300)
plt.suptitle("Helmholtz coil field Bz along z-axis, comparison to field yesterday") plt.suptitle("Helmholtz coil field B_z 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"$Bz$ [G]") plt.ylabel(r"$B_z$ [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 Bz [G/cm^2]$") plt.ylabel(r"$\nabla_z^2 B_z [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 Bz along z-axis") plt.suptitle("Helmholtz coil field B_z 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"$Bz$ [G]") plt.ylabel(r"$B_z$ [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 Bz [G/cm^2]$") plt.ylabel(r"$\nabla_z^2 B_z [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

@ -26,14 +26,14 @@ HH_Coil_78 = BC.BCoil(-1,54,37,4, 4, 1,1)
B_z,B_x = HH_Coil_78.B_field(1, x, z) B_z,B_x = HH_Coil_78.B_multiple(1,x,z)
#B_x = np.concatenate((-np.flip(B_x),B_x)) #B_x = np.concatenate((-np.flip(B_x),B_x))
#x = np.concatenate((-np.flip(r),r)) #x = np.concatenate((-np.flip(r),r))
B_z_grad = BC.BCoil.grad(B_z, z) B_z_grad = BC.BCoil.Bgrad(B_z, z)
B_x_grad = BC.BCoil.grad(B_x, x) B_x_grad = BC.BCoil.Bgrad(B_x,x)
#plt.rcParams.update({'font.size': 15}) #plt.rcParams.update({'font.size': 15})
plt.suptitle("Anti Helmholtz coil field, I = 1 A, d = 54 mm, R = 37 mm ", fontsize = 30) plt.suptitle("Anti Helmholtz coil field, I = 1 A, d = 54 mm, R = 37 mm ", fontsize = 30)
@ -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"$Bz$, d = 54 mm, R = 37 mm") plt.plot(z,B_z,linestyle = "solid", label = r"$B_z$, 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 Bz$, d = 54 mm, R = 37 mm") plt.plot(z,B_z_grad,linestyle = "solid", label = r"$\nabla_z B_z$, 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

@ -0,0 +1,59 @@
# -*- coding: utf-8 -*-
"""
Created on Tue Aug 24 16:24:52 2021
@author: Joschka
"""
import matplotlib.pyplot as plt
import numpy as np
from src import B_field_calculation as bf
from src import coil_class as BC
from IPython import get_ipython
get_ipython().run_line_magic('matplotlib', 'qt')
#get_ipython().run_line_magic('matplotlib', 'inline')
x = np.linspace(-1, 1, 11)
z = np.linspace(-1, 1, 11)
I_current = 5*16
HH_Coil = HH_Coil_comp = BC.BCoil(HH = 1, distance = 54 ,radius = 37,layers = 1, windings = 1,wire_width = 8, wire_height = 8)
HH_Coil.set_R_outer(49.3)
HH_Coil.set_d_min(49.8)
HH_Coil.print_info()
Bz, Bx = HH_Coil.B_multiple(I_current,x,z,raster = 50)
Bz_curv = BC.BCoil.curv(Bz, z)
HH_Coil.cooling(I_current,30)
print(f"B_z(0) = {Bz[1]:.2f} G")
print(f"B_z_curvature(0) = {Bz_curv[1]:.4f} G/cm^2")
B = []
Curv = []
array_width = np.arange(0.2,11,0.1)
#array_width = [5.7]
for width in array_width:
height = 20/width
HH_Coil = HH_Coil_comp = BC.BCoil(HH = 1, distance = 54 ,radius = 37,layers = 1, windings = 1,wire_width = width, wire_height = height)
HH_Coil.set_R_outer(49.3)
HH_Coil.set_d_min(49.8)
#HH_Coil.print_info()
Bz, Bx = HH_Coil.B_multiple(I_current,x,z,raster = 30)
Bz_curv = BC.BCoil.curv(Bz, z)
HH_Coil.cooling(I_current,30)
B.append(Bz[5])
Curv.append(Bz_curv[5])
print(f"width = {width}mm, height = {height}mm")
print(f"B_z(0) = {Bz[5]:.2f} G")
print(f"B_z_curvature(0) = {Bz_curv[5]:.4f} G/cm^2")
plt.plot(array_width,Curv)
#plt.plot(array_width,B)
plt.ylabel("curvature")
plt.xlabel("total width [mm]")
plt.show()

View File

@ -27,27 +27,27 @@ HH_Coil.set_R_outer(49.3)
HH_Coil.set_d_min(49.8) HH_Coil.set_d_min(49.8)
HH_Coil.print_info() HH_Coil.print_info()
Bz, Bx = HH_Coil.B_field(I_current, x, z, raster = 10) Bz, Bx = HH_Coil.B_multiple(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"Bz(0) = {Bz[150]:.2f} G") print(f"B_z(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")
print(x[500]) print(x[500])
# I_current = 5*16 # I_current = 5*16
# AHH_Coil = BC.BCoil(HH = 1, distance = 54 ,radius = 48 , layers = 1, windings = 1, wire_height = 10, wire_width = 6) # HH_Coil = BC.BCoil(HH = 1, distance = 54 ,radius = 48 , layers = 1, windings = 1, wire_height = 10, wire_width = 6)
# AHH_Coil.set_R_outer(49.3) # HH_Coil.set_R_outer(49.3)
# AHH_Coil.set_d_min(49.8) # HH_Coil.set_d_min(49.8)
# AHH_Coil.print_info() # HH_Coil.print_info()
# Bz, Bx = AHH_Coil.B_field(I_current,x,z,raster = 50) # Bz, Bx = HH_Coil.B_multiple(I_current,x,z,raster = 50)
# Bz_curv = BC.BCoil.curv(Bz, z) # Bz_curv = BC.BCoil.curv(Bz, z)
# AHH_Coil.cooling(I_current) # HH_Coil.cooling(I_current)
# print(f"Bz(0) = {Bz[150]:.2f} G") # print(f"B_z(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")
@ -57,7 +57,7 @@ HH_Coil_comp = BC.BCoil(HH = 1, distance = 54 ,radius = 37, layers = 4, windings
#HH_Coil_44.B_quick_plot(I,x,z) #HH_Coil_44.Bz_plot_HH(I,x,z)
#HH_Coil_44.Bz_plot_HH_comp(HH_Coil_54,I,x,z) #HH_Coil_44.Bz_plot_HH_comp(HH_Coil_54,I,x,z)
@ -65,8 +65,8 @@ I_HH = 5
I_comp = -1.4 I_comp = -1.4
#calculate field #calculate field
B_z, B_x = HH_Coil.B_field(I_HH, x, z) B_z, B_x = HH_Coil.B_multiple(I_HH,x,z)
B_z_comp,B_x_comp = HH_Coil_comp.B_field(I_comp, x, z) B_z_comp,B_x_comp = HH_Coil_comp.B_multiple(I_comp,x,z)
#Calculate curvature #Calculate curvature
B_z_curv = BC.BCoil.curv(B_z, z) B_z_curv = BC.BCoil.curv(B_z, z)
@ -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"$Bz$ [G]") plt.ylabel(r"$B_z$ [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 Bz [G/cm^2]$") plt.ylabel(r"$\nabla_z^2 B_z [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,10 +28,10 @@ AHH_Coil.set_R_outer(49.3)
#AHH_Coil.print_info() #AHH_Coil.print_info()
#Bz,B_x = AHH_Coil.B_field(1,x,z) #B_z,B_x = AHH_Coil.B_multiple(1,x,z)
#B_z_grad = BC.BCoil.grad(Bz, z) #B_z_grad = BC.BCoil.Bgrad(B_z, z)
#B_x_grad = BC.BCoil.grad(B_x,x) #B_x_grad = BC.BCoil.Bgrad(B_x,x)
plt.figure(1,figsize=(10,13)) plt.figure(1,figsize=(10,13))
#plt.rcParams.update({'font.size': 15}) #plt.rcParams.update({'font.size': 15})
@ -49,16 +49,16 @@ AHH_Coil.print_info()
#B = AHH_Coil.B_multiple_3d(10, x,z,raster=2) #B = AHH_Coil.B_multiple_3d(10, x,z,raster=2)
AHH_Coil.cooling(10) AHH_Coil.cooling(10)
B_z,B_x = AHH_Coil.B_field(10, x, z) B_z,B_x = AHH_Coil.B_multiple(10,x,z)
#Bz = B[:,150,1] #B_z = 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.Bgrad(B_z, z)
B_x_grad = BC.BCoil.grad(B_x, x) B_x_grad = BC.BCoil.Bgrad(B_x,x)
plt.subplot(2,1,1) plt.subplot(2,1,1)
plt.plot(z,B_z,linestyle = "solid", label = f"$Bz$, d = {d} mm") plt.plot(z,B_z,linestyle = "solid", label = f"$B_z$, 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 Bz$") plt.plot(z,B_z_grad,linestyle = "solid", label = r"$\nabla_z B_z$")
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

@ -30,7 +30,7 @@ HH_Coil.set_R_outer(49.3)
HH_Coil.set_d_min(49.8) HH_Coil.set_d_min(49.8)
HH_Coil.print_info() HH_Coil.print_info()
#Bz, Bx = AHH_Coil.B_field(I_current,x,z,raster = 10) #Bz, Bx = HH_Coil.B_multiple(I_current,x,z,raster = 10)
B_tot_z, B_tot_x = HH_Coil.B_tot_along_axis(I_current, x, z,raster = 8) B_tot_z, B_tot_x = HH_Coil.B_tot_along_axis(I_current, x, z,raster = 8)
Bz_curv = BC.BCoil.curv(B_tot_z, z) Bz_curv = BC.BCoil.curv(B_tot_z, z)
@ -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"$Bz along z-axis") #plt.plot(z,B_totz,linestyle = "solid", label = r"$B_z 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"$Bz$ [G]") plt.ylabel(r"$B_z$ [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 Bz [G/cm^2]$") plt.ylabel(r"$\nabla_z^2 B_z [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

@ -27,7 +27,7 @@ HH_Coil.set_R_outer(49.3)
HH_Coil.set_d_min(49.8) HH_Coil.set_d_min(49.8)
HH_Coil.print_info() HH_Coil.print_info()
Bz, Bx = HH_Coil.B_field(I_current, x, z, raster = 10) Bz, Bx = HH_Coil.B_multiple(I_current,x,z,raster = 10)
Bz_curv = BC.BCoil.curv(Bz, z) Bz_curv = BC.BCoil.curv(Bz, z)
HH_Coil.cooling(I_current) HH_Coil.cooling(I_current)
@ -35,7 +35,7 @@ HH_Coil.cooling(I_current)
I_HH = 5 I_HH = 5
#calculate field #calculate field
B_z, B_x = HH_Coil.B_field(I_HH, x, z) B_z, B_x = HH_Coil.B_multiple(I_HH,x,z)
#Calculate curvature #Calculate curvature
B_z_curv = BC.BCoil.curv(B_z, z) B_z_curv = BC.BCoil.curv(B_z, z)
@ -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"$Bz$ [G]") plt.ylabel(r"$B_z$ [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 Bz [G/cm^2]$") plt.ylabel(r"$\nabla_z^2 B_z [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,7 +28,7 @@ HH_Coil.set_R_outer(49.3)
HH_Coil.set_d_min(49.8) HH_Coil.set_d_min(49.8)
HH_Coil.print_info() HH_Coil.print_info()
Bz, Bx = HH_Coil.B_field(I_current, x, z, raster = 4) Bz, Bx = HH_Coil.B_multiple(I_current,x,z,raster = 4)
Bz_curv = BC.BCoil.curv(Bz, z) Bz_curv = BC.BCoil.curv(Bz, z)
B = HH_Coil.B_multiple_3d(I_current, x, z,raster = 2) B = HH_Coil.B_multiple_3d(I_current, x, z,raster = 2)
@ -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"Bz(0) = {Bz[15000]} G") print(f"B_z(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"Bz(1 ÎĽm) = {Bz[15001]}") print(f"B_z(1 ÎĽm) = {Bz[15001]}")
print(f"Bz(1 mm) = {Bz[16000]}") 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 1 ÎĽm: {Bz[15001] - Bz[15000]}, relative: {(Bz[15001] - Bz[15000])/Bz[15000]}")
@ -54,7 +54,7 @@ print(f"Diff B 1 mm: {Bz[16000] - Bz[15000]}, relative: {(Bz[16000] - Bz[15000])
I_HH = 5 I_HH = 5
#calculate field #calculate field
B_z, B_x = HH_Coil.B_field(I_HH, x, z) B_z, B_x = HH_Coil.B_multiple(I_HH,x,z)
#Calculate curvature #Calculate curvature
B_z_curv = BC.BCoil.curv(B_z, z) B_z_curv = BC.BCoil.curv(B_z, z)
@ -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"$Bz$ [G]") plt.ylabel(r"$B_z$ [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 Bz [G/cm^2]$") plt.ylabel(r"$\nabla_z^2 B_z [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,16 +28,16 @@ HH_Coil.set_R_inner(40.5)
HH_Coil.print_info() HH_Coil.print_info()
Bz, Bx = HH_Coil.B_field(I_current, x, z, raster = 10) Bz, Bx = HH_Coil.B_multiple(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"Bz(0) = {Bz[15000]} G") print(f"B_z(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"Bz(1 ÎĽm) = {Bz[15001]}") print(f"B_z(1 ÎĽm) = {Bz[15001]}")
print(f"Bz(1 mm) = {Bz[16000]}") 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 1 ÎĽm: {Bz[15001] - Bz[15000]}, relative: {(Bz[15001] - Bz[15000])/Bz[15000]}")
@ -51,7 +51,7 @@ print(f"Diff B 0.5 mm: {Bz[15500] - Bz[15000]}, relative: {(Bz[15500] - Bz[15000
I_HH = 5 I_HH = 5
#calculate field #calculate field
B_z, B_x = HH_Coil.B_field(I_HH, x, z) B_z, B_x = HH_Coil.B_multiple(I_HH,x,z)
#Calculate curvature #Calculate curvature
B_z_curv = BC.BCoil.curv(B_z, z) B_z_curv = BC.BCoil.curv(B_z, z)
@ -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"$Bz$ [G]") plt.ylabel(r"$B_z$ [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 Bz [G/cm^2]$") plt.ylabel(r"$\nabla_z^2 B_z [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

@ -12,8 +12,8 @@ import numpy as np
from src import coil_class as BC from src import coil_class as BC
#from IPython import get_ipython from IPython import get_ipython
#get_ipython().run_line_magic('matplotlib', 'qt') get_ipython().run_line_magic('matplotlib', 'qt')
#get_ipython().run_line_magic('matplotlib', 'inline') #get_ipython().run_line_magic('matplotlib', 'inline')
#set up axis #set up axis
@ -21,55 +21,38 @@ x = np.linspace(-15, 15, 30001)
z = np.linspace(-15, 15, 30001) z = np.linspace(-15, 15, 30001)
# New coil #New coil
Wire_1 = [0.5, 0.568] I_current = 10
#Wire_1 = [0.45, 0.514] HH_Coil = BC.BCoil(HH = 1, distance = 54 ,radius = 48 , layers = 4, windings = 2, wire_height = 2, wire_width = 1, windings_spacing=0.25, layers_spacing = 0.25)
#I_current = 0.94 HH_Coil.set_R_inner(44.5)
HH_Coil = BC.BCoil(HH = 1, distance = 54, radius = 48, layers = 8, windings = 8, wire_height = 0.5, HH_Coil.set_d_min(48.8)
wire_width = 0.5, insulation_thickness = (0.546-0.5)/2, is_round = True, print(f"height = {HH_Coil.get_coil_height()}")
winding_scheme= 2)
HH_Coil.set_R_inner(45.6)
HH_Coil.set_d_min(2*24.075)
HH_Coil.print_info()
R = HH_Coil.resistance(22.5)
print(f"U = {1 * R}")
I_current = 64 / HH_Coil.get_N() * 1.25
# 0.4 to get from +-30300
HH_Coil.print_info() HH_Coil.print_info()
#Bz, Bx = AHH_Coil.B_field(I_current, x, z, raster = 7) Bz, Bx = HH_Coil.B_multiple(I_current,x,z,raster = 10)
B_tot_z, B_tot_x = HH_Coil.B_multiple(I_current, x, z,raster = 10)
Bz, B_x_tot = HH_Coil.B_tot_along_axis(I_current, x, z, raster = 7)
Bz_curv = BC.BCoil.curv(Bz, z) Bz_curv = BC.BCoil.curv(Bz, z)
#AHH_Coil.cooling(I_current,28) HH_Coil.cooling(I_current,28)
print(f"Bz(0) = {Bz[15000]} G") 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_curvature(0) = {Bz_curv[15000]:.10f} G/cm^2")
#print(f"Bz(1 ÎĽm) = {Bz[15001]}") print(f"B_z(1 ÎĽm) = {Bz[15001]}")
#print(f"Bz(1 mm) = {Bz[16000]}") 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 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 1 mm: {Bz[16000] - Bz[15000]}, relative: {(Bz[16000] - Bz[15000])/Bz[15000]}")
print(f"Diff B 0.5 mm: {Bz[15500] - Bz[15000]}, relative: {(Bz[15500] - Bz[15000])/Bz[15000]}")
# %%
HH_Coil.B_quality()
#print(f"Diff B +/- 15 mm: {Bz[30000] - Bz[15000]}, relative: {(Bz[30000] - Bz[15000])/Bz[15000]}")
"""
plt.figure(300) plt.figure(300)
@ -78,7 +61,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"$Bz along z-axis") plt.plot(z,Bz,linestyle = "solid", label = r"$B_z 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")
@ -87,7 +70,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"$Bz$ [G]") plt.ylabel(r"$B_z$ [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')
@ -97,7 +80,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 Bz [G/cm^2]$") plt.ylabel(r"$\nabla_z^2 B_z [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')
@ -105,7 +88,7 @@ plt.legend()#bbox_to_anchor=(1.05, 1), loc='upper left')
#plt.savefig("output/first_compensation_idea.png") #plt.savefig("output/first_compensation_idea.png")
plt.show() plt.show()
"""

View File

@ -13,7 +13,7 @@ import numpy as np
from src import coil_class as BC from src import coil_class as BC
from IPython import get_ipython from IPython import get_ipython
#get_ipython().run_line_magic('matplotlib', 'qt') get_ipython().run_line_magic('matplotlib', 'qt')
#get_ipython().run_line_magic('matplotlib', 'inline') #get_ipython().run_line_magic('matplotlib', 'inline')
#set up axis #set up axis
@ -25,19 +25,15 @@ z = np.linspace(-5, 5, axis)
#New coil #New coil
I_current = 10 I_current = 10
HH_Coil = BC.BCoil(HH = 1, distance = 54 ,radius = 48 , layers = 4, windings = 2, wire_height = 2, wire_width = 1, insulation_thickness= 0.1) HH_Coil = BC.BCoil(HH = 1, distance = 54 ,radius = 48 , layers = 4, windings = 2, wire_height = 2, wire_width = 1, windings_spacing=0.25, layers_spacing = 0.25)
HH_Coil.set_R_inner(44.5) HH_Coil.set_R_inner(44.5)
HH_Coil.set_d_min(48.8) HH_Coil.set_d_min(48.8)
HH_Coil = BC.BCoil(HH = 1, distance = 54, radius = 48, layers = 8, windings = 8, wire_height = 0.4, wire_width = 0.4, insulation_thickness= 0.1, is_round = False, winding_scheme= False)
HH_Coil.set_R_outer(49.3)
HH_Coil.set_d_min(49.8)
print(HH_Coil.resistance(22)) print(HH_Coil.resistance(22))
print(HH_Coil.induct_perry()) print(HH_Coil.induct_perry())
HH_Coil.print_info() HH_Coil.print_info()
#Bz, Bx = AHH_Coil.B_field(I_current,x,z,raster = 10) #Bz, Bx = HH_Coil.B_multiple(I_current,x,z,raster = 10)
B_tot_z, B_tot_x = HH_Coil.B_tot_along_axis(I_current, x, z,raster = 8) B_tot_z, B_tot_x = HH_Coil.B_tot_along_axis(I_current, x, z,raster = 8)
Bz_curv = BC.BCoil.curv(B_tot_z, z) Bz_curv = BC.BCoil.curv(B_tot_z, z)
@ -53,7 +49,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"$Bz along z-axis") #plt.plot(z,B_totz,linestyle = "solid", label = r"$B_z 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

@ -1,85 +0,0 @@
import matplotlib.pyplot as plt
import numpy as np
import matplotlib
#matplotlib.use('Qt5Agg')
from src import coil_class as BC
scale = 1000
lim = 1
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
Wires = [[0.45, 0.514],[0.475, 0.543],[0.5, 0.568]]
Wire_1 = Wires[2]
#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 = 64 / HH_Coil.get_N() * 1.25
# set radius plus distance
#AHH_Coil.set_R_outer(50.5 - AHH_Coil.get_tot_wire_width()*1e3)
HH_Coil.set_R_inner(45.6)
HH_Coil.set_d_min(45.8+2*0.8)
# AHH_Coil.B_quick_plot(I)
# AHH_Coil.B_curv_quick_plot(I)
# AHH_Coil.plot_raster()
HH_Coil.print_info()
D_max = 2 * (HH_Coil.get_R_inner()*1e3 - 1) * np.tan(np.radians(41.11))
print(D_max)
AHH_Coil = BC.BCoil(HH = -1, distance = 54, radius = 48, layers = HH_Coil.get_layers, windings=2 * HH_Coil.get_windings,
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)
AHH_Coil.set_R_inner(HH_Coil.get_R_inner() * 1e3)
AHH_Coil.set_d_max(D_max)
AHH_Coil.print_info()
print(f"AHH N = {AHH_Coil.get_N()}")
I_grad = I - 0.128 # 8 x 9#128 / AHH_Coil.get_N() * I
I_grad = I - 0.15 # 8 x 8
print(f"current @ 6G/cm: {I_grad} A")
AHH_Coil.B_grad_quick_plot(I_grad)
#Bz, Bx = AHH_Coil.B_field(I)
AHH_Coil.cooling(I_grad, 22.5)
#Bz, Bx = AHH_Coil.B_field(I_grad, x, z, raster = 7)
# Bz_grad = BC.BCoil.grad(Bz,z)
# Bx_grad = BC.BCoil.grad(Bx,x)
#AHH_Coil.B_quick_plot(I_grad)
#AHH_Coil.B_grad_quick_plot(I_grad)
AHH_Coil.plot_raster(raster_value= 11)
AHH_Coil.plot_3d(I,50,50)
# zero = mu_it(0)
# print(f"Bz_grad({z[zero]}) = {Bz_grad[zero]} G/cm")
# mu = mu_it(1)
# mm = mu_it(1000)
# mid = mu_it(5000)
# outer = mu_it(15000)
# # Bz0 = Bz_grad[zero]
#
#
#
# print(f"Bz_grad({z[mu]} mm) - Bz_grad (0) = {Bz0 - Bz_grad[mu]}, relative = {(Bz0 - Bz_grad[mu])/Bz0}")
# print(f"Bz_grad({z[mm]} mm) - Bz_grad (0) = {Bz0 - Bz_grad[mm]}, relative = {(Bz0 - Bz_grad[mm])/Bz0}")
# print(f"Bz_grad({z[mid]} mm) - Bz_grad (0) = {Bz0 - Bz_grad[mid]}, relative = {(Bz0 - Bz_grad[mid])/Bz0}")
# print(f"Bz_grad({z[outer]} mm) - Bz_grad (0) = {Bz0 - Bz_grad[outer]}, relative = {(Bz0 - Bz_grad[outer])/Bz0}")

View File

@ -1,81 +0,0 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "672091c7",
"metadata": {},
"outputs": [],
"source": [
"# -*- coding: utf-8 -*-\n",
"\"\"\"\n",
"Created on Tue Aug 24 16:24:52 2021\n",
"\n",
"@author: Joschka\n",
"\"\"\"\n",
"\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"import sys\n",
"sys.path.insert(0,'..\\src')\n",
"\n",
"import coil_class_jupyter as BC\n",
"\n",
"#from IPython import get_ipython\n",
"#get_ipython().run_line_magic('matplotlib', 'qt')\n",
"#get_ipython().run_line_magic('matplotlib', 'inline')\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "d3a46f0f",
"metadata": {},
"outputs": [],
"source": [
"#set up axis\n",
"x = np.linspace(-50, 50, 301)\n",
"z = np.linspace(-50, 50, 301)\n",
"\n",
"#New coil\n",
"HH_Coil = BC.BCoil(HH = 1, distance = 54 ,radius = 48 , layers = 4, windings = 4, wire_height = 1, wire_width = 1)\n",
"\n",
"#Compensation Coil\n",
"HH_Coil_comp = BC.BCoil(HH = 1, distance = 54 ,radius = 37, layers = 4, windings = 4,wire_height = 1, wire_width = 1)\n",
"\n",
"\n",
"\n",
"#HH_Coil_44.B_quick_plot(I,x,z)\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "5eef49ab",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.11"
}
},
"nbformat": 4,
"nbformat_minor": 5
}

View File

@ -1,72 +0,0 @@
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 = [0.5, 0.568]
#I_current = 0.94
HH_Coil = BC.BCoil(HH = 1, distance = 54, radius = 48, layers = 16, windings = 16, 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 = 2
# 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.print_info()
#AHH_Coil.B_curv_quick_plot(I_current)
#AHH_Coil.plot_raster()

View File

@ -1,35 +0,0 @@
"""
Created on 11.11.21
@author: Joschka
"""
import numpy as np
import matplotlib.pyplot as plt
from src import coil_class as BC
from src import physical_constants as cs
import logging as log
log.basicConfig(level=log.DEBUG, format='%(message)s')
def main():
AHH_Coil = BC.BCoil(HH=-1, distance=69.313, radius=47, layers=8, windings=16,
wire_height=0.5, wire_width=0.5, insulation_thickness=0.068/2,
is_round=True, winding_scheme=2)
# for I_current in np.arange(0.38,1,0.0001):
# print(I_current)
# Bx = AHH_Coil.max_gradient(I_current)
# if np.abs(Bx) >= 1:
# print(I_current)
# break
I = 0.3804
AHH_Coil.max_gradient(0.9 * I)
AHH_Coil.max_gradient(I)
AHH_Coil.max_gradient(1.1 * I)
AHH_Coil.max_gradient(1.2 * I)
if __name__ == '__main__':
main()

View File

@ -1,96 +0,0 @@
"""
Created on 11.11.21
@author: Joschka
"""
import numpy as np
import matplotlib.pyplot as plt
from src import coil_class as BC
from src import physical_constants as cs
import logging as log
import time
log.basicConfig(level=log.DEBUG, format='%(message)s')
def main():
AHH_Coil = BC.BCoil(HH=-1, distance=69.313, radius=47, layers=8, windings=16,
wire_height=0.5, wire_width=0.5, insulation_thickness=0.068/2,
is_round=True, winding_scheme=2)
x, z = BC.BCoil.make_axis(50, 5)
I_current = 0.3804
# print(BC.BCoil._BCoil__B_z_loop(I_current = I, r_loop = 1, z_loop = 1, r_pos = 0, z_pos = 0.1)
# - BC.BCoil._BCoil__B_z_loop(I_current = I, r_loop = 1, z_loop = -1, r_pos = 0, z_pos = 0.1))
# print(BC.BCoil._BCoil__B_z_loop(I_current=I, r_loop=1, z_loop=1, r_pos=0, z_pos= -0.1)
# - BC.BCoil._BCoil__B_z_loop(I_current=I, r_loop=1, z_loop=-1, r_pos=0, z_pos=-0.1))
step = 5
xlim_mm = 30
xlim = int(xlim_mm/step) + 1
ylim_mm = 30
ylim = int(ylim_mm/step) + 1
zlim_mm = 20
zlim = int(zlim_mm/step) + 1
B_quarter = np.zeros((xlim, ylim, zlim, 2))
#print(B_quarter)
x = np.linspace(0,xlim_mm,xlim) * 1e-3
y = np.linspace(0,ylim_mm,ylim) * 1e-3
z = np.linspace(0,zlim_mm,zlim) * 1e-3
calc_raster = AHH_Coil.full_raster(1)
rastering_value = len(calc_raster[0])
I_current /= rastering_value
for wire in range(0,AHH_Coil.get_N()):
for ii in range(0,rastering_value):
# extract position information out of raster
z_pos = calc_raster[wire, ii, 0]
r_pos = calc_raster[wire, ii, 1]
for xx in range(0,xlim):
for yy in range(0,ylim):
r = np.sqrt(x[xx]**2 + y[yy]**2)
# calculate z-component at x,y
B_quarter[xx, yy, :, 1] += BC.BCoil._BCoil__B_z_loop(I_current, r_pos, z_pos, r, z) \
+ BC.BCoil._BCoil__B_z_loop(AHH_Coil.HH * I_current, r_pos, -z_pos, r, z)
if r == 0:
continue
# calculate r-component at x, y
B_quarter[xx, yy, :, 0] += BC.BCoil._BCoil__B_r_loop(I_current, r_pos, z_pos, r, z) \
+ BC.BCoil._BCoil__B_r_loop(AHH_Coil.HH * I_current, r_pos, -z_pos, r, z)
np.save('output/B_quarter_step_5.npy', B_quarter)
#B_tot = np.zeros(((2 * xlim) - 1, (2 * ylim) - 1, (2 * zlim)-1, 2))
#AHH_Coil.B_quick_plot(5,50)
#AHH_Coil.B_grad_quick_plot(5,50)
# Bz, Bx = AHH_Coil.B_field(I_current, x, z)
# B_tot_z, B_tot_x = AHH_Coil.B_field(I_current, x, z)
if __name__ == '__main__':
main()

View File

@ -1,93 +0,0 @@
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from src import coil_class as BC
from src import physical_constants as cs
import logging as log
def main():
AHH_Coil = BC.BCoil(HH=-1, distance=69.313, radius=47, layers=8, windings=16,
wire_height=0.5, wire_width=0.5, insulation_thickness=0.068 / 2,
is_round=True, winding_scheme=2)
step = 0.05
xlim_mm = 30
xlim = int(xlim_mm/step) + 1
ylim_mm = 30
ylim = int(ylim_mm/step) + 1
zlim_mm = 20
zlim = int(zlim_mm/step) + 1
# x = np.linspace(0,xlim_mm,xlim) * 1e-3
# y = np.linspace(0,ylim_mm,ylim) * 1e-3
# z = np.linspace(0,zlim_mm,zlim) * 1e-3
x = np.linspace(-xlim_mm, xlim_mm, 2 *xlim - 1) * 1e-3
y = np.linspace(-ylim_mm, ylim_mm, 2 *ylim - 1) * 1e-3
z = np.linspace(-zlim_mm, zlim_mm, 2 *zlim - 1) * 1e-3
b_raw = np.load('output/final/b_cart_1Gcm.npy')
#b_raw = np.load('output/b_cart_1_step_5.npy')
#b_raw = np.load('output/b_full_test.npy')
b_plot = np.swapaxes(b_raw,0,1) # Meshgrid uses different order of axis (y,x,z)
# x_m, z_m = np.meshgrid(x, z)
#
# plt.figure(34)
#
# plt.quiver(x_m,z_m,np.transpose(b_plot[0, :, :, 0]), np.transpose(b_plot[0, :, :, 2]))
# plt.xlabel("x-axis [mm]")
# plt.ylabel("z-axis [mm]")
# plt.title("x-z plane")
# plt.show()
#
# x_m, y_m = np.meshgrid(x, y)
#
# plt.figure(35)
#
# plt.quiver(x_m, y_m, b_plot[:, :, 0, 0], b_plot[:, :, 0, 1])
# plt.xlabel("x-axis [mm]")
# plt.ylabel("y-axis [mm]")
# plt.title("x-y plane")
# plt.show()
#
# y_m, z_m = np.meshgrid(y, z)
#
# plt.figure(36)
#
# plt.quiver(y_m, z_m, np.transpose(b_plot[0, :, :, 1]), np.transpose(b_plot[0, :, :, 2]))
# plt.xlabel("y-axis [mm]")
# plt.ylabel("z-axis [mm]")
# plt.title("y-z plane")
# plt.show()
x_m, y_m, z_m = np.meshgrid(x, y, z)
print(np.shape(x_m))
print(np.shape(b_plot))
fig = plt.figure(37)
ax = fig.gca(projection = '3d')
#print(b_plot[:, :, :, 0])
#print(b_plot[:, 0, :, 0])
scaling = 0.0001
ax.quiver(x_m, y_m, z_m, scaling * b_plot[:, :, :, 0], scaling * b_plot[:, :, :, 1], scaling * b_plot[:, :, :, 2])
plt.xlabel("x-axis [mm]")
plt.ylabel("y-axis [mm]")
#plt.zlabel("z-axis [mm]")
#plt.title("full 3d")
plt.show()
# AHH_Coil.B_quick_plot(5,abs = False)
#AHH_Coil.plot_3d(5,30,20)
if __name__ == '__main__':
main()

View File

@ -1,75 +0,0 @@
"""
Created on 11.11.21
@author: Joschka
"""
import numpy as np
import matplotlib.pyplot as plt
from src import coil_class as BC
from src import physical_constants as cs
import logging as log
def main():
step = 5
xlim_mm = 30
xlim = int(xlim_mm / step) + 1
print(xlim)
ylim_mm = 30
ylim = int(ylim_mm / step) + 1
zlim_mm = 20
zlim = int(zlim_mm / step) + 1
x = np.linspace(0, xlim_mm, xlim) * 1e-3
y = np.linspace(0, ylim_mm, ylim) * 1e-3
z = np.linspace(0, zlim_mm, zlim) * 1e-3
b_qu_polar = np.load('output/final/B_quarter_step_300_1Gcm.npy')
# print(f"shape of B_quarter = {np.shape(b_qu_polar)}")
shape = np.shape(b_qu_polar)
print(shape)
new_shape = (shape[0], shape[1], shape[2], shape[3] + 1)
b_cart_1 = np.zeros(new_shape,dtype = np.float32)
# add z-component
b_cart_1[:, :, :, 2] = b_qu_polar[:, :, :, 1]
for xx in range(0, xlim):
for yy in range(0, ylim):
if xx == 0:
phi = np.pi / 2
else:
phi = np.arctan(y[yy] / x[xx])
b_cart_1[xx, yy, :, 0] = b_qu_polar[xx, yy, :, 0] * np.cos(phi)
b_cart_1[xx, yy, :, 1] = b_qu_polar[xx, yy, :, 0] * np.sin(phi)
np.save('output/b_cart_1_step_5.npy', b_cart_1)
full_shape = (new_shape[0]*2 - 1, new_shape[1] * 2 - 1, new_shape[2] * 2 - 1, new_shape[3])
b_full = np.zeros(full_shape)
# fill first quarter
b_full[xlim-1:, ylim-1:, zlim-1:, :] = b_cart_1
print(xlim-1)
# mirror along y - z plane
b_full[:xlim-1, ylim-1:, zlim-1:, :] = b_cart_1[:0:-1, :, :, :]
b_full[:xlim-1, :, :, 0] *= - 1
# mirror along x - z plane
b_full[:, :ylim-1, zlim - 1:, :] = b_full[:, :ylim-1:-1 , zlim-1:, :]
b_full[:, :ylim-1, :, 1] *= -1
# mirror along x - y plane
b_full[:, :, :zlim-1, :] = b_full[:, :, :zlim-1 : -1, :]
b_full[:, :, :zlim-1, 2] *= -1
np.save('output/b_full_test.npy', b_full)
if __name__ == '__main__':
main()

View File

@ -1,56 +0,0 @@
"""
Created on 11.11.21
@author: Joschka
"""
import numpy as np
import matplotlib.pyplot as plt
from src import coil_class as BC
from src import physical_constants as cs
import logging as log
def main():
step = 0.3
xlim_mm = 30
xlim = int(xlim_mm / step) + 1
print(xlim)
ylim_mm = 30
ylim = int(ylim_mm / step) + 1
zlim_mm = 20
zlim = int(zlim_mm / step) + 1
x = np.linspace(0, xlim_mm, xlim) * 1e-3
y = np.linspace(0, ylim_mm, ylim) * 1e-3
z = np.linspace(0, zlim_mm, zlim) * 1e-3
b_cart_1 = np.load('output/final/b_cart_step_300_1Gcm.npy')
new_shape = np.shape(b_cart_1)
full_shape = (new_shape[0]*2 - 1, new_shape[1] * 2 - 1, new_shape[2] * 2 - 1, new_shape[3])
b_full = np.zeros(full_shape, dtype= np.float32)
# fill first quarter
b_full[xlim-1:, ylim-1:, zlim-1:, :] = b_cart_1
print(xlim-1)
# mirror along y - z plane
b_full[:xlim-1, ylim-1:, zlim-1:, :] = b_cart_1[:0:-1, :, :, :]
b_full[:xlim-1, :, :, 0] *= - 1
# mirror along x - z plane
b_full[:, :ylim-1, zlim - 1:, :] = b_full[:, :ylim-1:-1 , zlim-1:, :]
b_full[:, :ylim-1, :, 1] *= -1
# mirror along x - y plane
b_full[:, :, :zlim-1, :] = b_full[:, :, :zlim-1 : -1, :]
b_full[:, :, :zlim-1, 2] *= -1
np.save('output/final/b_full_step_300_1Gcm.npy', b_full)
if __name__ == '__main__':
main()

View File

@ -1,118 +0,0 @@
"""
Created on 15.11.21
@author: Joschka
"""
import logging
import numpy as np
from scipy.io import savemat
def main():
step = 0.05
xlim_mm = 30
xlim = int(xlim_mm / step) + 1
print(xlim)
ylim_mm = 30
ylim = int(ylim_mm / step) + 1
zlim_mm = 20
zlim = int(zlim_mm / step) + 1
b_1qu = np.load('output/final/b_full.npy')
#b_1qu = b_1qu.round(7)
#
# xx = 50
# yy = 50
# str = np.array2string(b_1qu[xx, yy, :, 0])
bx_txt = open("output/step_50ÎĽm/Bx_step_50.txt", "w+")
for xx in range(0,xlim):
for yy in range(0,ylim):
str_line = ''
for zz in range(0,zlim):
str_el = str(b_1qu[xx, yy, zz, 0])
if len(str_el) != 8:
length_diff = len(str_el) - 8
if length_diff > 0:
for i in range(0,length_diff):
str_el = str_el[:-1]
if length_diff < 0:
for i in range(0,-length_diff):
str_el = str_el + '0'
if len(str_el) != 8:
raise ValueError
str_line = str_line + str_el + ' '
str_line += '\n'
bx_txt.write(str_line)
bx_txt.close()
by_txt = open("output/step_50ÎĽm/By_step_50.txt", "w+")
for xx in range(0,xlim):
for yy in range(0,ylim):
str_line = ''
for zz in range(0,zlim):
str_el = str(b_1qu[xx, yy, zz, 1])
if len(str_el) != 8:
length_diff = len(str_el) - 8
if length_diff > 0:
for i in range(0,length_diff):
str_el = str_el[:-1]
if length_diff < 0:
for i in range(0,-length_diff):
str_el = str_el + '0'
if len(str_el) != 8:
raise ValueError
str_line = str_line + str_el + ' '
str_line += '\n'
by_txt.write(str_line)
by_txt.close()
bz_txt = open("output/step_50ÎĽm/Bz_step_50.txt", "w+")
for xx in range(0,xlim):
for yy in range(0,ylim):
str_line = ''
for zz in range(0,zlim):
str_el = str(b_1qu[xx, yy, zz, 2])
if len(str_el) != 8:
length_diff = len(str_el) - 8
if length_diff > 0:
for i in range(0,length_diff):
str_el = str_el[:-1]
if length_diff < 0:
for i in range(0,-length_diff):
str_el = str_el + '0'
if len(str_el) != 8:
raise ValueError
str_line += str_el + ' '
str_line += '\n'
bz_txt.write(str_line)
bz_txt.close()
"""
by_txt = open("output/By_step_300.txt", "w+")
for xx in range(0,xlim):
for yy in range(0,ylim):
str_1 = ' '.join(map(str,b_1qu[xx, yy, :, 1]))
by_txt.writelines(str_1)
by_txt.close()
bz_txt = open("output/Bz_step_300.txt", "w+")
for xx in range(0, xlim):
for yy in range(0, ylim):
str_1 = ' '.join(map(str, b_1qu[xx, yy, :, 2]))
bz_txt.writelines(str_1)
bz_txt.close()
"""
if __name__ == '__main__':
main()

View File

@ -1,2 +0,0 @@
[60.38439885 47.83581121 40.63613729 36.88246491 35.71293376 36.88246491
40.63613729 47.83581121 60.38439885]

View File

@ -1,110 +0,0 @@
# -*- coding: utf-8 -*-
"""
Created on Tue Aug 24 16:24:52 2021
@author: Joschka
"""
import matplotlib.pyplot as plt
import numpy as np
from src import B_field_calculation as bf
from src import coil_class as BC
#from IPython import get_ipython
#get_ipython().run_line_magic('matplotlib', 'qt')
#get_ipython().run_line_magic('matplotlib', 'inline')
x = np.linspace(-1, 1, 11)
z = np.linspace(-1, 1, 11)
I_current = 5*16
HH_Coil = HH_Coil_comp = BC.BCoil(HH = 1, distance = 54 ,radius = 37,layers = 1, windings = 1,wire_width = 8, wire_height = 8)
HH_Coil.set_R_outer(49.3)
HH_Coil.set_d_min(47.4)
HH_Coil.print_info()
Bz, Bx = HH_Coil.B_field(I_current, x, z, raster = 50)
Bz_curv = BC.BCoil.curv(Bz, z)
HH_Coil.cooling(I_current,30)
print(f"B_z(0) = {Bz[1]:.2f} G")
print(f"B_z_curvature(0) = {Bz_curv[1]:.4f} G/cm^2")
# %%
B = []
Curv = []
array_width = np.arange(2.5,6,0.1)
#array_width = [5.7]
for width in array_width:
height = 16/width
HH_Coil = HH_Coil_comp = BC.BCoil(HH = 1, distance = 54 ,radius = 37,layers = 1, windings = 1,wire_width = width, wire_height = height)
HH_Coil.set_R_outer(50)
HH_Coil.set_d_min(47.4)
#AHH_Coil.print_info()
Bz, Bx = HH_Coil.B_field(I_current, x, z, raster = 30)
Bz_curv = BC.BCoil.curv(Bz, z)
HH_Coil.cooling(I_current,30)
B.append(Bz[5])
Curv.append(Bz_curv[5])
print(f"width = {width}mm, height = {height}mm")
print(f"B_z(0) = {Bz[5]:.2f} G")
print(f"B_z_curvature(0) = {Bz_curv[5]:.4f} G/cm^2")
plt.plot(array_width,Curv)
#plt.plot(array_width,B)
plt.ylabel("curvature")
plt.xlabel("total width [mm]")
plt.show()
# %%
HH_Coil = HH_Coil_comp = BC.BCoil(HH = 1, distance = 54 ,radius = 37,layers = 1, windings = 1,wire_width = 8, wire_height = 8)
HH_Coil.set_R_outer(49.3)
HH_Coil.set_d_min(47.4)
#set up axis
x = np.linspace(-15, 15, 30001)
z = np.linspace(-15, 15, 30001)
# New coil
Wire_1 = [0.5, 0.568]
#Wire_1 = [0.45, 0.514]
#I_current = 0.94
HH_Coil = HH_Coil_comp = BC.BCoil(HH = 1, distance = 54 ,radius = 37,layers = 1, windings = 1,wire_width = 4, wire_height = 4)
HH_Coil.set_R_outer(50)
HH_Coil.set_d_min(47.4)
HH_Coil.print_info()
R = HH_Coil.resistance(22.5)
print(f"U = {1 * R}")
I_current = 55
# 0.4 to get from +-30300
HH_Coil.print_info()
#Bz, Bx = AHH_Coil.B_field(I_current, x, z, raster = 7)
Bz, Bx_tot = HH_Coil.B_tot_along_axis(I_current, x, z, raster = 7)
Bz_curv = BC.BCoil.curv(Bz, z)
#AHH_Coil.cooling(I_current,28)
print(f"Bz(0) = {Bz[15000]} G")
print(f"B_z_curvature(0) = {Bz_curv[15000]:.10f} G/cm^2")
#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]}")
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]}")

View File

@ -1,116 +0,0 @@
# -*- coding: utf-8 -*-
"""
Created on Mon Aug 23 17:40:37 2021
@author: Joschka
"""
import matplotlib.pyplot as plt
import numpy as np
#from src import B_field_calculation as bf
from src import coil_class as BC
#from IPython import get_ipython
#get_ipython().run_line_magic('matplotlib', 'qt')
#get_ipython().run_line_magic('matplotlib', 'inline')
#set up axis
x = np.linspace(-15, 15, 30001)
z = np.linspace(-15, 15, 30001)
# New coil
Wire_1 = [0.5, 0.568]
#Wire_1 = [0.45, 0.514]
#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)
R = HH_Coil.resistance(22.5)
print(f"U = {1 * R}")
I_current = 64 / HH_Coil.get_N() * 1.25
#set radius plus distance
#AHH_Coil.set_R_outer(50.5 - AHH_Coil.get_tot_wire_width()*1e3 - 0.5)
HH_Coil.set_R_outer(49.93)
additional_space = 0.3
HH_Coil.set_R_outer(49.93-additional_space)
HH_Coil.set_R_inner(45.6)
#AHH_Coil.set_R_inner(45.9-0.1)
# 0.4 to get from +-30300
HH_Coil.set_d_min(47.15+0.4+ 2*additional_space)
print(f"height = {HH_Coil.get_coil_height()}")
HH_Coil.print_info()
#Bz, Bx = AHH_Coil.B_field(I_current, x, z, raster = 7)
Bz, B_tot_x = HH_Coil.B_tot_along_axis(I_current, x, z, raster = 7)
Bz_curv = BC.BCoil.curv(Bz, z)
#AHH_Coil.cooling(I_current,28)
print(f"Bz(0) = {Bz[15000]} G")
print(f"B_z_curvature(0) = {Bz_curv[15000]:.10f} G/cm^2")
#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]}")
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]}")
"""
plt.figure(300)
#Field plot
##########################
plt.subplot(2,1,1)
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")
#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"$Bz$ [G]")
plt.xlabel("z-axis [mm]")
plt.legend()#bbox_to_anchor=(1.05, 1), loc='upper left')
plt.subplot(2,1,2)
plt.plot(z,Bz_curv,linestyle = "solid", label = r"$\nabla_z^2 B_{ref}$, d = 44 mm, R = 44 mm")
#plt.plot(z,B_z_comp_curv,linestyle = "solid", label = r"$\nabla_z^2 B_{z,1}$, d = 54 mm, R = 48.8 mm, I = 5 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 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')
#plt.savefig("output/first_compensation_idea.png")
plt.show()
"""
"""
AHH ############################################################################
###############################################################################
###############################################################################
"""

View File

@ -1,57 +0,0 @@
# -*- coding: utf-8 -*-
"""
Created on Tue Sep 7 13:18:18 2021
@author: Joschka
"""
import matplotlib.pyplot as plt
import numpy as np
from src import coil_class as BC
from IPython import get_ipython
#get_ipython().run_line_magic('matplotlib', 'qt')
I = 1.25
Wire_1 = BC.BCoil(HH = 1, distance = 54, radius = 48, layers = 8, windings = 8, wire_height = 0.425, wire_width = 0.425, insulation_thickness= 0.09, is_round = True, winding_scheme= False)
Wire_1.set_R_outer(49.3)
Wire_1.set_d_min(49.8)
Wire_1.print_info()
print(Wire_1.get_coil_width() * 1e3 * Wire_1.get_coil_height() * 1e3)
Wire_1.cooling(I,22.5)
Wire_1.plot_raster(30)
Wire_2 = BC.BCoil(HH = 1, distance = 54, radius = 48, layers = 8, windings = 8, wire_height = 0.425, wire_width = 0.425, insulation_thickness= 0.09, is_round = False, winding_scheme= False)
Wire_2.set_R_outer(49.3)
Wire_2.set_d_min(49.8)
Wire_2.print_info()
print(Wire_2.get_coil_width() * 1e3 * Wire_2.get_coil_height() * 1e3)
Wire_2.cooling(I,22.5)
Wire_2.plot_raster(30)
Wire_2 = BC.BCoil(HH = 1, distance = 54, radius = 48, layers = 8, windings = 8, wire_height = 0.55, wire_width = 0.55, insulation_thickness= 0.09, is_round = True, winding_scheme= True)
Wire_2.set_R_outer(49.3)
Wire_2.set_d_min(49.8)
Wire_2.print_info()
print(Wire_2.get_coil_width() * 1e3 * Wire_2.get_coil_height() * 1e3)
Wire_2.cooling(I,22.5)
Wire_2.plot_raster(30)
I = 64/42 * 1.25
Wire_2 = BC.BCoil(HH = 1, distance = 54, radius = 48, layers = 6, windings = 7, wire_height = 0.55, wire_width = 0.55, insulation_thickness= 0.09, is_round = True, winding_scheme= True)
Wire_2.set_R_outer(49.3)
Wire_2.set_d_min(49.8)
Wire_2.print_info()
print(Wire_2.get_coil_width() * 1e3 * Wire_2.get_coil_height() * 1e3)
Wire_2.cooling(I,22.5)
print(I)
Wire_2.plot_raster(30)

View File

@ -1,53 +0,0 @@
# -*- coding: utf-8 -*-
"""
Created on Tue Sep 7 13:18:18 2021
@author: Joschka
"""
import matplotlib.pyplot as plt
import numpy as np
import matplotlib
#matplotlib.use('Qt5Agg')
from src import coil_class as BC
scale = 1000
lim = 5
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 = [0.45, 0.6514]
for ll in range(7,11):
for ww in range(7,11)
Coil_1 = 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(Coil_1.get_tot_wire_width())
Coil_1.set_R_outer(50.5-Coil_1.get_tot_wire_width())
Coil_1.set_d_min(47.15)
Coil_1.print_info()
print(Coil_1.get_coil_width() * 1e3 * Coil_1.get_coil_height() * 1e3)
print(f"H = {Coil_1.get_coil_height() * 1e3}, W = {Coil_1.get_coil_width() * 1e3}")
I = 64 / Coil_1.get_N() * 1.25
print(f"I = {I} A")
Coil_1.cooling(I, 22.5)
Coil_1.plot_raster(30)
Bz, Bx = Coil_1.B_field(I, x, z, raster = 1)
Bz_curv = BC.BCoil.curv(Bz,z)
zero = mu_it(0)
print(z[zero])
print(f"Curvature = {Bz_curv[zero]}")
#Wire_1.B_quick_plot(I)
#Wire_1.B_curv_quick_plot(I,nr_points= 1000)

View File

@ -1,66 +0,0 @@
# -*- coding: utf-8 -*-
"""
Created on Tue Sep 7 13:18:18 2021
@author: Joschka
"""
import matplotlib.pyplot as plt
import numpy as np
import matplotlib
#matplotlib.use('Qt5Agg')
from src import coil_class as BC
scale = 1000
lim = 1
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):
step =
it = nr_points//2 + x_pos
return it
#Wire_1 = [0.45, 0.514]
#Wire_1 = [0.475, 0.543]
#Wire_1 = [0.5, 0.568]
Wires = [[0.45, 0.514],[0.475, 0.543],[0.5, 0.568]]
for i in [2]:
Wire_1 = Wires[i]
print(f"Wire core = {Wire_1[0]} mm:")
print(" ")
for ll in [6,10]:
for ww in [7,9]:
print(f"layers = {ll}, windings = {ww}")
Coil_1 = BC.BCoil(HH = 1, distance = 54, radius = 48, layers = ll, windings = ww, 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)
#set radius plus distance
Coil_1.set_R_outer(49.5)
Coil_1.set_d_min(47.4)
#Coil_1.print_info()
print(f" Coil crossection area = {Coil_1.get_coil_width() * 1e3 * Coil_1.get_coil_height() * 1e3} mm2")
print(f" H = {Coil_1.get_coil_height() * 1e3}, W = {Coil_1.get_coil_width() * 1e3}")
I = 64 / Coil_1.get_N() * 1.25
#I = 1
print(f" Current needed for 13.8 G: I = {I} A")
Coil_1.cooling(I, 22.5)
Bz, Bx = Coil_1.B_field(I, x, z, raster = 7)
Bz_curv = BC.BCoil.curv(Bz,z)
zero = mu_it(0)
print(f" Curvature = {Bz_curv[zero]:.4f} G/mm^2, B(0) = {Bz[zero]:.4f}")
print(f"ratio Power/Curvature: {Coil_1.power(I,22.5) * Bz_curv[zero]}")
print(" ")

View File

@ -1,81 +0,0 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "672091c7",
"metadata": {},
"outputs": [],
"source": [
"# -*- coding: utf-8 -*-\n",
"\"\"\"\n",
"Created on Tue Aug 24 16:24:52 2021\n",
"\n",
"@author: Joschka\n",
"\"\"\"\n",
"\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"import sys\n",
"sys.path.insert(0,'..\\src')\n",
"\n",
"import coil_class_jupyter as BC\n",
"\n",
"#from IPython import get_ipython\n",
"#get_ipython().run_line_magic('matplotlib', 'qt')\n",
"#get_ipython().run_line_magic('matplotlib', 'inline')\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "d3a46f0f",
"metadata": {},
"outputs": [],
"source": [
"#set up axis\n",
"x = np.linspace(-50, 50, 301)\n",
"z = np.linspace(-50, 50, 301)\n",
"\n",
"#New coil\n",
"HH_Coil = BC.BCoil(HH = 1, distance = 54 ,radius = 48 , layers = 4, windings = 4, wire_height = 1, wire_width = 1)\n",
"\n",
"#Compensation Coil\n",
"HH_Coil_comp = BC.BCoil(HH = 1, distance = 54 ,radius = 37, layers = 4, windings = 4,wire_height = 1, wire_width = 1)\n",
"\n",
"\n",
"\n",
"#HH_Coil_44.B_quick_plot(I,x,z)\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "5eef49ab",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.11"
}
},
"nbformat": 4,
"nbformat_minor": 5
}

View File

@ -1,74 +0,0 @@
import matplotlib.pyplot as plt
import numpy as np
import matplotlib
#matplotlib.use('Qt5Agg')
from src import coil_class as BC
scale = 10
lim = 20
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 = [0.5, 0.546]
scale = 10
#I_current = 0.94
HH_Coil = BC.BCoil(HH = 1, distance = 80, radius = 80, 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)
HH_Coil.set_R_inner(83.3-5)
HH_Coil.set_d_min(70.6 + 4)
print(HH_Coil.get_wire_length())
HH_Coil.print_basic_info()
I = 0.75
HH_Coil.B_quick_plot(I)
HH_Coil.B_curv_quick_plot(I)
HH_Coil.cooling(I,23)
print(" ")
HH_Coil.max_field(I)
print("\n")
AHH_Coil = BC.BCoil(HH = -1, distance = 80, radius = 80, layers = 10, windings = 10, wire_height = 1.18,
wire_width = 1.18, insulation_thickness=0.06, is_round = True,
winding_scheme= 2)
AHH_Coil.set_R_inner(HH_Coil.get_R_inner()*1e3+1)
AHH_Coil.set_d_min(HH_Coil.get_zmax()*2 * 1e3 + 4)
# Position 2
# AHH_Coil.set_R_inner(62)
# AHH_Coil.set_d_min(116)
#
# print(f"wire length = {AHH_Coil.get_wire_length()} m")
# AHH_Coil.print_info()
AHH_Coil.print_basic_info()
I = 1
#print(f"current I = {I} A")
AHH_Coil.cooling(I,23)
print("")
AHH_Coil.max_gradient(I)
# AHH_Coil.B_quick_plot(I)
# AHH_Coil.B_grad_quick_plot(I, nr_points = 200)
#AHH_Coil.B_curv_quick_plot(I, nr_points = scale)
HH_Coil.print_info()
AHH_Coil.print_info()
print(f"inductivity AHH: {AHH_Coil.induct_perry()*2*1e3} mH" )
print(f"inductivity HH: {HH_Coil.induct_perry() * 2*1e3} mH" )
print(f"resistance AHH: {2*AHH_Coil.resistance(22)} Ω")
print(f"resistance HH: {2*HH_Coil.resistance(22)} Ω")

View File

@ -1,99 +0,0 @@
#%%
import matplotlib.pyplot as plt
import numpy as np
import matplotlib
# matplotlib.use('Qt5Agg')
from src import coil_class as BC
scale = 10
lim = 20
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
scale = 10
# I_current = 0.94
HH_Coil = BC.BCoil(HH=1, distance=79.968, radius=80.228, layers=8, windings=8, wire_height=0.5,
wire_width=0.5, insulation_thickness=0.046 / 2, is_round=True,
winding_scheme=2)
AHH_Coil = BC.BCoil(HH=-1, distance=100.336, radius=85.016, layers=10, windings=10, wire_height=1.18,
wire_width=1.18, insulation_thickness=0.06, is_round=True,
winding_scheme=2)
#%%
AHH_Coil.print_basic_info()
I = 0.4
AHH_Coil.max_gradient(I)
HH_Coil.max_field(I)
# %%
HH_Coil.cooling(2, 30)
AHH_Coil.cooling(3.6,30)
HH_Coil.print_basic_info()
AHH_Coil.print_basic_info()
AHH_Coil.plot_raster()
I = 0.75
#AHH_Coil.B_quick_plot(I)
#AHH_Coil.B_curv_quick_plot(I)
# Power
#AHH_Coil.cooling(I, 23)
#AHH_Coil.cooling(I, 23)
print(f"resistance = {HH_Coil.resistance(23)} Ohm")
# rough Field
I_HH = 1
HH_Coil.max_field(I_HH)
I_AHH = 3.6
AHH_Coil.max_gradient(I_AHH)
# Quick plot
HH_Coil.B_quick_plot(I_HH)
HH_Coil.B_curv_quick_plot(I_HH)
AHH_Coil.B_quick_plot(I_AHH)
AHH_Coil.B_grad_quick_plot(I_AHH, nr_points = 200)
HH_Coil.plot_3d(I_HH, 50, 50)
AHH_Coil.plot_3d(I_AHH, 50, 50)
# Field calculation
Bz_HH, Bx_HH = HH_Coil.B_field(I_HH, x, z)
B_tot_z, B_tot_x = HH_Coil.B_tot_along_axis(I_HH, x, z)
Bz_grad = BC.BCoil.grad(Bz_HH, z)
# Position 2
# AHH_Coil.set_R_inner(62)
# AHH_Coil.set_d_min(116)
#
# print(f"wire length = {AHH_Coil.get_wire_length()} m")
# AHH_Coil.print_info()
I = 1
# print(f"current I = {I} A")
# AHH_Coil.B_quick_plot(I)
# AHH_Coil.B_grad_quick_plot(I, nr_points = 200)
# AHH_Coil.B_curv_quick_plot(I, nr_points = scale)
# AHH_Coil.print_info()
# AHH_Coil.print_info()

File diff suppressed because one or more lines are too long

View File

Before

Width:  |  Height:  |  Size: 132 KiB

After

Width:  |  Height:  |  Size: 132 KiB

View File

@ -0,0 +1,6 @@
{
"cells": [],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 5
}

View File

@ -25,10 +25,10 @@ percentage = 0.05
absolut = 5 absolut = 5
diff = percentage*0.01*5+ absolut *1e-3 diff = percentage*0.01*5+ absolut *1e-3
print(diff) print(diff)
Bz1, Bx = HH_Coil.B_field(5, x, z) Bz1, Bx = HH_Coil.B_multiple(5, x, z)
Bz2, Bx = HH_Coil.B_field(5 + diff, x, z) Bz2, Bx = HH_Coil.B_multiple(5+ diff, x, z)
print(Bz2[1500]-Bz1[1500]) print(Bz2[1500]-Bz1[1500])
print(" ") print(" ")
@ -38,7 +38,7 @@ diff = percentage*0.01*5+ absolut *1e-3
print(diff) print(diff)
Bz2, Bx = HH_Coil.B_field(5 + diff, x, z) Bz2, Bx = HH_Coil.B_multiple(5+ diff, x, z)
print(Bz2[1500]-Bz1[1500]) print(Bz2[1500]-Bz1[1500])
print((Bz2[1500]-Bz1[1500])/Bz2[1500]) print((Bz2[1500]-Bz1[1500])/Bz2[1500])

View File

@ -35,14 +35,14 @@ print(f"R = {R} ")
#B = AHH_Coil.B_multiple_3d(10, x,z,raster=2) #B = AHH_Coil.B_multiple_3d(10, x,z,raster=2)
AHH_Coil.cooling(I,30) AHH_Coil.cooling(I,30)
B_z,B_x = AHH_Coil.B_field(I, x, z) B_z,B_x = AHH_Coil.B_multiple(I,x,z)
#Bz = B[:,150,1] #B_z = 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)
B_z_grad = BC.BCoil.grad(B_z, z) B_z_grad = BC.BCoil.Bgrad(B_z, z)
B_x_grad = BC.BCoil.grad(B_x, x) B_x_grad = BC.BCoil.Bgrad(B_x,x)
lim = 7000 lim = 7000
B_0 = B_z_grad[5000] B_0 = B_z_grad[5000]
@ -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"$Bz$, d = {d} mm") plt.plot(z,B_z,linestyle = "solid", label = f"$B_z$, 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 Bz$") plt.plot(z,B_z_grad,linestyle = "solid", label = r"$\nabla_z B_z$")
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

@ -38,14 +38,14 @@ print(f"R = {R} ")
#B = AHH_Coil.B_multiple_3d(10, x,z,raster=2) #B = AHH_Coil.B_multiple_3d(10, x,z,raster=2)
AHH_Coil.cooling(I,30) AHH_Coil.cooling(I,30)
B_z,B_x = AHH_Coil.B_field(I, x, z) B_z,B_x = AHH_Coil.B_multiple(I,x,z)
#Bz = B[:,150,1] #B_z = 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)
B_z_grad = BC.BCoil.grad(B_z, z) B_z_grad = BC.BCoil.Bgrad(B_z, z)
B_x_grad = BC.BCoil.grad(B_x, x) B_x_grad = BC.BCoil.Bgrad(B_x,x)
# lim = 7000 # lim = 7000
# B_0 = B_z_grad[5000] # B_0 = B_z_grad[5000]
@ -57,15 +57,15 @@ distance = np.arange(80,95,2)
for d in distance: for d in distance:
print(d) print(d)
AHH_Coil = BC.BCoil(HH = -1, distance = d ,radius = 46.875 ,layers = 4, windings = 4 , wire_width= 1, wire_height= 2 ,layers_spacing = 0.25, windings_spacing= 0.25) AHH_Coil = BC.BCoil(HH = -1, distance = d ,radius = 46.875 ,layers = 4, windings = 4 , wire_width= 1, wire_height= 2 ,layers_spacing = 0.25, windings_spacing= 0.25)
B_z,B_x = AHH_Coil.B_field(I, x, z) B_z,B_x = AHH_Coil.B_multiple(I,x,z)
B_z_grad = BC.BCoil.grad(B_z, z) B_z_grad = BC.BCoil.Bgrad(B_z, z)
B_x_grad = BC.BCoil.grad(B_x, x) B_x_grad = BC.BCoil.Bgrad(B_x,x)
B_z_curv = BC.BCoil.grad(B_z_grad, z) B_z_curv = BC.BCoil.Bgrad(B_z_grad, z)
B_x_curv = BC.BCoil.grad(B_z_grad, z) B_x_curv = BC.BCoil.Bgrad(B_z_grad, z)
B_z_3rd = BC.BCoil.grad(B_z_curv, z) B_z_3rd = BC.BCoil.Bgrad(B_z_curv, z)
B_x_3rd = BC.BCoil.grad(B_z_curv, z) B_x_3rd = BC.BCoil.Bgrad(B_z_curv, z)
plt.subplot(2,2,1) plt.subplot(2,2,1)
@ -89,7 +89,7 @@ for d in distance:
plt.subplot(2,2,3) plt.subplot(2,2,3)
plt.title("Curvature") plt.title("Curvature")
plt.plot(z,B_z_curv,linestyle = "solid", label = f"$ d = {d} mm") plt.plot(z,B_z_curv,linestyle = "solid", label = f"$ d = {d} mm")
#plt.plot(x,B_x_curv, label = f"curv. $B_x$, d = {d} mm") #plt.plot(x,B_x_curv, label = f"Curv. $B_x$, d = {d} mm")
plt.title("B-field" ) plt.title("B-field" )
plt.ylabel(r"$B$ [G/cm^2]") plt.ylabel(r"$B$ [G/cm^2]")

View File

@ -36,16 +36,16 @@ AHH_Coil.print_info()
AHH_Coil.cooling(I, 30) AHH_Coil.cooling(I, 30)
print(f"R (30 degree C)= {AHH_Coil.resistance(30)}") print(f"R (30 degree C)= {AHH_Coil.resistance(30)}")
B_z,B_x = AHH_Coil.B_field(I, x, z) B_z,B_x = AHH_Coil.B_multiple(I,x,z)
B_z_grad = BC.BCoil.grad(B_z, z) B_z_grad = BC.BCoil.Bgrad(B_z, z)
B_x_grad = BC.BCoil.grad(B_x, x) B_x_grad = BC.BCoil.Bgrad(B_x,x)
B_z_curv = BC.BCoil.grad(B_z_grad, z) B_z_curv = BC.BCoil.Bgrad(B_z_grad, z)
B_x_curv = BC.BCoil.grad(B_z_grad, z) B_x_curv = BC.BCoil.Bgrad(B_z_grad, z)
B_z_3rd = BC.BCoil.grad(B_z_curv, z) B_z_3rd = BC.BCoil.Bgrad(B_z_curv, z)
B_x_3rd = BC.BCoil.grad(B_z_curv, z) B_x_3rd = BC.BCoil.Bgrad(B_z_curv, z)

View File

@ -48,14 +48,14 @@ print(f"R = {R} ")
#B = AHH_Coil.B_multiple_3d(10, x,z,raster=2) #B = AHH_Coil.B_multiple_3d(10, x,z,raster=2)
AHH_Coil.cooling(I,30) AHH_Coil.cooling(I,30)
B_z,B_x = AHH_Coil.B_field(I, x, z) B_z,B_x = AHH_Coil.B_multiple(I,x,z)
#Bz = B[:,150,1] #B_z = 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)
B_z_grad = BC.BCoil.grad(B_z, z) B_z_grad = BC.BCoil.Bgrad(B_z, z)
B_x_grad = BC.BCoil.grad(B_x, x) B_x_grad = BC.BCoil.Bgrad(B_x,x)
lim = 7000 lim = 7000
B_0 = B_z_grad[5000] B_0 = B_z_grad[5000]
@ -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"$Bz$, d = {d} mm") plt.plot(z,B_z,linestyle = "solid", label = f"$B_z$, 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 Bz$") plt.plot(z,B_z_grad,linestyle = "solid", label = r"$\nabla_z B_z$")
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

@ -45,19 +45,19 @@ print("Not cutting optical axis:")
AHH_comp.print_info() AHH_comp.print_info()
Bz_opt, Bx_opt = AHH_opt.B_field(I, x, z) Bz_opt, Bx_opt = AHH_opt.B_multiple(I,x,z)
Bz_comp, Bx_comp = AHH_comp.B_field(I, x, z) Bz_comp, Bx_comp = AHH_comp.B_multiple(I, x, z)
#Bz = B[:,150,1] #B_z = 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)
Bz_grad_opt = BC.BCoil.grad(Bz_opt, z) Bz_grad_opt = BC.BCoil.Bgrad(Bz_opt, z)
Bx_grad_opt = BC.BCoil.grad(Bx_opt, x) Bx_grad_opt = BC.BCoil.Bgrad(Bx_opt,x)
Bz_grad_comp = BC.BCoil.grad(Bz_comp, z) Bz_grad_comp = BC.BCoil.Bgrad(Bz_comp, z)
Bx_grad_comp = BC.BCoil.grad(Bx_comp, x) Bx_grad_comp = BC.BCoil.Bgrad(Bx_comp,x)
Bz_rel_opt = (Bz_grad_opt[zr]- Bz_grad_opt)/Bz_grad_opt[zr]*100 Bz_rel_opt = (Bz_grad_opt[zr]- Bz_grad_opt)/Bz_grad_opt[zr]*100
Bx_rel_opt = (Bx_grad_opt[zr]- Bx_grad_opt)/Bx_grad_opt[zr]*100 Bx_rel_opt = (Bx_grad_opt[zr]- Bx_grad_opt)/Bx_grad_opt[zr]*100
@ -103,7 +103,7 @@ plt.plot(z,Bz_rel_comp,linestyle = "solid",color = "blue", label = f"$B_z$, d =
plt.plot(x,Bx_rel_opt,linestyle = "dashed",color = "orange", label = f"$B_x$, d = {d_opt} mm") plt.plot(x,Bx_rel_opt,linestyle = "dashed",color = "orange", label = f"$B_x$, d = {d_opt} mm")
plt.plot(x,Bx_rel_comp, linestyle = "dashed",color = "blue", label = f"$B_x$, d = {d_comp} mm") plt.plot(x,Bx_rel_comp, linestyle = "dashed",color = "blue", label = f"$B_x$, d = {d_comp} mm")
plt.ylabel(r"rel. Deviation from grad to center [%]$") plt.ylabel(r"rel. Deviation from Grad to center [%]$")
plt.xlabel("z-axis /x-axis [mm]")#plt.xlim(-10,10) plt.xlabel("z-axis /x-axis [mm]")#plt.xlim(-10,10)
#plt.title(r"$\nabla_i B_i") #plt.title(r"$\nabla_i B_i")
#plt.ylim(-0.05,0.05) #plt.ylim(-0.05,0.05)

View File

@ -48,14 +48,14 @@ print(f"R = {R} ")
#B = AHH_Coil.B_multiple_3d(10, x,z,raster=2) #B = AHH_Coil.B_multiple_3d(10, x,z,raster=2)
AHH_Coil.cooling(I,30) AHH_Coil.cooling(I,30)
B_z,B_x = AHH_Coil.B_field(I, x, z) B_z,B_x = AHH_Coil.B_multiple(I,x,z)
#Bz = B[:,150,1] #B_z = 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)
B_z_grad = BC.BCoil.grad(B_z, z) B_z_grad = BC.BCoil.Bgrad(B_z, z)
B_x_grad = BC.BCoil.grad(B_x, x) B_x_grad = BC.BCoil.Bgrad(B_x,x)
lim = 7000 lim = 7000
B_0 = B_z_grad[5000] B_0 = B_z_grad[5000]
@ -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"$Bz$, d = {d} mm") plt.plot(z,B_z,linestyle = "solid", label = f"$B_z$, 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 Bz$") plt.plot(z,B_z_grad,linestyle = "solid", label = r"$\nabla_z B_z$")
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

@ -48,14 +48,14 @@ print(f"R = {R} ")
#B = AHH_Coil.B_multiple_3d(10, x,z,raster=2) #B = AHH_Coil.B_multiple_3d(10, x,z,raster=2)
AHH_Coil.cooling(I,30) AHH_Coil.cooling(I,30)
B_z,B_x = AHH_Coil.B_field(I, x, z) B_z,B_x = AHH_Coil.B_multiple(I,x,z)
#Bz = B[:,150,1] #B_z = 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)
B_z_grad = BC.BCoil.grad(B_z, z) B_z_grad = BC.BCoil.Bgrad(B_z, z)
B_x_grad = BC.BCoil.grad(B_x, x) B_x_grad = BC.BCoil.Bgrad(B_x,x)
lim = 7000 lim = 7000
B_0 = B_z_grad[5000] B_0 = B_z_grad[5000]

View File

@ -12,70 +12,60 @@ import numpy as np
from src import coil_class as BC from src import coil_class as BC
#from IPython import get_ipython from IPython import get_ipython
#get_ipython().run_line_magic('matplotlib', 'qt') get_ipython().run_line_magic('matplotlib', 'qt')
#get_ipython().run_line_magic('matplotlib', 'inline') #get_ipython().run_line_magic('matplotlib', 'inline')
#set up axis #set up axis
x = np.linspace(-15, 15, 30001) x = np.linspace(-20, 20, 40001)
z = np.linspace(-15, 15, 30001) z = np.linspace(-20, 20, 40001)
# New coil #New coil
Wire_1 = [0.5, 0.568] I_current = 10
#Wire_1 = [0.45, 0.514] d=69.4
#I_current = 0.94
AHH_Coil = BC.BCoil(HH = -1, distance = 69.622, radius = 47.528, layers = 8, windings=16,
wire_height = 0.5, wire_width=0.5, insulation_thickness=(0.546-0.5)/2,
is_round = True, winding_scheme= 2)
HH_Coil = BC.BCoil(HH = -1, distance = d ,radius = 46.875 ,layers = 4, windings = 4 , wire_width= 1, wire_height= 2 ,layers_spacing = 0.25, windings_spacing= 0.25)
AHH_Coil.print_info() HH_Coil.print_info()
R = AHH_Coil.resistance(22.5)
print(f"U = {1 * R}") Bz, Bx = HH_Coil.B_multiple(I_current,x,z,raster = 10)
I_current = 1 B_tot_z, B_tot_x = HH_Coil.B_multiple(I_current, x, z,raster = 10)
# 0.4 to get from +-30300 Bz = BC.BCoil.Bgrad(Bz, z)
AHH_Coil.print_info() HH_Coil.cooling(I_current,28)
#Bz, Bx = AHH_Coil.B_field(I_current, x, z, raster = 7) print(f"B_z(0) = {Bz[15000]} G")
B_z, B_x_tot = AHH_Coil.B_field(I_current, x, z, raster = 7)
Bz = BC.BCoil.grad(B_z, z)
Bz_curv = BC.BCoil.curv(Bz, z)
#AHH_Coil.cooling(I_current,28)
print(f"Bz_grad(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"Bz(1 ÎĽm) = {Bz[15001]}") print(f"B_z(1 ÎĽm) = {Bz[15001]}")
#print(f"Bz(1 mm) = {Bz[16000]}") 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 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 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 1 mm: {Bz[25000] - Bz[15000]}, relative: {(Bz[25000] - Bz[15000])/Bz[15000]}")
#print(f"Diff B +/- 15 mm: {Bz[30000] - Bz[15000]}, relative: {(Bz[30000] - Bz[15000])/Bz[15000]}") print(f"Diff B 1 mm: {Bz[32000] - Bz[15000]}, relative: {(Bz[32000] - Bz[15000])/Bz[15000]}")
print(z[32000])
print(z[15000])
"""
plt.figure(300) 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"$Bz along z-axis") plt.plot(z,Bz,linestyle = "solid", label = r"$B_z 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")
@ -84,7 +74,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"$Bz$ [G]") plt.ylabel(r"$B_z$ [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')
@ -94,7 +84,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 Bz [G/cm^2]$") plt.ylabel(r"$\nabla_z^2 B_z [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

@ -1,39 +0,0 @@
import matplotlib.pyplot as plt
import numpy as np
import matplotlib
#matplotlib.use('Qt5Agg')
from src import coil_class as BC
# %%
HH_Coil = BC.BCoil(HH = 1, distance = 54, radius = 48, layers = 8, windings = 8, wire_height = 0.5,
wire_width = 0.5, insulation_thickness = (0.546-0.5)/2, is_round = True,
winding_scheme= 2)
HH_Coil.set_R_inner(45.6)
HH_Coil.set_d_min(2*24.075)
AHH_Coil = BC.BCoil(HH = -1, distance = 54, radius = 48, layers = HH_Coil.get_layers, windings=2 * HH_Coil.get_windings,
wire_height = 0.5, wire_width=0.5, insulation_thickness=(0.546-0.5)/2,
is_round = True, winding_scheme= 2)
AHH_Coil.set_R_inner(45.6)
AHH_Coil.set_d_min(HH_Coil.get_zmax()*2 * 1e3 + 4)
d = AHH_Coil.get_radius()
print(d)
AHH_Coil.set_d(d + 5)
# %%
z = np.linspace(-50,50,500)
I = 1
Bz, Bx = AHH_Coil.B_field(I,z,z)
Bz_grad = AHH_Coil.grad(Bz,z)
Bz_curv = AHH_Coil.grad(Bz_grad, z)
Bz_4 = BC.BCoil.grad(Bz_curv, z)
plt.plot(z,Bz)
plt.plot(z,Bz_grad)
plt.plot(z, Bz_curv)
plt.plot(z, Bz_4)
plt.show()

View File

@ -1,33 +0,0 @@
import matplotlib.pyplot as plt
import numpy as np
import matplotlib
#matplotlib.use('Qt5Agg')
from src import coil_class as BC
# %%
z = np.linspace(-10,10,100)
x = np.linspace(-10,10,100)
I = 1
for i in range(0, 10):
AHH_Coil = BC.BCoil(HH = -1, distance=10+i, radius = 10, layers = 1, windings=1,
wire_height = 0.1, wire_width=0.1, insulation_thickness=0,
is_round = True)
Bz, Bx = AHH_Coil.B_field(I,z,z)
Bz_grad = BC.BCoil.grad(Bz,z)
Bx_grad = BC.BCoil.grad(Bx,x)
#plt.plot(z,Bz)
plt.plot(z, Bx_grad, label=f"d={10+i}mm")
plt.legend()
#plt.plot(z, Bz_curv)
#plt.plot(z, Bz_4)
plt.show()

File diff suppressed because one or more lines are too long

View File

Before

Width:  |  Height:  |  Size: 132 KiB

After

Width:  |  Height:  |  Size: 132 KiB

View File

@ -1,19 +0,0 @@
import matplotlib.pyplot as plt
import numpy as np
import matplotlib
#matplotlib.use('Qt5Agg')
from src import coil_class as BC
Wire_1 = [0.5, 0.568]
I_current = 1.33
HH_Coil = BC.BCoil(HH = 1, distance = 54, radius = 48, layers = 10, 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)
#set radius plus distance
HH_Coil.set_R_outer(50.5 - HH_Coil.get_tot_wire_width())
HH_Coil.set_d_min(47.15)
I = 5
I = 60/HH_Coil.get_N() * I
print(I)
HH_Coil.cooling(I, 25)

View File

@ -1,57 +0,0 @@
"""
Created on 3.11.21
@author: Joschka
"""
import numpy as np
import matplotlib.pyplot as plt
from src import coil_class as BC
from src import physical_constants as cs
def Q_heat(flow,d_T):
V_t = 4.8 * 3.2 * 1e-6 * flow
m = cs.water_dens * V_t
Q = m * cs.water_c_p * d_T
return Q
def main():
d_T = 2
flow = 1#/5 #m/s
#flow *=2
print(f"flow = {flow}m/s")
V_t = 4.7 * 3.2 * 1e-6 * flow
print(f"Volume rate = {V_t * 1e6} mL/s")
m = cs.water_dens * V_t
Q = m * cs.water_c_p * d_T
print(f"Q = {Q} J/s")
#flow = np.linspace(0,5,100)
#plt.plot(flow,Q_heat(flow,3))
#plt.show()
HH_Coil = BC.BCoil(HH=1, distance=51.694, radius=47.9263, layers=8, windings=16, wire_height=0.5,
wire_width=0.5, insulation_thickness=0.034, is_round=True,
winding_scheme=2)
for I in np.arange(1,20,0.001):
P = HH_Coil.power(I, 23)
if P > Q:
break
print(f"Power = {P} W @ {I} A")
B_max = HH_Coil.max_field(I)
print(f"max field = {B_max} G")
print(HH_Coil.cooling(I, 25))
if __name__ == '__main__':
main()

View File

@ -1,48 +0,0 @@
import matplotlib.pyplot as plt
import numpy as np
#from src import B_field_calculation as bf
from src import coil_class as BC
from src import physical_constants as cs
Wire_1 = [0.5, 0.568]
#Wire_1 = [0.45, 0.514]
#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)
e_cu = 3e-2 # emissivity copper, polished
rho_cu = 1.7 * 1e-8
I = 3 # A
surface = 10e-4
# S_coil = S_coil/2
print(f"Surface area = {surface}")
def power_bal(T, h_air):
T_0 = 22.5
P = 100e-3
f = h_air * surface * (T - T_0) - 0.5 * P
return f
print(e_cu * surface * cs.sigma_B ** 4 * (50 ** 4 - 22.5 ** 4))
T = np.linspace(20, 120, 500)
T_calc = np.linspace(20, 2200, 1000)
for h_air in [2.5, 10, 25]:
pos_min = np.argmin(np.abs(power_bal(T_calc, h_air)))
T_SS = T_calc[pos_min]
print(f"T_ss = {T_SS} °C")
plt.plot(T, power_bal(T, h_air), label=f"$h_{{air}} = {h_air} \; W/m^2 K$ , $T_{{SS}}$ = {T_SS:.2f}°C")
plt.ylabel("Power balance [W]")
plt.xlabel("temparature [°C]")
plt.title(f"Power balance, free convection, AHH coil, I = {I} A, windings: 4 x 4")
plt.legend()
plt.show()
print(AHH_opt.power(I, 25) / 2)

View File

View File

@ -1,116 +0,0 @@
# %%
import matplotlib.pyplot as plt
import RigolWFM.wfm as rigol
import numpy as np
import matplotlib as mpl
import scipy.optimize
# %%
# Data import
f = np.array(
[1, 1.83, 3.36, 6.16, 11.3, 20.7, 37.9, 69.5, 127, 234, 428, 785, 1440, 2640, 4830, 8860, 16200, 29800, 54600])
A_HH = np.array(
[1.13, 1.13, 1.13, 1.13, 1.13, 1.14, 1.13, 1.11, 1.03, 0.881, 0.708, 0.504, 0.334, 0.198, 0.119, 0.069, 0.046,
0.028, 0.024])
dA_HH = np.array(
[0.006, 0.002, 0.001, 0.002, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 0.002, 0.001, 0.004, 0.001, 0.001,
0.001, 0.001, 0.001])
ph_HH = np.array(
[0.8, -0.8, -1.2, -0.8, 1.5, 3.7, 7.9, 11.8, 20.6, 32.0, 44.6, 54.8, 64.3, 74.0, 78.6, 82.8, 85.3, 87.4, 93.7])
dph_HH = np.array(
[1.5, 1.5, 0.5, 1.2, 4.1, 0.001, 1.3, 0.001, 0.4, 0.001, 0.080, 0, 0.23, 0.7, 0.05, 1.6, 1.5, 2.5, 2.8])
A_AHH = np.array(
[1.14, 1.14, 1.14, 1.14, 1.15, 1.15, 1.13, 1.09, 0.966, 0.737, 0.539, 0.359, 0.216, 0.130, 0.0767, 0.0475])
dA_AHH = np.array(
[0.007, 0.005, 0.002, 0.002, 0.002, 0.002, 0.001, 0.001, 0.004, 0.012, 0.001, 0.001, 0.003, 0.001, 0.0004, 0.0004])
ph_AHH = np.array([0.6, -0.3, 0.5, 0.3, 2.5, 4.3, 8.8, 17.2, 30.3, 45.3, 54.2, 64.4, 72.6, 77.24, 79.4, 80.14])
dph_AHH = np.array([3.0, 2.0, 0.4, 1.2, 1.0, 0.7, 1.2, 1.2, 0.5, 2.6, 0.9, 1.4, 1.2, 1.5, 2.1, 1.2])
# %%
my_colors = {'light_green': '#97e144',
'orange': '#FF914D',
'light_grey': '#545454',
'pastel_blue': '#1b64d1',
'light_blue': '#71C8F4',
'purple': '#7c588c'}
mpl.rcParams.update({'font.size': 11, 'axes.linewidth': 1, 'lines.linewidth': 2, 'text.usetex': False, 'font.family': 'arial'})
mpl.rcParams['xtick.direction'] = 'in'
mpl.rcParams['ytick.direction'] = 'in'
mpl.rcParams['xtick.top'] = True
mpl.rcParams['ytick.right'] = True
# %% Fit func
def I_fit(f,U,tau):
omega = 2* np.pi *f
return U/np.sqrt(tau**2 + omega**2)
# %% fit HH
fit_bound = (0,len(A_HH))
p0 = [1,2.2e3]
popt_hh, pcov_hh = scipy.optimize.curve_fit(I_fit, f, A_HH, p0=p0, sigma=dA_HH, absolute_sigma=False)
print("U0, tau, t0")
print(popt_hh)
# %% fit AHH
fit_bound = (0,len(A_HH))
p0 = [1,2.2e3]
popt_ahh, pcov_ahh = scipy.optimize.curve_fit(I_fit, f[0:len(A_AHH)], A_AHH, p0=p0)
print("U0, tau, t0")
print(popt_hh)
# %% Scaling factor
scale = 0.3/I_fit(1, *popt_hh)
# %%
x=np.linspace(0,50000,10000)
fig, ax = plt.subplots(figsize=(5.4, 4), dpi=400)
ax.errorbar(f, scale*A_HH, yerr=scale*dA_HH, elinewidth=2, capsize=5, linewidth=0, label='Data HH', zorder=4, marker='.',color='C0')
ax.plot(x, scale*I_fit(x, *popt_hh),label=f'fit HH, $\\tau$ = 2255(110) 1/s',color='C8')
ax.errorbar(f[0:len(A_AHH)], scale*A_AHH, yerr=scale*dA_AHH, elinewidth=2, capsize=5, linewidth=0, label='Data AHH', zorder=3, marker='^',color='C1')
ax.plot(x, scale*I_fit(x, *popt_ahh),label=f'fit AHH, $\\tau$ = 1416(56) 1/s', color='C4')
ax.hlines(scale*I_fit(1, *popt_hh)/np.sqrt(2),0, 1e5, color='C7', linestyle=(0,(2.5,3)), label='3dB point \nHH: f = 359 Hz, AHH: 225 Hz ')
ax.grid(alpha=0.6)
ax.set_xscale('log')
ax.set_yscale('log')
ax.set_xlim(0, 1e5)
ax.set_ylabel(r'current amplitude ($\rm A_{pp}$)')
ax.set_xlabel('frequency f (Hz)')
handles, labels = ax.get_legend_handles_labels()
ax.legend(handles=[handles[3], handles[4], handles[0], handles[1], handles[2]])
fig.tight_layout()
fig.savefig('C:/Users/Joschka/Desktop/Master_Thesis/Figures/Coil_measurements/Final/freq_resp.png')
fig.savefig('C:/Users/Joschka/Desktop/Master_Thesis/Figures/Coil_measurements/Final_low/freq_resp.png', dpi=96)
plt.show()
# %% Find 3dB point
x=np.linspace(0,1000,10000)
for i in range(0,10000):
if I_fit(x[i], *popt_hh) < (I_fit(1, *popt_hh)/np.sqrt(2)):
print(f"Cutoff HH: {x[i]} Hz")
break
for i in range(0, 10000):
if I_fit(x[i], *popt_ahh) < (I_fit(1, *popt_ahh) / np.sqrt(2)):
print(f"Cutoff AHH: {x[i]} Hz")
break
# %%
fig, ax = plt.subplots(figsize=(5.4, 4),dpi=400)
ax.errorbar(f, ph_HH, yerr=dph_HH, label='Data HH')
ax.grid(alpha=0.6, which='minor')
ax.set_xscale('log')
#ax.set_yscale('log')
plt.show()

View File

@ -1,59 +0,0 @@
# %%
import matplotlib.pyplot as plt
import numpy as np
import matplotlib as mpl
from matplotlib.ticker import AutoMinorLocator
# %%
# Import data without water cooling
I = np.array([0, 0.5, 1, 1.25, 1.5, 1.75, 2,2.25])
HH = np.array([25, 26, 30.9, 36.6, 39.8, 46.8, 53.9, 62.3])
AHH = ([25,26.5,35.2, 42.7, 52.2])
# %%
# Data with water cooling
I_w = np.arange(0,5.25,0.5)
I_w = np.append(I_w, 5.25)
HH_w = np.array([17.8, 18.2, 18.9, 20, 21.8, 24.3, 27.3, 31.4, 36.8, 42.5, 49.3, 56.2])
AHH_w = np.array([17.2, 17.7,19.1, 21.3, 24.7, 29.3, 35.7, 43.9, 55.6])
# %%
my_colors = {'light_green': '#97e144',
'orange': '#FF914D',
'light_grey': '#545454',
'pastel_blue': '#1b64d1',
'light_blue': '#71C8F4',
'purple': '#7c588c'}
mpl.rcParams.update({'font.size': 11, 'axes.linewidth': 1, 'lines.linewidth': 2, 'text.usetex': False, 'font.family': 'arial'})
mpl.rcParams['xtick.direction'] = 'in'
mpl.rcParams['ytick.direction'] = 'in'
mpl.rcParams['xtick.top'] = True
mpl.rcParams['ytick.right'] = True
# %%
fig, ax = plt.subplots(figsize=(5, 3.6),dpi=400)
ax.scatter(I, HH, label='HH, no water')
ax.scatter(I[0:len(AHH)], AHH, label='AHH, no water',marker='v')
ax.scatter(I_w, HH_w, label='HH, with water',marker = 's')
ax.scatter(I_w[0:len(AHH_w)], AHH_w, label='AHH, with water', marker='d')
ax.legend(fontsize=10.5)
ax.grid(alpha = 0.2)
ax.set_xlim(-0.3, 5.7)
ax.set_ylim(11, 65)
ax.set_ylabel('temperature coil T (°C)')
ax.set_xlabel('current I (A)')
ax.xaxis.set_minor_locator(AutoMinorLocator(2))
ax.yaxis.set_minor_locator(AutoMinorLocator(2))
fig.tight_layout()
plt.savefig('C:/Users/Joschka/Desktop/Master_Thesis/Figures/Coil_measurements/Final/heating.png')
plt.savefig('C:/Users/Joschka/Desktop/Master_Thesis/Figures/Coil_measurements/Final_low/heating.png',dpi=96)
plt.show()

View File

@ -1,183 +0,0 @@
# %%
import matplotlib.pyplot as plt
import RigolWFM.wfm as rigol
import numpy as np
import matplotlib as mpl
# %%
import scipy.optimize
my_colors = {'light_green': '#97e144',
'orange': '#FF914D',
'light_grey': '#545454',
'pastel_blue': '#1b64d1',
'light_blue': '#71C8F4',
'purple': '#7c588c'}
mpl.rcParams.update({'font.size': 11, 'axes.linewidth': 1, 'lines.linewidth': 2, 'text.usetex': False, 'font.family': 'arial'})
mpl.rcParams['xtick.direction'] = 'in'
mpl.rcParams['ytick.direction'] = 'in'
mpl.rcParams['xtick.top'] = True
mpl.rcParams['ytick.right'] = True
# %%
hhpion.channels[1].volts
# %%
scope = 'DS1104Z-S'
hhpion = rigol.Wfm.from_file('C:/Users/Joschka/Desktop/Coil_Data/New/hhpion.wfm', scope)
hhpioff = rigol.Wfm.from_file('C:/Users/Joschka/Desktop/Coil_Data/New/hhpioff.wfm', scope)
hhon = rigol.Wfm.from_file('C:/Users/Joschka/Desktop/Coil_Data/New/hhon.wfm', scope)
hhoff = rigol.Wfm.from_file('C:/Users/Joschka/Desktop/Coil_Data/New/hhoff.wfm', scope)
ahhpion = rigol.Wfm.from_file('C:/Users/Joschka/Desktop/Coil_Data/New/ahhpion.wfm', scope)
ahhpioff = rigol.Wfm.from_file('C:/Users/Joschka/Desktop/Coil_Data/New/ahhpioff.wfm', scope)
ahhoff = rigol.Wfm.from_file('C:/Users/Joschka/Desktop/Coil_Data/New/ahhoff.wfm', scope)
ahhon = rigol.Wfm.from_file('C:/Users/Joschka/Desktop/Coil_Data/New/ahhon.wfm', scope)
# %%
print(hhon.channels[1])
# %%
def I(V):
return (V/1.2093 -2.47e-3) * 1.21/1.276
print(I(1.21))
print(1/0.88)
def I_exp(t, I_0, tau, t0):
return I_0 *(1-np.exp(-tau *(t-t0)))
def I_pi(t, tau, t0=0):
return 30/3.2 * (1 - np.exp(-tau * (t - t0)))
# %%
x = np.linspace(0,80e-6,1000)
fig, ax = plt.subplots(figsize=(5, 3.6), dpi=400)
ax.plot(1e6* hhpion.channels[1].times, I(hhpion.channels[1].volts), label='HH on')
ax.plot(1e6 *ahhpion.channels[1].times, I(ahhpion.channels[1].volts),label='AHH on')
# ax.plot(1e6 *x, I_pi(x, popt_hhon[1]))
ax.plot(1e6* hhpioff.channels[1].times, I(hhpioff.channels[1].volts), label='HH off')
ax.plot(1e6 *ahhpioff.channels[1].times, I(ahhpioff.channels[1].volts), label='AHH off')
ax.grid(alpha=0.5)
ax.set_xlabel('time (ÎĽs)')
ax.set_ylabel('current I (A)')
ax.set_xlim(-50, 300)
ax.legend()
fig.tight_layout()
plt.savefig('C:/Users/Joschka/Desktop/Master_Thesis/Figures/Coil_measurements/Final/time_resp_pi.png', dpi=400)
plt.savefig('C:/Users/Joschka/Desktop/Master_Thesis/Figures/Coil_measurements/Final_low/time_resp_pi.png',dpi=96)
plt.show()
# %%
# Fitting
# 0 at 745128
fitx = np.array(hhon.channels[1].times)
fity = np.array(I(hhon.channels[1].volts))
dfity = np.array(hhon.channels[1].volts)
dfity = 0.1*200e-3 + 2e-3 + 0.001 * dfity
dfity = I(dfity)
fit_bound = (745128,len(fitx))
p0 = [1,2.2e3,0]
popt_hhon, pcov_hhon = scipy.optimize.curve_fit(I_exp, fitx[fit_bound[0]:fit_bound[1]], fity[fit_bound[0]:fit_bound[1]],
p0=p0, sigma = dfity[fit_bound[0]:fit_bound[1]], absolute_sigma=True)
print("I0, tau, t0")
print(popt_hhon)
# %%
# Fitting
# 0 at 510128
fitx = np.array(ahhon.channels[1].times)
fity = np.array(I(ahhon.channels[1].volts))
fit_bound = (510128,len(fitx))
p0 = [1,2.2e3,0]
popt_ahhon, pcov_ahhon = scipy.optimize.curve_fit(I_exp, fitx[fit_bound[0]:fit_bound[1]], fity[fit_bound[0]:fit_bound[1]], p0=p0)
print("I0, tau, t0")
print(popt_ahhon)
# %%
for i in range(0,len(fitx)):
if fitx[i]>0:
print(i)
break
# %%
x = np.linspace(0, 0.01, 1000)
fig, ax = plt.subplots(figsize=(5, 3.6))
ax.scatter(1e3* fitx,fity, label='HH on', linewidth=0.01)
ax.legend()
plt.show()
# %%
x = np.linspace(0, 0.01, 1000)
fig, ax = plt.subplots(figsize=(5, 3.6),dpi=400)
ax.plot(1e3* hhon.channels[1].times, I(hhon.channels[1].volts), label='HH on', color='C0')
ax.plot(1e3 *ahhon.channels[1].times, I(ahhon.channels[1].volts),label='AHH on', color='C1')
ax.plot(1e3*x, I_exp(x, *popt_hhon))
ax.plot(1e3* hhoff.channels[1].times, I(hhoff.channels[1].volts), label='HH off', color='C2',zorder=0)
ax.plot(1e3 *ahhoff.channels[1].times, I(ahhoff.channels[1].volts), label='AHH off', color='C3',zorder=1)
ax.plot(1e3*x, I_exp(x, *popt_hhon), color = 'C8', linestyle=(0,(2,)),
label=f'fit HH on, $ \\tau$ = {popt_hhon[1]:.0f} 1/s', zorder=3)
ax.plot(1e3*x, I_exp(x, *popt_ahhon), color = 'C4', linestyle=(0,(2,)),
label=f'fit AHH on, $\\tau$ = {popt_ahhon[1]:.0f} 1/s')
ax.grid(alpha=0.5)
ax.set_xlabel('time (ms)')
ax.set_ylabel('current I (A)')
ax.legend(loc=5)
fig.tight_layout()
plt.savefig('C:/Users/Joschka/Desktop/Master_Thesis/Figures/Coil_measurements/Final/time_resp.png')
plt.savefig('C:/Users/Joschka/Desktop/Master_Thesis/Figures/Coil_measurements/Final_low/time_resp.png', dpi=96)
plt.show()
# %%
# Resistance HH Calculation
I = 1
U = 3.32
dI = 1e-3 + 0.001*I
dU = np.sqrt(5e-3**2 + (0.0005*U)**2 + (0.005*U)**2)
print(dU)
#dU = 0.05
R =U/I
dR = R* np.sqrt((dI/I)**2 + (dU/U)**2)
print(f"R = {R:.3f} +/- {dR:.3f} Ω")
L = R/popt_hhon[1]
dL=dR/popt_hhon[1]
print(f"L = {L:.6f} +/-{dL:.6f} Ω")
# %%
# Resistance AHH Calculation
I = 1
U = 6.64
dI = np.sqrt(1e-3**2 + (0.001*I)**2)
dU = np.sqrt(5e-3**2 + (0.0005*U)**2 + (0.005*U)**2)
print(dU)
R =U/I
dR = R* np.sqrt((dI/I)**2 + (dU/U)**2)
print(f"R = {R:.3f} +/- {dR:.3f} Ω")
L = R/popt_ahhon[1]
dL=dR/popt_ahhon[1]
print(f"L = {L:.5f} +/-{dL:.5f} Ω")
# %%

View File

@ -1,133 +0,0 @@
import matplotlib.pyplot as plt
import numpy as np
import matplotlib
#matplotlib.use('Qt5Agg')
from src import coil_class as BC
HH_Coil = BC.BCoil(HH = 1, distance = 54, radius = 48, layers = 8, windings = 8, wire_height = 0.5,
wire_width = 0.5, insulation_thickness = (0.546-0.5)/2, is_round = True,
winding_scheme= 2)
HH_Coil.set_R_inner(45.6)
HH_Coil.set_d_min(47.4)
HH_Coil.print_info()
print(f"inductivity = {HH_Coil.induct_perry()*2} H")
AHH_Coil = BC.BCoil(HH = -1, distance = 54, radius = 48, layers = HH_Coil.get_layers, windings=2 * HH_Coil.get_windings,
wire_height = 0.5, wire_width=0.5, insulation_thickness=(0.546-0.5)/2,
is_round = True, winding_scheme= 2, red_N=1)
AHH_Coil.set_R_inner(45.6)
AHH_Coil.set_d_max(77.6)
AHH_Coil.print_info()
R = HH_Coil.resistance(25)
# %%
AHH_Coil.plot_raster()
print(AHH_Coil.get_N())
# %%
I = 1
AHH_Coil.cooling(I, 22.5)
AHH_Coil.max_gradient(I)
I_2 = 0.92
HH_Coil.cooling(I_2,22.5)
HH_Coil.max_field(I_2)
# %%
HH_Coil.print_info()
AHH_Coil.print_info()
print("All values for pair in series")
print(f"inductivity AHH: {AHH_Coil.induct_perry()*2*1e3} mH" )
print(f"inductivity HH: {HH_Coil.induct_perry() * 2*1e3} mH" )
print(f"resistance AHH: {AHH_Coil.resistance(22) *2} Ω")
print(f"resistance HH: {HH_Coil.resistance(22)*2} Ω")
print(f"resistance HH: {HH_Coil.resistance(2)*2} Ω")
print(f"rel change: {(HH_Coil.resistance(22)-HH_Coil.resistance(23))/HH_Coil.resistance(22)} Ω")
print(f"res of 4 m copper wire: {BC.BCoil.resistivity_copper(22)*5*0.5**2 *np.pi *1e6} Ω")
# %%
I = 1
AHH_Coil.cooling(I,22)
AHH_Coil.max_gradient(I)
I_HH = 1
HH_Coil.cooling(I,22)
HH_Coil.max_field(I)
#%%
# field quality
HH_Coil.B_quality(z_pos=1)
HH_Coil.B_quality(z_pos=19)
# %%
AHH_Coil.Grad_quality(z_pos=1)
#%% gradient quality
x = np.linspace(-20, 20, 40001)
z = np.linspace(-20, 20, 40001)
B_z, B_x_tot = AHH_Coil.B_field(1, x, z, raster = 7)
Bz = BC.BCoil.grad(B_z, z)
#AHH_Coil.cooling(I_current,28)
print(f"Bz_grad(0) = {Bz[15000]} G")
#print(f"B_z_curvature(0) = {Bz_curv[15000]:.10f} G/cm^2")
#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]}")
print(f"Diff B +/- 0.5 mm: {Bz[15500] - Bz[15000]}, relative: {(Bz[15500] - Bz[15000])/Bz[15000]}")
print(f"0 = {z[20000]}, 1 = {z[21000]}, 19 = {z[39000]}")
print(f"Diff Grad B +/- 1 mm: relative: {(Bz[20000] - Bz[21000])/Bz[20000]}")
print(f"Diff Grad B +/- 19 mm: relative: {(Bz[20000] - Bz[39000])/Bz[20000]}")
# %%
plt.plot(z,Bz)
plt.show()
# %%
rho = BC.BCoil.resistivity_copper(50)
l = 48e-3*2*np.pi * 64
A = 0.25e-3**2 *np.pi
R_22 = BC.BCoil.resistivity_copper(16) *l/A
R_50 = BC.BCoil.resistivity_copper(50)*l/A
print(R_22)
print(R_50)
print((R_50-R_22)/R_50)
print(BC.BCoil.resistivity_copper(28))
# SF coil
# %%
SF_Coil = BC.BCoil(HH = 1, distance = 54, radius = 48, layers = 1, windings = 1, wire_height = 0.5,
wire_width = 0.5, insulation_thickness = (0.546-0.5)/2, is_round = True,
winding_scheme= 2)
SF_Coil.set_R_inner(38.4)
SF_Coil.set_d_min(47.4)
SF_Coil.print_info()
print(f"inductivity = {SF_Coil.induct_perry()*2} H")
print(f"resistance SF: {SF_Coil.resistance(22.5)*2} Ω")
SF_Coil.max_field(1)
SF_Coil.B_quality()
SF_Coil.B_quality( z_pos=19)
SF_Coil.cooling(1, 22.5)
print(SF_Coil.power(1, 22.5))

View File

@ -1,168 +0,0 @@
# -*- coding: utf-8 -*-
"""
Created on Mon Aug 23 17:40:37 2021
@author: Joschka
"""
import matplotlib.pyplot as plt
import numpy as np
#from src import B_field_calculation as bf
from src import coil_class as BC
#from IPython import get_ipython
#get_ipython().run_line_magic('matplotlib', 'qt')
#get_ipython().run_line_magic('matplotlib', 'inline')
# %%
#set up axis
x = np.linspace(-15, 15, 30001)
z = np.linspace(-15, 15, 30001)
# New coil
Wire_1 = [0.5, 0.568]
#Wire_1 = [0.45, 0.514]
#I_current = 0.94
HH_Coil = BC.BCoil(HH = 1, distance = 54, radius = 48, layers = 8, windings = 8, wire_height = 0.5,
wire_width = 0.5, insulation_thickness = (0.546-0.5)/2, is_round = True,
winding_scheme= 2)
HH_Coil.set_R_inner(45.6)
HH_Coil.set_d_min(2*24.075)
HH_Coil.print_info()
R = HH_Coil.resistance(22.5)
print(f"U = {1 * R}")
# %%
I_current = 1
# 0.4 to get from +-30300
#Bz, Bx = AHH_Coil.B_field(I_current, x, z, raster = 7)
Bz, B_x_tot = HH_Coil.B_field(I_current, x, z, raster = 7)
Bz_as, B_x_as = HH_Coil.B_field_asym(I_current, x, z, raster = 7)
Bz_curv = BC.BCoil.curv(Bz, z)
Bz_curv_as = BC.BCoil.curv(Bz_as, z)
#AHH_Coil.cooling(I_current,28)
# %%
print("Symmetric coil configuration")
print(f"Bz(0) = {Bz[15000]} G")
print(f"B_z_curvature(0) = {Bz_curv[15000]:.10f} G/cm^2")
#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]}")
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("")
print("Asymmetric coil configuration (one with 200 ÎĽm smaller diameter)")
print(f"Bz(0) = {Bz_as[15000]} G")
print(f"B_z_curvature(0) = {Bz_curv_as[15000]:.10f} G/cm^2")
#print(f"Bz(1 ÎĽm) = {Bz[15001]}")
#print(f"Bz(1 mm) = {Bz[16000]}")
print(f"Diff B + 1 ÎĽm: {Bz_as[15001] - Bz_as[15000]}, relative: {(Bz_as[15001] - Bz_as[15000])/Bz_as[15000]}")
print(f"Diff B - 1 ÎĽm: {Bz_as[14999] - Bz_as[15000]}, relative: {(Bz_as[14999] - Bz_as[15000])/Bz_as[15000]}")
print("")
print(f"Diff B + 0.5 mm: {Bz_as[15500] - Bz_as[15000]}, relative: {(Bz_as[15500] - Bz_as[15000])/Bz_as[15000]}")
print(f"Diff B - 0.5 mm: {Bz_as[14500] - Bz_as[15000]}, relative: {(Bz_as[14500] - Bz_as[15000])/Bz_as[15000]}")
print("")
print(f"Diff B + 1 mm: {Bz_as[16000] - Bz_as[15000]}, relative: {(Bz_as[16000] - Bz_as[15000])/Bz_as[15000]}")
print(f"Diff B - 1 mm: {Bz_as[14000] - Bz_as[15000]}, relative: {(Bz_as[14000] - Bz_as[15000])/Bz_as[15000]}")
print("")
print("Comparison Bx")
print(f"Symmetric Bx = {B_x_tot[15001]}")
print(f"Bx(0) = {B_x_as[15001]}")
print(f"Diff B - 1 mm: {B_x_as[14000] - B_x_as[15000]}, relative: {(B_x_as[14000] - B_x_as[15000])/B_x_as[15000]}")
#print(f"Diff B +/- 15 mm: {Bz[30000] - Bz[15000]}, relative: {(Bz[30000] - Bz[15000])/Bz[15000]}")
_
# %%
HH_Coil = BC.BCoil(HH = 1, distance = 54, radius = 48, layers = 8, windings = 8, wire_height = 0.5,
wire_width = 0.5, insulation_thickness = (0.546-0.5)/2, is_round = True,
winding_scheme= 2)
HH_Coil.set_R_inner(45.6-0.1)
HH_Coil.set_d_min(2*24.075)
HH_Coil.print_info()
# %%
I_current = 1
# 0.4 to get from +-30300
#Bz, Bx = AHH_Coil.B_field(I_current, x, z, raster = 7)
Bz_2, B_x_2 = HH_Coil.B_field(I_current, x, z, raster = 7)
Bz_curv_2 = BC.BCoil.curv(Bz_2, z)
print("")
print(f"Diff B +/- 1 mm: {Bz_2[16000] - Bz_2[15000]}, relative: {(Bz_2[16000] - Bz_2[15000])/Bz_2[15000]}")
"""
plt.figure(300)
#Field plot
##########################
plt.subplot(2,1,1)
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")
#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"$Bz$ [G]")
plt.xlabel("z-axis [mm]")
plt.legend()#bbox_to_anchor=(1.05, 1), loc='upper left')
plt.subplot(2,1,2)
plt.plot(z,Bz_curv,linestyle = "solid", label = r"$\nabla_z^2 B_{ref}$, d = 44 mm, R = 44 mm")
#plt.plot(z,B_z_comp_curv,linestyle = "solid", label = r"$\nabla_z^2 B_{z,1}$, d = 54 mm, R = 48.8 mm, I = 5 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 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')
#plt.savefig("output/first_compensation_idea.png")
plt.show()
"""
"""
AHH ############################################################################
###############################################################################
###############################################################################
"""

View File

@ -1,55 +0,0 @@
-3.23 9.68 9.68
0.0 12.9 6.45
0.0 9.68 6.45
3.23 12.9 6.45
6.45 9.68 9.68
0.0 3.23 3.23
0.0 6.45 6.45
0.0 3.23 6.45
0.0 3.23 6.45
0.0 6.45 6.45
0.0 -6.45 6.45
0.0 -3.23 6.45
0.0 -6.45 6.45
0.0 -6.45 6.45
3.23 -3.23 6.45
0.0 -12.9 9.68
0.0 -16.13 6.45
0.0 -12.9 9.68
0.0 -9.68 6.45
-3.23 -12.9 9.68
0.0 -19.35 9.68
0.0 -19.35 9.68
0.0 -22.58 6.45
0.0 -19.35 6.45
0.0 -19.35 6.45
0.0 -29.03 6.45
0.0 -29.03 6.45
-3.23 -29.03 6.45
0.0 -32.26 9.68
-3.23 -29.03 9.68
0.0 -35.48 6.45
0.0 -38.71 9.68
0.0 -38.71 6.45
-3.23 -38.71 6.45
0.0 -35.48 6.45
0.0 -45.16 6.45
0.0 -45.16 9.68
-3.23 -45.16 6.45
0.0 -45.16 6.45
-3.23 -45.16 6.45
0.0 -51.61 6.45
-3.23 -51.61 9.68
-3.23 -51.61 6.45
-3.23 -54.84 6.45
-3.23 -51.61 6.45
-3.23 -61.29 9.68
-3.23 -61.29 6.45
0.0 -58.06 9.68
-3.23 -64.52 9.68
-3.23 -61.29 9.68
0.0 -67.74 9.68
-3.23 -70.97 9.68
-3.23 -67.74 16.13
-3.23 -70.97 6.45
-3.23 -70.97 9.68

View File

@ -1,27 +0,0 @@
import matplotlib.pyplot as plt
import numpy as np
import matplotlib
#matplotlib.use('Qt5Agg')
from src import coil_class as BC
HH_Coil = BC.BCoil(HH = 1, distance = 54, radius = 48, layers = 8, windings = 8, wire_height = 0.5,
wire_width = 0.5, insulation_thickness = (0.546-0.5)/2, is_round = True,
winding_scheme= 2)
HH_Coil.set_R_inner(45.6)
HH_Coil.set_d_min(47.4)
HH_Coil.print_info()
HH_Coil.max_field_one_coil(5)
# %%
#By_cal = np.array([9.68, 12.9, 9.68, 12.9, 9.68, 3.23, 6.45, 3.23, 3.23, 6.45, -6.45, -3.23, -6.45, -6.45, -3.23, -12.9, -16.13, -12.9, -9.68, -12.9, -19.35, -19.35, -22.58, -19.35, -19.35, -29.03, -29.03, -29.03, -32.26, -29.03, -35.48, -38.71, -38.71, -38.71, -35.48, -45.16, -45.16, -45.16, -45.16, -45.16, -51.61, -51.61, -51.61, -54.84, -51.61, -61.29, -61.29, -58.06, -64.52, -61.29, -67.74, -70.97, -67.74, -70.97, -70.97])
#np.save('Data/By_cal.npy',By_cal)
# %%
B = np.load('Data/Bz_AHH.npy')
print(B)
print(len(B))

View File

@ -1,55 +0,0 @@
0.0 9.68 6.45
0.0 12.9 6.45
-3.23 9.68 6.45
0.0 12.9 6.45
0.0 9.68 6.45
3.23 19.35 6.45
0.0 19.35 6.45
3.23 19.35 3.23
0.0 19.35 3.23
0.0 19.35 6.45
0.0 29.03 3.23
0.0 25.81 3.23
0.0 25.81 6.45
0.0 25.81 6.45
0.0 25.81 6.45
3.23 35.48 9.68
0.0 32.26 3.23
0.0 35.48 6.45
3.23 35.48 6.45
0.0 35.48 6.45
0.0 45.16 3.23
0.0 45.16 3.23
0.0 41.94 3.23
0.0 45.16 3.23
0.0 41.94 3.23
0.0 51.61 3.23
0.0 51.61 6.45
0.0 51.61 3.23
0.0 48.39 3.23
3.23 48.39 3.23
3.23 58.06 3.23
0.0 58.06 3.23
0.0 61.29 3.23
0.0 61.29 3.23
0.0 58.06 3.23
0.0 67.74 3.23
3.23 67.74 6.45
3.23 67.74 3.23
0.0 67.74 3.23
0.0 67.74 3.23
0.0 74.19 3.23
0.0 77.42 6.45
3.23 74.19 3.23
0.0 74.19 3.23
3.23 74.19 6.45
0.0 83.87 3.23
0.0 87.1 0.0
0.0 80.65 3.23
3.23 87.1 3.23
3.23 83.87 3.23
0.0 93.55 0.0
6.45 93.55 3.23
0.0 90.32 0.0
0.0 93.55 3.23
3.23 90.32 3.23

View File

@ -1,55 +0,0 @@
0.0 9.68 6.45
0.0 9.68 6.45
0.0 12.9 3.23
0.0 9.68 6.45
3.23 9.68 6.45
3.23 3.23 6.45
0.0 0.0 6.45
0.0 0.0 6.45
0.0 0.0 6.45
0.0 3.23 6.45
0.0 -9.68 9.68
0.0 -9.68 6.45
0.0 -12.9 6.45
0.0 -9.68 6.45
0.0 -9.68 9.68
0.0 -22.58 9.68
-3.23 -22.58 6.45
0.0 -22.58 6.45
0.0 -19.35 6.45
0.0 -22.58 6.45
-3.23 -32.26 6.45
0.0 -32.26 6.45
-3.23 -32.26 6.45
0.0 -32.26 6.45
0.0 -32.26 6.45
-3.23 -41.94 9.68
-3.23 -41.94 6.45
-3.23 -45.16 6.45
0.0 -45.16 6.45
-3.23 -45.16 6.45
0.0 -54.84 9.68
-3.23 -54.84 6.45
-3.23 -51.61 9.68
-3.23 -58.06 9.68
-3.23 -51.61 6.45
0.0 -64.52 9.68
-3.23 -64.52 6.45
-3.23 -64.52 9.68
0.0 -61.29 9.68
-3.23 -64.52 9.68
0.0 -74.19 9.68
-3.23 -74.19 12.9
-3.23 -74.19 9.68
0.0 -77.42 6.45
3.23 -74.19 9.68
0.0 -87.1 12.9
-3.23 -87.1 9.68
-3.23 -87.1 9.68
0.0 -83.87 9.68
0.0 -83.87 12.9
-3.23 -96.77 9.68
-3.23 -96.77 9.68
-3.23 -96.77 9.68
-3.23 -96.77 9.68
-3.23 -96.77 9.68

View File

@ -1,55 +0,0 @@
0.0 12.9 6.45
0.0 12.9 6.45
0.0 9.68 6.45
3.23 12.9 6.45
0.0 12.9 6.45
3.23 22.58 6.45
0.0 22.58 6.45
0.0 19.35 3.23
0.0 22.58 6.45
0.0 22.58 6.45
0.0 35.48 6.45
0.0 32.26 3.23
0.0 32.26 6.45
0.0 32.26 3.23
0.0 32.26 3.23
0.0 41.94 3.23
0.0 41.94 3.23
0.0 41.94 3.23
3.23 45.16 6.45
0.0 41.94 9.68
0.0 54.84 3.23
0.0 54.84 3.23
0.0 54.84 3.23
0.0 54.84 3.23
0.0 51.61 3.23
3.23 67.74 6.45
3.23 64.52 3.23
0.0 64.52 6.45
0.0 64.52 3.23
3.23 64.52 3.23
3.23 77.42 3.23
3.23 77.42 3.23
3.23 74.19 3.23
0.0 77.42 9.68
3.23 80.65 6.45
0.0 87.1 3.23
3.23 87.1 3.23
3.23 87.1 0.0
0.0 87.1 0.0
0.0 87.1 3.23
3.23 96.77 0.0
3.23 96.77 3.23
3.23 100.0 6.45
0.0 96.77 3.23
3.23 96.77 3.23
3.23 112.9 3.23
3.23 109.68 3.23
3.23 109.68 3.23
0.0 109.68 0.0
6.45 109.68 3.23
3.23 119.35 3.23
0.0 119.35 0.0
3.23 122.58 0.0
3.23 119.35 3.23
3.23 116.13 0.0

View File

@ -1,34 +0,0 @@
import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import curve_fit
#get data from txt, usecols=0 is B_x, 1 is B_y, 2 is B_z
B=np.genfromtxt('Data.txt', usecols=1, unpack=True)
#just determining calibrating parameters from several tries
ratio=np.mean([0.49275,0.47778,0.48105,0.51098,0.49541,0.5094,0.4783,0.51914])
dratio=np.std([0.49275,0.47778,0.48105,0.51098,0.49541,0.5094,0.4783,0.51914])
offset=np.mean([7.12939,6.99607,6.8554,6.13588,7.06523,6.78745,3.4305,4.1762])
doffset=np.std([7.12939,6.99607,6.8554,6.13588,7.06523,6.78745,3.4305,4.1762])
print('ratio:',np.round(ratio,3),'+/-',np.round(dratio,3))
print('offset:',np.round(offset,3),'+/-',np.round(doffset,3))
#calibrated new values
B_cal=(-1)*(ratio*B-ratio*offset)
dB_cal=np.sqrt((B*dratio-offset*dratio)**2+(ratio*1.615)**2+(ratio*doffset)**2)
# exemplary plotting and fitting, analyse calibrated values whichever way you want
print(B_cal)
plt.errorbar(x,B_cal,dB-cal)
plt.ylabel('G')
plt.xlabel('mm')
plt.title('Gradient field z-axis 4A AHH, 1A HH')
def linear(x,m,b):
return m*x+b
popt,pcov=curve_fit(linear,x,B_cal,sigma=dB_cal)
plt.plot(x,linear(x,*popt),label='measurement fit')
print('Gradient:',popt[0]*10,'+/-',np.sqrt(pcov[0][0])*10)
plt.show()

View File

@ -1,53 +0,0 @@
import serial
import re
import matplotlib.pyplot as plt
import numpy as np
#connect to device, check if correct port
ser =serial.Serial('COM3',19200)
if not ser.isOpen():
ser.open()
print('com3 is open', ser.isOpen())
Bx=[]
By=[]
Bz=[]
x=[]
i=0
f=open('Data/Cal_neg.txt','w')
fig, axs=plt.subplots(1,3)
#plug in number of measurement points (here 35)
#save all data in a txt sheet
for k in range(0, 55 ):
a=ser.readline()
data=str(a,'utf-8')
points=re.findall(r'-?\d+\.?\d*', data)
Bx_point=float(points[0])
By_point=float(points[1])
Bz_point=float(points[2])
Bx.append(Bx_point)
By.append(By_point)
Bz.append(Bz_point)
x.append(i)
i+=1
print(Bx_point,By_point,Bz_point)
f.write(str(Bx_point)+'\t'+str(By_point)+'\t'+str(Bz_point)+'\n')
f.close()
#plot to get a first look at magnetic field (not calibrated)
axs[0].errorbar(x,Bx,1.615)
axs[0].set_title('Bx')
axs[0].set(ylabel='G')
axs[1].errorbar(x,By,1.615)
axs[1].set_title('By')
axs[1].set(ylabel='G')
axs[2].errorbar(x,Bz,1.615)
axs[2].set_title('Bz')
axs[2].set(ylabel='G')
print(By)
plt.show()
np.save('Data/By_cal_neg.npy', By)

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,34 @@
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 27 15:14:48 2021
@author: Joschka
"""
from src import physical_constants as cs
import numpy as np
m = 2.69e-25
k = 2*0.2097*9.9*cs.mu_B
omega = np.sqrt(k/m)
f = omega/(2*np.pi)
T = 1/f
T_exp = T/4
#print(T_exp)
start_z = 1e-6
d_t = 1e-3
def force(z):
return 2*0.248*z*9.9*cs.mu_B
z = start_z
v = 0
for t in np.arange(0,T_exp,d_t):
v = v + force(z)/m * d_t
#print(v)
z = z + v * d_t
print(z)
print(omega)
print(omega*1000e-3)
print(700*20e-3*2*np.pi)

Some files were not shown because too many files have changed in this diff Show More