CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > CFX

CFX Post: Problem with Macro

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By singer1812

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 24, 2010, 02:58
Question CFX Post: Problem with Macro
  #1
New Member
 
sam13
Join Date: Jul 2009
Location: St. John's, NL, Canada
Posts: 23
Rep Power: 17
Shafiul is on a distinguished road
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.
Shafiul is offline   Reply With Quote

Old   December 24, 2010, 11:17
Default Hi
  #2
Member
 
Dynampally Pavitran
Join Date: Mar 2010
Location: India
Posts: 74
Rep Power: 16
pavitran is on a distinguished road
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.
pavitran is offline   Reply With Quote

Old   December 24, 2010, 16:38
Default
  #3
New Member
 
sam13
Join Date: Jul 2009
Location: St. John's, NL, Canada
Posts: 23
Rep Power: 17
Shafiul is on a distinguished road
Thank you so much Pavitran. Yes, I missed the command file and data reader. Let me try with this.

Thanks again.

Shafi
Shafiul is offline   Reply With Quote

Old   December 26, 2010, 17:18
Exclamation
  #4
New Member
 
sam13
Join Date: Jul 2009
Location: St. John's, NL, Canada
Posts: 23
Rep Power: 17
Shafiul is on a distinguished road
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
Shafiul is offline   Reply With Quote

Old   December 26, 2010, 23:33
Default Hi
  #5
Member
 
Dynampally Pavitran
Join Date: Mar 2010
Location: India
Posts: 74
Rep Power: 16
pavitran is on a distinguished road
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.
pavitran is offline   Reply With Quote

Old   December 27, 2010, 00:00
Default
  #6
New Member
 
sam13
Join Date: Jul 2009
Location: St. John's, NL, Canada
Posts: 23
Rep Power: 17
Shafiul is on a distinguished road
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
Shafiul is offline   Reply With Quote

Old   January 2, 2011, 23:52
Default Hi
  #7
Member
 
Dynampally Pavitran
Join Date: Mar 2010
Location: India
Posts: 74
Rep Power: 16
pavitran is on a distinguished road
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
!}
#############################
pavitran is offline   Reply With Quote

Old   January 4, 2011, 16:12
Default
  #8
New Member
 
sam13
Join Date: Jul 2009
Location: St. John's, NL, Canada
Posts: 23
Rep Power: 17
Shafiul is on a distinguished road
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
Shafiul is offline   Reply With Quote

Old   January 4, 2011, 17:28
Default
  #9
Senior Member
 
Edmund Singer P.E.
Join Date: Aug 2010
Location: Minneapolis, MN
Posts: 511
Rep Power: 21
singer1812 is on a distinguished road
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.
singer1812 is offline   Reply With Quote

Old   January 4, 2011, 17:35
Default
  #10
Senior Member
 
Edmund Singer P.E.
Join Date: Aug 2010
Location: Minneapolis, MN
Posts: 511
Rep Power: 21
singer1812 is on a distinguished road
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");

!}
#############################
Milan2013 likes this.
singer1812 is offline   Reply With Quote

Old   January 4, 2011, 22:18
Default Hi shafiul
  #11
Member
 
Dynampally Pavitran
Join Date: Mar 2010
Location: India
Posts: 74
Rep Power: 16
pavitran is on a distinguished road
There is a problem in for loop, just change

$i=$i++ to just $i++.
pavitran is offline   Reply With Quote

Old   January 5, 2011, 16:21
Default
  #12
New Member
 
sam13
Join Date: Jul 2009
Location: St. John's, NL, Canada
Posts: 23
Rep Power: 17
Shafiul is on a distinguished road
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
Shafiul is offline   Reply With Quote

Old   January 5, 2011, 16:24
Default
  #13
New Member
 
sam13
Join Date: Jul 2009
Location: St. John's, NL, Canada
Posts: 23
Rep Power: 17
Shafiul is on a distinguished road
Dear Singer1812,

Thanks for your reply. I got it done.

Shafiul
Shafiul is offline   Reply With Quote

Reply


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


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


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