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

[ICEM] ICEM Scripting Issues

Register Blogs Community New Posts Updated Threads Search

Like Tree4Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 13, 2019, 07:36
Default
  #21
New Member
 
Anup Jain
Join Date: Mar 2019
Location: New Hampshire
Posts: 23
Rep Power: 7
jainanup27 is on a distinguished road
Quote:
Originally Posted by bluebase View Post
Hi Anup,
could you share your ICEM replay script too?
Best regards,
Sebastian
Yes Sure. Please find the attached Script (The script is only for blocking. Since the problem was with blocking itself I didn't create script for mesh parameters)

Thanks,
Anup
Attached Files
File Type: txt Script_Upload.txt (5.7 KB, 19 views)
jainanup27 is offline   Reply With Quote

Old   June 13, 2019, 20:20
Default
  #22
New Member
 
Anup Jain
Join Date: Mar 2019
Location: New Hampshire
Posts: 23
Rep Power: 7
jainanup27 is on a distinguished road
Quote:
Originally Posted by bluebase View Post
Hi Anup,
could you share your ICEM replay script too?
Best regards,
Sebastian
Hi Sebastian,

I recorded a simple script to create points. I then reran the same script on the same geometry.

I turn on the script record button. And create points using parameter along the curve and also using Base Point & Delta. I see that when the script record button is on these points have name pt.00, pt.01, pt.02, pt.03. etc. Now when I rerun the same script on the same geometry in the same session I see that these points are created but are numbered as pt.04, pt.05, and pt.06. Is there any command that I need to add the beginning of the script that will clear everything from the past and everything created will be new. I see that some of the commands are already there when the script recording button is turned on.

In the script attached below, I create 5 points
Thanks,
Anup
Attached Files
File Type: txt Script_to_Create_Points.txt (1.3 KB, 8 views)

Last edited by jainanup27; June 14, 2019 at 15:40.
jainanup27 is offline   Reply With Quote

Old   June 15, 2019, 11:17
Default
  #23
Senior Member
 
Sebastian Engel
Join Date: Jun 2011
Location: Germany
Posts: 566
Rep Power: 20
bluebase will become famous soon enough
Hi Anup,

let's start with a disclaimer. I am no expert user on the Workbench, so i don't fully understand the integration of ICEM into the WB environment.

However, i suspect the following. The geometry and the (old) blocking are loaded before running the script after you instruct to update the setup.

As i can see in your script, the blocking is only associated to the points pnt.00, 01, 02, and 03:
Code:
ic_point crv_par PART_1_1_1 pnt.00 {EDGEE5705 0.4}
ic_point crv_par PART_1_1_1 pnt.01 {EDGEE5705 0.8}
ic_point crv_par PART_1_1_1 pnt.02 {EDGEE5905 0.5}
ic_point crv_par PART_1_1_1 pnt.03 {EDGEE5905 0.75}
ic_point {} PART_1_1_1 pnt.04 VERT15+vector(2.4,0,0)
ic_point {} PART_1_1_1 pnt.05 VERT15+vector(5.7,0,0)
ic_point {} PART_1_1_1 pnt.06 VERT14+vector(0,0.8,0)
...
ic_hex_move_node 67 pnt.01
ic_hex_move_node 68 VERT18
ic_hex_move_node 66 pnt.00
ic_hex_move_node 69 pnt.02
ic_hex_move_node 73 pnt.03
...
while the VERTxx points are created in a previous program the mentioned points are created in your script. However the old blocking probably requires the points to be present already during the loading of the blocking. Because it does not find them, it might create them on its on.
At this point the geometry already contains the points pnt.00-03.
Probably then the script is executed.
Unfortunately the same names are present when ic_point... commands are run. That's why ICEM generates a new individual name for each duplicate.
Because it can detect sequential entity names, the first point in your script becomes pnt.04 instead pnt.00, the next after pnt.03.

I don't know whether this order of loading can be changed or influenced at all. The costumer support might have some insight.

Fortunately, ICEM returns the name it finally uses to create a new geometric entity. You just have to store it and recall it when needed.
So the above parts in your code need to become:
Code:
set mypnt_00 [ic_point crv_par PART_1_1_1 pnt.00 {EDGEE5705 0.4}]
set mypnt_01 [ic_point crv_par PART_1_1_1 pnt.01 {EDGEE5705 0.8}]
set mypnt_02 [ic_point crv_par PART_1_1_1 pnt.02 {EDGEE5905 0.5}]
set mypnt_03 [ic_point crv_par PART_1_1_1 pnt.03 {EDGEE5905 0.75}]
...
...
ic_hex_move_node 67 $mypnt_01
ic_hex_move_node 66 $mypnt_00
ic_hex_move_node 69 $mypnt_02
ic_hex_move_node 73 $mypnt_03
you might have to repeat this for lines i haven't shown here.

the set command is basic syntax of the tcl-language to store a variable with arbitrary content. The command in square brackets: [ic_point ...] returns the finally used entity name which is then stored in mypnt_xx.
Later, the value of mypnt_xx is called by the $-sign and the variable name.
This means, you don't actually need to know the new name of a geometry entity to use it, although it's good practice to label them meaningful.

Understandably, i can't test whether this solves your problem. So please let the forum know whether it worked.

Best regards,
Sebastian
bluebase is offline   Reply With Quote

Old   June 15, 2019, 12:57
Default
  #24
New Member
 
Anup Jain
Join Date: Mar 2019
Location: New Hampshire
Posts: 23
Rep Power: 7
jainanup27 is on a distinguished road
Quote:
Originally Posted by bluebase View Post
Hi Anup,

let's start with a disclaimer. I am no expert user on the Workbench, so i don't fully understand the integration of ICEM into the WB environment.

However, i suspect the following. The geometry and the (old) blocking are loaded before running the script after you instruct to update the setup.

As i can see in your script, the blocking is only associated to the points pnt.00, 01, 02, and 03:
Code:
ic_point crv_par PART_1_1_1 pnt.00 {EDGEE5705 0.4}
ic_point crv_par PART_1_1_1 pnt.01 {EDGEE5705 0.8}
ic_point crv_par PART_1_1_1 pnt.02 {EDGEE5905 0.5}
ic_point crv_par PART_1_1_1 pnt.03 {EDGEE5905 0.75}
ic_point {} PART_1_1_1 pnt.04 VERT15+vector(2.4,0,0)
ic_point {} PART_1_1_1 pnt.05 VERT15+vector(5.7,0,0)
ic_point {} PART_1_1_1 pnt.06 VERT14+vector(0,0.8,0)
...
ic_hex_move_node 67 pnt.01
ic_hex_move_node 68 VERT18
ic_hex_move_node 66 pnt.00
ic_hex_move_node 69 pnt.02
ic_hex_move_node 73 pnt.03
...
while the VERTxx points are created in a previous program the mentioned points are created in your script. However the old blocking probably requires the points to be present already during the loading of the blocking. Because it does not find them, it might create them on its on.
At this point the geometry already contains the points pnt.00-03.
Probably then the script is executed.
Unfortunately the same names are present when ic_point... commands are run. That's why ICEM generates a new individual name for each duplicate.
Because it can detect sequential entity names, the first point in your script becomes pnt.04 instead pnt.00, the next after pnt.03.

I don't know whether this order of loading can be changed or influenced at all. The costumer support might have some insight.

Fortunately, ICEM returns the name it finally uses to create a new geometric entity. You just have to store it and recall it when needed.
So the above parts in your code need to become:
Code:
set mypnt_00 [ic_point crv_par PART_1_1_1 pnt.00 {EDGEE5705 0.4}]
set mypnt_01 [ic_point crv_par PART_1_1_1 pnt.01 {EDGEE5705 0.8}]
set mypnt_02 [ic_point crv_par PART_1_1_1 pnt.02 {EDGEE5905 0.5}]
set mypnt_03 [ic_point crv_par PART_1_1_1 pnt.03 {EDGEE5905 0.75}]
...
...
ic_hex_move_node 67 $mypnt_01
ic_hex_move_node 66 $mypnt_00
ic_hex_move_node 69 $mypnt_02
ic_hex_move_node 73 $mypnt_03
you might have to repeat this for lines i haven't shown here.

the set command is basic syntax of the tcl-language to store a variable with arbitrary content. The command in square brackets: [ic_point ...] returns the finally used entity name which is then stored in mypnt_xx.
Later, the value of mypnt_xx is called by the $-sign and the variable name.
This means, you don't actually need to know the new name of a geometry entity to use it, although it's good practice to label them meaningful.

Understandably, i can't test whether this solves your problem. So please let the forum know whether it worked.

Best regards,
Sebastian
Hi Sebastian,

I did try using this but I have the same problem. I see that you suspect the old geometry and the old blocking are loaded before I instruct to update. But I have the command ic_hex_unload_blocking (which should unload the blocking from the previous run or if there is any associated while loading the new geometry)
(Also the Vertex points come with the geometry. I am not creating them in the script)


Let me tell you what I want maybe then you might understand.

I import the geometry to ICEM from the geometry tab on the screen. I want to create the points that I mentioned (located at 0.4,0.5,0.75 and 0.8 parameters of the curve), on the geometry. Once these points are created I want to assign the nodes of the block to these points (so that the blocking is perfect to accommodate the shape of my geometry). Once associated I want to create the mesh. Once the mesh is done I want to import it to Fluent.

Now once this is done Flune will do its job and store the result. I then change the design parameters which now change my geometry and it is fed to ICEM CFD. Now I want the script to perform the same steps in ICEM CFD that I mentioned above.

Problem: As I said I created the desired points (eg. say I create only one point at 0.4 parameters of the curve) and I see that the script automatically gives them name pt.00. The node is then associated with these points.
I save the script and project

Once this is done I change the parameters.
I have a new geometry that is fed in. Now as per the script I have should have a point at 0.4 parameters of the curve and yes the point is created as well. However, instead of having the name as pt.00 it names the point as pt.01 (In the last blocking it was pt.00) Now if I run the script again on other geometry that name for that point is pt.02 and it goes on.
As I said you the node was associated with pt.00 in the first script and when I run the script for the second time and even though the script says to create pt.00 in the new geometry it creates pt.01. As the script says to attach the node to pt.00 it cannot find pt.00 since that point is named as pt.01 and then it creates that point pt.00 by itself and throws an error.

In a nutshell, once the script is executed on one geometry why the does it carry the names from the previous blocking on the next run (next new geometry). And the beginning of the script I have the command
ic_hex_unload_blocking..




Thanks,
Anup
jainanup27 is offline   Reply With Quote

Old   June 15, 2019, 22:02
Default
  #25
Senior Member
 
Sebastian Engel
Join Date: Jun 2011
Location: Germany
Posts: 566
Rep Power: 20
bluebase will become famous soon enough
Quote:
I did try using this but I have the same problem.
Quote:
However, instead of having the name as pt.00 it names the point as pt.01 (In the last blocking it was pt.00) Now if I run the script again on other geometry that name for that point is pt.02 and it goes on.
Did my suggestion really did not solve the issue with your script?
Was there a different error message?

Are you sure that the script you have provided and the script you edited is the script which is used by the workbench environment? The wb script is stored in one of those sub folders of your project.


Try this minimal code example. Store those three lines into a tcl file and run it a few times. Even though the point name is pnt.01 in every iteration a new, individual name will be assigned and returned.
Code:
for {set i 1} {$i<10} {incr i} {
    set varpnt [ic_point {} GEOM pnt.01 "[expr 0+$i/10.],0,0"]
    ic_mess "The point created received the label: $varpnt\n"
}
If this really did not fix your problem. you could run a delete command on the respective entity names before assigning them.
Code:
ic_delete_geometry point names {pnt.00 pnt.01 pnt.02 pnt.03} 0 1
bluebase is offline   Reply With Quote

Old   June 15, 2019, 22:41
Default
  #26
New Member
 
Anup Jain
Join Date: Mar 2019
Location: New Hampshire
Posts: 23
Rep Power: 7
jainanup27 is on a distinguished road
Quote:
Originally Posted by bluebase View Post
Did my suggestion really did not solve the issue with your script?
Was there a different error message?

Are you sure that the script you have provided and the script you edited is the script which is used by the workbench environment? The wb script is stored in one of those sub folders of your project.


Try this minimal code example. Store those three lines into a tcl file and run it a few times. Even though the point name is pnt.01 in every iteration a new, individual name will be assigned and returned.
Code:
for {set i 1} {$i<10} {incr i} {
    set varpnt [ic_point {} GEOM pnt.01 "[expr 0+$i/10.],0,0"]
    ic_mess "The point created received the label: $varpnt\n"
}
If this really did not fix your problem. you could run a delete command on the respective entity names before assigning them.
Code:
ic_delete_geometry point names {pnt.00 pnt.01 pnt.02 pnt.03} 0 1
Your Initial suggestion did not solve the issue. The error message was the same. Yes, I am sure that the script I provided and the script I edited is used by the workbench environment. You are correct the script was stored in the subfolder.

Now coming to your first new script (I have attached the snapshot). I am trying to run it and it gives me an error saying that missing close_brace. I did confirm that the syntax you have used is correct still it gives an error.

However, the second option you suggested works. I thank you for replying immediately and getting back to me asap. Genuinely appreciate your help

Thanks,
Anup
Attached Images
File Type: png script and error.PNG (19.8 KB, 9 views)
jainanup27 is offline   Reply With Quote

Old   June 16, 2019, 10:55
Default
  #27
Senior Member
 
Sebastian Engel
Join Date: Jun 2011
Location: Germany
Posts: 566
Rep Power: 20
bluebase will become famous soon enough
Glad that i could help.

You might report the original issue to the Costumer Service of Ansys, and ask what's really going on.



Regarding my script, use the "run from script file" menu. Ignore the replay controls.

The replay control and replay format is maddening, in my opinion. It just reads one line commands, and in old versions, it even contained unnecessary line numbers.
For this reasons, ICEM raises the missing bracket error, because my snippet wasn't one-line formatted.


So you'd have to format my example to the following line to make it run in replay control.
Code:
for {set i 1} {$i<10} {incr i} {   set varpnt [ic_point {} GEOM pnt.01 "[expr 0+$i/10.],0,0"];  ic_mess "The point created received the label: $varpnt\n"; }
But who'd want to maintain such code?

I prefer the natively run tcl code:
points.zip


Best regards,
Sebastian
bluebase is offline   Reply With Quote

Old   June 19, 2019, 23:04
Default
  #28
New Member
 
Anup Jain
Join Date: Mar 2019
Location: New Hampshire
Posts: 23
Rep Power: 7
jainanup27 is on a distinguished road
Quote:
Originally Posted by bluebase View Post
Glad that i could help.

You might report the original issue to the Costumer Service of Ansys, and ask what's really going on.



Regarding my script, use the "run from script file" menu. Ignore the replay controls.

The replay control and replay format is maddening, in my opinion. It just reads one line commands, and in old versions, it even contained unnecessary line numbers.
For this reasons, ICEM raises the missing bracket error, because my snippet wasn't one-line formatted.


So you'd have to format my example to the following line to make it run in replay control.
Code:
for {set i 1} {$i<10} {incr i} {   set varpnt [ic_point {} GEOM pnt.01 "[expr 0+$i/10.],0,0"];  ic_mess "The point created received the label: $varpnt\n"; }
But who'd want to maintain such code?

I prefer the natively run tcl code:
Attachment 70469


Best regards,
Sebastian
Hi Sebastian,

The problem still arises when I run the script in batch mode. I said that the problem was solved but I did one mistake I was running it on the same geometry in the same session. Let me explain it to you. I import geometry and I run the script. Points are created. Now if I again run the script in the same session the points were created with different names. By adding the line ic_delete_geometry_pt.00 ..... the old points were deleted and new points are created with the same name. Hence it was working fine. But now when I run the script in the batch mode with changed geometry it will create the point at 0.4 parameters of the curve with other names. (even if the script says to
create it with the same name)

Here is the explanation:

For the very first geometry I write this script:

ic_delete_geometry point names{pnt.00 pnt.01 pnt.02 pnt.03 pnt.04} 0 1
ic_delete_geometry point names {pnt.05 pnt.06 pnt} 0 1
ic_point {} PART_1_1_1 pnt.00 VERT15+vector(2.4,0,0)
ic_point {} PART_1_1_1 pnt.01 VERT15+vector(5.7,0,0)
ic_point {} PART_1_1_1 pnt.02 VERT14+vector(0,0.75,0)
ic_point crv_par PTWALL pnt.03 {EDGEE6005 0.5}
ic_point crv_par PTWALL pnt.04 {EDGEE6005 0.75}
ic_point crv_par NWALL pnt.05 {EDGEE5805 0.4}
ic_point crv_par NWALL pnt.06 {EDGEE5805 0.75}


Now the points are created with these names. When I run it on other geometry in batch mode it should delete pnt.05 and create new pnt.05 at 0.4 parameters of the curve. But it rather creates pnt.05.1 at 0.4 parameters of the curve despite the script says it to name as pnt.05.

In a nutshell, the problem is the points created in the script in ICEM CFD gives its own names when it is run in batch mode despite the names given in the script

Thanks,
Anup
jainanup27 is offline   Reply With Quote

Old   June 20, 2019, 05:11
Default
  #29
Senior Member
 
Sebastian Engel
Join Date: Jun 2011
Location: Germany
Posts: 566
Rep Power: 20
bluebase will become famous soon enough
Just to say i am out:

Quote:
i don't fully understand the integration of ICEM into the WB environment.
Assume, i don't understand how ICEM is controlled within the WB at all. I use ICEM only in standalone mode.

Quote:
even if the script says to create it with the same name
Again, the script is not in control, it just suggests a new name to ICEM's kernel. If a name is already used a new name will be generated...
Why that's the case with the WB, i have no clue.

Someone with Workbench experience would have to take over. If you can, contact your account manager.
bluebase is offline   Reply With Quote

Old   June 20, 2019, 05:14
Default
  #30
New Member
 
Anup Jain
Join Date: Mar 2019
Location: New Hampshire
Posts: 23
Rep Power: 7
jainanup27 is on a distinguished road
Quote:
Originally Posted by bluebase View Post
Just to say i am out:

Assume, i don't understand how ICEM is controlled within the WB at all. I use ICEM only in standalone mode.

Again, the script is not in control, it just suggests a new name to ICEM's kernel. If a name is already used a new name will be generated...

Someone with Workbench experience would have to take over. If you can, contact your account manager.
Hi,

Thanks for your reply. I have already contacted but I am yet to hear. Let's see what happens.
jainanup27 is offline   Reply With Quote

Old   September 23, 2021, 17:43
Post Scripting error in ICEM CFD
  #31
New Member
 
Rohan Sunil
Join Date: Jul 2021
Posts: 7
Rep Power: 4
rsunil is on a distinguished road
Hello everyone,


I would really like your help on helping me understand what could be causing the Invalid node1 and Invalid edge error in ICEM while running the scripts.


I am trying to create a hybrid grid over a simplified corrugated wing.



When I run the script, it runs the script successfully at times. I retry running the script to bypass the error.



The script is attached for your reference


Thank you in advance



Best regards,
Rohan
rsunil is offline   Reply With Quote

Old   September 23, 2021, 17:47
Default
  #32
New Member
 
Rohan Sunil
Join Date: Jul 2021
Posts: 7
Rep Power: 4
rsunil is on a distinguished road
The attached script for the corrugated wing
Attached Files
File Type: txt hyb_v2_4_inter.txt (46.5 KB, 3 views)
rsunil is offline   Reply With Quote

Old   September 25, 2021, 18:38
Default
  #33
Senior Member
 
Sebastian Engel
Join Date: Jun 2011
Location: Germany
Posts: 566
Rep Power: 20
bluebase will become famous soon enough
These errors likely indicate, that the initial state when you recorded your script was not exactly the same as with a new ICEM session.


In some past projects, i dealt with it by including a few commands which try to reset your session to a clean state.


Have a look at this project file: https://github.com/blu-base/ao_supp_...on/in_icem.tcl And look for the "Start clean ICEM Session" section.


I think you'd need at least these commands to mostly reset the session:
Code:
ic_unload_tetin
ic_hex_unload_blocking 
ic_unload_mesh 
ic_empty_tetin

Then you can stop your script at any line by inserting the keyword break. By resetting your session with every script run and putting break at different locations (sequentially) you can test which parts of your recorded script run fine, and where the flawed record might be
rsunil likes this.
bluebase is offline   Reply With Quote

Old   September 27, 2021, 16:35
Default
  #34
New Member
 
Rohan Sunil
Join Date: Jul 2021
Posts: 7
Rep Power: 4
rsunil is on a distinguished road
Quote:
Originally Posted by bluebase View Post
These errors likely indicate, that the initial state when you recorded your script was not exactly the same as with a new ICEM session.


In some past projects, i dealt with it by including a few commands which try to reset your session to a clean state.


Have a look at this project file: https://github.com/blu-base/ao_supp_...on/in_icem.tcl And look for the "Start clean ICEM Session" section.


I think you'd need at least these commands to mostly reset the session:
Code:
ic_unload_tetin
ic_hex_unload_blocking 
ic_unload_mesh 
ic_empty_tetin

Then you can stop your script at any line by inserting the keyword break. By resetting your session with every script run and putting break at different locations (sequentially) you can test which parts of your recorded script run fine, and where the flawed record might be
Thank you so much for the help
rsunil 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] ICEM CFD Penetrating Elements/Surface Orientation Issues GSbert ANSYS Meshing & Geometry 9 August 13, 2012 05:04
[ICEM] Scripting language version for ICEM 14.0 on win 7 64 bit Far ANSYS Meshing & Geometry 3 May 21, 2012 14:09
[ICEM] meshing issues in ICEM CFD acjoshi ANSYS Meshing & Geometry 3 April 14, 2012 12:01
[ICEM] Meshing Issues in ICEM amod_kumar ANSYS Meshing & Geometry 4 June 23, 2010 07:57
[ICEM] Meshing Issues in ICEM amod_kumar ANSYS Meshing & Geometry 1 June 21, 2010 11:26


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