CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   ANSYS Meshing & Geometry (http://www.cfd-online.com/Forums/ansys-meshing/)
-   -   [ICEM] Question about ICEM script failure (http://www.cfd-online.com/Forums/ansys-meshing/105168-question-about-icem-script-failure.html)

lnk July 24, 2012 09:30

Question about ICEM script failure
 
Hi everyone,

May I ask why the following script doesn't work?

'
set a 2.5
set b (sqrt(pi*$a*$a)*0.5)

ic_undo_group_begin
ic_geo_new_family GEOM
ic_boco_set_part_color GEOM
ic_empty_tetin
ic_point {} GEOM pnt.00 0,0,$b
ic_undo_group_end
'

but this works

'
set a 2.5
set b (sqrt(pi*$a*$a)*0.5)

ic_undo_group_begin
ic_geo_new_family GEOM
ic_boco_set_part_color GEOM
ic_empty_tetin
ic_point {} GEOM pnt.00 0,0,0
ic_undo_group_end
'


Best regard and many thanks,
lnk

Far July 24, 2012 09:53

I am not able to execute both correctly

lnk July 24, 2012 10:22

Quote:

Originally Posted by Far (Post 373244)
I am not able to execute both correctly

If u copy it directly,

please change 'pipe_radius_fo r_round_pipe'

to 'pipe_radius_for_round_pipe' at the second line for the both case.


Bug of this website. I can't correct it at the question.

stuart23 July 29, 2012 09:19

Hi Ink,

You need to understand that the programming language used for ICEM is LISP. LISP is different to many other common languages (c, python, fortran, java etc) in the way that functions are used. The simple 1 + 2 + 3 + 4 is lisp is actually (+ 1 2 3 4) i.e. the operator (+) goes at the start followed by the arguements (1 2 3 4).

If you do a quick google for LISP programming, I'm sure you will find some great guides. The only piece of advice I will offer is that multiply CANNOT multiply more than two values, ie 2 * 3 * 4 * 5 CANNOT be written in LISP as (MULT 2 3 4 5). The easiest way to do this is to nest the multiplications, giving: (MULT (MULT 2 3) (MULT 4 5)). Obviously the inner multiplications are equated first, then the outer one gives the final value. This is the same as (2 * 3) * (4 * 5).

Stu

Far July 29, 2012 10:03

Quote:

Originally Posted by stuart23 (Post 374197)
Hi Ink,

You need to understand that the programming language used for ICEM is LISP. LISP is different to many other common languages (c, python, fortran, java etc) in the way that functions are used.

Stu

Are you sure? :confused:

stuart23 July 29, 2012 10:15

Hahaha, sorry it's late and I'm tired :-(. I was thinking Fluent. Fluent's scripting langauge is LISP, ICEM uses Tcl/Tk. In Tcl you use the expr function to evaluate maths functions.

For example:
set aft_angle [expr { (22000+(1-$steer_param)*1530)/$radius }]

lnk July 29, 2012 10:30

Quote:

Originally Posted by Far (Post 374202)
Are you sure? :confused:

Hey, Far. Do you have any idea about my question? I have fixed the question. Now you can copy the script directly.


All times are GMT -4. The time now is 21:07.