2021-10-01 14:37:07 +02:00
|
|
|
# -*- 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(-50, 50, 301)
|
|
|
|
z = np.linspace(-50, 50, 301)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
I = 5
|
|
|
|
HH = 1
|
|
|
|
d_coils = 44
|
|
|
|
R_mid = 44
|
|
|
|
|
|
|
|
|
|
|
|
layers = 6
|
|
|
|
windings = 2
|
|
|
|
wire_width = 1.7
|
|
|
|
wire_height = 2.6
|
|
|
|
|
|
|
|
|
|
|
|
#reference coil
|
|
|
|
HH_Coil_44 = BC.BCoil(HH, 44 ,44, 6, 2, wire_width = 1.7, wire_height= 2.6)
|
|
|
|
|
|
|
|
|
|
|
|
#Coil from first sketch
|
|
|
|
HH_Coil_y = BC.BCoil(HH, 55.2 ,44, 6, 2, wire_width = 1.7, wire_height= 2.6)
|
2021-10-20 16:49:17 +02:00
|
|
|
B_z_y, B_x_y = HH_Coil_y.B_field(6.5, x, z)
|
2021-10-01 14:37:07 +02:00
|
|
|
B_z_y_curv = BC.BCoil.curv(B_z_y, z)
|
|
|
|
|
|
|
|
d_coils_2 = 55.2
|
|
|
|
|
|
|
|
#New coil
|
|
|
|
HH_Coil_54 = BC.BCoil(HH, 54 ,48.8, 4, 4, 1,1)
|
|
|
|
|
|
|
|
HH_Coil_54.cooling(5)
|
|
|
|
|
|
|
|
#Compensation Coil
|
|
|
|
HH_Coil_78 = BC.BCoil(1,54,37,4, 4, 1,1)
|
|
|
|
|
2021-10-22 18:53:04 +02:00
|
|
|
#HH_Coil_44.B_quick_plot(I,x,z)
|
2021-10-01 14:37:07 +02:00
|
|
|
|
|
|
|
|
|
|
|
#HH_Coil_44.Bz_plot_HH_comp(HH_Coil_54,I,x,z)
|
|
|
|
|
2021-10-20 16:49:17 +02:00
|
|
|
B_z, B_x = HH_Coil_44.B_field(I, x, z)
|
|
|
|
B_z_2, B_x_2 = HH_Coil_54.B_field(I, x, z)
|
2021-10-01 14:37:07 +02:00
|
|
|
|
2021-10-20 16:49:17 +02:00
|
|
|
B_z_3,B_x_3 = HH_Coil_78.B_field(-0.72, x, z)
|
2021-10-01 14:37:07 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
B_z_curvature = np.gradient(np.gradient(B_z,z),z)*1e2
|
|
|
|
B_z_curvature_2 = BC.BCoil.curv(B_z_2, z)
|
|
|
|
|
|
|
|
B_z_curv_3 = BC.BCoil.curv(B_z_3, z)
|
|
|
|
|
|
|
|
B_tot = B_z_2 + B_z_3
|
|
|
|
|
|
|
|
B_tot_curv = BC.BCoil.curv(B_tot, z)
|
|
|
|
plt.figure(300)
|
|
|
|
|
|
|
|
|
2021-11-09 10:00:44 +01:00
|
|
|
plt.suptitle("Helmholtz coil field Bz along z-axis, comparison to field yesterday")
|
2021-10-01 14:37:07 +02:00
|
|
|
|
|
|
|
|
|
|
|
#Field plot
|
|
|
|
##########################
|
|
|
|
plt.subplot(2,1,1)
|
|
|
|
plt.plot(z,B_z_y,linestyle = "solid", label = r"$B_{sketch}$, B-field according to current solidworks sketch, d = 55.2 mm, R = 44 mm, 6 x 2")
|
|
|
|
plt.plot(z,B_z_2,linestyle = "solid", label = r"$B_{z,1}$, d = 54 mm, R = 48.8 mm, I = 5 A, 4 x 4")
|
|
|
|
|
|
|
|
#plt.xlim(-0.01,0.01)
|
|
|
|
plt.title("B-field" )
|
|
|
|
|
2021-11-09 10:00:44 +01:00
|
|
|
plt.ylabel(r"$Bz$ [G]")
|
2021-10-01 14:37:07 +02:00
|
|
|
plt.xlabel("z-axis [mm]")
|
|
|
|
plt.legend()
|
|
|
|
|
|
|
|
plt.subplot(2,1,2)
|
|
|
|
plt.plot(z,B_z_y_curv,linestyle = "solid", label = r"$\nabla_z^2 B_{sketch}$, d = 55.2 mm, R = 44 mm, 6 x 2")
|
|
|
|
plt.plot(z,B_z_curvature_2,linestyle = "solid", label = r"$\nabla_z^2 B_{z,1}$, d = 54 mm, R = 48.8 mm, I = 5 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}$")
|
|
|
|
|
2021-11-09 10:00:44 +01:00
|
|
|
plt.ylabel(r"$\nabla_z^2 Bz [G/cm^2]$")
|
2021-10-01 14:37:07 +02:00
|
|
|
plt.xlabel("z-axis [mm]")#plt.xlim(-10,10)
|
|
|
|
plt.title("Curvature of B-field")
|
|
|
|
plt.legend(loc='lower right')
|
|
|
|
|
|
|
|
plt.show()
|
|
|
|
|
|
|
|
|
|
|
|
plt.figure(200,figsize=(15,13))
|
|
|
|
|
|
|
|
plt.rcParams.update({'font.size': 15})
|
2021-11-09 10:00:44 +01:00
|
|
|
plt.suptitle("Helmholtz coil field Bz along z-axis")
|
2021-10-01 14:37:07 +02:00
|
|
|
|
|
|
|
|
|
|
|
#Field plot
|
|
|
|
##########################
|
|
|
|
plt.subplot(2,1,1)
|
|
|
|
plt.plot(z,B_z,linestyle = "solid", label = r"$B_{ref}$, reference, optimal HH-configuration d = 44 mm, R = 44 mm")
|
|
|
|
plt.plot(z,B_z_2,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_3,linestyle = "solid", label = r"$B_{z,2}$, d = 54 mm, R = 37 mm, I = -0.7 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" )
|
|
|
|
|
2021-11-09 10:00:44 +01:00
|
|
|
plt.ylabel(r"$Bz$ [G]")
|
2021-10-01 14:37:07 +02:00
|
|
|
plt.xlabel("z-axis [mm]")
|
|
|
|
plt.legend()#bbox_to_anchor=(1.05, 1), loc='upper left')
|
|
|
|
|
|
|
|
plt.subplot(2,1,2)
|
|
|
|
plt.plot(z,B_z_curvature,linestyle = "solid", label = r"$\nabla_z^2 B_{ref}$, d = 44 mm, R = 44 mm")
|
|
|
|
plt.plot(z,B_z_curvature_2,linestyle = "solid", label = r"$\nabla_z^2 B_{z,1}$, d = 54 mm, R = 48.8 mm, I = 5 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}$")
|
|
|
|
|
2021-11-09 10:00:44 +01:00
|
|
|
plt.ylabel(r"$\nabla_z^2 Bz [G/cm^2]$")
|
2021-10-01 14:37:07 +02:00
|
|
|
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()
|
|
|
|
plt.close()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
AHH ############################################################################
|
|
|
|
###############################################################################
|
|
|
|
###############################################################################
|
|
|
|
"""
|