ANSYS Fluent Live Tailing and Post Processing

This page will demonstrate Rescale's live tailing feature and post-processing for ANSYS Fluent in batch mode. Users can directly live-tail and post-process data while running the Fluent job on Rescale's ScaleX platform. The different sections will demonstrate the following -

  • Saving Fluent case and data files at user-specified intervals
  • Live tailing the residuals and saving it as an image
  • Saving contour, vector and streamline images at user-specified intervals
  • Saving report plots and report files
  • Saving CFD-Post Compatible files for further post-processing
  • Saving Animation files and Scenes

All the sections given below will be based on a transient simulation of a 2D unsteady laminar flow around a cylinder. A cylinder of diameter 1 m is in a circular domain of 64 m. An inlet velocity of 1m/s and air density of 0.00833 kg/m^3 is used to obtain a Von-Karman street behind the cylinder.

Contours-LiveTail

You can click on the "Import Job Setup" to get the job setup as well as the input files. You can also click on "Get Job Results" to obtain the final results of the job.

Import Job Setup Get Job Results

The input files are:

von-karman.cas - Case File

test.jou - Journal File

In this example, we patch the region behind the cylinder with a small y-velocity to start the von-karman street much quicker. This patching command is included in the journal file.

This section demonstrates the procedure to save Fluent case and data files at user-specified intervals. The users can save just case files, just data files or both case-data files. You can follow the following steps to save files -

  • In the Fluent setup, double click on Calculation Activities > Autosave, which opens an Autosave window. Here, you can specify the number of time-steps at which you want to save the data file.

    You can also type the root-name for the files to be saved. Fluent gives a default path directory for the rootname. Please make sure that you remove the path directory and type just the rootname, so that the files are saved in the working directory while running the job.

    You have the option of appending the time-step or flow-time to the file names. For this example, number of time-steps is 200, rootname of the files are results- and it is appended with time-steps.

Autosave

  • You can also include the following command line in the journal file /file/write-data von-karman-%t.dat.gz to save the data file at the time step the simulation stops. This can serve as a checkpoint file in case your simulation fails. If you want to save file name with the flow-time, use the %f suffix instead. The journal will look like:

      /file/set-batch-options no yes yes no 
      /file/read-case von_karman.cas
      
      ;INITIALIZING
      /solve/initialize/initialize-flow
      
      ;PATCHING 
      /adapt/mark-inout-rectangle yes no 0.5 32 -5 5
      /solve/patch () hexahedron-r0 () y-velocity ok 0.2
      
      ;SOLVING
      /solve/dual-time-iterate 3000 20
      
      ;SAVING AT LAST TIME STEP OF SIMULATION
      /file/write-data von-karman-%t.dat.gz
      /exit yes
    
  • Please refer to this section for printing residuals in fluent batch.

  • For the given example, the Execute Commands for residuals looks like this -

Residuals-Commands

  • You can live-tail the residuals by clicking on 'residual.png' anytime during the run -

Residuals

This section will guide you through the process for saving contours, vectors or streamlines while running your Fluent job through batch mode. These images can be saved by adding executable commands to the Fluent setup. The syntax for the commands can be found in the ANSYS Text User Interface (TUI) Commands Manual.

  • Before setting up the commands for saving images, we can also save a specific view in Fluent for the images. After you display the mesh, you can zoom in on a certain region manually.

  • Navigate to the Viewing tab on the top and click on Views... This opens up the window where you can click on Save button to save this view. In this example, the view is saved as zoom1

Views

  • In the solution tree on the left, double click on Execute commands under Calculation Activities.

Views

  • This opens up an Execute Commands window. Here, you can include different commands to display contours, vectors, pathlines and plots. You can also specify the frequency at which these commands must be executed.


