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

[ICEM] Question about the use of ICEM tcl scripting

Register Blogs Community New Posts Updated Threads Search

Like Tree10Likes
  • 5 Post By PSYMN
  • 5 Post By PSYMN

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 12, 2012, 16:51
Question Question about the use of ICEM tcl scripting
  #1
lnk
Senior Member
 
lnk
Join Date: Feb 2011
Location: Switzerland
Posts: 118
Rep Power: 15
lnk is on a distinguished road
Hi,

I'm using the ICEM tcl scripting right now. But there are still something about it not clear to me.

The tcl scripting is able to record all my commands at ICEM, so that if I have an idea about changing the geometry to improve my fluid dynamics behavior, I can change it very quickly.

But my project geometry is complex and there are a lot of points. Sometimes if I intend to change the diameter of a circle of my geometry, it takes me a lot of time to find out the correspondent points and change several points very carefully.

I'm wondering is there any way that I can parameterize my geometry like defining the diameters of the circles by parameters so that I can change them easily?

Best regards and many thanks,
lnk
lnk is offline   Reply With Quote

Old   July 13, 2012, 09:43
Default
  #2
Senior Member
 
PSYMN's Avatar
 
Simon Pereira
Join Date: Mar 2009
Location: Ann Arbor, MI
Posts: 2,663
Blog Entries: 1
Rep Power: 47
PSYMN has a spectacular aura aboutPSYMN has a spectacular aura about
Yes... You can read about this in the programmers guide. (under the Help menu)

In the commands you can use a $variable. At the top of the script, you could "set variable" to some value...

For instance, at the top of the window you could type the following...

Quote:
global tdv_current_viewer
set rotate_angleX 1
set rotate_angleY 2
set turns 5
This would be creating 3 parameters and setting their values to 1, 2, and 5.

you could then use these in expressions to create other parameters (if you want)

Quote:
set angleX [expr ($rotate_angleX * 3.14159) / 180]
set angleY [expr ($rotate_angleY * 3.14159) / 180]
And then you could either use these directly in a line of your replay or create a fancy for loop like this (it basically just rotates your model in view screen)...

Quote:
for {set cur_angle 0} {$cur_angle < [expr 360 * $turns]} {set cur_angle [expr $cur_angle + $rotate_angleX]} {
tdv_rotate_axis $tdv_current_viewer 0 1 0 $angleY
#tdv_rotate_axis $tdv_current_viewer 1 0 0 $angleX
tdv_trans_update $tdv_current_viewer
update
}

Any command you find in the replay can have any number replaced with a $variable or even a $array like this next example.

ic_geo_cre_bsp_crv_n_pnts HELIX "" $pnt_list 0


Just for fun, here is another script. This one makes a helix. The instructions at the start tell you where to put this file and then how to run it from the ICEM CFD message window. You could also add this to the UI with a little more effort. In this one, you set all the initial variable values as you launch the script... (that proc line), and then other variables are calculated from those and used in a loop to generate the points and finally the helix.

Quote:
## source "path"/helix.tcl
## helix
## p1: Center point of base
## d: Diameter of coil
## h: Height per turn
## n: number of turns
## eg. type "source helix.tcl"
## and then type "helix "10 5 2" 1 3 3 curve"

proc helix {p1 d h n {fam ""}} {
set pnt_list ""
set h_he [expr $h/round($n)]
set hei_s [expr $h_he/20.0]
set ang_s [expr 2*3.141592654/20.0]
set d_z 0
set alfa 0
while 1 {
set x_cor [expr [lindex $p1 0]+$d*cos($alfa)/2.0]
set y_cor [expr [lindex $p1 1]+$d*sin($alfa)/2.0]
set z_cor [expr [lindex $p1 2]+$d_z]
set d_z [expr $d_z+$hei_s]
set alfa [expr $alfa+$ang_s]
set pnt[list $x_cor $y_cor $z_cor]
lappend pnt_list $pnt
if {$d_z > $h} break
}
if {$fam == ""} {set fam "HELIX"}
ic_geo_cre_bsp_crv_n_pnts HELIX "" $pnt_list 0
}
Far, Ludvik, lnk and 2 others like this.
__________________
-----------------------------------------
Please help guide development at ANSYS by filling in these surveys

