.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/03-Cyclic-Examples/03-cyclic-mesh-external-layer.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_03-Cyclic-Examples_03-cyclic-mesh-external-layer.py: .. _ref_cyclic_mesh_external_layer_example: Reduce cyclic model size by using the mesh external layer for result and mesh extraction ======================================================================================== This example shows postprocessing on a mesh external layer for a cyclic modal analysis. The external layer is the layer of solid elements with at least one facet facing the outside of the geometry. This feature, available for all types of mechanical simulation supporting cyclic or cyclic multi-stage models, allows you to reduce the size of both the mesh and the extracted data to improve processing performance. Because larger stresses and strains are usually located on the skin of a model, computing results on the external layer gives equivalent maximum values in most cases. .. GENERATED FROM PYTHON SOURCE LINES 40-44 Perform required imports ------------------------ Perform required imports. This example uses a supplied file that you can get using the ``examples`` module. .. GENERATED FROM PYTHON SOURCE LINES 44-48 .. code-block:: Python from ansys.dpf import post from ansys.dpf.post import examples .. GENERATED FROM PYTHON SOURCE LINES 49-55 Get ``Simulation`` object ------------------------- Get the ``Simulation`` object that allows access to the result. The ``Simulation`` object must be instantiated with the path for the result file. For example, ``"C:/Users/user/my_result.rst"`` on Windows or ``"/home/user/my_result.rst"`` on Linux. .. GENERATED FROM PYTHON SOURCE LINES 55-62 .. code-block:: Python example_path = examples.download_modal_cyclic() simulation = post.ModalMechanicalSimulation(example_path) # print the simulation to get an overview of what's available print(simulation) .. rst-class:: sphx-glr-script-out .. code-block:: none Modal Mechanical Simulation. Data Sources ------------------------------ /opt/hostedtoolcache/Python/3.10.18/x64/lib/python3.10/site-packages/ansys/dpf/core/examples/result_files/cyclic/modal_cyclic.rst DPF Model ------------------------------ Modal analysis Unit system: MKS: m, kg, N, s, V, A, degC Physics Type: Mechanical Available results: - displacement: Nodal Displacement - reaction_force: Nodal Force - stress: ElementalNodal Stress - elastic_strain: ElementalNodal Strain - elastic_strain_eqv: ElementalNodal Strain eqv - element_orientations: ElementalNodal Element Euler Angles ------------------------------ DPF Meshed Region: 928 nodes 3836 elements Unit: m With solid (3D) elements ------------------------------ DPF Time/Freq Support: Number of sets: 48 Cumulative Frequency (Hz) LoadStep Substep Harmonic index 1 51369.575105 1 1 0.000000 2 114291.419744 1 2 0.000000 3 238849.856755 1 3 0.000000 4 254031.324493 1 4 0.000000 5 337729.470910 1 5 0.000000 6 348699.692284 1 6 0.000000 7 51970.152101 2 1 1.000000 8 51970.152101 2 2 -1.000000 9 126647.471593 2 3 -1.000000 10 126647.471593 2 4 1.000000 11 239807.889703 2 5 -1.000000 12 239807.889703 2 6 1.000000 13 54198.644112 3 1 2.000000 14 54198.644112 3 2 -2.000000 15 157264.852222 3 3 -2.000000 16 157264.852222 3 4 2.000000 17 242073.194077 3 5 -2.000000 18 242073.194077 3 6 2.000000 19 59105.565170 4 1 3.000000 20 59105.565170 4 2 -3.000000 21 194873.849513 4 3 -3.000000 22 194873.849513 4 4 3.000000 23 241988.808784 4 5 3.000000 24 241988.808784 4 6 -3.000000 25 67744.544169 5 1 4.000000 26 67744.544169 5 2 -4.000000 27 218600.039108 5 3 -4.000000 28 218600.039108 5 4 4.000000 29 229679.308122 5 5 4.000000 30 229679.308122 5 6 -4.000000 31 80576.477155 6 1 5.000000 32 80576.477155 6 2 -5.000000 33 192985.645574 6 3 -5.000000 34 192985.645574 6 4 5.000000 35 245990.772448 6 5 5.000000 36 245990.772448 6 6 -5.000000 37 97381.706833 7 1 6.000000 38 97381.706833 7 2 -6.000000 39 166306.784163 7 3 -6.000000 40 166306.784163 7 4 6.000000 41 259986.167834 7 5 6.000000 42 259986.167834 7 6 -6.000000 43 117422.022015 8 1 7.000000 44 117422.022015 8 2 -7.000000 45 141309.163007 8 3 -7.000000 46 141309.163007 8 4 7.000000 47 273449.890447 8 5 -7.000000 48 273449.890447 8 6 7.000000 .. GENERATED FROM PYTHON SOURCE LINES 63-66 Extract displacement data ------------------------- Extract displacement data on the external layer. .. GENERATED FROM PYTHON SOURCE LINES 66-72 .. code-block:: Python displacement_ext = simulation.displacement(external_layer=True) print(displacement_ext) displacement_ext.plot() .. image-sg:: /examples/03-Cyclic-Examples/images/sphx_glr_03-cyclic-mesh-external-layer_001.png :alt: 03 cyclic mesh external layer :srcset: /examples/03-Cyclic-Examples/images/sphx_glr_03-cyclic-mesh-external-layer_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none results U (m) set_ids 1 node_ids components 225 X 4.7760e-02 Y 2.2679e+01 Z -1.4026e-02 1153 X 3.7926e-02 Y 2.2679e+01 Z -3.2239e-02 ... ... ... (None, ) .. GENERATED FROM PYTHON SOURCE LINES 73-77 Select sectors for expansion ---------------------------- Extract displacement data on the external layer for a cyclic expansion on a selected number of sectors. .. GENERATED FROM PYTHON SOURCE LINES 77-81 .. code-block:: Python displacement_ext = simulation.displacement(external_layer=True, expand_cyclic=[1, 2, 3]) displacement_ext.plot() .. image-sg:: /examples/03-Cyclic-Examples/images/sphx_glr_03-cyclic-mesh-external-layer_002.png :alt: 03 cyclic mesh external layer :srcset: /examples/03-Cyclic-Examples/images/sphx_glr_03-cyclic-mesh-external-layer_002.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none (None, ) .. GENERATED FROM PYTHON SOURCE LINES 82-87 Extract stress and strain data ------------------------------ Extract stress and elastic strain data on the external layer. You can easily compute averages and invariants on the external layer because the connectivity of the kept elements remains unchanged. .. GENERATED FROM PYTHON SOURCE LINES 87-98 .. code-block:: Python elemental_stress_ext = simulation.stress_principal_elemental( components=[1], external_layer=True ) elemental_stress_ext.plot() elastic_strain_eqv_ext = simulation.elastic_strain_eqv_von_mises_nodal( external_layer=True ) elastic_strain_eqv_ext.plot() .. rst-class:: sphx-glr-horizontal * .. image-sg:: /examples/03-Cyclic-Examples/images/sphx_glr_03-cyclic-mesh-external-layer_003.png :alt: 03 cyclic mesh external layer :srcset: /examples/03-Cyclic-Examples/images/sphx_glr_03-cyclic-mesh-external-layer_003.png :class: sphx-glr-multi-img * .. image-sg:: /examples/03-Cyclic-Examples/images/sphx_glr_03-cyclic-mesh-external-layer_004.png :alt: 03 cyclic mesh external layer :srcset: /examples/03-Cyclic-Examples/images/sphx_glr_03-cyclic-mesh-external-layer_004.png :class: sphx-glr-multi-img .. rst-class:: sphx-glr-script-out .. code-block:: none (None, ) .. GENERATED FROM PYTHON SOURCE LINES 99-101 Get stress results on external layer of first sector with a cyclic phase ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. GENERATED FROM PYTHON SOURCE LINES 101-109 .. code-block:: Python stress_eqv_cyc_phase = simulation.stress_eqv_von_mises_nodal( set_ids=[5], expand_cyclic=[1], phase_angle_cyclic=45.0, external_layer=True, ) stress_eqv_cyc_phase.plot() .. image-sg:: /examples/03-Cyclic-Examples/images/sphx_glr_03-cyclic-mesh-external-layer_005.png :alt: 03 cyclic mesh external layer :srcset: /examples/03-Cyclic-Examples/images/sphx_glr_03-cyclic-mesh-external-layer_005.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none (None, ) .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 4.694 seconds) .. _sphx_glr_download_examples_03-Cyclic-Examples_03-cyclic-mesh-external-layer.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: 03-cyclic-mesh-external-layer.ipynb <03-cyclic-mesh-external-layer.ipynb>` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: 03-cyclic-mesh-external-layer.py <03-cyclic-mesh-external-layer.py>` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: 03-cyclic-mesh-external-layer.zip <03-cyclic-mesh-external-layer.zip>` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_