CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   Creating animation through TUI (https://www.cfd-online.com/Forums/fluent/90579-creating-animation-through-tui.html)

wawa July 14, 2011 08:18

Creating animation through TUI
 
Hi all

I need to create an animation sequence using TUI.

When I try to define an animation using the TUI (/solve/animate/define/define-monitor), FLUENT says:
"First display the post processing results and then define the animation sequence. Also, for all type of monitors(surface,residuals....etc), first set the monitor parameters and then define the animation monitor"

However when I create a surface monitor with the appropriate parameters to be recorded, and define the animation monitor, nothing is actually produced.

Can somebody help ?
WaWa

Deside February 9, 2012 10:12

Same problem with me. Can somebody help us.

Many thanks in advance.

wawa February 9, 2012 11:10

Deside

If you want to create animation, the way I'm doing it is to save a picture (.jpeg for e.g.) for each timestep and then use Windows movie maker to create the animation.

I'm not aware of any other way to do it with TUI..

Wawa

Deside February 9, 2012 12:04

Many thanks Wawa, are you doing this using GUI or TUI as doing an animation with GUI under Calculation activities->Solution Animation is straight forward. I want to compile a command in a journal file so that the command is executed at a remote cluster machine (HPC).

I guess if i found the command to "First display the post processing results", my problem will be solved.

wawa February 9, 2012 14:55

Deside

I'm Using TUI, doing something similar to simulating clusters..

I first set the windows using: "/display/set-window/" ;
set the image properly using different color, camera schemes;
then select the contours to be displayed;
and finally use the command " /display/hard " to save the picture for each timestep/iteration ..

Hope this helps

Deside February 10, 2012 01:41

Many thanks Wawa, am on it and will let you know my progress.

diamondx February 10, 2012 10:27

Please consider how i use the cluster to take a screenshot, it may help you set the image:

/display/set/contours/surfaces 0 ()
/display/set/picture/color-mode color
/display/set/picture/driver jpeg
/display/set/contours/n-contour 99
/display/set/contours/filled-contours yes
/display/contour mach-number
/display/views/restore-view left
/display/views/auto-scale
/display/views/camera/zoom-camera 2
/display/save-picture /home/maghazlani/Analysis/screenshot.jpeg

cheers,
Ali

zippyhybrid February 10, 2012 11:15

I am working on some transient simulations with water and air using the volume of fluid model and use a similar technique to create animations. Currently I am running on a local machine so use the GUI to set up a contour plot of phase volume fraction, then use the following 2 commands under "calculation activities."

display set-window 2 contour air vof 0 1
display hard-copy airvof%t.jpg

The first sets the display to the contour plot and defines its properties, the second saves the image as a jpg and includes the timestep in the name. I haven't run these particular simulations remotely so I'm not sure what additional commands I'd need if solely using the TUI, but hopefully this helps.

After completing the run I put the images together into a video...I've tried a few different Windows programs to do this (Monkeyjam, Photolapse, Virtualdub) and haven't really settled on one I really like. They do get the job done as long as there aren't too many frames to process.

Deside February 11, 2012 12:58

Mohamed and John, many thanks for the input and I have managed to set up my animations. I really appreciate your contributions.

Cheers!!!

Deside February 23, 2012 08:02

Quote:

Originally Posted by Deside (Post 343946)
Mohamed and John, many thanks for the input and I have managed to set up my animations. I really appreciate your contributions.

Cheers!!!

I set up my commands in the case file to display the contours and then saved the images to a .jpeg file then used a 3rd part tool linking the images into a movie.

niravtm007 March 7, 2012 00:18

animating waves
 
Hi my friends my problem is 2- phase flow in a river bed ( open channel flow) i need to capture animation of wavy nature which ocurs at the interface between air and water. mine is unsteady flow, so i got few results which vary with time. how can i animate this phenomenon using fluent or tec plot . please help

Deside March 7, 2012 02:21

Quote:

Originally Posted by niravtm007 (Post 348031)
Hi my friends my problem is 2- phase flow in a river bed ( open channel flow) i need to capture animation of wavy nature which ocurs at the interface between air and water. mine is unsteady flow, so i got few results which vary with time. how can i animate this phenomenon using fluent or tec plot . please help

Hi Niravtm007, in Fluent you can go to Solution>Calculation Activities>Solution Animation>Create/Edit>Activate a Animation Sequences>Specify frequency of data collection>Define> and in your case i guess you want contours of density since you want to see water-air interface>then specify storage directory

When your simulation is completed, you will find that in the storage directory, there will be .hmf files. Go to Results>Graphics and animations>Solution Animation Playback>Set Up>Write/Record Format (Specify mpeg)>Write, then you will see your .mpeg animation in your specified directory for storage.

I hope this helps!!!:)