Public ANSYS ICEM CFD Users Survey

This second one is more general (Gambit, TGrid and ANSYS Meshing users welcome)...

CFD Online Users Survey
PSYMN is offline   Reply With Quote

Old   July 13, 2012, 09:51
Default R14.5 has checkbox parameters...
  #3
Senior Member
 
PSYMN's Avatar
 
Simon Pereira
Join Date: Mar 2009
Location: Ann Arbor, MI
Posts: 2,663
Blog Entries: 1
Rep Power: 47
PSYMN has a spectacular aura aboutPSYMN has a spectacular aura about
One other fun bit of information...

In R14.5 (due out later this year), we have added the ability to just click a checkbox to parameterize ICEM CFD (like you would in DM or ANSYS Meshing)...

CreateParameter_03.jpg

You can even use them to create blocking edge parameters

CreateParameter_21.jpg

These parameters are then driven by the Workbench Parameter manager.

Of course, this only works when ICEM CFD is launched from within Workbench...

ICEM_ADDIN_21.jpg

CreateParameter_21.jpg
Attached Images
File Type: jpg CreateParameter_04.jpg (15.0 KB, 73 views)
Far, sshah, leoly and 2 others like this.
__________________
-----------------------------------------
Please help guide development at ANSYS by filling in these surveys

Public ANSYS ICEM CFD Users Survey

This second one is more general (Gambit, TGrid and ANSYS Meshing users welcome)...

CFD Online Users Survey
PSYMN is offline   Reply With Quote

Old   July 13, 2012, 09:53
Default
  #4
Far
Senior Member
 
Sijal
Join Date: Mar 2009
Location: Islamabad
Posts: 4,558
Blog Entries: 6
Rep Power: 54
Far has a spectacular aura aboutFar has a spectacular aura about
Send a message via Skype™ to Far
Quote:
Originally Posted by PSYMN View Post
Yes... You can read about this in the programmers guide. (under the Help menu)

In the commands you can use a $variable. At the top of the script, you could "set variable" to some value...

For instance, at the top of the window you could type the following...



This would be creating 3 parameters and setting their values to 1, 2, and 5.

you could then use these in expressions to create other parameters (if you want)



And then you could either use these directly in a line of your replay or create a fancy for loop like this (it basically just rotates your model in view screen)...




Any command you find in the replay can have any number replaced with a $variable or even a $array like this next example.

ic_geo_cre_bsp_crv_n_pnts HELIX "" $pnt_list 0


Just for fun, here is another script. This one makes a helix. The instructions at the start tell you where to put this file and then how to run it from the ICEM CFD message window. You could also add this to the UI with a little more effort. In this one, you set all the initial variable values as you launch the script... (that proc line), and then other variables are calculated from those and used in a loop to generate the points and finally the helix.
Great. It find it interesting.
Far is offline   Reply With Quote

Old   July 13, 2012, 09:55
Default
  #5
Far
Senior Member
 
Sijal
Join Date: Mar 2009
Location: Islamabad
Posts: 4,558
Blog Entries: 6
Rep Power: 54
Far has a spectacular aura aboutFar has a spectacular aura about
Send a message via Skype™ to Far
Will parametrization replace the Tcl scripting in R14.5?
Far is offline   Reply With Quote

Old   July 13, 2012, 10:42
Default
  #6
Senior Member
 
PSYMN's Avatar
 
Simon Pereira
Join Date: Mar 2009
Location: Ann Arbor, MI
Posts: 2,663
Blog Entries: 1
Rep Power: 47
PSYMN has a spectacular aura aboutPSYMN has a spectacular aura about
Oh no, TCL scripting is a very important part of ICEM CFD... Users would RIOT if we ever threatened to take it away.

This new parametric ability is more about ease of use and connection with the Workbench Parameter manager. TCL scripting still offers more flexibility and power.

In fact, you can also define parameters in Workbench for use in ICEM CFD replay scripts (instead of setting the variable in the script, it is driven by the workbench parameter manager). We are working on a tutorial right now and will release it with the software.
__________________
-----------------------------------------
Please help guide development at ANSYS by filling in these surveys

Public ANSYS ICEM CFD Users Survey

This second one is more general (Gambit, TGrid and ANSYS Meshing users welcome)...

