Jump to content
Sign in to follow this  
Harish

How to set element density on the lines if line IDs are available?

Recommended Posts

How can I set element density for two shortest lines of a rectangular surface and leave the other two lines with the default element density based on predefined element size?

 

I have the line IDs.

#Selected Surface
set surfIDs [ hm_getmark surfs 1]
*createmark lines 1 "by surface" {*}$surfIDs

#Line list 
set lineList [hm_getmark lines 1]

#Line IDs
set lineId1 [lindex $lineList 0]
set lineId2 [lindex $lineList 1]
set lineId3 [lindex $lineList 2]
set lineId4 [lindex $lineList 3]

 

 

 

Share this post


Link to post
Share on other sites

Hi,

try this script:

set Density1 5
set Density2 10
*deleteelementsmode 2
*createmarkpanel surfs 1 "Pick a surface:"
if {[hm_marklength surfs 1]==1} {
    foreach LineId [join [hm_getsurfaceedges [hm_getmark surfs 1]]] {lappend LineList [list $LineId [hm_linelength $LineId]]}
    set LineList [lsort -increasing -real -index 1 $LineList]
    lassign [join $LineList] Line1 -> Line2
    *setedgedensitylinkwithaspectratio -1 
    *elementorder 1 
    *defaultremeshsurf 1 [hm_getelementsize] 2 2 2 0 1 1 1 0 0 0 0 
    *createmark lines 1 $Line1
    *change_edgedensities 1 1 $Density1 0
    *createmark lines 1 $Line2
    *change_edgedensities 1 1 $Density2 0
}

 

Rahul R likes this

Share this post


Link to post
Share on other sites

I'm selecting the top surface as shown in image.

 

Capture7.thumb.PNG.82b69cc978b17847d16fc2da5e460b21.PNG

 

 

Getting following message:

 

Capture6.PNG.059b7fa44bc3629441919ea622360553.PNG

 

 

Few questions regarding the code:

 

Can you please explain what does below line do?

lassign [join $LineList] Line1 -> Line2

 

 puts "[lassign [join $LineList] Line1 -> Line2]]"

Above line is following output. What are 43  and 42 numbers signify?

 

1 43 1 42 1 15 1 45 1 15 1 45 1 43 1 42 1 45 1 46 1 45 1 46 1 15 1 45 1 43 1 42 1 15 1 45 1 43 1 42 1 45 1 46 1 15 1 45 1 43 1 42 1 45 1 46 1 15 1 45 1 43 1 42 1 43 1 42 1 15 1 45 1 45 1 46 1 15 1 45 1 15 1 45 1 15 1 45 1 45 1 46 1 43 1 42 1 43 1 42 1 43 1 42 1 43 1 42 1 15 1 45 1 43 1 42 1 18 1 20 1 24 1 26 1 24 1 26 1 18 1 20 1 18 1 20 1 26 1 22 1 24 1 26 1 18 1 20 1 26 1 22 1 9 1 8 1 5 1 4 1 5 1 4 1 5 1 4 1 5 1 4 1 5 1 4 1 6 1 9 1 6 1 9 1 5 1 4 1 9 1 8 1 6 1 9 1 5 1 4 1 5 1 4 1 5 1 4 1 5 1 4 1 5 1 4 1 5 1 4 1 5 1 4 1 5 1 4 1 5 1 4 1 5 1 4 1 5 1 4 1 5 1 4 1 5 1 4 1 5 1 4 1 5 1 4 1 5 1 4 1 5 1 4 1 5 1 4 1 48 2 48 2 48 2 48 2 48 2 48 2 48 2 15 2 15 2 2 2 2 2 44 5 47 5 25 5 47 5 41 5 40 5 41 5 40 5 25 5 47 5 44 5 47 5 44 5 47 5 41 5 40 5 25 5 47 5 41 5 40 5 25 5 47 5 44 5 47 5 41 5 40 5 25 5 47 5 44 5 47 5 41 5 40 5 25 5 47 5 25 5 47 5 41 5 40 5 44 5 47 5 41 5 40 5 41 5 40 5 41 5 40 5 44 5 47 5 25 5 47 5 25 5 47 5 25 5 47 5 25 5 47 5 41 5 40 5 25 5 47 5 17 5 19 5 23 5 25 5 23 5 25 5 17 5 19 5 {19 15 21 26 22} 5 {23 24 25 26} 5 {17 18 19 20} 5 {19 15 21 26 22} 5 {23 24 25 26} 5 17 5 19 5 19 5 21 5 23 5 25 5 17 5 19 5 19 5 21 5 3 5 7 5 1 5 3 5 1 5 3 5 1 5 3 5 1 5 3 5 1 5 3 5 11 5 10 5 11 5 10 5 1 5 3 5 3 5 7 5 11 5 10 5 1 5 3 5 1 5 3 5 1 5 3 5 1 5 3 5 1 5 3 5 1 5 3 5 1 5 3 5 1 5 3 5 1 5 3 5 1 5 3 5 1 5 3 5 1 5 3 5 1 5 3 5 1 5 3 5 1 5 1 5 1 5 1 5 3 5 1 5 3 5 1 5 3 5 1 5 3 5]

 

 

Share this post


Link to post
Share on other sites

Hi

smallSurfs.hm

surfMesh.tcl

I'm using the exact code what you have written.

The selected surface is meshed but not according to the element density specified in the code. 

 

I closed the hypermesh and started it again. Now I'm getting the error. But the mesh is not according to the density specified.

 

On one of the shortest edge density is 5 and another shortest edge its 10.

 

 

 

Capture9.PNG

Capture10.PNG

Share this post


Link to post
Share on other sites

I don't understand.

In tcl script, you set Density1 = 5 and Density2 = 10, then your mesh appeared with one shortest edge has 5 segments and the alternative has 10. So what are you expecting?

Share this post


Link to post
Share on other sites

I would like to have same elements on both the short edges of the rectangle and mesh with default element size on the other two long edges.

 

In the second image(rectangular surface on the bottom right corner) above it can be seen , the element density is 2 on the shortest edges. But I have set the Density1 = 5 in the script.

Share this post


Link to post
Share on other sites

My problem is not completely solved but taking your script as a reference I have written a script. Its working now.

 

Thank you very much for your help.

tinh likes this

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
You are posting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...