niravtm007 March 7, 2012 03:03

Thanks Deside. is it possible to generate animation with out having to simulate , as i allready have simulated results, as its an unsteady problem it will take long time to generate new results.

Deside March 7, 2012 03:24

Hi Niravtm007, yes its possible but i am not sure of the easy way. Since your simulation was transient, i guess you have your data files at your predetermine time-steps. Save pictures at your predetermined data intervals as .jpeg files and use a 3rd part tool thereafter to link the images into a movie. You can try this 3rd part software http://www.easytornado.com/software/p2avi-setup.exe

zippyhybrid March 7, 2012 16:27

TUI commands for animating air/water interface
 
I'm not sure of a way to do that without having data files saved at previous time steps. I haven't used Fluent's tools to create animation, I've always saved contour plots as .png or .jpg images then used 3rd party tools to create animations. I create similar animations however since I am investigating air-lift driven flow and am interested in the behavior of bubbles in the airlift column. I'd suggest visualizing the interface using contours of phase and plot the contours of air ranging from 0 (water) to 1 (air).

Here is a sample journal file for a 2D simulation I ran in batch mode.

;read case and data
file/read-case single-48cm-2D-batchtest.cas
;
;initialize domain with air
/solve/initialize/initialize-flow
;
;patch water to raceway depth of 3.5 cm
/adapt/mark-inout-rectangle yes no 0 0.62875 -0.48 0.035
/solve/patch water () (0) mp 1
;
;set up image output
/display/set/contours/filled-contours yes
/display/set/picture/driver png
/display/set/picture/landscape yes
/display/set/picture/x-resolution 960
/display/set/picture/y-resolution 720
/display/set/picture/color-mode color
/views/restore-view front
;
;print front view of phases and velocity magnitude at t=0
/display/contour air vof 0 1
/display/save-picture airvof%t.png
/display/contour mixture velocity-magnitude 0 0.5
/display/save-picture velmag%t.png
;
;set up display commands to print front view of phases and velocity magnitude every 20 time steps
/solve/execute-commands/add-edit command-2 20 "time-step" "/display/contour air vof 0 1"
/solve/execute-commands/add-edit command-3 20 "time-step" "/display/save-picture airvof%t.png"
/solve/execute-commands/add-edit command-4 20 "time-step" "/display/contour mixture velocity-magnitude 0 0.5"
/solve/execute-commands/add-edit command-5 20 "time-step" "/display/save-picture velmag%t.png"
;
;set up auto-save
/file/auto-save data-frequency 500
/file/auto-save append-file-name-with time-step 6
;
;iterate over 5000 time steps
solve/set/time-step 0.001
solve/dual-time-iterate 5000 50
file/write-data single-48cm-2D-batchtest.dat

fadiga March 13, 2013 12:35

Animation sequence when using remote solver
 
Hi all,

A related question. I am running transient FLUENT simulations on a remote machine using ansys' RSM.

Having set-up an animation sequence via GUI, FLUENT seems not to keep this in the case setup when closed and submitted to the remote solver.

Anyone have any tips? Should I construct a command file instructing it what to do every time step?

Thanks alot!

billwangard March 13, 2013 15:03

For most of my animations for my clients, I will create a journal file of the tui commands, along the lines of what zyppyhybrid has done.

I prefer to create graphics images (tiff) or (png) format, numbered sequentially. When you save a picture:

/file sp fig_my_picture_%t.png

