DyLab_3D_MOT/Test_class1.py

82 lines
1.8 KiB
Python
Raw Normal View History

2021-10-01 14:37:07 +02:00
# -*- coding: utf-8 -*-
"""
Created on Mon Aug 16 11:49:41 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, 101)
z = np.linspace(-50, 50, 101)
################# My simulation #########################
I = 5
HH = 1
d_coils = 44
R_mid = 44
layers = 6
windings = 2
wire_width = 1.7
wire_height = 2.6
HH_Coil_44 = BC.BCoil(HH, d_coils ,R_mid, layers, windings, wire_width, wire_height)
d_coils_2 = 55.2
HH_Coil_54 = BC.BCoil(HH, d_coils_2 ,R_mid, layers, windings, wire_width, wire_height)
#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)
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
B_z_curvature = np.gradient(np.gradient(B_z,z),z)*1e2
B_z_curvature_2 = np.gradient(np.gradient(B_z_2,z),z)*1e2
plt.figure(100,figsize=(13,10))
#plt.rcParams.update({'font.size': 15})
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)
2021-11-09 10:00:44 +01:00
plt.plot(z,B_z,linestyle = "solid", label = r"$Bz$, d = 44 mm")
2021-10-01 14:37:07 +02:00
plt.plot(z,B_z_2,linestyle = "solid", label = r"$B_{z,2}$, d = 55.2 mm")
#plt.xlim(-0.01,0.01)
plt.title("B-field" )
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)
2021-11-09 10:00:44 +01:00
plt.plot(z,B_z_curvature,linestyle = "solid", label = r"$\nabla_z^2 Bz$, d = 44 mm")
2021-10-01 14:37:07 +02:00
plt.plot(z,B_z_curvature_2,linestyle = "solid", label = r"$\nabla_z^2 B_{z,2}, d = 55.2 mm$")
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()