How to use script to calculate elements timestep?

Jason_Yin
Jason_Yin Altair Community Member
edited October 2020 in Community Q&A

Hi Altair,

 

I met a problem of use Hypermesh script to calculate elems timestep.

I want to realize following function to check out the smallest timestep elmes.

<?xml version="1.0" encoding="UTF-8"?>Capture.thumb.PNG.24dddf80ec3b05aed120ab69cbb96cb2.PNG

 

I have also checked the help manual of hypermesh script, but I dont' think it works.

 

<?xml version="1.0" encoding="UTF-8"?>Capture2.thumb.PNG.d691c3b5661d265536f30c4b3249d576.PNG

 

I want to get the table like Primer check result.

 

<?xml version="1.0" encoding="UTF-8"?>Capture4.thumb.PNG.b754382727cf573443ffec58e6cb107e.PNG

 

or, like the check result use LS-DYNA.

<?xml version="1.0" encoding="UTF-8"?>Capture5.thumb.PNG.602bcbed8dabc272e8d8bbd94f4b2ae7.PNG

 

Is there any method to do that in Hypermesh?

 

Thanks!

 

Jason

Tagged:

Answers

  • tinh
    tinh Altair Community Member
    edited November 2018

    There is available template function to do that. I will check it

     

  • tinh
    tinh Altair Community Member
    edited November 2018

    This script will utilize  template function HM_CALC_TIMESTEP

    I am not sure whether its results are same as dyna or prime. please confirm

     

     proc p_TimeStepOutput {{all 0}} { set funcs [file join [file dirname [hm_info templatefilename]] include functions] set fpt [open $funcs] fconfigure $fpt -encoding utf-8 set buf [read -nonewline $fpt] close $fpt set Index1 [string first {*function('HM_CALC_TIMESTEP'} $buf] set Index2 [string first {*return()} $buf $Index1] set func [string range $buf [string first \n $buf $Index1] $Index2-1] set Index2 0 foreach {ecfgname ecfgid} {spring 20 bar2 60 tria3 103 quad4 104 tetra4 204 penta6 206 hex8 208} { foreach typeid [hm_entityinfo configtypeids elems $ecfgname] typename [hm_entityinfo configtypes elems $ecfgname] { set etypename($ecfgid,$typeid) $typename } } set attribs [file join [file dirname [hm_info templatefilename]] include attribs] set fpt [open $attribs] fconfigure $fpt -encoding utf-8 set buf [read $fpt] close $fpt while 1 { set Index1 [string first *elements( $func $Index2] set Index2 [string first *output() $func $Index1] if {$Index1==-1||$Index2==-1} break set eblock [string range $func $Index1 $Index2-1] regexp {^\*elements\(([^,]*),([^,]*).*(variable[^\)]*)[^v]*$} $eblock -> econfig etype varname if {!$etype} {set etype 1} append buf $eblock '*string(\'$etypename($econfig,$etype) \')' \n *field(integer,id,0) '*string(\' \')' \n  append buf *field(integer,collector.id,0) '*string(\' \')' \n *field(real,$varname,0) \n *end() \n *output() \n } set fpt [open TSOUT.tpl w] fconfigure $fpt -encoding utf-8 puts -nonewline $fpt $buf close $fpt *usercheck TSOUT.tpl TSOUT.out $all set fpt [open TSOUT.out] fconfigure $fpt -encoding utf-8 set buf [read -nonewline $fpt] close $fpt set list [split $buf \n] set list100 [lrange [lsort -real -index 3 $list] 0 99] set fpt [open TSOUT.out w] fconfigure $fpt -encoding utf-8 puts $fpt '100 smallest timesteps' puts $fpt [string repeat - 50] puts $fpt [format '%-12s %10s %10s %15s' element number part timestep] foreach line $list100 { puts $fpt [format '%-12s %10s %10s %15s' {*}$line] } close $fpt } p_TimeStepOutput

     

    TSOUT.PNG.3f4c312e2f8d787c3707c2e7741cd239.PNG

    Unable to find an attachment - read this blog

  • Jason_Yin
    Jason_Yin Altair Community Member
    edited November 2018

    Hi Tinh,

     

             Thanks for your reply! Your script helps me much.

             I checked the script and found some problems.

                   For 1D Beam, all of the beams timestep is 0. It's not correct.

                   For 2D Shell, the timesteps are totally same as Dyna results and Primer check results.

                   For 3D Solid, some of the solids elems are rigid material, but it check out timestep problem.

             One more problem is the script has limit of elements number, if the elements increase, it will meet problem and not work.

           <?xml version="1.0" encoding="UTF-8"?>Capture6.thumb.PNG.bef8690fb83ab182047ce8d765b32b35.PNG<?xml version="1.0" encoding="UTF-8"?>Capture7.thumb.PNG.a11ef6cae4c911a1cee5110c4a32a032.PNG

     

    Regards,

     

    Jason