.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/00-Different-analysis-types/02-modal-simulation.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_00-Different-analysis-types_02-modal-simulation.py: .. _ref_modal_example: Modal Simulation ================ Simple post processing operations like viewing the different mode shapes is displayed in this example. .. GENERATED FROM PYTHON SOURCE LINES 11-15 Perform required imports ------------------------ Perform required imports. # This example uses a supplied file that you can get by importing the DPF ``examples`` package. .. GENERATED FROM PYTHON SOURCE LINES 15-19 .. code-block:: Python from ansys.dpf import post from ansys.dpf.post import examples .. GENERATED FROM PYTHON SOURCE LINES 20-26 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 26-34 .. code-block:: Python example_path = examples.download_modal_frame() # to automatically detect the simulation type, use: simulation = post.load_simulation(example_path) # to enable auto-completion, use the equivalent: simulation = post.ModalMechanicalSimulation(example_path) .. GENERATED FROM PYTHON SOURCE LINES 35-38 View the frequency domain ------------------------- Printing the time freq support can help pick the right modes .. GENERATED FROM PYTHON SOURCE LINES 38-44 .. code-block:: Python print(simulation.time_freq_support) # set_ids returns the unique identifiers for the modes print(simulation.set_ids) .. rst-class:: sphx-glr-script-out .. code-block:: none DPF Time/Freq Support: Number of sets: 6 Cumulative Frequency (Hz) LoadStep Substep 1 253.615690 1 1 2 317.918491 1 2 3 329.825709 1 3 4 575.619678 1 4 5 621.973976 1 5 6 667.364882 1 6 [1, 2, 3, 4, 5, 6] .. GENERATED FROM PYTHON SOURCE LINES 45-47 Extract all mode shapes and view them one by one ------------------------------------------------ .. GENERATED FROM PYTHON SOURCE LINES 47-55 .. code-block:: Python displacement_norm = simulation.displacement(all_sets=True, norm=True) print(displacement_norm) for set_id in simulation.set_ids: displacement_norm.plot(set_ids=set_id) .. rst-class:: sphx-glr-horizontal * .. image-sg:: /examples/00-Different-analysis-types/images/sphx_glr_02-modal-simulation_001.png :alt: 02 modal simulation :srcset: /examples/00-Different-analysis-types/images/sphx_glr_02-modal-simulation_001.png :class: sphx-glr-multi-img * .. image-sg:: /examples/00-Different-analysis-types/images/sphx_glr_02-modal-simulation_002.png :alt: 02 modal simulation :srcset: /examples/00-Different-analysis-types/images/sphx_glr_02-modal-simulation_002.png :class: sphx-glr-multi-img * .. image-sg:: /examples/00-Different-analysis-types/images/sphx_glr_02-modal-simulation_003.png :alt: 02 modal simulation :srcset: /examples/00-Different-analysis-types/images/sphx_glr_02-modal-simulation_003.png :class: sphx-glr-multi-img * .. image-sg:: /examples/00-Different-analysis-types/images/sphx_glr_02-modal-simulation_004.png :alt: 02 modal simulation :srcset: /examples/00-Different-analysis-types/images/sphx_glr_02-modal-simulation_004.png :class: sphx-glr-multi-img * .. image-sg:: /examples/00-Different-analysis-types/images/sphx_glr_02-modal-simulation_005.png :alt: 02 modal simulation :srcset: /examples/00-Different-analysis-types/images/sphx_glr_02-modal-simulation_005.png :class: sphx-glr-multi-img * .. image-sg:: /examples/00-Different-analysis-types/images/sphx_glr_02-modal-simulation_006.png :alt: 02 modal simulation :srcset: /examples/00-Different-analysis-types/images/sphx_glr_02-modal-simulation_006.png :class: sphx-glr-multi-img .. rst-class:: sphx-glr-script-out .. code-block:: none results U_N (mm) set_ids 1 2 3 4 5 6 node_ids 367 1.3730e+00 1.8709e+00 2.0199e+00 2.2695e+00 2.9911e+00 1.2970e+00 509 1.9036e+00 2.5893e+00 2.5942e+00 3.0953e+00 4.0005e+00 1.2648e+00 428 1.0166e+00 1.4147e+00 1.5069e+00 1.8534e+00 2.3165e+00 7.5843e-01 510 1.0461e+00 1.4141e+00 1.4841e+00 1.8647e+00 2.2996e+00 8.1520e-01 3442 1.6226e+00 2.2226e+00 2.2954e+00 2.6685e+00 3.4864e+00 1.2905e+00 3755 1.4089e+00 1.9743e+00 1.9950e+00 2.4323e+00 3.1554e+00 9.2167e-01 ... ... ... ... ... ... ... .. GENERATED FROM PYTHON SOURCE LINES 56-58 Extract a selection of mode shapes and view them one by one ----------------------------------------------------------- .. GENERATED FROM PYTHON SOURCE LINES 58-66 .. code-block:: Python modes = [1, 2, 3] displacement_norm = simulation.displacement(modes=modes, norm=True) print(displacement_norm) for set_id in modes: displacement_norm.plot(set_ids=set_id) .. rst-class:: sphx-glr-horizontal * .. image-sg:: /examples/00-Different-analysis-types/images/sphx_glr_02-modal-simulation_007.png :alt: 02 modal simulation :srcset: /examples/00-Different-analysis-types/images/sphx_glr_02-modal-simulation_007.png :class: sphx-glr-multi-img * .. image-sg:: /examples/00-Different-analysis-types/images/sphx_glr_02-modal-simulation_008.png :alt: 02 modal simulation :srcset: /examples/00-Different-analysis-types/images/sphx_glr_02-modal-simulation_008.png :class: sphx-glr-multi-img * .. image-sg:: /examples/00-Different-analysis-types/images/sphx_glr_02-modal-simulation_009.png :alt: 02 modal simulation :srcset: /examples/00-Different-analysis-types/images/sphx_glr_02-modal-simulation_009.png :class: sphx-glr-multi-img .. rst-class:: sphx-glr-script-out .. code-block:: none results U_N (mm) set_ids 1 2 3 node_ids 367 1.3730e+00 1.8709e+00 2.0199e+00 509 1.9036e+00 2.5893e+00 2.5942e+00 428 1.0166e+00 1.4147e+00 1.5069e+00 510 1.0461e+00 1.4141e+00 1.4841e+00 3442 1.6226e+00 2.2226e+00 2.2954e+00 3755 1.4089e+00 1.9743e+00 1.9950e+00 ... ... ... ... .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 6.236 seconds) .. _sphx_glr_download_examples_00-Different-analysis-types_02-modal-simulation.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: 02-modal-simulation.ipynb <02-modal-simulation.ipynb>` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: 02-modal-simulation.py <02-modal-simulation.py>` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_