# -*- coding: utf-8 -*- """ Created on Mon Sep 20 11:41:53 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 src import physical_constants as cs from IPython import get_ipython get_ipython().run_line_magic('matplotlib', 'qt') #get_ipython().run_line_magic('matplotlib', 'inline') #set up constants #h_air =10 #Heat transfer with air W/m^2 K e_cu = 3e-2 #emissivity copper, polished rho_cu = 1.7*1e-8 I = 10 #A #set up axis x = np.linspace(-50, 50, 10001) z = np.linspace(-50, 50, 10001) AHH_opt = BC.BCoil(HH = -1, distance = 81.8 ,radius = 46.875 ,layers = 4, windings = 4 , wire_width= 1, wire_height= 2 ,layers_spacing = 0.25, windings_spacing= 0.25) h = AHH_opt.get_coil_height() w = AHH_opt.get_coil_width() print(h) print(w) vert_surf = h * AHH_opt.radius * 2 *np.pi hor_surf = np.pi*(AHH_opt.get_R_outer()**2-AHH_opt.get_R_inner()**2) S_coil = 2*vert_surf + 2*hor_surf #S_coil = S_coil/2 print(f"Surface area = {S_coil}") def power_bal(T,h_air): T_0 = 22.5 f = h_air * S_coil *(T-T_0) - 0.5*AHH_opt.power(I, T) return f print(e_cu * S_coil * cs.sigma_B**4 * (50**4 - 22.5**4)) T = np.linspace(20,120,500) T_calc = np.linspace(20,2200,1000) for h_air in [2.5,10,25]: pos_min = np.argmin(np.abs(power_bal(T_calc,h_air))) T_SS = T_calc[pos_min] print(f"T_ss = {T_SS} °C") plt.plot(T,power_bal(T,h_air),label = f"$h_{{air}} = {h_air} \; W/m^2 K$ , $T_{{SS}}$ = {T_SS:.2f}°C") plt.ylabel("Power balance [W]") plt.xlabel("temparature [°C]") plt.title(f"Power balance, free convection, AHH coil, I = {I} A, windings: 4 x 4") plt.legend() plt.show() print(AHH_opt.power(I, 25)/2)