|
[Sponsors] |
January 24, 2003, 19:24 |
One question about macro
|
#1 |
Guest
Posts: n/a
|
What's wrong in the following macro?
calc i = 1 while ( $i < 100 ) . . . calc ms$i=masstotal . . . echo $ms$i If the value of "i" is 7, the result is "$ms7". What I want is to get an valute stored in variable "ms7". How can I fix this problem? |
|
February 14, 2003, 09:36 |
Re: One question about macro
|
#2 |
Guest
Posts: n/a
|
(I'm assuming your first line, "calc i=1 while ($i < 100)" is actually two lines. This message board did the same thing to me, sticking two lines together unless I left a blank line between them.)
You should be getting a value stored in parameter ms7 (and all of ms1 through ms99, presumably). The problem is in the "echo" command. You want TASCtool to substitute 7 for $i, then substitute the value of ms7 for $ms7. This requires sort of a nesting of dollar signs; it's got to substitute the $i and then use the first dollar sign after that's done. I haven't found any way to get TASCtool to do that either. Instead, it's just reading left to right, trying to evaluate $ms (which has no value set, so it just echoes "$ms"), then $i (which it correctly replaces with "7"). The workaround I use is to use "calc" to put the value into a simple parameter name just for output. After all, the correct value has been placed into ms7. Instead of "echo $ms$i", try: calc ms_output=ms$i echo $ms_output This ought to work. Just let ms_output keep getting replaced by the current value of ms$i as the loop goes. Jim |
|
February 17, 2003, 21:21 |
Re: One question about macro
|
#3 |
Guest
Posts: n/a
|
Thank you very very much, Jim!
|
|
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
question about uds | tanven | FLUENT | 2 | July 5, 2015 12:22 |
Unanswered question | niklas | OpenFOAM | 2 | July 31, 2013 17:03 |
internal field question - PitzDaily Case | atareen64 | OpenFOAM Running, Solving & CFD | 2 | January 26, 2011 16:26 |
Question about Table applicaiton. | universez | OpenFOAM Running, Solving & CFD | 0 | January 12, 2010 21:31 |
Poisson Solver question | Suresh | Main CFD Forum | 3 | August 12, 2005 05:37 |