Skip to content

Commit aa30b7d

Browse files
committed
Merge branch 'main' into release/0.52
2 parents 666101f + 9d01203 commit aa30b7d

File tree

4 files changed

+42
-23
lines changed

4 files changed

+42
-23
lines changed

ansys/mapdl/reader/cyclic_reader.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -515,8 +515,15 @@ def _get_full_result(
515515

516516
# full result may or may not contain the duplicate sector
517517
if self._has_duplicate_sector:
518-
result = full_result[self._mas_ind]
519-
nnum = nnum[self._mas_ind]
518+
if nnum.size < self._mas_ind.size:
519+
# node numbers of the master sector
520+
nnum_mas = self._neqv[self._mas_ind]
521+
mask = np.in1d(nnum, nnum_mas)
522+
nnum = nnum[mask]
523+
result = full_result[mask]
524+
else:
525+
result = full_result[self._mas_ind]
526+
nnum = nnum[self._mas_ind]
520527
else:
521528
result = full_result
522529

@@ -1181,7 +1188,6 @@ def plot_nodal_solution(
11811188
>>> result.plot_nodal_solution(0)
11821189
11831190
"""
1184-
11851191
# Load result from file
11861192
if not full_rotor:
11871193
return super().plot_nodal_solution(
@@ -1203,17 +1209,17 @@ def plot_nodal_solution(
12031209
label = "Cyclic Rotor\nDisplacement"
12041210
if comp == "x":
12051211
scalars = result[:, :, 0]
1206-
title = "X {:s}\n".format(label)
1212+
title = f"X {label}\n"
12071213
elif comp == "y":
12081214
scalars = result[:, :, 1]
1209-
title = "Y {:s}\n".format(label)
1215+
title = f"Y {label}\n"
12101216
elif comp == "z":
12111217
scalars = result[:, :, 2]
1212-
title = "Z {:s}\n".format(label)
1218+
title = f"Z {label}\n"
12131219
else:
12141220
# Normalize displacement
1215-
scalars = (result * result).sum(2) ** 0.5
1216-
title = "Normalized\n%s\n" % label
1221+
scalars = np.linalg.norm(result, axis=-1)
1222+
title = f"Normalized\n{label}\n"
12171223

12181224
kwargs.setdefault("scalar_bar_args", {"title": title})
12191225
kwargs["node_components"] = node_components

ansys/mapdl/reader/rst.py

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ def access_bit(data, num):
6060

6161

6262
EMAIL_ME = """Please raise an issue at:
63+
6364
https://github.com/pyansys/pymapdl-reader/issues
64-
Or email the PyAnsys support team at pyansys.support@ansys.com
6565
"""
6666
np.seterr(divide="ignore", invalid="ignore")
6767

@@ -151,7 +151,6 @@ def __init__(self, filename, read_mesh=True, parse_vtk=True, **kwargs):
151151
self._sidx_elem = np.argsort(self._resultheader["eeqv"])
152152

153153
# Store node numbering in ANSYS
154-
self._neqv = self._resultheader["neqv"]
155154
self._eeqv = self._resultheader["eeqv"] # unsorted
156155

157156
# cache geometry header
@@ -1460,8 +1459,7 @@ def nodal_acceleration(self, rnum, in_nodal_coord_sys=False):
14601459
def _nodal_solution_result(
14611460
self, rnum, solution_type, in_nodal_coord_sys=False, nodes=None
14621461
):
1463-
"""Returns the DOF solution for each node in the global
1464-
cartesian coordinate system or nodal coordinate system.
1462+
"""Return the DOF solution for each node in the global coordinate system.
14651463
14661464
Parameters
14671465
----------
@@ -1509,8 +1507,7 @@ def _nodal_solution_result(
15091507
# check if nodal solution exists
15101508
if not self.available_results[solution_type]:
15111509
raise AttributeError(
1512-
'Result file is missing "%s"'
1513-
% self.available_results.description[solution_type]
1510+
f'Result file is missing "{self.available_results.description[solution_type]}"'
15141511
)
15151512

15161513
# result pointer
@@ -1560,14 +1557,20 @@ def _nodal_solution_result(
15601557
new_sidx = np.argsort(unsort_nnum)
15611558
nnum = unsort_nnum[new_sidx]
15621559
result = result[new_sidx]
1560+
1561+
# Convert result to the global coordinate system
1562+
if not in_nodal_coord_sys:
1563+
euler_angles = self._mesh.node_angles[new_sidx].T
1564+
rotate_to_global(result, euler_angles)
1565+
15631566
else:
15641567
nnum = self._neqv[self._sidx]
15651568
result = result.take(self._sidx, 0)
15661569

1567-
# Convert result to the global coordinate system
1568-
if not in_nodal_coord_sys:
1569-
euler_angles = self._mesh.node_angles[self._insolution].T
1570-
rotate_to_global(result, euler_angles)
1570+
# Convert result to the global coordinate system
1571+
if not in_nodal_coord_sys:
1572+
euler_angles = self._mesh.node_angles[self._insolution].T
1573+
rotate_to_global(result, euler_angles)
15711574

15721575
# check for invalid values (mapdl writes invalid values as 2*100)
15731576
result[result == 2**100] = 0
@@ -3757,7 +3760,8 @@ def _nodal_result(self, rnum, result_type, nnum_of_interest=None):
37573760
# replace values in nodstr
37583761
is_solid = elements.SOLID_ELEMENTS[self.mesh.ekey[:, 1]]
37593762
is_solid += self.mesh.ekey[:, 1] == 41 # must include SHELL41
3760-
nodstr[1:][is_solid] = self._nodfor[1:][is_solid]
3763+
ind = self.mesh.ekey[:, 0]
3764+
nodstr[ind][is_solid] = self._nodfor[ind][is_solid]
37613765

37623766
# call cython to extract and assemble the data
37633767
cells, offset = vtk_cell_info(grid)
@@ -3924,6 +3928,11 @@ def nodal_reaction_forces(self, rnum):
39243928
nnum = self._resultheader["neqv"][idx]
39253929
return rforces, nnum, dof
39263930

3931+
@property
3932+
def _neqv(self):
3933+
"""Return the nodal equivalence array."""
3934+
return self._resultheader["neqv"]
3935+
39273936
def plot_element_result(
39283937
self, rnum, result_type, item_index, in_element_coord_sys=False, **kwargs
39293938
):

requirements/requirements_docs.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
Sphinx<6
2-
ansys-sphinx-theme==0.8.2
2+
ansys-sphinx-theme==0.9.5
33
notfound==1.0.2
44
pypandoc==1.10
5-
pyvista==0.38.1
5+
pyvista==0.38.3
66
sphinx-copybutton==0.5.1
77
sphinx-gallery==0.11.1
88
sphinx-notfound-page==0.8.3
9-
vtk==9.2.5
9+
vtk==9.2.6

setup.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@
2727
description="Pythonic interface to files generated by MAPDL",
2828
long_description=open("README.rst").read(),
2929
long_description_content_type="text/x-rst",
30+
author="Ansys, Inc.",
31+
author_email="pyansys.maintainers@ansys.com",
32+
maintainer="PyAnsys developers",
33+
maintainer_email="pyansys.maintainers@ansys.com",
3034
license="MIT",
3135
classifiers=[
3236
"Development Status :: 4 - Beta",
@@ -36,11 +40,11 @@
3640
"Operating System :: Microsoft :: Windows",
3741
"Operating System :: POSIX",
3842
"Operating System :: MacOS",
39-
"Programming Language :: Python :: 3.6",
4043
"Programming Language :: Python :: 3.7",
4144
"Programming Language :: Python :: 3.8",
4245
"Programming Language :: Python :: 3.9",
4346
"Programming Language :: Python :: 3.10",
47+
"Programming Language :: Python :: 3.11",
4448
],
4549
url="https://github.com/pyansys/pymapdl-reader",
4650
# Build cython modules

0 commit comments

Comments
 (0)