Hi,
I developed a code below to retrieve data (Shear_strain_xy & Shear_stress_xy) from the DSS test of the Soiltest module in Plaxis 2D Ultimate (academic version). This code was already working, but after upgrading to the latest version of Plaxis (2023), it is not working at all. The error and code can be found below. I hope someone can help me ASAP.
from plxscripting.easy import new_server import numpy as np import itertools from scipy.interpolate import CubicSpline import datetime import os import smtplib import traceback #---------------------------------------------------------- # API - 1 #---------------------------------------------------------- PORT = 10000 PASSWORD = '**********' s, g = new_server('localhost', PORT, password=PASSWORD) #---------------------------------------------------------- def dss(): if g.calculate(g.DSS) is not None: tau_xy = g.DSS.Results.Sigxy.value gamma_xy = g.DSS.Results.Gamxy.value return tau_xy, gamma_xy else: return None #---------------------------------------------------------- # Undrain DSS function - 3 #---------------------------------------------------------- tau_xy_simulated, gamma_xy_simulated = dss() def undrained_runs(): results_simulation = [] tau_xy_simulated, gamma_xy_simulated = dss() if gamma_xy_simulated is not None: tau_xy_max = np.max(tau_xy_simulated) tau_DSS_after_inter = np.interp(gamma_xy_simulated, DSS_exp_results[:,0], DSS_exp_results[:,1]) rmse = np.sqrt(np.mean(np.square(np.array(tau_DSS_after_inter) - np.array(tau_xy_simulated)))) else: print(f"gamma_xy_simulated is None - value: {gamma_xy_simulated}") tau_xy_max = None rmse = None # rmspe = None results_simulation.append(tau_xy_max) results_simulation.append(rmse) return results_simulation #---------------------------------------------------------- g.Materials[-1].E50ref = E_50 g.Materials[-1].EoedRef = E_oed g.Materials[-1].EurRef = E_ur g.Materials[-1].powerm = m g.Material.G0ref = G0 g.Material.gamma07 = gamma_07 g.Material.phi = Phi g.Material.psi = Psi g.Material.Rf = Rf results_simulation = undrained_runs()
Error:
--------------------------
Traceback (most recent call last): File "d:/Javad file/DSS_Py_HSsmall_v3_2023.py", line 266, in <module> results_simulation = undrained_runs() File "d:/Javad file/DSS_Py_HSsmall_v3_2023.py", line 173, in undrained_runs tau_xy_max = np.max(tau_xy_simulated) File "<__array_function__ internals>", line 180, in amax File "C:\ProgramData\Seequent\PLAXIS Python Distribution V2\python\lib\site-packages\numpy\core\fromnumeric.py", line 2791, in amax return _wrapreduction(a, np.maximum, 'max', axis, None, out, File "C:\ProgramData\Seequent\PLAXIS Python Distribution V2\python\lib\site-packages\numpy\core\fromnumeric.py", line 86, in _wrapreduction return ufunc.reduce(obj, axis, dtype, out, **passkwargs)ValueError: zero-size array to reduction operation maximum which has no identity