CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM

Creating animations

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 1 Post By Luise
  • 1 Post By ThomasBE
  • 1 Post By kalle

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 10, 2010, 09:33
Default Creating animations
  #1
New Member
 
Thomas
Join Date: Aug 2010
Posts: 11
Rep Power: 15
ThomasBE is on a distinguished road
Hi,

I am running a transient LES simulation and am making an animation of the results. I was wondering if there is any way to save pictures of the results at timesteps during the run automatically. As of now I am only able to save the entire results files, and this takes vast amounts of storage. Anyone know of a solution to this problem?

Best regards,

Thomas
ThomasBE is offline   Reply With Quote

Old   August 10, 2010, 10:20
Default
  #2
Member
 
Francois Gallard
Join Date: Mar 2010
Location: Toulouse, France
Posts: 43
Rep Power: 16
fgal is on a distinguished road
Hi Thomas,

You don't need to save the results at each time step to make an annimation, 25 images per second is a maximum and even you don't need that much, do you ? If it is the case you can regulary use the save animation tool of paraFoam and delete the corresponding result directories once done while the computation is running.

Cheers

Francois.
fgal is offline   Reply With Quote

Old   August 10, 2010, 10:57
Default
  #3
Senior Member
 
akidess's Avatar
 
Anton Kidess
Join Date: May 2009
Location: Germany
Posts: 1,377
Rep Power: 29
akidess will become famous soon enough
Francois, 25 frames per second of animation, yes. However one might wish to have 50 frames per second of simulation time to make the animation more clear, or even if you restrict yourself to 25 frames per second, for a long animation and large grids a lot of data can accumulate.

You could try to write a Python script to run paraview without graphical output and create your images alongside the simulation, but I don't really know how that works.
akidess is offline   Reply With Quote

Old   August 10, 2010, 12:12
Default
  #4
New Member
 
Join Date: Jan 2010
Posts: 12
Rep Power: 16
Luise is on a distinguished road
Hi,
i haven't done this before, so I don't know if it works, but I thouht of including the sample library as a function object in controlDict. This way you could at least output the vtk-files.

something like this:
Code:
functions
(
    outputFolder
    {
        type sample;
        region region0;
        functionObjectLibs ("libsampling.so");
        outputControl timeStep;
        outputInterval 1;
        outputFormat vtk; // Dont know if this is the correct keyword...
        fields
        (
            U
            p
        );
        surfaces
        (
            domainSlice
            {
                // surface definition
            }
        );
    };
);
Luise
randolph likes this.
Luise is offline   Reply With Quote

Old   August 10, 2010, 16:01
Default
  #5
New Member
 
Daniel
Join Date: Jun 2010
Posts: 12
Rep Power: 15
DVSoares is on a distinguished road
Well, if the problem is memory, I believe that a python/bash/shell script would do well - store the results normally and then delete the ones you'll not use after taking a picture of.

I use the paraview create animation and then mencoder for the animations... Memory footprint is really small. Mencoder is awesome.

Cheers,
DVSoares is offline   Reply With Quote

Old   August 11, 2010, 03:28
Default
  #6
New Member
 
Thomas
Join Date: Aug 2010
Posts: 11
Rep Power: 15
ThomasBE is on a distinguished road
Hi,

The problem is harddisk space. 1 picture per second for 60 seconds took 20 GB. Preferably I'd run the simulation for 1200 seconds, which would mean 400 GB. And this is the coarse mesh. Creating pictures manually and deleting the files is an option, but it would be nice not having to babysit the simulation.

Luise, do you know where I could find information about your idea? Would be interesting to see if it is viable.
ThomasBE is offline   Reply With Quote

Old   August 11, 2010, 04:16
Default
  #7
New Member
 
Join Date: Jan 2010
Posts: 12
Rep Power: 16
Luise is on a distinguished road
Hi,

the syntax for outputFormat and surface definition etc. should be the same like in sampleDict.

Luise
Luise is offline   Reply With Quote

Old   August 11, 2010, 06:50
Default
  #8
