ansys / pymapdl

Pythonic interface to MAPDL
https://mapdl.docs.pyansys.com
MIT License
428 stars 120 forks source link

Better error handling by expanding error types #1241

Open germa89 opened 2 years ago

germa89 commented 2 years ago

Description of the feature

Current state

Currently most of the errors presented in the MAPDL logs are handled as RuntimeErrors. This might be convenient, because it simplifies the implementation, but it is not for error handling.

As detailed in https://github.com/pyansys/pymapdl/discussions/1230, currently we cannot do:

try:
    mapdl.solve()
except NonConvergence:
    pass # keep going.

Steps for implementing the feature

Ideally there should be an exception type for each possible Ansys MAPDL error.

This is a bit of work, but it is worthy.

Pinging @FredAns to know if there is a dict or database for MAPDL errors, and warnings.

List of errors

violate_shape_error_limits

*** ERROR ***                           CP =       0.969   TIME= 13:30:36
 Previous testing revealed that 14 of the 38745 selected elements
 violate shape error limits.  Please review error messages on the
 output or error file (or issue the CHECK command), then delete or
 unselect those elements.

warping_factor

*** ERROR *** CP = 32.219 TIME= 00:32:58
Brick element 456 has a face with a warping factor of 0.4387, which
exceeds the error limit of 0.4.
FredAns commented 2 years ago

Hi @germa89 ! Agree with you we need to improve the error handling. We have this initiative starting end of summer to improve the log/monitoring of MAPDL in PyAnsys. Warning and Error Feeback is part of the scope. Actually there's no formalized table of errors we can rely on for now.