Radioss queing using TCL

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

Hello,

 

 

I have created a simulation file in TCL script. If i use loops in the file and wish to create a queing sequence of Radioss. How should the queing be done in TCL.

 

Generally, In 2017 full version i can run Radioss from desktop and just go on running the .rad files individually it is queued automatically. But how should i do it with a TCL script in hypermesh.

 

yours sincerely,

kartik kanugo

Tagged:

Answers

  • tinh
    tinh Altair Community Member
    edited February 2018

    You can write a simple proc to be embedded in your tcl script, like this

     proc ::p_RunRadiossFiles FileList { 	set Home [hm_info -appinfo ALTAIR_HOME] 	set RadiossCmd [glob [file join $Home hwsolvers common tcl tcl* win?? bin tclsh*rd.exe]] 	set HwSolverTcl [glob [file join $Home hwsolvers scripts hwsolver.tcl]] 	dict set ::p_RunRadiossFiles -queued [llength $FileList] 	foreach InputFile $FileList { 		if {[file exists $InputFile]} { 			set InputFile [file normalize $InputFile] 			set PipedCmd [list $RadiossCmd $HwSolverTcl $InputFile -screen -dir -solver RD] 			puts '[clock format [clock seconds] -format %Y/%m/%d-%H:%M] RUNNING FILE: $InputFile' 			puts '([expr [dict get $::p_RunRadiossFiles -queued]-1] file(s) queued)' 			set Pipe [open '| $PipedCmd'] 			fconfigure $Pipe -blocking 0 -encoding utf-8 			fileevent $Pipe readable '::p_Output $Pipe $InputFile' 			tkwait variable ::p_RunRadiossFiles 		} 	} } proc ::p_Output {Pipe InputFile} { 	if {[eof $Pipe]} { 		catch {close $Pipe} 		puts '[clock format [clock seconds] -format %Y/%m/%d-%H:%M] FINISHED FILE: $InputFile' 		dict incr ::p_RunRadiossFiles -queued -1 		return 	} else { 		if {[gets $Pipe Line]>0} { 			puts \t$Line 		} 	} }

     

    suppose you have a filelist of radioss files to be run: file1_D00 file2_D00 file3_D00

    invoke p_RunRadiossFiles $filelist

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited February 2018

    Hello @tinh

     
    Could you tell me if we need to have separate Radioss Engine file. Because I am running the student version of Hypermesh V120 Radioss. 
    Also In the above code I need to run the code in Hypermesh Run or anywhere else?
     
     
    yours sincerely,
    kartik

     

  • tinh
    tinh Altair Community Member
    edited February 2018

    I tested it with v2017

    If you run from tcl wish, set Home by hw install folder

    I will check with v12 later

  • tinh
    tinh Altair Community Member
    edited February 2018

    for v12 please change 'tclsh*rd.exe' to 'tclsh*.exe'

     

    and if you want to run it from tcl (not hypermesh), home should be

    set Home 'C:/Program Files/Altair/12.0'; #or something else depends on your installation