.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/01-cyclic_results/academic_sector_stress_strain.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_examples_01-cyclic_results_academic_sector_stress_strain.py: .. _ref_academic_sector_stress_strain: Stress and Strain from a Cyclic Modal Analysis ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This example shows how to extract strain and stress from a cyclic modal analysis. .. GENERATED FROM PYTHON SOURCE LINES 11-15 .. code-block:: Python # sphinx_gallery_thumbnail_number = 2 from ansys.mapdl.reader import examples .. GENERATED FROM PYTHON SOURCE LINES 16-17 Download the academic modal analysis file .. GENERATED FROM PYTHON SOURCE LINES 17-21 .. code-block:: Python rotor = examples.download_academic_rotor_result() print(rotor) .. rst-class:: sphx-glr-script-out .. code-block:: none PyMAPDL Result Units : User Defined Version : 20.1 Cyclic : True Result Sets : 26 Nodes : 786 Elements : 524 Available Results: EMS : Miscellaneous summable items (normally includes face pressures) ENF : Nodal forces ENS : Nodal stresses ENG : Element energies and volume EEL : Nodal elastic strains ETH : Nodal thermal strains (includes swelling strains) EUL : Element euler angles EPT : Nodal temperatures NSL : Nodal displacements .. GENERATED FROM PYTHON SOURCE LINES 22-26 Plot nodal displacement for result ``(2, 2)``, which corresponds to the load step and sub step in fortran indexing. You could have also used the python cumulative index 3. rotor._positive_cyclic_dir = True .. GENERATED FROM PYTHON SOURCE LINES 26-29 .. code-block:: Python _ = rotor.plot_nodal_displacement((2, 2), "x", cpos="xy") .. image-sg:: /examples/01-cyclic_results/images/sphx_glr_academic_sector_stress_strain_001.png :alt: academic sector stress strain :srcset: /examples/01-cyclic_results/images/sphx_glr_academic_sector_stress_strain_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 30-49 Extract the nodal elastic strain for the fourth cumulative result. Because pymapdl-reader uses zero based indexing, we have to input "3" here. Depending on the version of ANSYS, MAPDL either does or does not write the duplicate sector for a result. If MAPDL does not write a duplicate sector, pymapdl-reader will search for a duplicate mode and use that as the duplicate sector in order to be able to expand to the full rotor. Regardless of if there is or isn't a duplicate sector, only the master sector will be output. .. warning:: Cyclic results extracted from pymapdl-reader may disagree with MAPDL due to several issues/variations when extracting cyclic results within MAPDL using ``PowerGraphics``. By default, MAPDL uses ``\EDGE,,,45``, which disables averaging across surface features that exceed 45 degrees, but only writes one value when outputting with ``PRNSOL``. On the other hand ``pymapdl-reader`` always averages, so you will see differences between MAPDL and ``pymapdl-reader`` in these cases. .. GENERATED FROM PYTHON SOURCE LINES 49-52 .. code-block:: Python nnum, strain = rotor.nodal_elastic_strain(3, full_rotor=True) .. GENERATED FROM PYTHON SOURCE LINES 53-66 Plot the nodal elastic strain in the "Z" direction for result ``(5, 2)``. ``pymapdl-reader`` can plot the displacements while also plotting the stress/strain. Since modal results may or may not be normalized, you will have to adjust the ``displacement_factor`` to scale up or down the displacement to get a reasonable looking result. Disable plotting the displacement by setting ``show_displacement=False``. Additionally, you can also save screenshots by setting ``screenshot`` to a filename with ``screenshot='elastic_strain.png'``. If you wish to do this without manually closing the plotting screen, set ``off_screen=True``. This can help you automate saving screenshots. .. GENERATED FROM PYTHON SOURCE LINES 66-72 .. code-block:: Python _ = rotor.plot_nodal_elastic_strain( (5, 2), "Z", show_displacement=True, displacement_factor=0.01 ) .. image-sg:: /examples/01-cyclic_results/images/sphx_glr_academic_sector_stress_strain_002.png :alt: academic sector stress strain :srcset: /examples/01-cyclic_results/images/sphx_glr_academic_sector_stress_strain_002.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 73-79 Plot the nodal elastic stress in the "Z" direction for this rotor. Since this is plotting the other pair of modes for the 5th loadstep, the displacement of this response is 90 degrees out of phase of result ``(5, 2)`` Available stress components are ``['Y', 'Z', 'XY', 'YZ', 'XZ']`` .. GENERATED FROM PYTHON SOURCE LINES 79-84 .. code-block:: Python _ = rotor.plot_nodal_stress( (5, 1), "Z", show_displacement=True, displacement_factor=0.01 ) .. image-sg:: /examples/01-cyclic_results/images/sphx_glr_academic_sector_stress_strain_003.png :alt: academic sector stress strain :srcset: /examples/01-cyclic_results/images/sphx_glr_academic_sector_stress_strain_003.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 85-89 You can also plot the nodal von mises principal stress. This plot shows the principal stress for result ``(5, 2)``. Available stress components are ``['S1', 'S2', 'S3', 'SINT', 'SEQV']``. .. GENERATED FROM PYTHON SOURCE LINES 89-92 .. code-block:: Python _ = rotor.plot_principal_nodal_stress( (5, 2), "SEQV", show_displacement=True, displacement_factor=0.01 ) .. image-sg:: /examples/01-cyclic_results/images/sphx_glr_academic_sector_stress_strain_004.png :alt: academic sector stress strain :srcset: /examples/01-cyclic_results/images/sphx_glr_academic_sector_stress_strain_004.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 1.647 seconds) .. _sphx_glr_download_examples_01-cyclic_results_academic_sector_stress_strain.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: academic_sector_stress_strain.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: academic_sector_stress_strain.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: academic_sector_stress_strain.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_