.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples\04-advanced\12-read_distributed_files.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_04-advanced_12-read_distributed_files.py: .. _ref_distributed_files: Read results from distributed files ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Solvers usually solve analysis with distributed architecture. In this case, one file is written by spatial or temporal domains. DPF is capable of reading one result in distributed files. This allows it to skip the merging of files on the solver side, which is time-consuming and often doubles the memory used. .. GENERATED FROM PYTHON SOURCE LINES 13-17 .. code-block:: Python from ansys.dpf import core as dpf from ansys.dpf.core import examples .. GENERATED FROM PYTHON SOURCE LINES 18-21 Create the data sources ~~~~~~~~~~~~~~~~~~~~~~~ First create a data sources with one result file by domain .. GENERATED FROM PYTHON SOURCE LINES 21-27 .. code-block:: Python distributed_file_path = examples.download_distributed_files() data_sources = dpf.DataSources() data_sources.set_domain_result_file_path(distributed_file_path[0], 0) data_sources.set_domain_result_file_path(distributed_file_path[1], 1) .. GENERATED FROM PYTHON SOURCE LINES 28-35 Compute displacements ~~~~~~~~~~~~~~~~~~~~~ Once the file architecture is put in the data sources, computing displacements with or without domain has the exact same syntax. DPF reads parts of the result on each domain and merges these results in the outputs fields. The output is no different than when using combined or distributed files. .. GENERATED FROM PYTHON SOURCE LINES 35-43 .. 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/04-advanced/images/sphx_glr_12-read_distributed_files_001.png :alt: 12 read distributed files :srcset: /examples/04-advanced/images/sphx_glr_12-read_distributed_files_001.png :class: sphx-glr-multi-img * .. image-sg:: /examples/04-advanced/images/sphx_glr_12-read_distributed_files_002.png :alt: 12 read distributed files :srcset: /examples/04-advanced/images/sphx_glr_12-read_distributed_files_002.png :class: sphx-glr-multi-img * .. image-sg:: /examples/04-advanced/images/sphx_glr_12-read_distributed_files_003.png :alt: 12 read distributed files :srcset: /examples/04-advanced/images/sphx_glr_12-read_distributed_files_003.png :class: sphx-glr-multi-img * .. image-sg:: /examples/04-advanced/images/sphx_glr_12-read_distributed_files_004.png :alt: 12 read distributed files :srcset: /examples/04-advanced/images/sphx_glr_12-read_distributed_files_004.png :class: sphx-glr-multi-img * .. image-sg:: /examples/04-advanced/images/sphx_glr_12-read_distributed_files_005.png :alt: 12 read distributed files :srcset: /examples/04-advanced/images/sphx_glr_12-read_distributed_files_005.png :class: sphx-glr-multi-img * .. image-sg:: /examples/04-advanced/images/sphx_glr_12-read_distributed_files_006.png :alt: 12 read distributed files :srcset: /examples/04-advanced/images/sphx_glr_12-read_distributed_files_006.png :class: sphx-glr-multi-img .. GENERATED FROM PYTHON SOURCE LINES 44-46 Compute equivalent stress ~~~~~~~~~~~~~~~~~~~~~~~~~ .. GENERATED FROM PYTHON SOURCE LINES 46-53 .. code-block:: Python stress_res = model.results.stress stress_res.on_location(dpf.locations.nodal) stress = stress_res.on_all_time_freqs.eval() freq_scoping = stress.get_time_scoping() for freq_set in freq_scoping: model.metadata.meshed_region.plot(stress.get_field_by_time_complex_ids(freq_set, 0)) .. rst-class:: sphx-glr-horizontal * .. image-sg:: /examples/04-advanced/images/sphx_glr_12-read_distributed_files_007.png :alt: 12 read distributed files :srcset: /examples/04-advanced/images/sphx_glr_12-read_distributed_files_007.png :class: sphx-glr-multi-img * .. image-sg:: /examples/04-advanced/images/sphx_glr_12-read_distributed_files_008.png :alt: 12 read distributed files :srcset: /examples/04-advanced/images/sphx_glr_12-read_distributed_files_008.png :class: sphx-glr-multi-img * .. image-sg:: /examples/04-advanced/images/sphx_glr_12-read_distributed_files_009.png :alt: 12 read distributed files :srcset: /examples/04-advanced/images/sphx_glr_12-read_distributed_files_009.png :class: sphx-glr-multi-img * .. image-sg:: /examples/04-advanced/images/sphx_glr_12-read_distributed_files_010.png :alt: 12 read distributed files :srcset: /examples/04-advanced/images/sphx_glr_12-read_distributed_files_010.png :class: sphx-glr-multi-img * .. image-sg:: /examples/04-advanced/images/sphx_glr_12-read_distributed_files_011.png :alt: 12 read distributed files :srcset: /examples/04-advanced/images/sphx_glr_12-read_distributed_files_011.png :class: sphx-glr-multi-img * .. image-sg:: /examples/04-advanced/images/sphx_glr_12-read_distributed_files_012.png :alt: 12 read distributed files :srcset: /examples/04-advanced/images/sphx_glr_12-read_distributed_files_012.png :class: sphx-glr-multi-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 16.685 seconds) .. _sphx_glr_download_examples_04-advanced_12-read_distributed_files.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: 12-read_distributed_files.ipynb <12-read_distributed_files.ipynb>` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: 12-read_distributed_files.py <12-read_distributed_files.py>` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: 12-read_distributed_files.zip <12-read_distributed_files.zip>` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_