Two plots animated simultaneously?

Moderators: davetaflin, salter, steve, jprenaud, straton, Chris Idso

gittenlucky
Newbie
Posts: 9
Joined: Mon Nov 16, 2009 8:47 am
Location: Maine
Contact:

Two plots animated simultaneously?

Postby gittenlucky » Mon May 10, 2010 9:49 am

I have two plots that I would like to animate simultaneously. One is a contour of the convection / diffusion equation and the second is an estimate of the same thing. I would like to play them both at the same time so I can visually see how well my estimate matches the actual. Is it possible to have multiple plots at once in tecplot?

Chris Idso
Jedi Master
Posts: 249
Joined: Mon Jan 15, 2007 10:07 am
Location: Bellevue, WA
Contact:

Re: Two plots animated simultaneously?

Postby Chris Idso » Tue May 11, 2010 6:48 am

Hello,

Yes. You can place each plot in its own frame, so you would have two frames in your Tecplot window, then you can animate them simultaneously with a macro. Below is a macro that animates multiple Tecplot frames at the same time. It might need to be modified a little so that it will work in your case:

$!VarSet |MFBD| = 'C:\TECPLOT75'
$!VarSet |lpa| = 1
$!VarSet |NZm1| = |NUMZONES|
$!VarSet |NZm1| -= 1
$!Varset |MOVIE| = "avi"
$!Varset |ANIMSETUP| = "AVI"

$!PROMPTFORTEXTSTRING |ANIMTYPE|
INSTRUCTIONS = "Please enter the animation file type: 1 for AVI, 2 for Raster Metafile"

$!IF |ANIMTYPE| == 2
$!VARSET |MOVIE| = "rm"
$!VARSET |ANIMSETUP| = "RASTERMETAFILE"
$!ENDIF


#Get the name of the output movie
$!PROMPTFORFILENAME |fname|
DIALOGTITLE="Specify output movie file."
DEFAULTFNAME = "*.|MOVIE|"

$!LOOP |NUMFRAMES|
$!if |framemode| >= 2
$!ACTIVEFIELDZONES = [ |lpa| ]
$!Endif
$!if |framemode| == 1
$!XYMAP
ASSIGN { ZONE = |lpa| }
$!Endif
$!FRAMECONTROL PUSHTOP
$!ENDLOOP
$!REDRAWALL
$!Delay 1

$!EXPORTSETUP EXPORTFORMAT = |ANIMSETUP|
$!EXPORTSETUP BITDUMPREGION = ALLFRAMES
$!EXPORTSETUP EXPORTFNAME = '|fname|'
$!EXPORT
APPEND = NO

$!Loop |NZm1|
$!VARSET |lpa| += 1
$!LOOP |NUMFRAMES|
$!if |framemode| >= 2
$!ACTIVEFIELDZONES = [ |lpa| ]
$!Endif
$!if |framemode| == 1
$!XYMAP
ASSIGN { ZONE = |lpa| }
$!Endif
$!FRAMECONTROL PUSHTOP
$!ENDLOOP
$!REDRAWALL
$!Delay 1
$!EXPORT
APPEND = YES
$!ENDLOOP

$!RemoveVar |MFBD|
$!RemoveVar |lpa|
$!RemoveVar |NZm1|
$!RemoveVar |fname|
Chris


Christopher Idso

Tech Support Lead
Tecplot, Inc

gittenlucky
Newbie
Posts: 9
Joined: Mon Nov 16, 2009 8:47 am
Location: Maine
Contact:

Re: Two plots animated simultaneously?

Postby gittenlucky » Tue May 11, 2010 10:01 am

That worked great. Thank you very much.

bkl
Newbie
Posts: 2
Joined: Tue Jan 09, 2007 7:47 am
Location:

Re: Two plots animated simultaneously?

Postby bkl » Wed Jun 30, 2010 1:17 am

Hello

I just tried the macro, but the resolution of the movie is small. How to increase it? Thanks in advance

sgildea
Newbie
Posts: 8
Joined: Tue Nov 25, 2008 2:53 pm
Location: Boston, MA
Contact:

Re: Two plots animated simultaneously?

