Skip to content

Commit 84c1f82

Browse files
committed
Added text to nodal results plot
1 parent 278d134 commit 84c1f82

File tree

4 files changed

+37
-18
lines changed

4 files changed

+37
-18
lines changed

doc/conf.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,6 @@
3636
templates_path = ['_templates']
3737

3838
# The suffix(es) of source filenames.
39-
# You can specify multiple suffix as a list of string:
40-
#
41-
# source_suffix = ['.rst', '.md']
4239
source_suffix = '.rst'
4340

4441
# The master toctree document.
@@ -54,9 +51,10 @@
5451
# built documents.
5552
#
5653
# The short X.Y version.
57-
version = u'0.16'
54+
version = u'0.17'
55+
5856
# The full version, including alpha/beta/rc tags.
59-
release = u'0.16'
57+
release = u'0.17.1'
6058

6159
# The language for content autogenerated by Sphinx. Refer to documentation
6260
# for a list of supported languages.

doc/loading_results.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@ accesses the results through a python object `result` which you can create with
2929
import pyansys
3030
result = pyansys.ResultReader('file.rst')
3131
32-
Upon initialization this result file contains several properties to include the
33-
time values from the analysis, node numbering, element numbering, etc.
32+
Upon initialization the ``ResultReader`` object contains several properties to
33+
include the time values from the analysis, node numbering, element numbering, etc.
3434

3535

36-
Result File Properties
37-
~~~~~~~~~~~~~~~~~~~~~~
36+
ResultReader Properties
37+
~~~~~~~~~~~~~~~~~~~~~~~
3838

39-
The properties of the result file can be listed the below code. At the moment,
39+
The properties of the ``ResultReader`` are listed below. At the moment,
4040
the property listing is limited to only the number of results in the file.
4141

4242
.. code:: python
@@ -63,7 +63,7 @@ Geometry
6363
~~~~~~~~
6464

6565
The geometry of the model can be accessed directly from the dictionary by
66-
accessing
66+
accessing:
6767

6868
.. code:: python
6969
@@ -103,9 +103,9 @@ degrees of freedom.
103103
result.PlotNodalResult(0, label='Normalized')
104104
105105
Stress can be obtained as well using the below code. The nodal stress is
106-
computed in the same manner that ANSYS uses by to determine the stress at each
107-
node by averaging the stress evaluated at that node for all attached elements.
108-
For now, only component stresses can be displayed.
106+
computed in the same manner as ANSYS by averaging the stress evaluated at
107+
that node for all attached elements. For now, only component stresses can
108+
be displayed.
109109

110110
.. code:: python
111111

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, 17, 1
2+
version_info = 0, 17, 2
33

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

pyansys/binary_reader.py

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,9 @@ def LoadKM(self, as_sparse=True, utri=True):
180180
m_diag = m_block[3]
181181
m_data_diag = m_block[4]
182182

183+
self.m_block = m_block
184+
self.k_block = k_block
185+
183186
# assemble data
184187
if utri:
185188
# stiffness matrix
@@ -203,6 +206,13 @@ def LoadKM(self, as_sparse=True, utri=True):
203206
mcol = np.hstack((m_block[1], m_block[0], m_diag)) # col and diag
204207
mdata= np.hstack((m_block[2], m_block[2], m_data_diag)) # data and diag
205208

209+
# store data for later reference
210+
self.krow = krow
211+
self.kcol = kcol
212+
self.kdata = kdata
213+
self.mrow = mrow
214+
self.mcol = mcol
215+
self.mdata = mdata
206216

207217
# number of dimentions
208218
ndim = nref.size
@@ -301,7 +311,7 @@ def __init__(self, filename, logger=False, load_geometry=True):
301311
if load_geometry:
302312
self.StoreGeometry()
303313

304-
if self.resultheader['nSector'] and load_geometry:
314+
if self.resultheader['nSector'] > 1 and load_geometry:
305315
self.iscyclic = True
306316

307317
# Add cyclic properties
@@ -608,11 +618,22 @@ def PlotNodalResult(self, rnum, comp='norm', as_abs=False, label=''):
608618
d = np.abs(d)
609619

610620
# Generate plot
611-
text = 'Result {:d} at {:f}'.format(rnum + 1, self.tvalues[rnum])
621+
# text = 'Result {:d} at {:f}'.format(rnum + 1, self.tvalues[rnum])
622+
623+
# setup text
624+
ls_table = self.resultheader['ls_table']
625+
freq = self.GetTimeValues()[rnum]
626+
text = 'Cumulative Index: {:3d}\n'.format(ls_table[rnum, 2])
627+
text += 'Loadstep: {:3d}\n'.format(ls_table[rnum, 0])
628+
text += 'Substep: {:3d}\n'.format(ls_table[rnum, 1])
629+
# text += 'Harmonic Index: {:3d}\n'.format(hindex)
630+
text += 'Frequency: {:10.4f} Hz'.format(freq)
631+
632+
612633
plobj = vtkInterface.PlotClass()
613634
plobj.AddMesh(self.uGrid, no_copy=True, scalars=d, stitle=stitle,
614635
flipscalars=True, interpolatebeforemap=True)
615-
plobj.AddText(text)
636+
plobj.AddText(text, fontsize=20)
616637
cpos = plobj.Plot(); # store camera position
617638
del plobj
618639

0 commit comments

Comments
 (0)