Fluent renders image incorrectly in batch-mode

  • Last Post 01 August 2019
JamesWright posted this 27 July 2019


So I'm attempting to create a "screen-shot" of a contour every timestep of a SBES simulation. However, the some images will render part-way through adjusting the view of the image.  

See images in this imgur album: https://imgur.com/a/t6BH3ba Each image is a successive timestep. You can see that the timestep 427859 is taken at some odd angle. Below is the journal file, where every timestep the view is adjusted to make sure it is in the right position.    

Attached Files

Order By: Standard | Newest | Votes
JamesWright posted this 27 July 2019

/solve/execute-commands/add-edit command-1 1 "time-step" "/display/contour velocity-magnitude 0 20"
/solve/execute-commands/add-edit command-2 1 "time-step" "/display/views/restore-view right"
/solve/execute-commands/add-edit command-3 1 "time-step" "/display/views/auto-scale"
/solve/execute-commands/add-edit command-4 1 "time-step" "/display/views/camera/zoom-camera 1.8"
/solve/execute-commands/add-edit command-5 1 "time-step" "/views/camera/orbit-camera 180 0"
/solve/execute-commands/add-edit command-6 1 "time-step" "/display/views/camera/target 0 0 0.9"
/solve/execute-commands/add-edit command-7 1 "time-step" "/display/save-picture /scratch2/jrwrigh/6634049_p178L0260_S025_SBES/images/velocitymag%t.png"
/solve/execute-commands/add-edit command-8 1 "time-step" "/display/contour pressure -200 200"
; /solve/execute-commands/add-edit command-9 1 "time-step" "/display/views/restore-view right"
; /solve/execute-commands/add-edit command-10 1 "time-step" "/display/views/auto-scale"
; /solve/execute-commands/add-edit command-11 1 "time-step" "/display/views/camera/zoom-camera 1.8"
; /solve/execute-commands/add-edit command-12 1 "time-step" "/views/camera/orbit-camera 180 0"
; /solve/execute-commands/add-edit command-13 1 "time-step" "/display/views/camera/target 0 0 0.9"
/solve/execute-commands/add-edit command-14 1 "time-step" "/display/save-picture /scratch2/jrwrigh/6634049_p178L0260_S025_SBES/images/pressure%t.png"

JamesWright posted this 28 July 2019

Also note, the journal file is being run on linux using the "-gu" and "-driver null" flags. It's being run on a cluster.

The overall goal is to get contour plots of a simulation at each timestep in batch mode.