will replace %t with the time step. %f is the flow time, and %i is the iteration number (for steady-state calculations.

Once you have a series of png files, use Imagemagick to convert the files to an animated GIF.

> convert -adjoin -delay 10 -format gif fig_myfig_*.png animation.gif

I also recommend increasing the resolution of images to something like 2400 x 1800. It is a bit high, but you can always use convert to resize the final product using resize option:

> convert -adjoin -resize 50% -delay 10 -format gif fig_myfig_*.png animation.gif

To read a large number of data sets, I use a SCHEME file which performs a loop, and then calls the journal file.

I hope this helps.

fadiga March 13, 2013 18:14

Thank you for your reply.
I grasp the idea of compiling commands to create the animation sequence in a Journal file. I think I'm not quite getting the whole execution procedure though. To elaborate a bit more, I am launching my calculations from workbench 14.5. I have a remote solver which I send calculations to, having setup the case in fluent on my local machine.

I have used journal files before, by manually going to File>Read>Journal Files... and selecting the journal I wanted to read in.

So assuming I have the journal to create the animation sequence, how do I instruct FLUENT to set up sequence by reading the journal file when running on the remote machine?

Hope I've clarified my position. I would imagine that anyone working in industry/academia using a cluster or remote machine, encounters this needs relatively often.

Thanks again for your help...

mjthomp3 June 26, 2014 13:02

Quote:

Originally Posted by zippyhybrid (Post 348225)
I'm not sure of a way to do that without having data files saved at previous time steps. I haven't used Fluent's tools to create animation, I've always saved contour plots as .png or .jpg images then used 3rd party tools to create animations. I create similar animations however since I am investigating air-lift driven flow and am interested in the behavior of bubbles in the airlift column. I'd suggest visualizing the interface using contours of phase and plot the contours of air ranging from 0 (water) to 1 (air).

Here is a sample journal file for a 2D simulation I ran in batch mode.

;read case and data
file/read-case single-48cm-2D-batchtest.cas
;
;initialize domain with air
/solve/initialize/initialize-flow
;
;patch water to raceway depth of 3.5 cm
/adapt/mark-inout-rectangle yes no 0 0.62875 -0.48 0.035
/solve/patch water () (0) mp 1
;
;set up image output
/display/set/contours/filled-contours yes
/display/set/picture/driver png
/display/set/picture/landscape yes
/display/set/picture/x-resolution 960
/display/set/picture/y-resolution 720
/display/set/picture/color-mode color
/views/restore-view front
;
;print front view of phases and velocity magnitude at t=0
/display/contour air vof 0 1
/display/save-picture airvof%t.png
/display/contour mixture velocity-magnitude 0 0.5
/display/save-picture velmag%t.png
;
;set up display commands to print front view of phases and velocity magnitude every 20 time steps
/solve/execute-commands/add-edit command-2 20 "time-step" "/display/contour air vof 0 1"
/solve/execute-commands/add-edit command-3 20 "time-step" "/display/save-picture airvof%t.png"
/solve/execute-commands/add-edit command-4 20 "time-step" "/display/contour mixture velocity-magnitude 0 0.5"
/solve/execute-commands/add-edit command-5 20 "time-step" "/display/save-picture velmag%t.png"
;
;set up auto-save
/file/auto-save data-frequency 500
/file/auto-save append-file-name-with time-step 6
;
;iterate over 5000 time steps
solve/set/time-step 0.001
solve/dual-time-iterate 5000 50
file/write-data single-48cm-2D-batchtest.dat




This was pretty helpful.



It helped me to advance my code:



;Developing a set of CFD simulations to investigate pressure on the sheet metal
; surface
file read-case Transient_Fender_No_holes.cas
;-------------------------------------------------------------
;-------------------------------------------------------------
;---Defining the length units in mm, the wall length is 50mm --
;-------------------------------------------------------------
;-------------------------------------------------------------
/define/units
; it asks for quantity?
length
; it asks for units name?
mm
;-------------------------------------------------------------
;-------------------------------------------------------------
;---Defining the Pressure units in atm,the inlet is 1atm------
;-------------------------------------------------------------
;-------------------------------------------------------------
/define/units
; it asks for quantity?
pressure
; it asks for units name?
atm

;---------------TO INITIALIZE---------------------------
/solve/initialize/set-defaults pressure 0.1
/solve/initialize/set-defaults x-velocity 0.01
/solve/initialize/set-defaults y-velocity 0.01
/solve/initialize/set-defaults z-velocity 0.01
/solve/initialize/set-defaults k 0.1
/solve/initialize/set-defaults epsilon 0.01
;units for turbulent dissipation rate is m2/s3

/solve/initialize/initialize-flow
;set up image output
/display/set/contours/filled-contours yes
/display/set/picture/driver png
/display/set/picture/landscape yes
/display/set/picture/x-resolution 960
/display/set/picture/y-resolution 720
/display/set/picture/color-mode color
/views/restore-view front
;
;print front view of phases and velocity magnitude at t=0
/display/contour s-2-part pressure -1.8e-09 0.10
/display/save-picture airpof%t.png
/display/contour s-2-part velocity-magnitude 0 1
/display/save-picture velmag%t.png
;
;set up display commands to print front view of phases and velocity magnitude every 20 time steps
/solve/execute-commands/add-edit command-2 1 "time-step" "/display/contour s-2-part pressure 0 1"
/solve/execute-commands/add-edit command-3 1 "time-step" "/display/save-picture airpof%t.png"
/solve/execute-commands/add-edit command-4 1 "time-step" "/display/contour s-2-part velocity-magnitude 0 1"
/solve/execute-commands/add-edit command-5 1 "time-step" "/display/save-picture velmag%t.png"
;
;set up auto-save
/file/auto-save data-frequency 1
/file/auto-save append-file-name-with time-step 6
;---------------------TRANSIENT SOLUTION--------------------
;
;iterate over 5000 time steps
solve/set/time-step 0.05
solve/dual-time-iterate 100 1
;--write the new case and data for this setup----------------
wc --transientP1.cas.gz
wd --transientP1.dat.gz

;--------------CALCULATIONS ACTIVITIES-----------------
;------------------------------------------------------
;-----------AUTOMATIC EXPORT TO PARAVIEW----------
; FOR GETTING THE ENSIGHT
;
; DATA INSTEAD
; OF THE .DAT DATA WHICH IS THE STANDARD
; OUTPUT THAT FLUENT GIVES
;
;------------------------------------------------------
/file/export
ensight-gold
;EnSight-Gold output file name
transientencas_gold
;EnSight-Gold scalar(1)>
pressure
; EnSight-Gold scalar(2)>
velocity-magnitude
; EnSight-Gold scalar(3)
()
; write in binary format?
y
; cell zone id/name(1)
*
; cell zone id/name(2)
()
; Interior Zone Surfaces(1)
()
; Cell-Centered
n
; Writing "d.geo"...
; Writing "d.vel"...
; "d.scl1"...
; Static Pressure
; Writing "d.scl2"...
; Velocity Magnitude
; "d.encas"...



;-------------------------END-------------------------------

mjthomp3 June 26, 2014 15:58

Quote:

Originally Posted by diamondx (Post 343811)
Please consider how i use the cluster to take a screenshot, it may help you set the image:

/display/set/contours/surfaces 0 ()
/display/set/picture/color-mode color
/display/set/picture/driver jpeg
/display/set/contours/n-contour 99
/display/set/contours/filled-contours yes
/display/contour mach-number
/display/views/restore-view left
/display/views/auto-scale
/display/views/camera/zoom-camera 2
/display/save-picture /home/maghazlani/Analysis/screenshot.jpeg

cheers,
Ali



Thanks a lot!! I was getting an error and this helped me to exapnad my
journal file as I will share mines:




;Developing a set of CFD simulations to investigate pressure on the sheet metal
; surface
file read-case Transient_Fender_No_holes.cas
;-------------------------------------------------------------
;-------------------------------------------------------------
;---Defining the length units in mm, the wall length is 50mm --
;-------------------------------------------------------------
;-------------------------------------------------------------
/define/units
; it asks for quantity?
length
; it asks for units name?
mm
;-------------------------------------------------------------
;-------------------------------------------------------------
;---Defining the Pressure units in atm,the inlet is 1atm------
;-------------------------------------------------------------
;-------------------------------------------------------------
/define/units
; it asks for quantity?
pressure
; it asks for units name?
atm

;---------------TO INITIALIZE---------------------------
/solve/initialize/set-defaults pressure 0.1
/solve/initialize/set-defaults x-velocity 0.01
/solve/initialize/set-defaults y-velocity 0.01
/solve/initialize/set-defaults z-velocity 0.01
/solve/initialize/set-defaults k 0.1
/solve/initialize/set-defaults epsilon 0.01
;units for turbulent dissipation rate is m2/s3

/solve/initialize/initialize-flow
;set up image output
/display/set/contours/filled-contours yes
/display/set/picture/driver png
/display/set/picture/landscape yes
/display/set/picture/x-resolution 960
/display/set/picture/y-resolution 720
/display/set/picture/color-mode color
/views/restore-view front

;take a screenshot, it may help you set the image:
/display/set/contours/surfaces s-2-part ()
/display/set/picture/color-mode color
/display/set/picture/driver jpeg
/display/set/contours/n-contour 99
/display/set/contours/filled-contours yes
/display/contour pressure 0 1
/display/views/restore-view left
/display/views/auto-scale
/display/views/camera/zoom-camera 2
/display/save-picture screenshot.jpeg
;print front view of phases and velocity magnitude at t=0
/display/contour front pressure -1.8e-09 0.10
/display/save-picture airpof%t.png
/display/contour front velocity-magnitude 0 1
/display/save-picture velmag%t.png
;
;set up display commands to print front view of phases and velocity magnitude every 20 time steps
/solve/execute-commands/add-edit command-1 1 "time-step" "/display/set-window 5"
/solve/execute-commands/add-edit command-2 1 "time-step" "/display/views restore-view auto-scale"
/solve/execute-commands/add-edit command-3 1 "time-step" "/display/contour front pressure 0 1"
/solve/execute-commands/add-edit command-4 1 "time-step" "/display/save-picture airpof%t.png"
/solve/execute-commands/add-edit command-5 1 "time-step" "/display/contour front velocity-magnitude 0 1"
/solve/execute-commands/add-edit command-6 1 "time-step" "/display/save-picture velmag%t.png"
;
;set up auto-save
/file/auto-save data-frequency 1
/file/auto-save append-file-name-with time-step 6
;---------------------TRANSIENT SOLUTION--------------------
;
;iterate over 5000 time steps
solve/set/time-step 0.05
solve/dual-time-iterate 100 1
;--write the new case and data for this setup----------------
wc --transientP1.cas.gz
wd --transientP1.dat.gz

;--------------CALCULATIONS ACTIVITIES-----------------
;------------------------------------------------------
;-----------AUTOMATIC EXPORT TO PARAVIEW----------
; FOR GETTING THE ENSIGHT
;
; DATA INSTEAD
; OF THE .DAT DATA WHICH IS THE STANDARD
; OUTPUT THAT FLUENT GIVES
;
;------------------------------------------------------
/file/export
ensight-gold
;EnSight-Gold output file name
transientencas_gold
;EnSight-Gold scalar(1)>
pressure
; EnSight-Gold scalar(2)>
velocity-magnitude
; EnSight-Gold scalar(3)
()
; write in binary format?
y
; cell zone id/name(1)
*
; cell zone id/name(2)
()
; Interior Zone Surfaces(1)
()
; Cell-Centered
n
; Writing "d.geo"...
; Writing "d.vel"...
; "d.scl1"...
; Static Pressure
; Writing "d.scl2"...
; Velocity Magnitude
; "d.encas"...



;-------------------------END-------------------------------

FJSJ January 26, 2015 05:51

Hi guys,

I would like to know just taking a look to your journal files if is possible define a variable time step in the journal file. Something like:

100 iterations with x time-step

1000 iterations with y time-step

Thanks :)