New Member
 
Thomas
Join Date: Aug 2010
Posts: 11
Rep Power: 15
ThomasBE is on a distinguished road
Thanks Luise,

It worked like a charm. I now get 1.5 MB in .vtk files instead of 360 MB worth of results.

If any one is interested this is my final function. Basically just changed outputFormat to surfaceFormat.
Quote:
outputFolder
{
type surfaces;
region region0;
functionObjectLibs ("libsampling.so");
outputControl timeStep;
outputInterval 1;
surfaceFormat vtk;
fields
(
U
p
);
surfaces
(
domainSlice
{
type plane;
basePoint (-100 300 547.5);
normalVector (0 1 0);
interpolate true;
}
);
}
Now all I have to do is figure out how to load them as succesive timesteps in paraview...
randolph likes this.

Last edited by ThomasBE; August 11, 2010 at 07:10.
ThomasBE is offline   Reply With Quote

Old   August 11, 2010, 11:47
Default
  #9
New Member
 
Daniel
Join Date: Jun 2010
Posts: 12
Rep Power: 15
DVSoares is on a distinguished road
Couldn't we also consider using something like zlib for compression and on-the-fly reading of compressed files/folders?
DVSoares is offline   Reply With Quote

Old   August 11, 2010, 13:33
Default
  #10
Senior Member
 
akidess's Avatar
 
Anton Kidess
Join Date: May 2009
Location: Germany
Posts: 1,377
Rep Power: 29
akidess will become famous soon enough
Daniel, you could, but if you don't care to keep most of the results anyways why not postprocess and discard them right away? Compressing would just add additional cost to compress and uncompress again for postprocessing.
akidess is offline   Reply With Quote

Old   August 11, 2010, 14:05
Default
  #11
Member
 
Francois Gallard
Join Date: Mar 2010
Location: Toulouse, France
Posts: 43
Rep Power: 16
fgal is on a distinguished road
Thanks for sharing it, that is very useful.
fgal is offline   Reply With Quote

Old   August 12, 2010, 09:06
Default
  #12
Senior Member
 
Tom Fahner
Join Date: Mar 2009
Location: Breda, Netherlands
Posts: 634
Rep Power: 32
tomf will become famous soon enoughtomf will become famous soon enough
Send a message via MSN to tomf Send a message via Skype™ to tomf
Hey,

I basically had the same problem, so I used the suggestions from this topic and it helps a lot. Unfortunately I do not get nice results for a planar slice through a polygonal mesh. I got nice slices for the simple cavity tutorial, also for a 3D version with a hybrid tetrahedral/prims mesh and a polygonal mesh, but not for this more challenging case. There are also warnings in the output of the case, which read like:

--> FOAM Warning :
From function Foam::cuttingPlane::walkCell
in file cuttingPlane/cuttingPlane.C at line 227
Did not find closed walk along surface of cell 900795 starting from edge 482246 in 1001 iterations.
Collected cutPoints so far:

And then a long list of cutPoints

The corresponding surface with holes is shown in the figure beneath.



I wonder if it is possible to make sure the holes are not in the surface, so we get a nice closed surface. I also created the same slices from the full dataset in paraview, which then results in normal figures.

It seems like too many iterations are needed to find a "closed walk" around the surface of a cell? Or am I mistaken? I found the sourc of cuttingPlane.C, which has a limit of 1000 iterations. Modifying the source to increase the maximum number of iterations did not improve the situation.

Is there any way to improve the situation?

Thanks,
Tom
tomf is offline   Reply With Quote

Old   August 13, 2010, 04:51
Default
  #13
New Member
 
Thomas
Join Date: Aug 2010
Posts: 11
Rep Power: 15
ThomasBE is on a distinguished road
I'm sorry, but I don't know what happens there. The vtk files I get are give images of lower quality then the datasets, but I haven't experienced any holes or error messages.
ThomasBE is offline   Reply With Quote

Old   August 26, 2010, 04:54
Default
  #14
Member
 
