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

Tecplot Macro - conditional - array variable

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree3Likes
  • 1 Post By pchidamb
  • 1 Post By wsfowler
  • 1 Post By pchidamb

Reply
 
LinkBack Thread Tools Display Modes
Old   July 23, 2009, 13:45
Default Tecplot Macro - conditional - array variable
  #1
New Member
 
Prabavathi Chidhambaram
Join Date: Jul 2009
Posts: 2
Rep Power: 0
pchidamb is on a distinguished road
Hi

I am using Tecplot 10. I am able to use conditional Tecplot macros for scalar variables.
Ex:
#!MC 1000
$!Macrofunction Name = "CheckControl"
$!Varset |A| =2
$!Varset |B| =1
$!If |B| != 0
$!ALTERDATA
EQUATION = '{CC} = ATAN({AA}/{BB})'
$!Else
$!ALTERDATA
EQUATION = '{CC} = ATAN({AA})'
$!Endif
$!Endmacrofunction
$!Runmacrofunction "CheckControl"

I also want to use conditional Tecplot macros for array variables.
For example, I want to scan the array {BB} and evaluate the array {CC}.
Will you please let me know the syntax in Tecplot?

Thanks
Praba
Светлана likes this.
pchidamb is offline   Reply With Quote

Old   July 28, 2009, 19:02
Default
  #2
New Member
 
Scott Fowler
Join Date: May 2009
Posts: 7
Rep Power: 8
wsfowler is on a distinguished road
You should be able to use $!GETFIELDVALUE to get values from a particular zone/variable. Something like this:

$!LOOP |NUMPOINTS|
$!GETFIELDVALUE |VALUE|
ZONE = 1
VAR = 1
INDEX = (|LOOP|)
#Do something with |VALUE|
$!ENDLOOP

You'll need to know, or calculate |NUMPOINTS|.
Светлана likes this.
wsfowler is offline   Reply With Quote

Old   July 29, 2009, 09:48
Default Tecplot Macro - conditional - array variable
  #3
New Member
 
Prabavathi Chidhambaram
Join Date: Jul 2009
Posts: 2
Rep Power: 0
pchidamb is on a distinguished road
Thank you Scott!
My macro works!
#!MC 1000
#$!VarSet |MFBD| = 'C:\Program Files\TEC100'
$!Macrofunction Name = "Equation1"
$!VarSet |NumPoints| = (|MaxI|*|MaxJ|*|MaxK|)
$!VarSet |VarFp| = 42 #Fp
$!VarSet |ConstantF| = 1.2776E+06
$!VarSet |ANR| = 3.0E+11
$!LOOP |NumPoints|
$!GetFieldValue |Value|
Zone = 1
Var = |VarFp|
Index = |LOOP|
#
$!If |Value| > |ConstantF|
$!ALTERDATA
EQUATION = '{DELTA} = |ANR|/(2 * PI * SQRT(|Value|*|Value| - |ConstantF|*|ConstantF|))'
$!Else
$!ALTERDATA
EQUATION = '{DELTA} = 1000'
$!Endif
$!ENDLOOP
#
#Cleanup
#
$!RemoveVar |NumPoints|
$!RemoveVar |VarFp|
$!RemoveVar |ConstantF|
$!RemoveVar |ANR|
$!RemoveVar |Value|
$!Endmacrofunction
$!Runmacrofunction "Equation1"
Светлана likes this.
pchidamb is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Extract Data from Polyline in a Macro (Tecplot) Joe Main CFD Forum 0 September 5, 2008 03:46
error in COMSOL:'ERROR:6164 Duplicate Variable' bhushas Main CFD Forum 1 May 30, 2008 04:35
Env variable not set gruber2 OpenFOAM Installation 5 December 30, 2005 05:27
TECPLOT 10 macro problem Matthew Morse Tecplot 5 July 5, 2004 01:31
Replace periodic by inlet-outlet pair lego CFX 3 November 5, 2002 21:09


All times are GMT -4. The time now is 16:54.