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(-15, 15, 30000)
|
|
|
|
z = np.linspace(-15, 15, 30000)
|
|
|
|
|
|
|
|
#New coil
|
|
|
|
I_current = 5
|
|
|
|
HH_Coil = BC.BCoil(HH = 1, distance = 54 ,radius = 48 , layers = 4, windings = 4, wire_height = 1, wire_width = 1,windings_spacing=0.25, layers_spacing = 0.25)
|
|
|
|
HH_Coil.set_R_outer(49.3)
|
|
|
|
HH_Coil.set_d_min(49.8)
|
|
|
|
|
|
|
|
HH_Coil.print_info()
|
2021-10-20 16:49:17 +02:00
|
|
|
Bz, Bx = HH_Coil.B_field(I_current, x, z, raster = 10)
|
2021-10-01 14:37:07 +02:00
|
|
|
Bz_curv = BC.BCoil.curv(Bz, z)
|
|
|
|
HH_Coil.cooling(I_current)
|
|
|
|
|
|
|
|
print(f"B_z(0) = {Bz[150]:.2f} G")
|
|
|
|
print(f"B_z_curvature(0) = {Bz_curv[150]:.4f} G/cm^2")
|
|
|
|
|
|
|
|
|
|
|
|
print(x[500])
|
|
|
|
|
|
|
|
# I_current = 5*16
|
|
|
|
# HH_Coil = BC.BCoil(HH = 1, distance = 54 ,radius = 48 , layers = 1, windings = 1, wire_height = 10, wire_width = 6)
|
|
|
|
# HH_Coil.set_R_outer(49.3)
|
|
|
|
# HH_Coil.set_d_min(49.8)
|
|
|
|
|
|
|
|
# HH_Coil.print_info()
|
2021-10-20 16:49:17 +02:00
|
|
|
# Bz, Bx = HH_Coil.B_field(I_current,x,z,raster = 50)
|
2021-10-01 14:37:07 +02:00
|
|
|
# Bz_curv = BC.BCoil.curv(Bz, z)
|
|
|
|
# HH_Coil.cooling(I_current)
|
|
|
|
|
|
|
|
# print(f"B_z(0) = {Bz[150]:.2f} G")
|
|
|
|
# print(f"B_z_curvature(0) = {Bz_curv[150]:.4f} G/cm^2")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#Compensation Coil
|
|
|
|
HH_Coil_comp = BC.BCoil(HH = 1, distance = 54 ,radius = 37, layers = 4, windings = 4,wire_height = 1, wire_width = 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)
|
|
|
|
I_HH = 5
|
|
|
|
I_comp = -1.4
|
|
|
|
|
|
|
|
#calculate field
|
2021-10-20 16:49:17 +02:00
|
|
|
B_z, B_x = HH_Coil.B_field(I_HH, x, z)
|
|
|
|
B_z_comp,B_x_comp = HH_Coil_comp.B_field(I_comp, x, z)
|
2021-10-01 14:37:07 +02:00
|
|
|
|
|
|
|
#Calculate curvature
|
|
|
|
B_z_curv = BC.BCoil.curv(B_z, z)
|
|
|
|
B_z_comp_curv = BC.BCoil.curv(B_z_comp, z)
|
|
|
|
|
|
|
|
|
|
|
|
B_tot = B_z + B_z_comp
|
|
|
|
|
|
|
|
B_tot_curv = BC.BCoil.curv(B_tot, z)
|
|
|
|
plt.figure(300)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#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_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"$B_z$ [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,B_z_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 B_z [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 ############################################################################
|
|
|
|
###############################################################################
|
|
|
|
###############################################################################
|
|
|
|
"""
|