Making Animations

From Elmer Wiki
Jump to: navigation, search

There are different variants for animating and making animations. Below some instructions are given.


Contents

Regular animations

Running animation on the screen with ElmerPost

  • start ElmerPost
  • read the results in ReadModelFile menu selecting all the relevant timesteps
  • In Edit / Timestep Control Loop all the timesteps and check that your animation is working

Saving the animation into a file

This assumes that you have the "savempg" plugin in the right-hand-corner of ElmerPost.

  • Choose the plug-in Modules / savempg
  • In the Savempg control pop-up window choose the packing and parameters, and pres Start
  • In Edit / Timestep Control write the following string in the "Do after frame" box savempg append and pres "Loop"
  • In Savempg control pres Stop and you're done.

In the VTK widget the animation is more or less similar, except there is no built-in plugin for doing the animations. However, you can compose the animation from a frequence of frames with some auxiliary program. Also in ElmerPost if you happen to miss the plugin you can create a set of files with setting in the "Do after frame" box something like

$ xwd -name "ELMER POST GRAPHICS" -out pic$t.xwd

where xwd is the system level call for crabbing the window.

You should note that the coding algorithms prefer multiples of 16. Hence you may tune the window size for best performance by saying in the ElmerPost command line something like

winsize 1024 768

Or whatever your preferred size of animation is. Note that ElmerPost has the unfortunate handicap that the visualization screen needs to be intact while doing the animations.


Animations with geometry deformation

Sometimes the geometry is chanching with time. ElmerPost assumes that the node coordinates are defined in the "nodes" matrix such that nodes=[x y z]. Now if you want to have the displacement/deflection included in the nodes you should alter it accordingly i.e. x=x0+dx etc. For that we 1st save the original nodes:

math n0=nodes

The simplest case is if you have just one timestep/eigenvalue read: In the math window of the main window

math nodes=n0+Displacement*scale

and press the phsychedelic button in the upper righthand corner. Here "scale" is a scaling factor of your choice

When you have more than one step open "Timestep control" panel, write the following in the "Do after Frame" field:

math nodes=n0+Displacement(0:2,time($t))

and press the "Loop" button. Otherwise the making of animations is simular as in the basic case.

Animations of harmonic solutions

Sometimes it is nice to animation harmonic solutions or eigenmode as a time-dependent simulation. The sinusoidal time-dependency may be done within ElmerPost. You need to create time-harmonic behavior on-the-fly in the main math window using a small loop. For example over 2*pi:

do i 0 20 { math phi=2*pi*$i/20; math 
nodes=n0+Displacement(0:2,time(0))*sin(phi)*0.02; display}

or if you have a complex function, like in this case a complex pressure,

do i 1 50 { math phi=2*pi*$i/50; math nodes=n+Displacement*sin(phi)*1.0e-5; 
math pres=Pressure.1*cos(phi)-Pressure.2*sin(phi); display; savempg append }

In this case its a good idea to a priori set the scaling and fix it since otherwise the colorscale will be chanching all the time. For sinusoidal movement the interval sould be [-max(Displacement_abs),max(Displacement_abs)]. Otherwise the making of animations is simular as in the basic case.


Doing animation with ParaView

ParaView is a also a nice tool for doing animations. It has the advantage that the graphics card memory is not used for the figures and therefore the animations may be done in the background, and the may be of any resolution (even FullHD, 1920 x 1080).

To get the needed vtu files add the following sequence with the next free Solver id to your sif file, or use ElmerGUI to add it.

Solver 5 
  Exec Solver = String "after timestep"	
  Equation = String "ResultOutput"
  Procedure = File "ResultOutputSolve" "ResultOutputSolver"
  Output File Name = String "case" 
  Output Format = String "vtu"
End

Then open the file case*.vtu in ParaView and perform the visualization as explained in the documentation of ParaView. You may also use other tools based on VTK library (i.e. ViSit).

Personal tools