CFX Post: Problem with Macro
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 :o. Thanks in advance. Shafi |
Hi
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. |
Thank you so much Pavitran. Yes, I missed the command file and data reader. Let me try with this.
Thanks again. Shafi |
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 TABLE:Domain 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 |
Hi
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. |
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 |
Hi
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 !} ############################# |
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 |
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. |
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"); !} ############################# |
Hi shafiul
There is a problem in for loop, just change
$i=$i++ to just $i++. |
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 |
Dear Singer1812,
Thanks for your reply. I got it done. Shafiul |
All times are GMT -4. The time now is 20:28. |