Creating temp nodes inside an enclosed volume

Altair Forum User
Altair Forum User
Altair Employee
edited October 2020 in Community Q&A

Hi

I have a volume that is enclosed by a mesh of 2D quad and tria elements. I need to fill the inside of this volume with nodes on a regular grid arrangement (in order to generate SPH particles).

My plan was to create a large grid of temp nodes that intersected with the volume and then delete the nodes that lie outside the volume. However I can't figure out a way of doing this.

Can anyone help or suggest a different method?

Thanks

Tagged:

Answers

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited November 2007

    Hello Joe,

    I am not very familiar with SPH particles and I do not really understand why you need those nodes. However, the folowing code will generate the needed nodes:

    for {set i 0} { $i<=5} {incr i} {

    for {set j 0} { $j<=5} {incr j} {

    for {set k 0} { $k<=5} {incr k} {

    *createnode $i $j $k 0 0 0

    }

    }

    }

    You just have to copy-paste it into your Command window. You can change the number of node in each direction 9set here to 5) and set your origine (here 0,0,0).

    Let me know if it is want you want.

    Regards,

    Arnaud

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited December 2007

    Think about this ....

    1. create a solid

    2. use the following function :

    Syntax:

    hm_ispointinsidesolid coords solidID

    Arguments:

    coords: The test point’s coordinates.

    solidID: The ID of the specified solid.

    Returns: 1 if the point is found to be inside the solid; -1 if the point is outside the solid; 0 if the point is on the solid’s boundary.

    Example:

    To check whether the point with coordinates 10, 20, 30 is inside the solid with id 1:

    hm_ispointinsidesolid 10 20 30 1

    Regards Mario

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited December 2007

    here are some code that may help:

    set nodesInsideSolid {}

    ### PUT CODE HERE TO GENERATE THE NODES

    foreach nodeId $nodelist {

    set xVal1 [ hm_getentityvalue NODES $nodeId 'x' 0 ]

    set yVal1 [ hm_getentityvalue NODES $nodeId 'y' 0 ]

    set zVal1 [ hm_getentityvalue NODES $nodeId 'z' 0 ]

    set nodeCondition [hm_ispointinsidesolid $xVal1 $yVal1 $yVal1 $solidId]

    if {$nodeCondition !=-1} {lappend nodesInsideSolid $nodeId}

    }

    puts 'Nodes Inside Solid $solidId are $nodesInsideSolid '

    there may be some codin mistypos, just check for them

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited February 2008

    Why don't you just

    1. fill the 2d mesh enclosed volume using tetramesh

    2. Duplicate all the nodes

    3. Delete all the internal elements (by config = tet4)

    That will give you some random/even distribution of nodes inside the volume and will take 1 min

    I hope it works for you

    Guayo