How to use script to calculate elements timestep?
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"?>
I have also checked the help manual of hypermesh script, but I dont' think it works.
<?xml version="1.0" encoding="UTF-8"?>
I want to get the table like Primer check result.
<?xml version="1.0" encoding="UTF-8"?>
or, like the check result use LS-DYNA.
<?xml version="1.0" encoding="UTF-8"?>
Is there any method to do that in Hypermesh?
Thanks!
Jason
Answers
-
There is available template function to do that. I will check it
0 -
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
0 -
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"?><?xml version="1.0" encoding="UTF-8"?>
Regards,
Jason
0