Nick Gardiner
Join Date: Apr 2009
Location: Chichester, UK
Posts: 94
Rep Power: 17
NickG is on a distinguished road
Hi

I don't take any samples just use the utility in paraview under files>save animation. This saves a sequence of images as you see them on screen.

I don't change any thing in the first box that comes up though you can change the number of frames per timestep etc.
If you save them as .png files then I understand that the resolution is better than jpeg.(?)

Then with gimp: file>open as layers : select all your images, enter.
(gimp is a free opensource image software package)

Save as gif - you may need to write this in the name box e.g. test.gif as changing it in the drop down file type box doesn't work for me.

In the next box that comes up you need to click on save as animation then Export.

In the final box you can choose to loop the animation to keep it restarting, also you can specify the gap between frames. So if a feature is moving too fast for you to watch properly you can increase this value to slow the animation down. I try to space my write directories such that I'm not wasting memory space but also not making the animation too jumpy.

Hope that helps too

Nick

The attached gif is of 46 frames with 100 ms between frames and represents ~0.2s real time and not looped
Attached Images
File Type: gif sample.gif (93.0 KB, 536 views)
NickG is offline   Reply With Quote

Old   August 26, 2010, 05:00
Default
  #15
Member
 
Nick Gardiner
Join Date: Apr 2009
Location: Chichester, UK
Posts: 94
Rep Power: 17
NickG is on a distinguished road
looped hopefully
Attached Images
File Type: gif sample.gif (93.2 KB, 537 views)
NickG is offline   Reply With Quote

Old   October 10, 2010, 12:16
Default
  #16
Senior Member
 
Join Date: Mar 2009
Location: My oyster
Posts: 124
Rep Power: 17
ziad is on a distinguished road
Quote:
Originally Posted by NickG View Post
Hi

I don't take any samples just use the utility in paraview under files>save animation. This saves a sequence of images as you see them on screen.

I don't change any thing in the first box that comes up though you can change the number of frames per timestep etc.
If you save them as .png files then I understand that the resolution is better than jpeg.(?)

Then with gimp: file>open as layers : select all your images, enter.
(gimp is a free opensource image software package)

Save as gif - you may need to write this in the name box e.g. test.gif as changing it in the drop down file type box doesn't work for me.

In the next box that comes up you need to click on save as animation then Export.

In the final box you can choose to loop the animation to keep it restarting, also you can specify the gap between frames. So if a feature is moving too fast for you to watch properly you can increase this value to slow the animation down. I try to space my write directories such that I'm not wasting memory space but also not making the animation too jumpy.

Hope that helps too

Nick

The attached gif is of 46 frames with 100 ms between frames and represents ~0.2s real time and not looped
Thanks for the tip Nick. Works nicely and all opensource!

Ziad
ziad is offline   Reply With Quote

Old   October 12, 2010, 02:52
Default
  #17
Senior Member
 
Karl-Johan Nogenmyr
Join Date: Mar 2009
Location: Linköping
Posts: 279
Rep Power: 21
kalle is on a distinguished road
If you get 'low quality' in your animations when saving in vtk-format, it might be because you plot cell data instead of point data in paraview. You can convert from cell to point data by Filters -> Alphabetical -> Cell data to point data

I made a small python script some time ago to assist making animations:

http://openfoamwiki.net/index.php/VtkAnim

might be of help for someone...

K
ashvinc9 likes this.
kalle is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[blockMesh] Problems in creating a wedge type mesh Joscha OpenFOAM Meshing & Mesh Conversion 28 August 3, 2019 07:59
[Commercial meshers] Fluent msh and cyclic boundary cfdengineering OpenFOAM Meshing & Mesh Conversion 48 January 25, 2013 03:28
[blockMesh] Cyclic BC's: Possible face ordering problem? (Channel flow) sega OpenFOAM Meshing & Mesh Conversion 3 September 28, 2010 12:46
Problems with Meshing: Collapsed Cells Emmanuel Resch Siemens 1 July 30, 2007 03:02
Gerris software installation mer Main CFD Forum 2 November 12, 2005 08:50


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