Page 1 of 2
Display time in animations
Posted: 26 Oct 2010, 12:34
by mzenker
Hi,
is there a way to display the time (in seconds) on the picture of an animation generated from a transient simulation?
Thank you,
Matthias
Re: Display time in animations
Posted: 26 Oct 2010, 15:25
by petroo
Hello Matthias,
if there is no intrinsic solution you might take a detour via ImageMagick: If you save the individual images for the later animation with a sensible time-dependent file name (I can send you an example upon request) you can put filename-extracted pieces of text by some simple ImageMagick command into each image and combine them to the desired animation afterwards.
Regards,
Peter
Re: Display time in animations
Posted: 26 Oct 2010, 15:53
by mzenker
Hi Peter,
thank you for the hint. But as I save the animation directly from ElmerPost, I would by far prefer a solution within Elmer .
Would it be possible to do it with the VTK postprocessor?
BTW, the VTK Postprocessor is still veeery unstable for me, it frequently crashes right at startup. Is this a known behaviour?
Matthias
Re: Display time in animations
Posted: 27 Oct 2010, 10:44
by Juha
Hi,
If your system has had freetype installed at the time of compiling & installing
ElmerPost you might have the commands
ffttext x y string
ftfont font [size r g b]
in your Elmerpost. If so, you might have some luck with the following
o save the script below to a file, say "file.txt"
Code: Select all
proc time_disp { x y t } {
math t=$t-1
math x=$x
math y=$y
math { tstr=sprintf( "fttext %g %g \"Simulation time: %g (s)\"",x y times(2,t) ); }
math tcl(tstr);
}
o in the ElmerPost main windows command line enter
o in the "Timestep Control" panels "after timestep" input field enter
(replace the x & y by screen coordinates of your choice.) You can enter
several command there separated by semicolon, if need be...
Regards, Juha
Re: Display time in animations
Posted: 27 Oct 2010, 12:50
by mzenker
Hi Juha,
thank you for your help.
I have tried on the ElmerPost command line
math {tstr=sprintf("fttext 0 0 \"test\"")}
math tcl(tstr)
and I get the error message
invalid command name "fttext"
So I am afraid my system does not support this command, unless I have made another trivial error.
I use the binary distribution 4671 (Elmersolver says it's 4649) under Windoze XP.
Is there anything else I can do?
Thank you,
Matthias
Re: Display time in animations
Posted: 27 Oct 2010, 14:23
by Juha
Hi,
no i'm sorry, not that i know.
Regards, Juha
PS. You don't have to take the detour from matc to tcl to use the fttext-command,
if such existed. You should be able to just do:
from the ElmerPost command line.
Re: Display time in animations
Posted: 27 Oct 2010, 14:34
by mzenker
If I do
fttext 0 0 "test"
from the command line, I get again the "invalid command name" error.
Do I have to compile ElmerPost myself in order to get freetype support, or are there binaries with this functionality?
Thank you,
Matthias
Re: Display time in animations
Posted: 27 Oct 2010, 16:14
by petroo
Hi Matthias,
mzenker wrote:fttext 0 0 "test"
from the command line, I get again the "invalid command name" error.
Maybe there is a typo? Is it
ffttext ..., i.e. with an additional f in the command?
(Didn't test myself as I am quite sure not to have had it installed at compilation time.)
Regards,
Peter
Re: Display time in animations
Posted: 27 Oct 2010, 16:18
by mzenker
Hi Peter,
neither
fttext
nor
ffttext
works, unfortunately...
Matthias
Re: Display time in animations
Posted: 28 Oct 2010, 13:43
by Juha
Hi,
Mikko kindly made a new windows installer, with freetype stuff included. The
installer is found here:
http://www.nic.funet.fi/pub/sci/physics ... n/windows/
Examples:
fttext hello
fttext hello 0.1 0.2
note the argument order "string x y", change the script accordingly & x ja y are in range -1...1
Setting fonts:
ftfont FreeSerif
ftfont FreeSerif 20
font size given in pixels
ftfont FreeSerif 20 1.0 0.0 0.0
r, g, b in range 0...1
Fonts are to be found $ELMER_POST_HOME/fonts/TrueType.
Freetype installer provided fonts are:
FreeMono
FreeMonoBold
FreeMonoBoldOblique
FreeMonoOblique
FreeSans
FreeSansBold
FreeSansBoldOblique
FreeSansOblique
FreeSerif
FreeSerifBold
FreeSerifBoldItalic
FreeSerifItalic
Juha