Failure Based On Results

This script allows the user to stop the solution when a certain Von Mises Stress (SEQV) is reached.

  • Create a body named selection of the body/bodies of interest and name i my_elems

Transparent

  • Use SMP when solving (i.e. untick Distributed!)

Transparent

In this example model we have a total of 5 load steps where we ramp up a force from 0 to 5000 N with a 1000 N increment / load step. We will make sure the solution stops once the Von Mises stress (SEQV) reaches 400 MPa.

  • Add the attached code in a commands object under Static Structural. Below shows the line with the apdl command NSEL,R,S,EQV,400 . This is where we select all nodes where the SEQV is higher than our threshold, here 400 MPa.

Transparent

  • Save & Solve. Look at the Von Mises Stress scoped to my_elems.

Transparent

!   Commands inserted into this file will be executed just prior to the ANSYS SOLVE command.
!   These commands may supersede command settings set by Workbench.

!   Active UNIT system in Workbench when this object was created:  Metric (mm, kg, N, s, mV, mA)
!   NOTE:  Any data that requires units (such as mass) is assumed to be in the consistent solver unit system.
!                See Solving Units in the help system for more information.

NROPT,FULL
*GET,NUMLS,ACTIVE,,SOLU,NCMLS
*IF,NUMLS,GT,0,THEN
    CMSEL,S,my_elems ! ELEM COMPONENT
    ESEL,R,ENAME,,185,186
    NSLE
    SELTOL,1.0e-12
    NSEL,R,S,EQV,400 ! STOP SOLUTION IF SEQV > 400 MPa (according to Metric (mm, t, N) ) 
    SELTOL
    *GET,NUMNODE,NODE,,COUNT
    *IF,NUMNODE,GT,0,THEN
        ESLN
        *GET,NUMELEM,ELEM,,COUNT
        *IF,NUMELEM,GT,0,THEN
            /EXIT,ALL
        *ENDIF
    *ENDIF
    ALLSEL
*ELSE
    FINISH
    /CONFIG,NOELDB,0 
    /SOLU 
*ENDIF