FJSJ January 29, 2015 08:14

Hi again,

I managed to do it with a simple UDF.

DEFINE_DETALT

hwet July 9, 2015 22:26

Hi
I am trying to do something similar but i need to select a surface at which the contours will be displayed.

using

display/set/contours/surfaces/plane-xyz

It selects the plane but then returns

contour surface id/name(2) [()]

to select another surface, and this keeps on repeating with (3) (4) etc i want it to return to "/display" after it has selected the one surface i want.

Any ideas on how to skip selecting more surfaces

Thanks

hwet July 10, 2015 01:33

OK i sorted this out, have to write () in the command as well at the end.

Next problem; error file saying no graphics functions available.

I would think that is the actual case as well, but how did all of you guys end up getting a graphics (png jpg) file running the cluster which uses TUI.

Am i missing something here.

FJSJ July 10, 2015 06:41

1 Attachment(s)
Hi Hwet,

What was your startup setup and your grapics or gui options?

Have a look at the picture below :)

hwet July 10, 2015 22:49

Well, apparently the cluster at my university does not have a graphics card and hence no graphics driver, thats why this couldn't be done.

I wonder if there is another way?

mohanty.shuvam4 December 3, 2019 02:48

yeah, that's a very good example of scripting. But can you tell me how to scripting an animation for a particular surface?

xuzishan November 5, 2021 03:17

hello, have you solved the issue before, I met the same issue now, I wanna output the animation through hpc , but the journal file maybe incorrect, can you support me ? My partly journal file is below



/solve/animate/objects/create no-animation animate-on contour-1 frequency-of time-step storage-type jpeg storage-dir ""

/solve/dual-time-iterate 2 3


All times are GMT -4. The time now is 05:06.