Other symptoms are that sometimes fluent will simply output plots without the actual contour with it (it'll save a png with the color bar and text, but no domain contour).

JamesWright posted this 29 July 2019

I've updated the topic title to better reflect the pressing issue. I'm currently getting inconsistent behavior running this journal file.

The consistent part: I'm running the same journal file with the same case/data file on the same hardware (in some cases, the same exact computer) using ANSYS 19.0. The code runs perfectly fine, exits without errors, and always outputs images.

The inconsistent part: The images will sometimes not have the actual geometry in them. 


I've combined results from three different runs: two unsuccessful, one successful. They're designated by their job numbers. They contain journal scripts, transcripts and images from the runs.

6634049 (Drive link here) is from the original posting. The first two images are perfect, but the third is rendered at an odd angle. This was run using "-gu" and "-driver null" flags for fluent

6641572 (Drive link here) is a completely successful example. This has more images than the first, utilizes the "save-view" function in the Fluent TUI, and has the axes. This was done using "-gu" and "-driver x11". The driver was changed as a colleague using the exact same hardware is able to get correct plots using similar methods.

6641591 (Drive link here) is a complete failure. The only difference between this and the previous run (6641572) is a change to taking images every other timestep. This also has the axes shown.

Focusing on 6641591, Note that the "[variable]0.png" images were not taken using the "every timestep" sequence of commands, while the rest were. Notice that the axes in "[variable]0.png" are in the correct position (negative x axis pointing at camera) while all others are not in the correct position (positive z axis pointing at camera). This says to me that the view-state is not being updated correctly for some reason.


Note that these (inconsistent) results have been reproduced dozens of times in both batch mode (no DISPLAY variable set, purely scripted on remote compute nodes) and interactive modes (DISPLAY variable set, fully scripted on interactive virtual machines on remote nodes).

rwoolhou posted this 29 July 2019

Staff can't open/download attachments so please repost what you're seeing & what you expect. 

One observation on the view commands: you can save the view so rather than restoring "right" then changing camera position just get the view you want and save it. The script in your first post only has two images in it, what commands did you use for the third one?

JamesWright posted this 29 July 2019

Staff can't open/download attachments

Huh. That's not overly helpful, but I can understand why the policy exists. I tried to originally copy/paste the journal file in, but it wasn't within the post size limits. I take it you can see the imgur album though?

One observation on the view commands: you can save the view so rather than restoring "right" then changing camera position just get the view you want and save it.

Yep, this is what I do in the second and third runs. 

The script in your first post only has two images in it, what commands did you use for the third one?

If you're referring to the images in the imgur album, they are taken at different timesteps. The first one is taken before starting the calculation, the second one is after the first timestep, and third is the second timestep. That make sense?


Assuming you can see the imgur album, I've added two more images at the end to clarify what I'm seeing now.

The one's called "Failure: ___" are from the 6641591 run described before. The first one is taken before the calculation is started, the second is after. An example of a successful image is shown by the first two images. 

/display/set/contours/filled-contours yes
/display/set/picture/driver png
/display/set/picture/landscape yes
/display/set/picture/use-window-resolution? no
/display/set/picture/x-resolution 2400
/display/set/picture/y-resolution 1440
/display/set/picture/color-mode color
/display/set/colors/color-scheme classic
/display/set/colors/background "dark gray"
/display/set/picture/invert-background? no
/surface/plane-point-n-normal zyplaneani 0 0 0 1 0 0

/display/set/lights/headlight-on? no
/display/set/lights/lights-on? no

/display/set/contours/surfaces zyplaneani ()
/display/set/contours/coloring no
/display/set/contours/node-values? yes
/display/set/contours/clip-to-range? no
/display/set/windows/scale/alignment bottom
/display/set/windows/text/application? no
/display/set/windows/text/date? no
/display/set/windows/text/visible? yes
/display/set/windows/text/top -0.85
/display/set/windows/axes/visible? yes

/display/contour velocity-magnitude 0 20
/display/views/restore-view right
/display/views/camera/zoom-camera 1.8
/display/views/camera/orbit-camera 180 0
/display/views/camera/target 0 0 0.9
/views/save-view aniview
/display/save-picture /scratch2/jrwrigh/6641591_p178L0260_S025_SBES/images/velocitymag0.png
/display/contour pressure -200 200
/display/save-picture /scratch2/jrwrigh/6641591_p178L0260_S025_SBES/images/pressure0.png
/display/contour vorticity-mag 0 1500
/display/save-picture /scratch2/jrwrigh/6641591_p178L0260_S025_SBES/images/vorticitymag0.png
/display/contour y-velocity -10 10
/display/save-picture /scratch2/jrwrigh/6641591_p178L0260_S025_SBES/images/yvelocity0.png
/display/contour strain-rate-mag 0 2000
/display/save-picture /scratch2/jrwrigh/6641591_p178L0260_S025_SBES/images/strainratemag0.png

; Make pictures at every timestep
/solve/execute-commands/add-edit command-1 2 "time-step" "/display/contour velocity-magnitude 0 20"
/solve/execute-commands/add-edit command-2 2 "time-step" "/views/restore-view aniview"
/solve/execute-commands/add-edit command-4 2 "time-step" "/display/save-picture /scratch2/jrwrigh/6641591_p178L0260_S025_SBES/images/velocitymag%t.png"
/solve/execute-commands/add-edit command-5 2 "time-step" "/display/contour pressure -200 200"
/solve/execute-commands/add-edit command-6 2 "time-step" "/display/save-picture /scratch2/jrwrigh/6641591_p178L0260_S025_SBES/images/pressure%t.png"
/solve/execute-commands/add-edit command-7 2 "time-step" "/display/contour vorticity-mag 0 1500"
/solve/execute-commands/add-edit command-8 2 "time-step" "/display/save-picture /scratch2/jrwrigh/6641591_p178L0260_S025_SBES/images/vorticitymag%t.png"
/solve/execute-commands/add-edit command-9 2 "time-step" "/display/contour y-velocity -10 10"
/solve/execute-commands/add-edit command-10 2 "time-step" "/display/save-picture /scratch2/jrwrigh/6641591_p178L0260_S025_SBES/images/yvelocity%t.png"
/solve/execute-commands/add-edit command-11 2 "time-step" "/display/contour strain-rate-mag 0 2000"
/solve/execute-commands/add-edit command-12 2 "time-step" "/display/save-picture /scratch2/jrwrigh/6641591_p178L0260_S025_SBES/images/strainratemag%t.png"

JamesWright posted this 29 July 2019

The last part is the visualization commands used in the journal file for the last two runs. The forum site won't let me edit the post to say that.

rwoolhou posted this 30 July 2019

I can't see any images, or any links to Imgur (which I can't access). Please post a couple of images into the text, resize as needed as I only need to be able to see the problem not fine details. 