Postby sgildea » Tue Aug 21, 2012 3:13 pm

Hello,

Is there a way to use the Animate menu to do this? I have two groups of frames (each group consists of two frames, one with 2D data, the other with a sketch on top) that I have successfully animated individually, but but when I animate to file, even if I select "All Frames" in the "Region" dropdown menu, only one of the videos will play. I tried the macro given here, but it did not work for me - it even crashed Tecplot once - and I don't understand all the commands because I could not find some of them in the manual. Also, when the macro does not crash Tecplot, it creates an avi file that I can't read.

Also, when I removed the sketches from each group (leaving just one frame in each group), the macro produced a video I could view, but it did not animate anything. It just showed data from the first zone the entire time.

Is there any hope of animating the two frames (each frame takes data from the same zones) at the same time and recording the movie this way?

I would appreciate any responses. Right now I will resign myself to printing the time-step to screen, and then manually matching things up in my media player.

I am using Tecplot 360 2011 Release 2, Build 13.3.0.21255 (Oct 27 2011)
for MS-WINDOWS (64-Bit)

Thank you,

Steve

User avatar
salter
Moderator
Posts: 188
Joined: Thu Dec 21, 2006 10:57 am
Location: NASA Langley Research Center
Contact:

Re: Two plots animated simultaneously?

Postby salter » Wed Aug 22, 2012 5:46 am

Steve,

Unfortunately the types of animation you are considering require a bit more work than what is available in the animation menu. You have to still use the macro Chris Idso provided. I've done this quite frequently with as many as 9 different frames. It is usually best to name your frames if you do this so that the active frame can be determined directly.

Good Luck,
Steve...

Aerospace Research Engineer
Aerothermodynamics Branch
NASA Langley Research Center

sgildea
Newbie
Posts: 8
Joined: Tue Nov 25, 2008 2:53 pm
Location: Boston, MA
Contact:

Re: Two plots animated simultaneously?

Postby sgildea » Wed Aug 22, 2012 7:18 am

Thanks for the reply. Does anyone have a version of the macro with comments that might provide more intuition for how to adapt it to my specific application? Also, the resolution of the images I have been able to make with this method are very low, as another poster pointed out.

I don't know why, but this macro does not work for me. Even the simple part where you specify an output file gives me an error unless I select a preexisting .avi file (I have not tried it for the raster metafile format).

For instance, if |framemode|>=2, does that mean it is not an (XY) or (2D) plot, and if |framemode|==1, does that mean it is a 2D plot? The manual I looked at did not list numerical values for these plots. What is the |framemodel| value for a sketch?

Also, what does

"$!ACTIVEFIELDZONES = [|lpa|]" accomplish? I'm sure it is important but I haven't put it all together in my head yet.

If anyone has guidance to offer, it would help tremendously.

Thanks,

Steve

User avatar
salter
Moderator
Posts: 188
Joined: Thu Dec 21, 2006 10:57 am
Location: NASA Langley Research Center
Contact:

Re: Two plots animated simultaneously?

Postby salter » Fri Aug 24, 2012 10:19 am

Steve,

You have lots of questions, and hopefully we can get you some good answers. First, the easy parts. The

Code: Select all

$!ActiveFieldZones = [|lpa|]

is an older method of specifying which zones are active for a particular frame. In Tecplot, you use the attributes dialog to set the visualization parameters of each zone. Then, you make the zones you want to visible by making them "active". That's what this function does. For the example that Chris provided, the variable |lpa| is a number. In reality, Tecplot macros see all variables as text, and convert the text to a number where it is expected. So for the active field zones, you could have a list, where

Code: Select all

$!VarSet |lpa| = "2,4-7,10-20:2"

meaning that zones 2, 4, 5, 6, 7, 10, 12, 14, 16, 18, and 20 would be active.

In the tprm.pdf (the scripting guide) file of the documentation for Tecplot, there is a page with internal macro variables defined. In the current version I have (Tecplot 360 2011) the |FrameMode| was replaced by |PlotType|, and the list of options is the same, except the polar one where I'm not sure the polar plots were available in Tecplot 7.5.

The macro that is more up to date, is below:

