Reputation: 21
Does anyone have a convenient way to plot time dependent data? Say you have a program that outputs a trajectory over a period of time, so a 3 column txt file (t,x,y). I'd like to create a video file (mp4 avi gif etc) that will show the latter two columns evolution in time. I've written a program that outputs data, calls gnuplot, output a png, repeat however long needed, then uses ffmpeg to mash all the pngs into an mp4. It takes a very long time to produce every png however (somewhere around 0.2 sec for each one) and a 2 minute 30fps will take about 12 minutes to execute because of this. Also, I end up creating a directory with 3600 png's and then deleting the directory. I can't help but feel there has been an easier way to do this developed by someone over the past few decades. There must be a more elegant way to do something like this. I'm running Windows 10 as well.
Upvotes: 1
Views: 681
Reputation: 1608
It's probably overkill for your application, but you may want to look into writing (or converting) your data to VTK format (see http://www.cacr.caltech.edu/~slombey/asci/vtk/vtk_formats.simple.html), then processing the result through Paraview (http://www.paraview.org/) or VisIt (https://wci.llnl.gov/simulation/computer-codes/visit). Legacy VTK format is relatively easy to write from Fortran; the hardest part is understanding the so-flexible-nobody-can-explain-how-to-do-simple-things-with-it file format. The second hardest part is finding where the options you want are hidden in the VisIt UI. There are existing F90 libraries for writing VTK (see https://people.sc.fsu.edu/~jburkardt/f_src/vtk_io/vtk_io.html) which may give you a head start.
Glowing praise, I know, but once you've sorted the bits out, it's easy to generate animated plots using VisIT and it should be much faster than gnuplot. I've used this method for making animated 2D maps of temperature, heat generation, etc. based on data written directly from Fortran code.
Another tactic is to look for simpler data formats supported by VisIt and use those. I chose VTK because it was (somewhat) documented and supported by multiple viewers but there may be a better format for your needs.
Upvotes: 1