.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples\03-harmonic_analyses\01-modal_superposition.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-harmonic_analyses_01-modal_superposition.py: .. _ref_msup: Expand harmonic modal superposition with DPF ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Different types of linear dynamics expansions are implemented in DPF. With modal superposition used in harmonic analysis, modal coefficients are multiplied by mode shapes (of a previous modal analysis) to analyse a structure under given boundary conditions in a range of frequencies. Doing this expansion "on demand" in DPF instead of in the solver reduces the size of the result files. .. GENERATED FROM PYTHON SOURCE LINES 15-20 .. code-block:: Python from ansys.dpf import core as dpf from ansys.dpf.core import examples .. GENERATED FROM PYTHON SOURCE LINES 21-27 Create data sources ~~~~~~~~~~~~~~~~~~~ Create data sources with the mode shapes and the modal response. The expansion is recursive in DPF: first the modal response is read. Then, "upstream" mode shapes are found in the data sources, where they are read and expanded (mode shapes x modal response) .. GENERATED FROM PYTHON SOURCE LINES 27-35 .. code-block:: Python msup_files = examples.download_msup_files_to_dict() data_sources = dpf.DataSources(msup_files["rfrq"]) up_stream_data_sources = dpf.DataSources(msup_files["mode"]) up_stream_data_sources.add_file_path(msup_files["rst"]) data_sources.add_upstream(up_stream_data_sources) .. GENERATED FROM PYTHON SOURCE LINES 36-41 Compute displacements ~~~~~~~~~~~~~~~~~~~~~ Once the ``add_upstream()`` method puts the recursivity in the data sources, in a harmonic, transient, or modal analysis, computing displacements with or without expansion has the exact same syntax. .. GENERATED FROM PYTHON SOURCE LINES 41-48 .. code-block:: Python model = dpf.Model(data_sources) disp = model.results.displacement.on_all_time_freqs.eval() freq_scoping = disp.get_time_scoping() for freq_set in freq_scoping: model.metadata.meshed_region.plot(disp.get_field_by_time_complex_ids(freq_set, 0)) .. rst-class:: sphx-glr-horizontal * .. image-sg:: /examples/03-harmonic_analyses/images/sphx_glr_01-modal_superposition_001.png :alt: 01 modal superposition :srcset: /examples/03-harmonic_analyses/images/sphx_glr_01-modal_superposition_001.png :class: sphx-glr-multi-img * .. image-sg:: /examples/03-harmonic_analyses/images/sphx_glr_01-modal_superposition_002.png :alt: 01 modal superposition :srcset: /examples/03-harmonic_analyses/images/sphx_glr_01-modal_superposition_002.png :class: sphx-glr-multi-img * .. image-sg:: /examples/03-harmonic_analyses/images/sphx_glr_01-modal_superposition_003.png :alt: 01 modal superposition :srcset: /examples/03-harmonic_analyses/images/sphx_glr_01-modal_superposition_003.png :class: sphx-glr-multi-img * .. image-sg:: /examples/03-harmonic_analyses/images/sphx_glr_01-modal_superposition_004.png :alt: 01 modal superposition :srcset: /examples/03-harmonic_analyses/images/sphx_glr_01-modal_superposition_004.png :class: sphx-glr-multi-img * .. image-sg:: /examples/03-harmonic_analyses/images/sphx_glr_01-modal_superposition_005.png :alt: 01 modal superposition :srcset: /examples/03-harmonic_analyses/images/sphx_glr_01-modal_superposition_005.png :class: sphx-glr-multi-img * .. image-sg:: /examples/03-harmonic_analyses/images/sphx_glr_01-modal_superposition_006.png :alt: 01 modal superposition :srcset: /examples/03-harmonic_analyses/images/sphx_glr_01-modal_superposition_006.png :class: sphx-glr-multi-img * .. image-sg:: /examples/03-harmonic_analyses/images/sphx_glr_01-modal_superposition_007.png :alt: 01 modal superposition :srcset: /examples/03-harmonic_analyses/images/sphx_glr_01-modal_superposition_007.png :class: sphx-glr-multi-img * .. image-sg:: /examples/03-harmonic_analyses/images/sphx_glr_01-modal_superposition_008.png :alt: 01 modal superposition :srcset: /examples/03-harmonic_analyses/images/sphx_glr_01-modal_superposition_008.png :class: sphx-glr-multi-img * .. image-sg:: /examples/03-harmonic_analyses/images/sphx_glr_01-modal_superposition_009.png :alt: 01 modal superposition :srcset: /examples/03-harmonic_analyses/images/sphx_glr_01-modal_superposition_009.png :class: sphx-glr-multi-img * .. image-sg:: /examples/03-harmonic_analyses/images/sphx_glr_01-modal_superposition_010.png :alt: 01 modal superposition :srcset: /examples/03-harmonic_analyses/images/sphx_glr_01-modal_superposition_010.png :class: sphx-glr-multi-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 12.756 seconds) .. _sphx_glr_download_examples_03-harmonic_analyses_01-modal_superposition.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: 01-modal_superposition.ipynb <01-modal_superposition.ipynb>` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: 01-modal_superposition.py <01-modal_superposition.py>` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_