Repository navigation
Expand file tree
/
Copy pathtemperature_map.py
More file actions
90 lines (71 loc) · 3.71 KB
/
Copy pathtemperature_map.py
File metadata and controls
90 lines (71 loc) · 3.71 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
def traverse_mm_s_to_kg_hr(v):
return v*width*t*ρ_mat*3600/1000
def traverse_kg_hr_to_mm_s(v):
return v/(width*t*ρ_mat*3600/1000)
def vfeed_kg_hr_to_mm_s(dr):
vtool = traverse_kg_hr_to_mm_s(dr)
return vtool * (math.pi*Rtool*t) / (4*Rbar**2)
def vfeed_mm_s_to_kg_hr(vfeed):
vtool = vfeed * (4*Rbar**2) / (math.pi*Rtool*t)
return traverse_mm_s_to_kg_hr(vtool)
# Reset parameters:
t = 1.5e-3 # m
Rbar = 12.5e-3/2 # m
Rtool = 38e-3/2 # m
Nd = 200
NΩ = 200
deposition_rate = numpy.linspace(0, 40, Nd)
vtools = traverse_kg_hr_to_mm_s(deposition_rate)/1000
vfeeds = vtools * (math.pi*Rtool*t) / A_feed #numpy.array([1e-3, 2e-3, 3e-3]) # m/s
Pel = width * vtools * ρ_mat * cp / κ_mat
FEM_domain = numpy.logical_and(Pel < 6, Pel > 0.3)
above_FEM_domain = Pel >= 6
below_FEM_domain = Pel <= 1
RPM_low = 200
RPM_max = 900
Ωs = numpy.linspace(RPM_low, RPM_max, NΩ)#numpy.linspace(300, 900, 10) # RPM
X, Y = numpy.meshgrid(deposition_rate, Ωs)
Tprocess = numpy.zeros((NΩ,Nd))
Pprocess = numpy.zeros((NΩ,Nd))
for count, Ω in enumerate(Ωs):
for count2, vfeed in enumerate(vfeeds):
T = 450
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)
#print(result_process_temp)
Tresult = result_process_temp.x[0]
Tprocess[count,count2] = Tresult
# Determine what was the total heat input associated with this temperature:
Pprocess[count,count2] = total_heat_input_motor(Tresult, Ω, vfeed, ρ_mat, κ_mat, cp, α, A, n, Rbar, Rtool, t, h, width,
Ttool, Tm, β0, β1, β2)
Tprocess_ = numpy.copy(Tprocess)
Tprocess_[Tprocess_ > Tm] = Tm
figsize=set_size('elsevier', fraction=fraction)
fig, ax = plt.subplots(1, 1, figsize=(figsize[0],figsize[1]*1.4))
plt.grid(True, which="both", axis="x")
plt.grid(True, which="major", axis="y")
im = ax.imshow(Tprocess_/Tm, interpolation='bilinear', origin='lower',
cmap=cm.bone, extent=(deposition_rate[0], deposition_rate[-1], RPM_low, RPM_max), aspect='auto')
levels = numpy.arange(0, 1.1, 0.1)
CS = ax.contour(Tprocess/Tm, levels, origin='lower', colors='red', extend='both',
linewidths=1, extent=(deposition_rate[0], deposition_rate[-1], RPM_low, RPM_max))
ax.clabel(CS, levels, # label every second level
inline=True, fmt='%1.1f Tm', fontsize=10, colors='red', manual=[(20,278),(20, 420), (5,800)])
# We can still add a colorbar for the image.
CBI = fig.colorbar(im, orientation='vertical', shrink=0.8)
CBI.set_label('Fraction of the melting temperature')
ax.set_xlabel("Deposition rate (kg/hr)")
ax.set_ylabel("Tool rotational speed (RPM)")
secax = ax.secondary_xaxis('top', functions=(traverse_kg_hr_to_mm_s,traverse_mm_s_to_kg_hr))
secax.set_xlabel("Traverse velocity (mm/s)")
thiax = ax.secondary_xaxis(1.2, functions=(vfeed_kg_hr_to_mm_s,vfeed_mm_s_to_kg_hr))
thiax.set_xlabel(r"Feed rate (mm/s)")
plt.text(0.74, 0.81, 't={} mm'.format(t*1000), horizontalalignment='left', verticalalignment='center', transform=ax.transAxes)
plt.text(0.74, 0.88, '$R_0$={:.0f} mm'.format(Rbar*1000), horizontalalignment='left', verticalalignment='center', transform=ax.transAxes)
plt.text(0.74, 0.95, '$R_t$={:.0f} mm'.format(Rtool*1000), horizontalalignment='left', verticalalignment='center', transform=ax.transAxes)
#ax.set_xlim(0,20)
#ax.set_ylim(200,1200)
#ax.set_xscale('log')
pdfname5 = "figures/process_map_RPM_vs_transverse_speed.pgf"
plt.tight_layout()
plt.savefig(pdfname5, format='pgf')