Sample Script: TCL Script to Reduce the Size of Large Output Files |
|||||
Sample Script: TCL Script to Reduce the Size of Large Output Files |
To reduce the size of large solver output files for DOE or Stochastic analyses (where several dozen output files may be created), you can reduce or extract only specific results of interest by running a custom post-processing command. This approach will work for all solvers with available HyperWorks readers in HyperGraph or HyperView.
As an example, the following Tcl code can be used to extract only the History output from an Abaqus™ ODB™ file, and the command for running HGTrans can be added to the solver execution script. Output responses can then be created from the (much smaller) ABF file, instead of the original ODB file.
Replace file names in the code as appropriate.
If the code below is saved in a file with name odb.tcl, the following command be used to run HGTrans to extract only the history results.
c:\Altair\hw10.0\hw\bin\win64\hgtrans.exe -c odb.tcl
set filename "C:/tmp/Run-11/Job11_exp.odb"
set abffilename "Job11_exp.abf"
## Files
hgtrans control SetFile $filename
hgtrans control SetOutputFile $abffilename
set subcases [hgtrans result GetSubcaseList]
## All subcases
foreach subcase $subcases {
set datatypes [hgtrans result GetDataTypeList $subcase]
## All datatypes
foreach datatype $datatypes {
if {[string first "(Time History)" $datatype] == -1} {
#Not a time history datatype. Skip
continue;
}
set requests [hgtrans result GetRequestList $subcase
$datatype]
set components [hgtrans result GetComponentList
$subcase $datatype]
## All requests
foreach request $requests {
## All components
foreach component $components {
## Add the vector to the abf file
hgtrans config SetChannelSelected $subcase
$datatype $request $component true
}
}
}
}
#hgtrans control SetCompressionLevel high
#hgtrans control SetTimeScaleFactor 1000
hgtrans control StartTranslation
Please see the HGTrans or HVTrans documentation for more details.