我正在對立方體進行熱傳遞模擬,并在立方體的中部使用二維熱圖繪制隨時間的演變。
這是使用“Image Viewer”啟動的 .gif 熱圖影片的螢屏截圖:

我想在 .gif 影片上顯示每次迭代的當前模擬時間,也就是說,在每個影像上,使用 Gnuplot。實際上,增量時間是 0.001 s,所以我想顯示類似“Time = 0.001 s”...“Time = 0.002 s”之類的東西。
我的資料集是這樣的:
x z t T
0.000 0.000 0.000 373.000
0.000 0.005 0.000 298.000
0.000 0.015 0.000 298.000
...
0.000 0.985 0.000 298.000
0.000 0.995 0.000 298.000
0.000 1.000 0.000 373.000
...
0.015 0.000 0.001 373.000
0.015 0.005 0.001 292.000
0.015 0.015 0.001 283.000
0.015 0.025 0.001 283.000
....
0.015 0.985 0.001 283.000
0.015 0.995 0.001 292.000
0.015 1.000 0.001 373.000
...
0.615 0.000 0.004 373.000
0.615 0.005 0.004 309.900
0.615 0.015 0.004 287.100
0.615 0.025 0.004 283.300
...
這是 Gnuplot 的 .plt 代碼:
set view map scale 1
set size square
set xlabel("x (m)")
set ylabel("z (m)")
set zlabel("T")
set xrange [-0.01:1.01]
set yrange [-0.01:1.01]
set title "Heat transfert 3D at mid depth of a cube"
set cblabel "T (K)"
set hidden3d
set palette rgb 33,13,10
set cbrange [283:373] # colobar range
set pm3d implicit at s
set pm3d corners2color max
set term gif animate delay 100
set output "para_heat_3D_insta_4_0.gif"
stats "plot_para_heat_3D_insta.dat"
do for [i=1:int(STATS_blocks)]{
splot "plot_para_heat_3D_insta.dat" index (i-1) using 1:2:4 with pm3d notitle
}
set output
有人有想法可以幫助我嗎?提前致謝。
uj5u.com熱心網友回復:
使用當前版本的 gnuplot (5.4) 的解決方案
DATA = "plot_para_heat_3D_insta.dat"
set key center at screen 0.5, 0.95
set key samplen 0
do for [i=1:int(STATS_blocks)]{
splot DATA index (i-1) using 1:2:(t=$3,$4) with pm3d title sprintf("time = %g",t)
}
這會將變數設定t為每個評估點的第 3 列的內容。在評估完所有點之后,最后一個點的第 3 列值仍然存在,t因此您可以使用它來構建繪圖的標題。
如果您有早期版本的 gnuplot
同樣的技巧是可能的,但它需要一個額外的虛擬繪圖命令來加載t但不繪制任何東西。
do for [i=1:int(STATS_blocks)]{
splot DATA index (i-1) every 1::1::1 using (t=$3):(NaN):(NaN) notitle, \
DATA index (i-1) using 1:2:4 with pm3d title sprintf("time = %g",t)
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/410455.html
標籤:
上一篇:漢堡圖示css影片成x
