Generating Images and Videos using OnScale


This article will go over some of the ways to generate image and movie output files from the current graphic being plotted at that point in the simulation.

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:

pset imag
plot matr

This is the simplest way to output an image. 

To generate a video this same process would be applied after the PRCS step and would look something like this:

proc plot save	   /* Name procedure 'plot' and save the code
exec $nexec2	   /* Run model partially
  set imag mpeg /* Set image capture for movie file generation
nvew 3 1 /* Set up 3 plotting windows in layout number 3
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.

Using these to method will create movies and images from local and cloud runs.

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.

Attached is the PZT_Disc model that demonstrates what is described in this article. 


0 out of 0 found this helpful



Please sign in to leave a comment.