You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Nodal principal stresses (i.e. S1, S2, S3, SEQV, SINT)
21
+
- Nodal elastic, plastic, and thermal stress
22
+
- Nodal time history
23
+
- Nodal boundary conditions and force
24
+
- Nodal temperatures
25
+
- Nodal thermal strain
26
+
- Various element results (see ``element_solution_data``)
14
27
15
28
We're working on adding additional plotting and retrieval functions to the code If you would like us to add an additional result type to be loaded, please open an issue in `GitHub <https://github.com/akaszynski/pyansys>`_ and include result file for the result type you wish to load.
16
29
@@ -20,7 +33,7 @@ Loading the Result File
20
33
As the ANSYS result files are binary files, the entire file does not
21
34
need to be loaded into memory in order to retrieve results. This
22
35
module accesses the results through a python object `result` which you
23
-
can create with:
36
+
can initialize with:
24
37
25
38
.. code:: python
26
39
@@ -31,31 +44,85 @@ Upon initialization the ``ResultFile`` object contains several
31
44
properties to include the time values from the analysis, node
32
45
numbering, element numbering, etc.
33
46
47
+
The `pyansys` module can determine the correct result type by reading
48
+
the header of the file, which means that if it is an ANSYS binary
49
+
file, `pyansys` can probably read it (at least to some degree. For
50
+
example, a thermal result file can be read with
51
+
52
+
.. code:: python
53
+
54
+
rth = pyansys.read_binary('file.rth')
55
+
34
56
35
57
ResultFile Properties
36
58
---------------------
37
-
The properties of the ``ResultFile`` are contained in the result header.
59
+
The properties of the ``ResultFile`` can be quickly shown by printing the result file with:
38
60
39
61
.. code:: python
40
62
41
-
result.resultheader
63
+
>>> result = pyansys.read_binary('file.rst')
64
+
>>>print(result)
65
+
PyANSYS MAPDL Result fileobject
66
+
Units : User Defined
67
+
Version : 20.1
68
+
Cyclic : False
69
+
Result Sets : 1
70
+
Nodes : 321
71
+
Elements : 40
72
+
73
+
74
+
Available Results:
75
+
EMS : Miscellaneous summable items (normally includes face pressures)
76
+
ENF : Nodal forces
77
+
ENS : Nodal stresses
78
+
ENG : Element energies and volume
79
+
EEL : Nodal elastic strains
80
+
ETH : Nodal thermal strains (includes swelling strains)
81
+
EUL : Element euler angles
82
+
EPT : Nodal temperatures
83
+
NSL : Nodal displacements
84
+
RF : Nodal reaction forces
85
+
42
86
43
87
To obtain the time or frequency values of an analysis use:
44
88
45
89
.. code:: python
46
90
47
-
tval = result.time_values
48
-
91
+
>>> result.time_values
92
+
array([1.])
93
+
94
+
95
+
Individual results can be obtained with one of the many methods
96
+
available to the result object. For example, the nodal displacement
@@ -87,7 +154,9 @@ Which contains the following attributes:
87
154
88
155
Coordinate Systems
89
156
~~~~~~~~~~~~~~~~~~
90
-
Non default coordinate systems are always saved to an ANSYS result file. The coordinate system is zero indexed and individual coordinate systems can be accessed with:
157
+
Non-default coordinate systems are always saved to an ANSYS result
158
+
file. The coordinate system is zero indexed and individual coordinate
159
+
systems can be accessed with:
91
160
92
161
.. code:: python
93
162
@@ -167,7 +236,10 @@ This yields::
167
236
pCnvVal 0.0
168
237
169
238
170
-
The DOF solution for an analysis for each node in the analysis can be obtained using the code block below. These results correspond to the node numbers in the result file. This array is sized by the number of nodes by the number of degrees of freedom.
239
+
The DOF solution for an analysis for each node in the analysis can be
240
+
obtained using the code block below. These results correspond to the
241
+
node numbers in the result file. This array is sized by the number of
242
+
nodes by the number of degrees of freedom.
171
243
172
244
.. code:: python
173
245
@@ -182,7 +254,9 @@ The DOF solution for an analysis for each node in the analysis can be obtained u
182
254
# normalized displacement can be plotted by excluding the direction string
183
255
result.plot_nodal_solution(0, label='Normalized')
184
256
185
-
Stress can be obtained as well using the below code. The nodal stress is computed in the same manner as ANSYS by averaging the stress evaluated at that node for all attached elements.
257
+
Stress can be obtained as well using the below code. The nodal stress
258
+
is computed in the same manner as ANSYS by averaging the stress
259
+
evaluated at that node for all attached elements.
186
260
187
261
.. code:: python
188
262
@@ -197,12 +271,15 @@ Stress can be obtained as well using the below code. The nodal stress is comput
197
271
nnum, pstress = result.principal_nodal_stress(0)
198
272
result.plot_principal_nodal_stress(0, 'SEQV')
199
273
200
-
Element stress can be obtained using the following segment of code. Ensure that the element results are expanded for a modal analysis within ANSYS with::
274
+
Element stress can be obtained using the following segment of code.
275
+
Ensure that the element results are expanded for a modal analysis
276
+
within ANSYS with::
201
277
202
278
/SOLU
203
279
MXPAND, ALL, , , YES
204
280
205
-
This block of code shows how you can access the non-averaged stresses for the first result from a modal analysis.
281
+
This block of code shows how you can access the non-averaged stresses
282
+
for the first result from a modal analysis.
206
283
207
284
.. code:: python
208
285
@@ -254,7 +331,9 @@ These stresses can be verified using ANSYS using:
254
331
255
332
Accessing Element Solution Data
256
333
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
257
-
Individual element results for the entire solution can be accessed using the ``element_solution_data`` method. For example, to get the volume of each element:
334
+
Individual element results for the entire solution can be accessed
335
+
using the ``element_solution_data`` method. For example, to get the
336
+
volume of each element:
258
337
259
338
.. code:: python
260
339
@@ -269,12 +348,11 @@ Individual element results for the entire solution can be accessed using the ``e
269
348
edata = np.asarray(edata)
270
349
volume = edata[:, 0]
271
350
272
-
Documentation for the underlying results can be found in `Description of the Results File <https://www.sharcnet.ca/Software/Ansys/16.2.3/en-us/help/ans_prog/Hlp_P_INT1_2.html>`_.
273
-
274
351
275
352
Animiating a Modal Solution
276
353
~~~~~~~~~~~~~~~~~~~~~~~~~~~
277
-
Solutions from a modal analysis can be animated using ``animate_nodal_solution``. For example:
354
+
Solutions from a modal analysis can be animated using
355
+
``animate_nodal_solution``. For example:
278
356
279
357
.. code:: python
280
358
@@ -285,7 +363,6 @@ Solutions from a modal analysis can be animated using ``animate_nodal_solution``
285
363
result.animate_nodal_solution(3)
286
364
287
365
288
-
289
366
Results from a Cyclic Analysis
290
367
------------------------------
291
368
``pyansys`` can load and display the results of a cyclic analysis:
@@ -297,7 +374,9 @@ Results from a Cyclic Analysis
297
374
# load the result file
298
375
result = pyansys.read_binary('rotor.rst')
299
376
300
-
You can reference the load step table and harmonic index tables by printing the result header dictionary keys ``'ls_table'`` and ``'hindex'``:
377
+
You can reference the load step table and harmonic index tables by
378
+
printing the result header dictionary keys ``'ls_table'`` and
379
+
``'hindex'``:
301
380
302
381
.. code:: python
303
382
@@ -314,7 +393,9 @@ You can reference the load step table and harmonic index tables by printing the
Using this indexing method, repeated modes are indexed by the same mode index. To access the other repeated mode, use a negative harmonic index. Should a result not exist, pyansys will return which modes are available:
417
+
Using this indexing method, repeated modes are indexed by the same
418
+
mode index. To access the other repeated mode, use a negative
419
+
harmonic index. Should a result not exist, pyansys will return which
420
+
modes are available:
337
421
338
422
.. code:: python
339
423
@@ -343,7 +427,11 @@ Alternatively, the result number can be obtained by using:
343
427
Exception: Invalid mode for harmonic index 1
344
428
Available modes: [0123456789]
345
429
346
-
Results from a cyclic analysis require additional post processing to be interperted correctly. Mode shapes are stored within the result fileas unprocessed parts of the real and imaginary parts of a modal solution. ``pyansys`` combines these values into a single complex array and then returns the real result of that array.
430
+
Results from a cyclic analysis require additional post processing to
431
+
be interperted correctly. Mode shapes are stored within the result
432
+
fileas unprocessed parts of the real and imaginary parts of a modal
433
+
solution. ``pyansys`` combines these values into a single complex
434
+
array and then returns the real result of that array.
347
435
348
436
.. code:: python
349
437
@@ -353,7 +441,8 @@ Results from a cyclic analysis require additional post processing to be interper
353
441
[ 42.339, 48.516, 52.475]
354
442
[ 36.000, 33.121, 39.044]]
355
443
356
-
Sometimes it is necessary to determine the maximum displacement of a mode. To do so, return the complex solution with:
444
+
Sometimes it is necessary to determine the maximum displacement of a
445
+
mode. To do so, return the complex solution with:
357
446
358
447
.. code:: python
359
448
@@ -370,24 +459,31 @@ Sometimes it is necessary to determine the maximum displacement of a mode. To d
370
459
371
460
See ``help(result.nodal_solution)``for more details.
372
461
373
-
The real displacement of the sector is always the real component of the mode shape ``ms``, and this can be varied by multiplying the mode shape by a complex value for a given phase. To change the phase by 90 degrees simply:
462
+
The real displacement of the sector is always the real component of
463
+
the mode shape ``ms``, and this can be varied by multiplying the mode
464
+
shape by a complex value for a given phase.
374
465
375
-
The results of a single sector can be displayed as well using the ``plot_nodal_solution``
466
+
The results of a single sector can be displayed as well using the
467
+
``plot_nodal_solution``
376
468
377
469
.. code:: python
378
470
379
-
# Plot the result from the first mode of the 2nd harmonic index
The phase of the result can be changed by modifying the ``phase`` option. See ``help(result.plot_nodal_solution)``for details on its implementation.
476
+
The phase of the result can be changed by modifying the ``phase``
477
+
option. See ``help(result.plot_nodal_solution)``for details on its
478
+
implementation.
386
479
387
480
388
481
Exporting to ParaView
389
482
---------------------
390
-
ParaView is a visualization application that can be used for rapid generation of plots and graphs using VTK through a GUI. ``pyansys`` can translate the ANSYS result files to ParaView compatible files containing the geometry and nodal results from the analysis:
483
+
ParaView is a visualization application that can be used for rapid
484
+
generation of plots and graphs using VTK through a GUI. ``pyansys``
485
+
can translate the ANSYS result files to ParaView compatible files
486
+
containing the geometry and nodal results from the analysis:
391
487
392
488
.. code:: python
393
489
@@ -400,7 +496,13 @@ ParaView is a visualization application that can be used for rapid generation of
400
496
# save as a binary vtk xml file
401
497
result.save_as_vtk('beam.vtu')
402
498
403
-
The vtk xml file can now be loaded using ParaView. This screenshot shows the nodal displacement of the first result from the result file plotted within `ParaView <https://www.paraview.org/>`_. Within the vtk file are two point arrays (``NodalResult``and``nodal_stress``) for each result in the result file. The nodal result values will depend on the analysis type, while nodal stress will always be the node average stress in the Sx, Sy Sz, Sxy, Syz, and Sxz directions.
499
+
The vtk xml file can now be loaded using ParaView. This screenshot
500
+
shows the nodal displacement of the first result from the result file
501
+
plotted within `ParaView <https://www.paraview.org/>`_. Within the
502
+
vtk file are two point arrays (``NodalResult``and``nodal_stress``)
503
+
for each result in the result file. The nodal result values will
504
+
depend on the analysis type, while nodal stress will always be the
505
+
node average stress in the Sx, Sy Sz, Sxy, Syz, and Sxz directions.
0 commit comments