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)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AHH_Coil = BC.BCoil(-1,54,37,4, 4, 1,1)
|
|
|
|
|
|
|
|
AHH_Coil.set_R_outer(49.3)
|
|
|
|
|
|
|
|
#AHH_Coil.print_info()
|
|
|
|
|
2021-11-09 10:00:44 +01:00
|
|
|
#Bz,B_x = AHH_Coil.B_field(1,x,z)
|
2021-10-01 14:37:07 +02:00
|
|
|
|
2021-11-09 10:00:44 +01:00
|
|
|
#B_z_grad = BC.BCoil.grad(Bz, z)
|
2021-10-22 18:53:04 +02:00
|
|
|
#B_x_grad = BC.BCoil.grad(B_x,x)
|
2021-10-01 14:37:07 +02:00
|
|
|
|
|
|
|
plt.figure(1,figsize=(10,13))
|
|
|
|
#plt.rcParams.update({'font.size': 15})
|
|
|
|
plt.suptitle("Anti Helmholtz coil field, I = 2 A, d = 82 mm, R_inner = 46.3 mm ", fontsize = 13)
|
|
|
|
|
|
|
|
#Field plot
|
|
|
|
##########################
|
|
|
|
|
|
|
|
d=82
|
|
|
|
AHH_Coil = BC.BCoil(-1,d,47.3,4, 4, 1,1)
|
|
|
|
|
|
|
|
#AHH_Coil.set_R_outer(49.3)
|
|
|
|
|
|
|
|
AHH_Coil.print_info()
|
|
|
|
#B = AHH_Coil.B_multiple_3d(10, x,z,raster=2)
|
|
|
|
AHH_Coil.cooling(10)
|
|
|
|
|
2021-10-20 16:49:17 +02:00
|
|
|
B_z,B_x = AHH_Coil.B_field(10, x, z)
|
2021-11-09 10:00:44 +01:00
|
|
|
#Bz = B[:,150,1]
|
2021-10-01 14:37:07 +02:00
|
|
|
#B_x = B[150,:,0]
|
|
|
|
|
2021-10-22 18:53:04 +02:00
|
|
|
B_z_grad = BC.BCoil.grad(B_z, z)
|
|
|
|
B_x_grad = BC.BCoil.grad(B_x, x)
|
2021-10-01 14:37:07 +02:00
|
|
|
|
|
|
|
plt.subplot(2,1,1)
|
|
|
|
|
2021-11-09 10:00:44 +01:00
|
|
|
plt.plot(z,B_z,linestyle = "solid", label = f"$Bz$, d = {d} mm")
|
2021-10-01 14:37:07 +02:00
|
|
|
plt.plot(x,B_x, label = f"$B_x$, d = {d} mm")
|
|
|
|
#plt.xlim(-0.01,0.01)
|
|
|
|
plt.title("B-field" )
|
|
|
|
#plt.ylim(-0.5,0.4)
|
|
|
|
plt.ylabel(r"$B$ [G]")
|
|
|
|
plt.xlabel("z-axis / x-axis [mm]")
|
|
|
|
plt.legend()
|
|
|
|
|
|
|
|
plt.subplot(2,1,2)
|
2021-11-09 10:00:44 +01:00
|
|
|
plt.plot(z,B_z_grad,linestyle = "solid", label = r"$\nabla_z Bz$")
|
2021-10-01 14:37:07 +02:00
|
|
|
plt.plot(x,B_x_grad,linestyle = "solid", label = r"$\nabla_x B_x$")
|
|
|
|
|
|
|
|
plt.ylabel(r"$\nabla_i B_i [G/cm]$")
|
|
|
|
plt.xlabel("z-axis /x-axis [mm]")#plt.xlim(-10,10)
|
|
|
|
plt.title("Gradient of B-field")
|
|
|
|
plt.legend()
|
|
|
|
plt.savefig("output/AHH_field.pdf")
|
|
|
|
plt.show()
|
|
|
|
|
|
|
|
#AHH_Coil.plot_3d(2, 80, 80)
|
|
|
|
|
|
|
|
"""
|
|
|
|
print(" ")
|
|
|
|
print(f"B_grad_z(0) = {B_z_grad[1500]} G/cm")
|
|
|
|
print(f"B_grad_z(10 mm) = {B_z_grad[1800]} G/cm")
|
|
|
|
print(f"Diff B_grad z 10mm - 0 mm, {-(B_z_grad[1800]-B_z_grad[1500])} G/cm, relative: {(B_z_grad[1800]-B_z_grad[1500])/-B_z_grad[1500]}")
|
|
|
|
print(" ")
|
|
|
|
print(f"B_grad_x(0) = {B_x_grad[1500]} G/cm")
|
|
|
|
print(f"B_grad_x(10 mm) = {B_x_grad[1800]} G/cm")
|
|
|
|
print(f"Diff B_grad x 10mm - 0 mm, {B_x_grad[1800]-B_x_grad[1500]} G/cm, relative: {(B_x_grad[1800]-B_x_grad[1500])/-B_x_grad[1500]}")
|
|
|
|
"""
|
|
|
|
|
|
|
|
|