Output scripting example: get maximum bending moment


ApplicationPLAXIS 2D
VersionPLAXIS 2D
Date created29 April 2015
Date modified29 April 2015

In this example, we will use Tutorial Lesson 3 (Tied back excavation) [link] for the Plaxis file. In this case, we want to determine the maximum bending moment for the left retaining wall for each phase in which the plate is active. This left retaining wall is activated in Phase_1, and is located at X = 40 m.

In order to retrieve the maximum and minimum bending moment for the left retaining wall, we will use Output’s Remote Scripting environment with the Python wrapper:

  1. open SciTE program under Expert>Python>Editor
    note that this will launch the Configure remote scripting server window.
  2.  add the boilerplate code at the beginning of the script [link to detailed article]
  3. and we should make sure the Plaxis results are opened in the Output program
  4. then we will obtain the bending moment values for each phase in which the plate is active. Since the plate is activated in Phase_1, we can use all phases, except the InitialPhase ( g_o.Phases[1:] )
  5. for each phase we will obtain all plate results: coordinates X and Y, and the bending moment M.
  6. from which we will filter out the nodes that are part of the left retaining wall (at X= 40.0). Because the order of the nodes is the same in each of the getresults-lists, we can use the X - coordinate to filter out the correct bending moment.
  7. and from this, we will obtain the maximum value for the bending moment for the left retaining wall.
  8. hit F5 to run the script on SciTE program
# geometric limits for the left retaining wall:
x_left = 40.0  

# for all phases, starting from the second phase (Phase_1) 
for phase in g_o.Phases[1:]: 
    #initialize defaults: 
    maxM = 0.0 
    xAtMaxM = 0.0 
    yAtMaxM = 0.0 
    minM = 0.0 
    xAtMinM = 0.0 
    yAtMinM = 0.0 

    # obtain result tables 
    plateX = g_o.getresults(phase, g_o.ResultTypes.Plate.X, 'node') 
    plateY = g_o.getresults(phase, g_o.ResultTypes.Plate.Y, 'node') 
    plateM = g_o.getresults(phase, g_o.ResultTypes.Plate.M2D, 'node') 
    
    # determine minimum and maximum bending moment: 
    for x, y, M in zip(plateX, plateY, plateM): 
        #is it on the left wall (with small numerical tolerance)? 
        if abs(x - x_left) < 1E-5: 
            if M > maxM: 
                maxM = M 
                xAtMaxM = x 
                yAtMaxM = y 
            if M < minM: 
                minM = M 
                xAtMinM = x 
                yAtMinM = y 
    print( "{}: ".format( phase.Name ) + 
           "Mmax = {:.2f} kNm/m at Y={:.2f} m; ".format(maxM, yAtMaxM) + 
           "Mmin = {:.2f} kNm/m at Y={:.2f} m".format(minM, yAtMinM) )

The result in the Python console would look similar to this:

  Response in Python console
>>> 
Phase_1: Mmax = 3.02 kNm/m at Y=26.33 m; Mmin = -0.00 kNm/m at Y=14.00 m
Phase_2: Mmax = 4.94 kNm/m at Y=20.00 m; Mmin = -39.68 kNm/m at Y=25.67 m
Phase_3: Mmax = 21.25 kNm/m at Y=22.62 m; Mmin = -95.76 kNm/m at Y=27.00 m
Phase_4: Mmax = 68.03 kNm/m at Y=23.67 m; Mmin = -91.24 kNm/m at Y=27.00 m
Phase_5: Mmax = 26.09 kNm/m at Y=19.57 m; Mmin = -142.34 kNm/m at Y=23.00 m
Phase_6: Mmax = 122.61 kNm/m at Y=20.38 m; Mmin = -140.18 kNm/m at Y=23.00 m
>>>

See also