-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpython_functions.py
More file actions
66 lines (50 loc) · 3.18 KB
/
python_functions.py
File metadata and controls
66 lines (50 loc) · 3.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
def beta_law(T, a, b, c):
return a*numpy.power(Tm/(Tm-T),1/2)
def beta_law_energy(x, a, b):
return a*numpy.power(x,b)
def total_heat_output(T_, T0_, vfeed_, ρ_mat_, κ_mat_, κ_tool_, cp_, Rbar_, Rtool_, t_, h_, width_, Ttool_, Tlayer_, C_th_, alpha_th_):
A_feed_ = 4 * Rbar_**2 # m^2
A_tool_ = math.pi * Rtool_**2 # m^2
vtool_ = vfeed_ * A_feed_ / (math.pi*Rtool_*t_)
Pel_ = width_ * vtool_ * ρ_mat_ * cp_ / κ_mat_
Q1m_ = -(T_ - T0_)/power_law(Pel_, C_th_, alpha_th_)
Q2m_ = -κ_tool_*A_tool_*(T_ - Ttool_)/h_
Q3m_ = -vfeed_*A_feed_*ρ_mat_*cp_*(T_-Tlayer_)
return Q1m_+Q2m_+Q3m_
def Q3plus(T_, vfeed_, ρ_mat_, cp_, Rbar_, Ttool_):
A_feed_ = 4 * Rbar_**2 # m^2
return vfeed_*A_feed_*ρ_mat_*cp_*(T_-Ttool_)
def total_heat_input_motor(T_, Ω_, vfeed_, ρ_mat_, κ_mat_, cp_, α_, A_, n_, Rbar_, Rtool_, t_, h_, width_, Ttool_, Tm_, β0_, β1_, β2_):
ω_ = 2*math.pi*Ω_/60 # rad/s
ΔH_ = 145000 # J/mol
G_ = 8.314 # J/(mol.K)
A_feed_ = 4 * Rbar_**2 # m^2
A_tool_ = math.pi * Rtool_**2 # m^2
ζ_ = 0.9
G_ = 8.314
gamma_dot_max_ = Rbar_*ω_/t_
epsilon_dot_average_1_ = 2/(3*math.sqrt(3))*gamma_dot_max_
Z_ = epsilon_dot_average_1_*numpy.exp(ΔH_/(G_*T_))
sigma_e_ = numpy.arcsinh((Z_/A_)**(1/n_))/α_
Q1p_ = ζ_ * A_feed_*t_*sigma_e_*epsilon_dot_average_1_
r_ = numpy.linspace(Rbar_,Rtool_,1000)
Ea = 6e3
#β_ = beta_law_energy(2*math.pi*ω_*t_/vfeed_*numpy.exp(Ea/(G*(T_+273.15))), β0_, β1_)
β_ = beta_law(T_, β0_, β1_, β2_)
δ_ = 1-numpy.exp(-β_*(r_-Rbar_)/Rtool_)
Δ__ = (Rtool_ / β_**3) * (β_**2*Rbar_**2+2*β_*Rtool_*Rbar_+2*Rtool_**2 - (β_**2+2*β_+2)*Rtool_**2*numpy.exp(-β_*(Rtool_-Rbar_)/Rtool_))
Q2p_ = ζ_ * 2 * (math.pi/math.sqrt(3)) * ω_ * sigma_e_ * Δ__
return Q1p_ + Q2p_
def total_heat_input(T_, Ω_, vfeed_, ρ_mat_, κ_mat_, cp_, α_, A_, n_, Rbar_, Rtool_, t_, h_, width_,
Ttool_, Tm_, β0_, β1_, β2_):
return total_heat_input_motor(T_, Ω_, vfeed_, ρ_mat_, κ_mat_, cp_, α_, A_, n_, Rbar_, Rtool_, t_, h_, width_, Ttool_, Tm_, β0_, β1_, β2_) + Q3plus(T_, vfeed_, ρ_mat_, cp_, Rbar_, Ttool_)
def total_heat_abs(T_, T0_, Ω_, vfeed_, ρ_mat_, κ_mat_, κ_tool_, cp_, α_, A_, n_, Rbar_, Rtool_, t_, h_, width_,
Ttool_, Tlayer_, C_th_, alpha_th_, Tm_, β0_, β1_, β2_):
Qout_ = total_heat_output(T_, T0_, vfeed_, ρ_mat_, κ_mat_, κ_tool_, cp_, Rbar_, Rtool_, t_, h_, width_, Ttool_, Tlayer_, C_th_, alpha_th_)
Qin_ = total_heat_input(T_, Ω_, vfeed_, ρ_mat_, κ_mat_, cp_, α_, A_, n_, Rbar_, Rtool_, t_, h_, width_, Ttool_, Tm_, β0_, β1_, β2_)
Qtot_ = Qin_ + Qout_
return abs(Qtot_)
def temperature_offset(Ω, T0, Ttarget, vfeed, ρ_mat, κ_mat, κ_tool, cp, α, A, n, Rbar, Rtool, t, h, width, Ttool, Tlayer, C_th, alpha_th, Tm, β0, β1, β2):
T = 400 # Guess
result_process_temp = optimize.minimize(total_heat_abs, T, method='Nelder-Mead', options={'xatol': 1.0}, args=(T0, Ω, vfeed, ρ_mat, κ_mat, κ_tool, cp, α, A, n, Rbar, Rtool, t, h, width, Ttool, Tlayer, C_th, alpha_th, Tm, β0, β1, β2), tol=1.0)
return abs(result_process_temp.x[0]-Ttarget)