|
[Sponsors] |
December 24, 2010, 02:58 |
CFX Post: Problem with Macro
|
#1 |
New Member
sam13
Join Date: Jul 2009
Location: St. John's, NL, Canada
Posts: 23
Rep Power: 17 |
Hi everybody,
I was trying to export transient simulation data for selected time steps with the following macro- !$start = 120; !$finish = 240; !for($i = $start; $i<=$finish; $i++){ > load timestep = $i EXPORT: Export File = export_exp$i.csv Type = Generic Locations = BladePre Coord Frame = Global Unit System = US Engineering Select Variable = Pressure END > export !} But it did not produce any output!! Can any one show me where I'm doing wrong? Is there any good reference for macro writing? I have no basic on writing macros . Thanks in advance. Shafi Last edited by Shafiul; December 24, 2010 at 03:32. |
|
December 24, 2010, 11:17 |
Hi
|
#2 |
Member
Dynampally Pavitran
Join Date: Mar 2010
Location: India
Posts: 74
Rep Power: 16 |
I guess your using the macro in batch mode, did you add the Command file at the start of your macro, The command file looks like below:
############# COMMAND FILE: CFX Post Version = 11.0 END ############# If your version is CFX 12 then just replace with 12.0 or 12.1 in COMMAND FILE and also add the below DATA READER LINES: The domain names should be according to what you declared in CFX Pre ############# DATA READER: Domains to Load = S1, S2 END ############# As such there are no extensive details given in CFX help for writing macros, but you can find some sample macros. |
|
December 24, 2010, 16:38 |
|
#3 |
New Member
sam13
Join Date: Jul 2009
Location: St. John's, NL, Canada
Posts: 23
Rep Power: 17 |
Thank you so much Pavitran. Yes, I missed the command file and data reader. Let me try with this.
Thanks again. Shafi |
|
December 26, 2010, 17:18 |
|
#4 |
New Member
sam13
Join Date: Jul 2009
Location: St. John's, NL, Canada
Posts: 23
Rep Power: 17 |
Hi there,
I'm sorry to say it did not work! I encounterd with the following error message- ERROR CCL validation failed with message: Error: Sub-object 'COMMENT:User Data' of type COMMENT is not allowed in / Error: Sub-object 'REPORT' is not allowed in / Error: Sub-object 'INTERNAL TABLE:File Information Table P4718farbcUnsteady_001' of type INTERNAL TABLE is not allowed in / Error: Sub-object 'INTERNAL TABLE:Mesh Information Table P4718farbcUnsteady_001' of type INTERNAL TABLE is not allowed in / Error: Sub-object 'INTERNAL TABLE:Mesh Statistics Table P4718farbcUnsteady_001' of type INTERNAL TABLE is not allowed in / Error: Sub-object 'INTERNAL TABLEomain Physics Table P4718farbcUnsteady_001' of type INTERNAL TABLE is not allowed in / Error: Sub-object 'INTERNAL TABLE:Boundary Physics Table P4718farbcUnsteady_001' of type INTERNAL TABLE is not allowed in / Error: Sub-object 'INTERNAL TABLE:Boundary Flow Table P4718farbcUnsteady_001' of type INTERNAL TABLE is not allowed in / Error: Sub-object 'INTERNAL TABLE:Force And Torque Table P4718farbcUnsteady_001' of type INTERNAL TABLE is not allowed in / Error: Sub-object 'COMMAND FILE' is not allowed in / Error: Parameter 'File' is not allowed in /EXPORT Error: Parameter 'Type' is not allowed in /EXPORT Error: Parameter 'Locations' is not allowed in /EXPORT Error: Parameter 'Coord Frame' is not allowed in /EXPORT Error: Parameter 'Unit System' is not allowed in /EXPORT Error: Parameter 'Select Variable' is not allowed in /EXPORT Any idea? Shafiul |
|
December 26, 2010, 23:33 |
Hi
|
#5 |
Member
Dynampally Pavitran
Join Date: Mar 2010
Location: India
Posts: 74
Rep Power: 16 |
How are you executing the macro? in batch mode I suppose. Which version of CFX post are you using.
Can you post your macro, I guess that there may be some problem with the syntax. |
|
December 27, 2010, 00:00 |
|
#6 |
New Member
sam13
Join Date: Jul 2009
Location: St. John's, NL, Canada
Posts: 23
Rep Power: 17 |
Hi Pavitran,
Thanks for your respnose. I'm very new to using macro and I've no idea about the batch mode. I wrote the macro in command editor and then hit the process button. Here is the macro- COMMAND FILE: CFX Post Version = 11.0 END DATA READER: Domains to Load = Default Domain END !$start = 120; !$finish = 240; !for($i = $start; $i<=$finish; $i++){ > load timestep = $i EXPORT: Export File = export_exp$i.csv Type = Generic Locations = BladePre Coord Frame = Global Unit System = US Engineering Select Variable = Pressure END > export !} I'm damn sure I'm doing something wrong. Just can't figure it out!! -Shafi |
|
January 2, 2011, 23:52 |
Hi
|
#7 |
Member
Dynampally Pavitran
Join Date: Mar 2010
Location: India
Posts: 74
Rep Power: 16 |
In your previous macro there was a syntax error in EXPORT CCL format. Copy the macro in between the hashes and process it. I beleive this will work now.
############################ COMMAND FILE: CFX Post Version = 11.0 END ! for($i=120;$i<=240;$i=$i++){ > load filename=$i.trn EXPORT: Export Coord Frame = Global Export File = $i.csv Export Type = Generic Export Units System = US Engineering Location List = BladePre Variable List = Pressure END >export !} ############################# |
|
January 4, 2011, 16:12 |
|
#8 |
New Member
sam13
Join Date: Jul 2009
Location: St. John's, NL, Canada
Posts: 23
Rep Power: 17 |
Hi Pavitran,
It works perfectly for a single time step only! I am getting en error message as follows- ERROR Overwrite not allowed: 120.csv It seems the loop is not working properly which is really weird. I am trying to solve it. Thanks for your help though. I really appreciate it. Shafi |
|
January 4, 2011, 17:28 |
|
#9 |
Senior Member
Edmund Singer P.E.
Join Date: Aug 2010
Location: Minneapolis, MN
Posts: 511
Rep Power: 21 |
Not exactly sure what you are trying to doing. It seems you might accomplish this alot easier through a chart and export those values.
There is no reason to cycle through the *.trn files. |
|
January 4, 2011, 17:35 |
|
#10 |
Senior Member
Edmund Singer P.E.
Join Date: Aug 2010
Location: Minneapolis, MN
Posts: 511
Rep Power: 21 |
Ohh, I understand, thats a file of x,y,z and t. This could be a large set.
Looks like the file name isn't updating in the export. Try this (below script is written for use on C: drive but you can change it): ############################ COMMAND FILE: CFX Post Version = 11.0 END ! for($i=120;$i<=240;$i=$i++){ > load filename=$i.trn EXPORT: Export Coord Frame = Global Overwrite = True Export File = junk.csv Export Type = Generic Export Units System = US Engineering Location List = BladePre Variable List = Pressure END >export !rename("C:/Your_Location/junk.csv","C:/Your_Location/$i.csv"); !} ############################# |
|
January 4, 2011, 22:18 |
Hi shafiul
|
#11 |
Member
Dynampally Pavitran
Join Date: Mar 2010
Location: India
Posts: 74
Rep Power: 16 |
There is a problem in for loop, just change
$i=$i++ to just $i++. |
|
January 5, 2011, 16:21 |
|
#12 |
New Member
sam13
Join Date: Jul 2009
Location: St. John's, NL, Canada
Posts: 23
Rep Power: 17 |
Dear Pavitran,
Yes, it works! Thanks a lot for your generous help. But I am just wondering how can I learn this language? Is there any source that you can recommend me? Thanks agian. Shafiul |
|
January 5, 2011, 16:24 |
|
#13 |
New Member
sam13
Join Date: Jul 2009
Location: St. John's, NL, Canada
Posts: 23
Rep Power: 17 |
Dear Singer1812,
Thanks for your reply. I got it done. Shafiul |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
CFX Post export problem | jeff_F | CFX | 0 | August 17, 2009 22:25 |
problem in displaying surfaces in CFX | haho | CFX | 1 | July 5, 2009 20:25 |
Macro problem | cfddummy | Siemens | 1 | April 9, 2007 13:37 |
(CFX POST) Rotational Speed | ARJUN | CFX | 9 | July 13, 2006 21:38 |
Doubt Regarding macro calculator option in CFX | Sridevi | CFX | 0 | December 21, 2005 04:55 |