fbpx

Single-Frame Restarts In Workbench

Inspect Results in the /POST1 Postprocessor | Single-Frame Restart


When running Workbench Mechanical, a user might like to have APDL commands execute between load steps, going to the /POST1 processor to examine a model, make the kinds of changes permitted between load steps according to results examined, then go back to the /SOLU solution processor and continue with SOLVE for a next load step. A single-frame restart can make this possible.

SimuTech-Group-Inspect-Results-in-the-POST1-Postprocessor-Single-Frame-Restart

Although no longer documented, it is still possible to perform single-frame restarts inside Ansys. Current documentation covers the multiframe restart, which lets a user restart an analysis from any saved load step or substep. Modifications between load steps might perform EKILL or EALIVE commands that are based on element results after a SOLVE. Other creative modifications could include material attribute changes (MPCHG) or Real constant adjustments (RMODIF).

Setup for a single-frame restart inside an APDL commands object in a Workbench Mechanical environment will be explored here. Actual model changes are up to the user.

Details of a Single-Frame Restart in Workbench Mechanical

Inside Workbench, multiframe restarts are employed for a variety of sophisticated purposes. A simpler sort of restart, the single-frame restart, lets a user continue solving after the end of the most recent load step if Ansys has temporarily exited the /SOLU solution processor. A single-frame restart makes it possible to inspect results in the /POST1 postprocessor, return to the solution processor, and continue in another load step. A user might choose to use commands that change a model between load steps, while a restart makes it possible to continue.

Example changes between load steps include material changes with the MPCHG command. Changes to real constants are possible with the RMODIF command. Element birth and death are supported with EALIVE and EKILL. Under unusual circumstances, original coordinates of the active set of nodes might be modified according to solution values with the UPCOORD command. Some changes between load steps can be based on solution information found in the /POST1 postprocessor. When re-entering the /SOLU solution processor, a restart is required to continue from the most recent previous load step solution, rather than starting with a new analysis.

An APDL Commands Object is shown in the above figure. In the figure below, choice of when an APDL Commands Object executes can be controlled if “Analysis Settings” contains more than one load step.

There is a *GET command that can execute in the /SOLU solution processor to discover the most recent load step that was solved. The following command retrieves the number of load steps that have accumulated up to the time when the *GET command is executed inside the /SOLU processor:

*GET,xxx,ACTIVE,,SOLU,NCMLS    ! Cumulative number of load steps

The following *GET commands are listed as /POST1 postprocessing commands, but experience has been that they also execute inside the /SOLU solution processor. If the *GET commands above or below are executed in Workbench Mechanical in an APDL Commands Object located in one of the solution environments, the variable returned as “xxx” is due to the load step number of the most recent SOLVE, not the one that is about to take place:

*GET,xxx,ACTIVE,,SET,LSTP ! Most recent SOLVE load step number
*GET,xxx,ACTIVE,,SET,TIME ! Time associated with current results in the database

The *GET commands listed above can be used to discover LSTP, the number of the most recently executed load step, or the “Time” of the most recently executed SOLVE. A *IF command could decide whether to execute further APDL commands, or which ones to execute, based on a load step number or time, in an APDL commands object set to execute at every load step when “Step Selection Mode” in Figure 3 above is set to “All”.

Locating Ansys Macros with the PSEARCH Command

Inside the directory that holds files for a Workbench project, there is a sub-directory called user_files. It is stored along with the overall project. A user can move files there if desired. The files could include macros that are to be executed by APDL commands in the WB Mechanical Outline. The /PSEARCH command indicates a location on the hard drive where macros for Ansys commands should be checked for existence. A starter section in the APDL command object that will implement a single frame restart and adjust the model might include:

*GET,current_loadstep,ACTIVE,,SET,LSTP ! current load step number
*IF,current_loadstep,EQ,0,then ! before first load step SOLVE
! Location of macros in user_files
FINISH
/PSEARCH,_wb_userfiles_dir(1) ! provides location of “user_files”
/SOLU
*GET,myjobname,ACTIVE,,JOBNAM ! jobname, <= 8 characters
/DELETE,myjobname,rdb ! if exists, req’d for single frame restart
RESCONTROL,DEFINE,NONE ! no files for multiframe restart
*ENDIF

Preventing Multiframe Restarts in Ansys Workbench

The deletion of an .RDB file if it exists, and use of the RESCONTROL command to prevent multiframe restart files, will make a single-frame restart possible.

Documentation suggests that /PSEARCH as above only works with up to 60-character strings, but it has been found to support longer strings. Jobname in Workbench Mechanical is “file” so the 8-character limitation of *GET above is not problematic. An /INQUIRE command can retrieve a longer Jobname.

After the first load step, commands as below can identify the most recent load step SOLVE, exit the solution processor, look up results, move them to an array, come back to the solution processor, make model changes based on results, perform a restart, and let the SOLVE that the Ansys input file “ds.dat” will perform next.

*GET,current_loadstep,ACTIVE,,SET,LSTP ! current load step number
*IF,current_loadstep,GT,0,then ! after a load step SOLVE
FINISH
/POST1
SET,LAST ! just in case not loaded
*GET,num_elem,elem,,COUNT ! how many elements
*GET,num_elem_max,elem,,NUM,MAX ! highest element number
! example examination of results
ETABLE,my_epeq,NL,EPEQ ! Example: accumulated strain
*DEL,my_epeq,,NOPR ! delete array without warning
*DIM,my_epeq,ARRAY,num_elem_max ! array to hold strain
*VGET,my_epeq(1),ELEM,1,ETAB,my_epeq ! element table column to array
FINISH
!
/SOLU
ANTYPE,,REST ! single frame restart
! Example: make changes according to my_epeq array contents
current_elem=0
*DO,ii,1,num_elem ! step through elements
current_elem=ELNEXT(current_elem) ! next element
! create changes for this element per my_epeq(current_elem) value
! …
*ENDDO
ALLSEL
*ENDIF
! At this point, WB follows with the next SOLVE using the above settings…

In the above commands, a user can go to /POST1, /PREP7 or to other processors to perform operations of interest. If commands that are compatible with a restart and the next load step are used, the Workbench model can continue with further load steps and analysis.

Conclusions | Inspecting Results via Multi and Single-Frame Restarts in Ansys

Workbench Mechanical is designed to make multiframe restarts possible for a variety of purposes, including perturbation methods. APDL commands can make single-frame restarts available, so that a model can temporarily exit the /SOLU processor, go to /PREP7 or /POST1, learn about the model, go back to /SOLU, adjust the model, set Analysis Type to a Restart, and continue with the model analysis in more load steps.

A closing tip: Using /SHOW,PNG at any time, followed by plotting commands, will create plots that are visible in the postprocessing area, if a Commands Object is created below Solution in the Outline.  Please let us know if you have any difficulties with multiframe or single-frame restarts!

Additional Ansys Software Tips & Tricks Resources

FEA-Consulting-Engineers-SimuTech-Group-Ansys-Partner
Ansys-Mechanical-Design-Optimization-Support

Most Recent Tips & Tricks