Skip to content

Commit 31d0ca2

Browse files
authored
Misc Fixes (ansys#300)
* automatically addressing DMP bug * make install_requires version explicit * allow logging failure on collection * fix invalid consistency check * version bump to 0.44.12
1 parent af5c266 commit 31d0ca2

File tree

6 files changed

+25
-10
lines changed

6 files changed

+25
-10
lines changed

pyansys/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# major, minor, patch
2-
version_info = 0, 44, 11
2+
version_info = 0, 44, 12
33

44
# Nice string for the version
55
__version__ = '.'.join(map(str, version_info))

pyansys/launcher.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Module for launching MAPDL locally."""
2+
import platform
23
from glob import glob
34
import re
45
import warnings
@@ -512,6 +513,12 @@ def launch_mapdl(exec_file=None, run_location=None, mode=None, jobname='file',
512513
version = int(re.findall(r'\d\d\d', exec_file)[0])
513514
mode = check_mode(mode, version)
514515

516+
# known issue with distributed memory parallel
517+
if 'ubuntu' in platform.platform().lower():
518+
if 'smp' not in additional_switches:
519+
# Ubuntu ANSYS fails to launch without I_MPI_SHM_LMT
520+
os.environ['I_MPI_SHM_LMT'] = 'shm'
521+
515522
start_parm = {'exec_file': exec_file,
516523
'run_location': run_location,
517524
'jobname': jobname,

pyansys/mapdl.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1895,7 +1895,10 @@ def __del__(self): # pragma: no cover
18951895
try:
18961896
self.exit()
18971897
except Exception as e:
1898-
self._log.error('exit: %s', str(e))
1898+
try: # logger might be closed
1899+
self._log.error('exit: %s', str(e))
1900+
except:
1901+
pass
18991902

19001903
@supress_logging
19011904
def get_array(self, entity='', entnum='', item1='', it1num='', item2='',

pyansys/mesh.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ def _parse_vtk(self, allowable_types=None, force_linear=False,
147147

148148
if additional_checking:
149149
cells[cells < 0] = 0
150-
cells[cells >= nodes.shape[0]] = 0
150+
# cells[cells >= nodes.shape[0]] = 0 # fails when n_nodes < 20
151151

152152
if VTK9:
153153
grid = pv.UnstructuredGrid(cells, celltypes, nodes, deep=False)

pyansys/rst.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ def plot_nodal_solution(self, rnum, comp=None,
571571
comp = 'U' + comp
572572

573573
if comp == 'NORM':
574-
if dof[:3] != ['UX', 'UY', 'UZ']:
574+
if dof[:3] != ['UX', 'UY', 'UZ'] and dof[:2] != ['UX', 'UY']:
575575
raise AttributeError('Unable to compute norm given the DOF(s) %s'
576576
% str(dof))
577577
# Normalize displacement
@@ -2140,7 +2140,12 @@ def _plot_point_scalars(self, scalars, rnum=None, grid=None,
21402140
elif element_components:
21412141
_, ind = self._extract_element_components(element_components)
21422142
disp = disp[ind]
2143-
new_points = disp + grid.points
2143+
2144+
if disp.shape[1] == 2: # ignore Z
2145+
new_points = grid.points.copy()
2146+
new_points[:, :-1] += disp
2147+
else:
2148+
new_points = disp + grid.points
21442149
grid = grid.copy()
21452150
grid.points = new_points
21462151

setup.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,12 @@
88

99
try:
1010
import numpy as np
11-
except:
11+
except ImportError:
1212
raise Exception('Please install numpy first with "pip install numpy"')
1313

1414

1515
def check_cython():
1616
"""Check if binaries exist and if not check if Cython is installed"""
17-
path = os.path.dirname(__file__)
1817
has_binary_reader = False
1918
for filename in os.listdir('pyansys'):
2019
if '_binary_reader' in filename:
@@ -28,6 +27,7 @@ def check_cython():
2827
raise ImportError('\n\n\nTo build pyansys please install Cython with:\n\n'
2928
'pip install cython\n\n') from None
3029

30+
3131
check_cython()
3232

3333

@@ -89,10 +89,10 @@ def compilerName():
8989

9090
install_requires = ['numpy>=1.14.0',
9191
'pyvista>=0.25.0',
92-
'appdirs',
92+
'appdirs>=1.4.0',
9393
'psutil>=5.0.0',
94-
'pexpect',
95-
'tqdm',
94+
'pexpect>=4.8.0',
95+
'tqdm>=4.45.0',
9696
'pyiges>=0.1.2']
9797

9898
# MacOS can't launch MAPDL

0 commit comments

Comments
 (0)