This article will go over some of the ways to generate image and movie output files from the current graphics being plotted at that point in the simulation.
Here is an example file in which you will find how to use the code to save images and videos:
Generating an Image File with the "grph imag command"
The easiest and most common way of doing this would be using the IMAG subcommand when using the GRPH command, see the code snippet below:
set imag png
This bit of code saves a picture of the acoustic pressure (aprs) in png format into the same folder than the current ".flxinp" file.
Note: You can put this code anywhere inside the ".flxinp3 file
If you want to change the title of the filename being printed and make sure you save only one viewport on the picture, you can modify the code like that:
set imag png
set nvew 1 1
Important: You should have calculated before the result you print by adding the calculation of the acoustic pressure (aprs) into the calc command like this:
pres acoustic /* Calculate acoustic pressure
Generating an mp4 video File of the results
To generate a video this same process would be applied after the PRCS step and would look something like this:
set imag mpeg /* Set image capture for movie file generation
nvew 3 1 /* Set up 3 plotting windows in layout number 3
proc plot save /* Name procedure 'plot' and save the code
exec $nexec2 /* Run model partially
plot aprs /* Plot calculated data array
plot 1 /* Plot Time History 1 - Drive Function
plot 3 /* Plot Time History 3 - Charge on Top electrode
imag /* Snapshot of Graphics window for Movie generation
end$ proc /* End of Procedure Code
c Run model by calling 'plot' procedure 'nloops' times
proc plot $nloops
To create a movie you must use the SET IMAG MPEG before using the IMAG command at the end of the GRPH command. AVI file format will be used if STANDARD graphics are being used.
These two methods shown above will generate images/videos for cloud and local runs in OnScale
Generating an Image and Video Files from the post-processor module
Movies and images can also be generated via the post processor to do this you would output snapshots of field variable arrays the simplest way to do this is using the DATA OUT command. For example if you would like to generate time snapshots for the data array APRS shown in the snippet above you would simply add the following code after EXEC and before the GRAP command:
data out aprs
Once the model has been run a flxdato file will be generated that contains this snapshot data, open it in the post processor and once open there will be a record in the Results Manager that will read 'Time-xx' that contains the data array snapshot of APRS captured at that timestamp if you right click APRS and select Plot Data over Time the Plot Controls will become visible under the Results Manager. Here you are met with the option to save the video enable this option and choose a name and save location for the video by clicking this icon , now all that is left to do is plat the animation and once it is complete a video will be saved in the same directory as the flxdato file. Similarly you can open a snapshot of the data array at a given timestamp and you can save this view to as an image by clicking Save Image in the post processor.