CFD Online Users Survey
PSYMN is offline   Reply With Quote

Old   July 13, 2012, 14:37
Default
  #7
lnk
Senior Member
 
lnk
Join Date: Feb 2011
Location: Switzerland
Posts: 118
Rep Power: 15
lnk is on a distinguished road
Quote:
Originally Posted by PSYMN View Post
Oh no, TCL scripting is a very important part of ICEM CFD... Users would RIOT if we ever threatened to take it away.

This new parametric ability is more about ease of use and connection with the Workbench Parameter manager. TCL scripting still offers more flexibility and power.

In fact, you can also define parameters in Workbench for use in ICEM CFD replay scripts (instead of setting the variable in the script, it is driven by the workbench parameter manager). We are working on a tutorial right now and will release it with the software.

May I ask if I have iterative geometry, could I make a iterative loop for it? How? And since the curve and points name are not iterative, how to solve that problem?

Best regards and many thanks,
lnk
lnk is offline   Reply With Quote

Old   July 13, 2012, 15:49
Default
  #8
Senior Member
 
PSYMN's Avatar
 
Simon Pereira
Join Date: Mar 2009
Location: Ann Arbor, MI
Posts: 2,663
Blog Entries: 1
Rep Power: 47
PSYMN has a spectacular aura aboutPSYMN has a spectacular aura about
Yes, you can.

I suggest you start simple and grow from there. Take a look into the programmers guide for more help. There are many things you can do once you understand the basics.
__________________
-----------------------------------------
Please help guide development at ANSYS by filling in these surveys

Public ANSYS ICEM CFD Users Survey

This second one is more general (Gambit, TGrid and ANSYS Meshing users welcome)...

CFD Online Users Survey
PSYMN is offline   Reply With Quote

Old   January 16, 2013, 06:42
Default
  #9
Senior Member
 
Matthias Voß
Join Date: Mar 2009
Location: Berlin, Germany
Posts: 449
Rep Power: 20
mvoss is on a distinguished road
Quote:
Originally Posted by PSYMN View Post
Oh no, TCL scripting is a very important part of ICEM CFD... Users would RIOT if we ever threatened to take it away.

This new parametric ability is more about ease of use and connection with the Workbench Parameter manager. TCL scripting still offers more flexibility and power.

In fact, you can also define parameters in Workbench for use in ICEM CFD replay scripts (instead of setting the variable in the script, it is driven by the workbench parameter manager). We are working on a tutorial right now and will release it with the software.
Was the mentioned tut released with WB 14.5 update as i would really want to know more about using wb-parameters within an TCL script.
mvoss is offline   Reply With Quote

Old   January 16, 2013, 10:24
Default
  #10
Senior Member
 
PSYMN's Avatar
 
Simon Pereira
Join Date: Mar 2009
Location: Ann Arbor, MI
Posts: 2,663
Blog Entries: 1
Rep Power: 47
PSYMN has a spectacular aura aboutPSYMN has a spectacular aura about
I showed a live demo of how to turn an ICEM CFD script into one that uses Workbench Parameters during a webinar last Thursday. You can find the recording on the ANSYS website (Here and search for ICEM ) (or here is the download link .

I will re-record it for Youtube at some point...

You can also find the instructions if you go into the workbench help (no the ICEM CFD help) and do a search for ICEM CFD... Read down the ICEM CFD Component page until you find the Custom Input Parameter section. It explains the process there.
__________________
-----------------------------------------
Please help guide development at ANSYS by filling in these surveys

Public ANSYS ICEM CFD Users Survey

This second one is more general (Gambit, TGrid and ANSYS Meshing users welcome)...

CFD Online Users Survey
PSYMN 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
[ICEM] Node Number vs. Node_ID & ICEM vs. CFX Araz ANSYS Meshing & Geometry 1 April 25, 2011 12:03
question on ICEM CFD Tetra peiyong wang CFX 2 September 3, 2008 19:35
ICEM CFD 11 Question Raj CFX 2 June 25, 2008 03:11
ICEM -CFX a basic question Al Mazdeh CFX 2 April 5, 2008 12:51
ICEM 10 mesh scale foe CFX Korsh Mik CFX 2 October 7, 2005 10:07


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