Code: Select all

#!MC 1200
#
# This macro animates multiple frames simultaneously for visualization
# of data. Assumed in this macro is the user has taken the time to set
# each frame plot attributes differently, but to show the exact same
# single zone. It supports both line maps and 2D and 3D plots.
#
# Begin by setting the parameters for the animation such as the root
# directory |MFBD|, the zones to plot |lpa|, and the type of movie to
# be generated |MOVIE|.

$!VarSet |MFBD| = 'C:\TECPLOT75'
$!VarSet |lpa| = 1
$!Varset |MOVIE| = "avi"
$!Varset |ANIMSETUP| = "AVI"

# Ask the user the type of animation to be generated:

$!PROMPTFORTEXTSTRING |ANIMTYPE|
INSTRUCTIONS = "Please enter the animation file type: 1 for AVI, 2 for Raster Metafile"

$!IF |ANIMTYPE| == 2
  $!VARSET |MOVIE| = "rm"
  $!VARSET |ANIMSETUP| = "RASTERMETAFILE"
$!ENDIF

# Get the name of the output movie. Here, the |MOVIE| variable will
# only select the *.|MOVIE| file names as possibilities. If you want
# more, simply use *.* as the default name.

$!PROMPTFORFILENAME |fname|
  DIALOGTITLE="Specify output movie file."
  DEFAULTFNAME = "*.|MOVIE|"

# For both frames, determine what is to be active. In a 2D plot a zone
# is active, but in XY mode, a mapping is active and the zone to plot
# is set for that mapping. This works for individual zones, but if a
# list of zones is specified, more work is needed to expand the list
# so that multiple maps can be created. Set the attributes for each
# frame, pusing the top frame down to get to the next frame.

$!FrameControl ActivateTop

$!LOOP |NUMFRAMES|

  $!if |PlotType| >= 2
    $!ActiveFieldMaps = [ |lpa| ]
  $!Endif

  $!if |PlotType| == 1
    $!LineMap
      Assign { Zone = |lpa| }
  $!Endif

  $!FrameControl ActivateNext

$!ENDLOOP

$!REDRAWALL

# Prepare the output for the movie.

$!EXPORTSETUP
  EXPORTFORMAT = |ANIMSETUP|
  ExportRegion = ALLFRAMES
  EXPORTFNAME = '|fname|'

# Output initial set of frames established with the look that set up
# each frame.

$!ExportStart

# Loop through all the zones, switching between frames to generate a
# new plot, then output each set as a new "slide" in the animation.

$!VarSet |NumberOfSlides| = (|NumZones|-1)

$!Loop |NumberOfSlides|

  $!VARSET |lpa| += 1

  $!LOOP |NUMFRAMES|

    $!if |PlotType| >= 2
      $!ACTIVEFIELDZONES = [ |lpa| ]
    $!Endif

    $!if |PlotType| == 1
      $!LineMAP
        ASSIGN { ZONE = |lpa| }
    $!Endif

    $!FRAMECONTROL ActivateNext

  $!ENDLOOP

  $!REDRAWALL
  $!EXPORTNextFrame

$!ENDLOOP

$!ExportFinish

$!RemoveVar |AnimSetUp|
$!RemoveVar |AnimType|
$!RemoveVar |lpa|
$!RemoveVar |MFBD|
$!RemoveVar |Movie|
$!RemoveVar |NumberOfSlides|
$!RemoveVar |fname|


Hope this helps. If there are issues let us know.
Steve...



Aerospace Research Engineer

Aerothermodynamics Branch

NASA Langley Research Center

mconnelly
Moderator
Posts: 8
Joined: Fri Mar 31, 2006 2:58 pm
Location: richland, wa

Re: Two plots animated simultaneously?

Postby mconnelly » Mon Aug 27, 2012 12:32 pm

I have written a shareware add-on that may work for you if the data is not transient.

here is the webpage for the add-on

http://webpages.charter.net/tecgeo/AZD/index.html

please contact me outside of TecplotTalk, if you think this may work for you

tecgeo@charter.net

Mike


Return to “Animation”

Who is online

Users browsing this forum: No registered users and 0 guests

cron