close_all_local_instances#

ansys.mechanical.core.close_all_local_instances(port_range=None, use_thread=True)#

Close all Mechanical instances within a port range.

You can use this method when cleaning up from a failed pool or batch run.

Parameters:
port_rangelist, optional

List of a range of ports to use when cleaning up Mechanical. The default is None, in which case the ports managed by PyMechanical are used.

use_threadbool, optional

Whether to use threads to close the Mechanical instances. The default is True. So this call will return immediately.

Examples

Close all Mechanical instances connected on local ports.

>>> import ansys.mechanical.core as pymechanical
>>> pymechanical.close_all_local_instances()