I am doing a heat transfer simulation into a cube and plotting the evolution through time with a 2D heatmap at mid-depth of the cube.
The issue is that the edges, while they represent the same value because it is a boundary condition, are not the same thickness on the heatmap during the simulation.
We can see that easier with the top and bottom boundaries, which are at 373 K, in red. Here is a screenshot of the .gif heatmap launched with "Image Viewer":
I join the dataset used to plot the heatmap:
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
...
And here is the .plt code for Gnuplot:
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
Is someone has an idea and could help me? Thanks in advance.
Unfortunately, I don't have a good solution. To my opinion it is an issue with the rendering library, which I cannot explain.
You can compare
term pngcairo
andterm gif
. It looks like the GIF-terminal always makes the thin lines in different thicknesses, whereas the PNG looks much better.As a workaround for the GIF I tried to extract the "active plot area" in pixels of the gif image via the gnuplot variables
GPVAL_...
(in the gnuplot console typeshow var GPVAL
). You get these values only after plotting. Therefore, I extract the margins from a firstgif
plot and set the newgif
size accordingly and replot. Your step size of0.005
should correspond to 2 pixels. However, this still doesn't give good results for the GIF. The new plot area should have a square size of 402+8 pixels pixels but it does not. I haven't yet found out why. Sorry, maybe somebody else has a better idea.My recommendation for an alternative workaround, would be to generate all the frames as PNGs and then use another software to put them together to an animated GIF. For Windows I used ScreenToGif in the past.
Code:
Result:
SO70684623.png
(looks ok)SO70684623.gif
(unequal red lines on top and bottom)SO70684623_new.gif
(modified size, does not solve the issue)