Contours

  • To save a contour image, we need to first set up a window to display the contour. The command used is display/set-window <NUMBER> Here, window number 5 is used for velocity contours.

  • Next, we can change contour settings by using /display/set/contours.... For this example, the following settings are changed -

      /display/set-window 5
      /display/set/contours/surfaces flow-domain ()
      /display/set/contours/filled-contours? yes
      /display/set/contours/coloring? no
    
  • The second line sets up the contour for the user-defined surface - "flow-domain". The brackets '( )' is used to specify that no other surfaces are used and this needs to be included. This step is crucial in setting up contours. The third line makes the contour filled and the fourth specifies that banded coloring is not to be used (Hence, smooth contours are obtained). The default setting is banded coloring and the user can also specify the contour level by using /display/set/contours/n-contours <LEVELS>

  • Next, you can display the contour using the command /display/contour velocity-magnitude <MIN> <MAX>. We need to specify global min and max value for the contour. Using the pre-defined view zoom1, we save the contour image by using the commands shown below. Addtional settings such as, changing the image width and height resolution can also be done. We also need to specify the image type using the command /dsiplay/set/picture/driver <TYPE> -

      /display/contour velocity-magnitude 0 3
      /views/restore-view/zoom1
      /display/set/picture/x-resolution 1000
      /display/set/picture/y-resolution 1000
      /display/set/picture/driver png
      /display/save-picture velocity-contour-%t.png
    
  • For the given example, the Execute Commands for contours looks like this

Contours-Commands

  • During the job run, you can use Rescale's live taling feature by clicking on the contour images already saved to check your simulation results -

Contours-LiveTail



Vectors

  • You can setup a new active window for velocity contours. In this example, we use window 6 for vectors. To display velocity vectors, we use the following commands - /display/vector velocity velocity-magnitude <MIN> <MAX> <SCALE> <SKIP-EVERY>. We need to specify the minimum, maximum value, arrow scale and skip-every data. Using the pre-defined view view1 and by defining the resolution of the picture, we can save the image as shown below. We also need to specify the image type using the command /display/set/picture/driver <TYPE>

      /display/vector velocity-magnitude 0 3 12 0
      /views/restore-view/zoom1
      /display/set/picture/x-resolution 800
      /display/set/picture/y-resolution 800
      /display/set/picture/driver png
      /display/save-picture velocity-vector-%t.png
    
  • You can also make some setup changes to the velocity vectors by using the command line - /display/set/velocity-vectors/.....

  • For the given example, the Execute Commands for vectors looks like this

Vectors-Commands

  • During the job run, you can use Rescale's live taling feature by clicking on the vector images already saved to check your simulation results -

Vectors-LiveTail



Pathlines

  • You can setup a new active-window for pathlines only. In this example, we use window 7 for pathlines. Initially, we can setup pathline settings using the following command /display/set/path-lines/..... Next, we can display the path-lines using the command /display/path-lines/path-lines <COLORED-BY> <FROM-SURFACE(1)> <FROM-SURFACE(2)> <SKIP-EVERY> <MIN> <MAX> <WANT-TO-PLOT-OIL-FLOW-PATHLINES?(YES/NO)>

      /display/set/path-lines/maximum-steps 9000
      /display/path-lines/path-lines velocity-magnitude farfield1 () 0 0 3 no
      /display/set/picture/x-resolution 1600
      /display/set/picture/y-resolution 800
      /display/set/picture/driver png
      /display/save-picture velocity-vector-%t.png
    
  • In the first line we set up maximum-steps to be 9000 so that the pathlines extend from inlet till outlet. The second line displays the pathlines colored by the velocity magnitude from the surface 'farfield1'. The '( )' following the first surface specifies that no other surfaces are used. Next, we specify the skip factor, followed by the range for velocity. Finally, we specify 'no' to oil flow pathlines. We also need to specify the image type using the command /display/set/picture/driver <TYPE>

  • For the given example, the Execute Commands for pathlines looks like this

Pathines-Commands

  • During the job run, you can use Rescale's live taling feature by clicking on the vector images already saved to check your simulation results -

Pathines-LiveTail



  • You can create '.out' report files and report plots based on the report definitions you create. To create report definitions, click on the Report Definitions under the Solutions tree. For this problem, we create report definitions for Coefficient of Drag (Cd), Coefficent of Lift (Cl) and Moment about the cylinder.

  • Click on New > Force Report > Drag. It opens a new window, where you can name the report definition (In this example : cd-cylinderwall), select the force direction and the surface zone where Cd is to be calculated. Additionally, you can avearge the Cd over some timesteps (Here, we choose 1).

  • Follow the same procedure for Lift and Moment. Three default report definitions that are already defined are - flow-time, delta-time, iters-per-timestep.

Report-Definitions

