How to compute normal vector of quad4?

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

Hi,

In Hypermesh's database, I see :

=====================================

normalx

      The x component of the element normal (double).

normaly

     The y component of the element normal (double).

normalz

     The z component of the element normal (double).

=====================================

I'm curious to know how Hypermesh compute the normal vector of a quad4 element ?

In simple case, all 4 nodes of quad4 are coplanar, it's simple.

However, when the 4th node is not coplanar to 3 others, how to compute?

And for quad8 elems, how to do compute ?

 

Thanks,

Answers

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited December 2014

    Hi,

     

    It's all about the node id's how it was placed in element card

     

     

    Check the elem card edit for the particular element.

     

    If the node id's are placed in  anti clockwise then the normal is toward us (Red).

     

    If the node id's are placed in clockwise then the normal is Opposite(Blue).

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited December 2014

    @Karthi : thank you for your reply. But that's not an answer to my question.

  • tinh
    tinh Altair Community Member
    edited December 2014

    @Karthi : thank you for your reply. But that's not an answer to my question

     

     

     

     

    Hi I think it is N1N3 x N2N4 so this can eliminate affect of warpage

    it is similar to when we calculate dihedral angel of solid elems we have to take normal of each face as that

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited December 2014

    @tinh: I do a test with two quad4 elements (see my quad4.zip attached)

     

    1st element : all 4 nodes are coplanar.

    2nd element: the 4th node was moved out of plan

     

    Run this simple script:


    proc get_normal { eid } {
    set nx [hm_getentityvalue elems $eid 'normalx' 0]
    set ny [hm_getentityvalue elems $eid 'normaly' 0]
    set nz [hm_getentityvalue elems $eid 'normalz' 0]
    puts [format 'E= %d : normal=(%0.3f ; %0.3f ; %0.3f)' $eid $nx $ny $nz]
    }

    get_normal 1;
    get_normal 2;

    I got the same normal vector for two elements.


    E= 1 : normal=(0.000 ; 0.000 ; 1.000)
    E= 2 : normal=(0.000 ; 0.000 ; 1.000)

    Try it and tell me what do you think about that.

     

     

     

     

     

    Unable to find an attachment - read this blog

  • tinh
    tinh Altair Community Member
    edited December 2014

    Hi Mr.Quy

    I cannot open your file on hm12

    but i test a warping quad and surprised that its normal is calculated by N1N2N3

    image/emoticons/default_ohmy.png' alt=':o' srcset='<fileStore.core_Emoticons>/emoticons/ohmy@2x.png 2x' width='20' height='20'>

    <?xml version="1.0" encoding="UTF-8"?>post-3195-0-52112300-1418833608_thumb.pn

     

    can this confict with solver specific?. I read manual that y axis of element coordinate system where stress output, lies on plane defined by 'G1,G2,G3 and G4', means it should be N1N3 x N2N4

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited March 2017

    Hy Tinh,

     

    The requirement is to project a node on a user defined plane, whose normals keep changing for different files

    i wanted to obtain the normal x, normal y, normal z for passing in the parameter for *createplane 


     

     

    *createmark nodes 1 7053 
    set nodeIds [ hm_getmark nodes 1 ]
    if { ! [ Null nodeIds ] } {
    set nodeId [ lindex $nodeIds 0 ]
    set x [ hm_getentityvalue NODES $nodeId 'x' 0 ]
    set y [ hm_getentityvalue NODES $nodeId 'y' 0 ]
    set z [ hm_getentityvalue NODES $nodeId 'z' 0 ]
    }

    *createmark nodes 1 7099
    set nodeIds [ hm_getmark nodes 1 ]
    if { ! [ Null nodeIds ] } {
    set nodeId [ lindex $nodeIds 0 ]
    set xx [ hm_getentityvalue NODES $nodeId 'x' 0 ]
    set yy [ hm_getentityvalue NODES $nodeId 'y' 0 ]
    set zz [ hm_getentityvalue NODES $nodeId 'z' 0 ]
    }

    set x_vector [ expr { $xx - $x } ]
    set z_vector [ expr { $zz - $z } ]
    *createmarkpanel nodes 1 'Select 3 nodes '
    set NodeList1 [ hm_getmark nodes 1 ]
    *clearmark nodes 1

    set  CoordX [hm_getentityvalue NODE $NodeList1 'x' 0]
    set  CoordY [hm_getentityvalue NODE $NodeList1 'y' 0]
    set  CoordZ [hm_getentityvalue NODE $NodeList1 'z' 0]

    *createmark nodes 1  7099
    *duplicatemark nodes 1 28 
    *createmark nodes 1  550003
    *createplane 1 -0.596426819 -1.81399629e-008 0.239601619 $CoordX $CoordY $CoordZ 
    *createvector 1 $x_vector 0 $z_vector 
    *projectmarktoplane nodes 1 1 1 1 

     

     

    I tried the above code, and got an error:

     

    0
    0
        while executing
    '*projectmarktoplane nodes 1 1 1 1 '

     

     

    Please suggest me how to proceed ahead. 

     

    Thanks in advance.

    Arjun Arasan

     

     

     

     

     

    Hi I think it is N1N3 x N2N4 so this can eliminate affect of warpage

     

    it is similar to when we calculate dihedral angel of solid elems we have to take normal of each face as that

     

  • tinh
    tinh Altair Community Member
    edited March 2017

    Hi, 

    from HM13, you don't need to do such complex, use available functions

    example

     *createmarkpanel nodes 1 'Select nodes to project to plane:' if {[hm_marklength nodes 1]} {      set Plane [hm_getplanepanel 'Specify a plane:']      if {[llength $Plane]==2} {           set Vector [lindex [hm_getdirectionpanel 'Specify a vector:'] 0]           if {[llength $Vector]==3} {                *duplicatemark nodes 1                                eval *createvector 1 $Vector                eval *createplane 1 [join [join $Plane]]                *projectmarktoplane nodes 1 1 1 1           }      } }

     

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited March 2017

    Dear Tinh,

     

    Thank you for the help.

     

    could you please explain the logic behind them?

    {

                    eval *createvector 1 $Vector                eval *createplane 1 [join [join $Plane]]

    }

     

    what does it do internally?

    is it similar to our vector product of 2 vectors specified by 3 nodes co ordinates?

    It would be of great learning, if explained.

    Thanks and regards,

    Arjun Arasan

  • Q.Nguyen-Dai
    Q.Nguyen-Dai Altair Community Member
    edited March 2017

    Have a look at Help doc

     

    <?xml version="1.0" encoding="UTF-8"?>projectmarktoplane.png

  • tinh
    tinh Altair Community Member
    edited March 2017

    Dear Tinh,

     

    Thank you for the help.

     

    could you please explain the logic behind them?

    {

                     eval *createvector 1 $Vector                eval *createplane 1 [join [join $Plane]]

    }

     

    what does it do internally?

    is it similar to our vector product of 2 vectors specified by 3 nodes co ordinates?

    It would be of great learning, if explained.

    Thanks and regards,

    Arjun Arasan

     

     

    Hi,

    example Vector is {1 0 0} then 'eval *createvector 1 $Vector' will be '*createvector 1 1 0 0'

    if Plane is {{1 0 0} {0 0 0}} then '[join [join $Plane]]' will be '{1 0 0 0 0 0}'

    and 'eval *createplane 1 [join [join $Plane]]' will be '*createplane 1 1 0 0 0 0 0'

    it is not vector product. It is tcl syntax that you can refer on tcl manual