DyLab_3D_MOT/Coil_geometry/HH/04_Iterative_Testing.py

111 lines
2.9 KiB
Python
Raw Normal View History

2021-10-01 14:37:07 +02:00
# -*- 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
2022-09-02 13:30:37 +02:00
#from IPython import get_ipython
#get_ipython().run_line_magic('matplotlib', 'qt')
2021-10-01 14:37:07 +02:00
#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)
2022-09-02 13:30:37 +02:00
HH_Coil.set_d_min(47.4)
2021-10-01 14:37:07 +02:00
HH_Coil.print_info()
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,30)
print(f"B_z(0) = {Bz[1]:.2f} G")
print(f"B_z_curvature(0) = {Bz_curv[1]:.4f} G/cm^2")
2022-09-02 13:30:37 +02:00
# %%
2021-10-01 14:37:07 +02:00
B = []
Curv = []
2022-09-02 13:30:37 +02:00
array_width = np.arange(2.5,6,0.1)
2021-10-01 14:37:07 +02:00
#array_width = [5.7]
for width in array_width:
2022-09-02 13:30:37 +02:00
height = 16/width
2021-10-01 14:37:07 +02:00
HH_Coil = HH_Coil_comp = BC.BCoil(HH = 1, distance = 54 ,radius = 37,layers = 1, windings = 1,wire_width = width, wire_height = height)
2022-09-02 13:30:37 +02:00
HH_Coil.set_R_outer(50)
HH_Coil.set_d_min(47.4)
#AHH_Coil.print_info()
2021-10-01 14:37:07 +02:00
Bz, Bx = HH_Coil.B_field(I_current, x, z, raster = 30)
2021-10-01 14:37:07 +02:00
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()
2022-09-02 13:30:37 +02:00
# %%
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]}")