Extracting Results for the Last Increment via Hvtrans in Batch Mode


When running HvTrans in batch mode, all the settings defined through the GUI in the interactive mode need to be provided in the configuration (config) file (see Online Help for more information). User can request the data to be extracted for a specific time step by referencing the time step index. For example, to extract element stresses for time step with index 10 in subcase 1, the config file would include the following block:

BeginSubcase:1
    BeginSimulation:10
        Element Stresses (2D & 3D)
    EndSimulation
EndSubcase

If the same data needs to be extracted for all simulation steps, the keyword all can be used instead of the index. Since the index of the last step can vary between simulation results, we need a generic way of referencing the last step. Currently, the config file does not support a keyword pointing to the last step. However, this can be achieved by essentially replacing the config file statements with a Tcl code that provides the necessary logic to automatically retrieve the index:

beginconfig: hvtrans
hvtrans_useplugins = hvtranstcl
endconfig
beginscript: tcl
    set ListOfRequestedResults {	{Displacement} \
				{S-Global-Stress components}
				{S-Global-Stress components|(corners)}}
    if { [hvtrans control GetResultFile]!="" } {
        hvtrans control LoadResults
        foreach subc [hvtrans result GetSubcases] {
            foreach Result $ListOfRequestedResults {
                hvtrans config AddItem "Subcase<$subc>/Simulation<[llength [hvtrans result GetSimulations $subc]]>/${Result}"
            }
        }
    }
endscript

The index of the last simulation step is defined using the command block [llength [hvtrans result GetSimulations $subc]]. In the example above, the Tcl block also includes a list of requested results (ListOfRequestedResults). These need to be referenced using the correct syntax corresponding to the result file. Alternatively, user can request all results using the following syntax:

foreach subc [hvtrans result GetSubcases] {
            foreach Result $ListOfRequestedResults {
                hvtrans config AddItem "Subcase<$subc>/Simulation<[llength [hvtrans result GetSimulations $subc]]>/(all)"
}