There's nothing in the above (last post) script that should cause any problems, so not sure why some images would work and others not. 

JamesWright posted this 31 July 2019

Sorry for the delay. Below are the images with relevant descriptions.

6634049: Taken before calculation

^^ 6634049.0 taken before calculation was started (this is the desired view)

6634049: taken during calculation after 1 timestep

^^ 6634049.1 taken after 1 timestep of calculation (this is also the desired view)

6634049: taken after 2 timesteps of calculation

^^ 6634049.2 taken after 2 timestep of calculation (this is not the desired view)

6641591: taken before calculation

^^ 6641591.0 taken before calculation. Notice from axes we are looking at the "negative X" axis, which is what is desired.

6641591: taken after 1 timestep

^^ 6641591.1 taken after 1 timestep. Now we're looking at the positive Z axis, which means the "save-view" command didn't stick for some unknown reason.


rwoolhou posted this 31 July 2019

You've got a scale & titles so the correct window is being displayed. If save-view failed there would be an error in the TUI window or transcript if present. Are we looking across the plane (ie the image is on the y=constant plane)? Otherwise, is the velocity between 0 & 20m/s: if clip to range is on and it's not there will be nothing to see. 

JamesWright posted this 31 July 2019

The only error that comes up in the transcript is for the "/display/set/picture/use-window-resolution? no" command. Otherwise, the script runs error free.

The contour lies on the ZY plane, so in 6641591.0 we should be looking straight at it. For 6641591.1 we're looking across the plane.

The velocity magnitude is between 0 and 20 m/s. All the images start with the same initial conditions, so all the images taken at the 0th, 1st, 2nd, etc. timestep should look exactly the same. In the case of 6634049 and 6641572*, the look exactly the same for the 0th and 1st timestep (though they obviously differ for the 2nd timestep due to the rotation in 6634049.2


* Note that 6641572 images are explicitly shown, but they also look exactly like 6634049 excluding the odd rotation in 6634049.2

rwoolhou posted this 31 July 2019

How does that error display? In journals if you get an error it can cause problems for subsequent steps. 

JamesWright posted this 31 July 2019

The error shows up as this:

> /display/set/picture/use-window-resolution? invalid command [use-window-resolution?]


Additionally, this error shows up on every simulation run, including the ones that worked correctly.

rwoolhou posted this 01 August 2019

OK. Often when a TUI command fails it triggers all sorts of problems through the remainder of the journal. Looks like you're lucky in that it just fails and doesn't trigger further issues. 

The journal you put in sets up all of the commands: that seems to (mostly) work. You are then running the model without the journal? Ie just the execute commands are triggering?  Out of interest what is command 3? Check your commands. 

JamesWright posted this 01 August 2019

Command 3 was a "!sleep 5" to see if that would do anything. It didn't, so I just commented it out instead of going through all of the commands and subtracting one from their command number. 

What I posted earlier is just a portion of the journal file used to run the simulation. The line length limits of the forum system would not allow me to post the script in full. Here are the other journal file commands:

; confirm file overwrite?
; Exit on Error?
; Hide Questions?
/server/start-server server_info.txt

/file/read-case p178L0260_S025_SBES.cas
/file/read-data 6587934_p178L0260_S025_SBES.dat

; 24= Coupled
; /solve/set/p-v-coupling 24

/solve/set/under-relaxation/body-force 1
    /solve/set/under-relaxation/mom 0.7
    /solve/set/under-relaxation/turb-viscosity 0.8
    /solve/set/under-relaxation/density 1
    /solve/set/under-relaxation/omega 0.8
    /solve/set/under-relaxation/k 0.8
    /solve/set/under-relaxation/pressure 0.8

!date report summary no define/parameters/input-parameters/edit "TimeStepSize" 7e-5


/solve/dual-time-iterate 3 !date /file/write-data 6634049_p178L0260_S025_SBES.dat report summary no ;########### Parallel Timer Usage ##################### /parallel/timer/usage ;########## Time Statistics ########################### report/system/time-stats ;########## System Statistics ########################### report/system/time-stats ;########## Processor Statistics ########################### report/system/proc-stats exit yes

rwoolhou posted this 01 August 2019

If you open the Execute Commands panel up does that look correct? Not sure what else to try, you may need to talk to your ANSYS contact and get them to raise a query.