Report Files

  • To create report files, click on Solutions > Monitors > Report Files. Create a new report file by clikcing on New, which opens a new window. Here, you can specify the report name and include the two variables you want to report. In this exmaple, we report 'cl-cylinderwall' vs 'flow-time'.

  • Make sure you create the output file name without any root-directory. You can get the data for the variables by specifying the time-steps or iterations. Also, make sure to check the Print to Console option.

Report-Files

  • During the job run, you can use Rescale's live taling feature by clicking on the report files already saved to check your simulation results -

Report-Files-Livetailing



Report Plots

  • To create report plots, click on Solutions > Monitors > Report Plots. Create a new plot by clicking on New, which opens a new window. Here, you can include 'cd-cylinder' to be plotted.

  • Choose an appropriate window such that its not common with your other active windows. You can specify frequency of data, pot title and labels. Make sure to check the Active option and Print to Console option on the window.

Report-Plots

  • To save these report plots, we can write an executable command in the Solution > Calculation Activities > Execute Commands. Make sure you set the window number you used to create the report plots. The following commands are used for saving the plots -

      /display/set-window 2
      /display/set/picture/driver png
      /display/save-picture cd_vs_flowtime.png
    
  • Here, we need to use the same name for image as we used for creating the report plots.

  • For the given example, the Execute Commands for report plots looks like this

Report-Commands

  • During the job run, you can use Rescale's live taling feature by clicking on the report plots already saved to check your simulation results -

Pathines-LiveTail

  • You can create CFD-Post compatible files which can be imported into CFD-Post for post-processing. Click on Solutions > Calculation Activities. Under Automatic Export, create a Solution Data Export.

CFD-Post-1

  • This opens an export window, where you can select the File Type as CFD-Post Compatible from the drop down box. Next highlight cell-zones and select the variable you would like to export. Finally, specify the file name by removing the root directory and giving just the file name. You can append the file name with time-step or iterations.

CFD-Post-2

  • You can find the CFD-Post compatible file, 'cdat' files in the Results section of Rescale platform. Please refer to the ANSYS Fluent User Guide for importing these files into CFD Post.
  • For creating animations, a convenient method is to save image files of your desired graphics at high frequency (Every timestep or every 2-10 timesteps), depending on your format. You can then use any third-party software/package to convert your image sequence into a video or GIF. Fluent can save images in the following formats : EPS, JPEG, PPM, TIFF, PNG, HSF, VRML.

  • The recommended format would be PNG since it gives lossless compression images and takes up less memory. The JPEG format takes up less memory but gives a lossy compression image.

  • You can save the images in PPM or TIFF formats as well but these are uncompressed formats which take up a lot of memory. HSF format gives a highly compressed image file.

  • To save the images, display the desired graphics (Contours, vectors etc.) as shown in the section using the Execute Commands. Then specify the image format file and save the picture. In this example, the images for velocity contours are saved in PNG format every 5 timesteps to obtain an animation. The following commands are used in the given example.

      /display/set/window 8
      /dispay/set/contours/surface flow-domain ()
      /display/set/contours/filled-contours? yes
      /display/set/contours/coloring no
      /display/contour velocity-magnitude 0 1.5 
      /views/restore-view/zoom1 
      /display/set/picture/x-resolution 1200
      /display/set/picture/y-resolution 1200
      /display/set/picture/driver png
      /display/save-picture velocity-anim-%t.png
    
  • For the given example, the Execute Commands for animations look like this

Animation-Commands

  • Rescale offers a very useful feature of archiving certain output files for easy download by using the Filter option. You can refer to this section under the heading Output File Filters. In this example, we add the filter ' *anim* '. This creates an ' output-archive.zip ' file in the Results tab of the Rescale platform. This can be easily downloaded locally and converted into video formats.

Filters

  • Many third party software/packages are available for converting the image files to an animation video. Fluent User guides suggests ImageMaverick while converting PPM files to video files or GIF Files.

  • The ffmpeg package can be downloaded to convert image files to .mpeg or .avi video formats.

  • In the given example, velocity-contours were saved every 5 time-steps in PNG format and comverted to MP4 video using ffmpeg using -

      `ffmpeg -pattern_type glob -framerate 15 -i "*.png" -vb 20M velocity-animation.mp4`
    
  • The command converts all .png files into a MPEG video with framerate 15 and video bitrate of 20M. The video quality is better if .mp4 extenion is given.