.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "tutorials\mesh\extract_mesh_in_split_parts.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_tutorials_mesh_extract_mesh_in_split_parts.py: .. _ref_tutorials_extract_mesh_in_split_parts: Extract a mesh in split parts ============================== :bdg-fluent:`Fluent` :bdg-cfx:`CFX` This tutorial shows how to extract meshes split on a given space or time from a result file. To accomplish this goal, use the :class:`meshes_provider` operator. The split meshes are given in a :class:`MeshesContainer` and can be spatially or temporally varying. .. GENERATED FROM PYTHON SOURCE LINES 42-44 Import the necessary modules ----------------------------- .. GENERATED FROM PYTHON SOURCE LINES 44-48 .. code-block:: Python from ansys.dpf import core as dpf from ansys.dpf.core import examples, operators as ops .. GENERATED FROM PYTHON SOURCE LINES 49-57 Define the ``DataSources`` -------------------------- Create :class:`DataSources` objects so the ``meshes_provider`` operator can access the mesh. For this tutorial, use result files available in the :mod:`examples` module. For more information on importing result files, see the :ref:`ref_tutorials_import_data` tutorials section. .. GENERATED FROM PYTHON SOURCE LINES 57-66 .. code-block:: Python # Fluent result_file_path_3 = examples.download_fluent_axial_comp()["flprj"] ds_3 = dpf.DataSources(result_path=result_file_path_3) # CFX result_file_path_4 = examples.download_cfx_mixing_elbow() ds_4 = dpf.DataSources(result_path=result_file_path_4) .. GENERATED FROM PYTHON SOURCE LINES 67-71 Extract all mesh parts — Fluent -------------------------------- Instantiate and evaluate the ``meshes_provider`` operator. .. GENERATED FROM PYTHON SOURCE LINES 71-75 .. code-block:: Python meshes_31 = ops.mesh.meshes_provider(data_sources=ds_3).eval() print(meshes_31) .. rst-class:: sphx-glr-script-out .. code-block:: none DPF Meshes Container with 24 mesh(es) defined on labels: time zone with: - mesh 0 {time: 1, zone: 3, } with 429 nodes and 0 elements. - mesh 1 {time: 1, zone: 4, } with 429 nodes and 0 elements. - mesh 2 {time: 1, zone: 5, } with 187 nodes and 0 elements. - mesh 3 {time: 1, zone: 6, } with 187 nodes and 0 elements. - mesh 4 {time: 1, zone: 7, } with 425 nodes and 0 elements. - mesh 5 {time: 1, zone: 8, } with 425 nodes and 0 elements. - mesh 6 {time: 1, zone: 9, } with 204 nodes and 0 elements. - mesh 7 {time: 1, zone: 10, } with 204 nodes and 0 elements. - mesh 8 {time: 1, zone: 11, } with 68 nodes and 0 elements. - mesh 9 {time: 1, zone: 12, } with 68 nodes and 0 elements. - mesh 10 {time: 1, zone: 13, } with 7293 nodes and 6080 elements. - mesh 11 {time: 1, zone: 16, } with 551 nodes and 0 elements. - mesh 12 {time: 1, zone: 17, } with 551 nodes and 0 elements. - mesh 13 {time: 1, zone: 18, } with 323 nodes and 0 elements. - mesh 14 {time: 1, zone: 19, } with 323 nodes and 0 elements. - mesh 15 {time: 1, zone: 20, } with 357 nodes and 0 elements. - mesh 16 {time: 1, zone: 21, } with 357 nodes and 0 elements. - mesh 17 {time: 1, zone: 22, } with 357 nodes and 0 elements. - mesh 18 {time: 1, zone: 23, } with 357 nodes and 0 elements. - mesh 19 {time: 1, zone: 24, } with 68 nodes and 0 elements. - mesh 20 {time: 1, zone: 25, } with 68 nodes and 0 elements. - mesh 21 {time: 1, zone: 26, } with 85 nodes and 0 elements. - mesh 22 {time: 1, zone: 27, } with 85 nodes and 0 elements. - mesh 23 {time: 1, zone: 28, } with 9367 nodes and 7776 elements. .. GENERATED FROM PYTHON SOURCE LINES 76-77 Extract all mesh parts — CFX .. GENERATED FROM PYTHON SOURCE LINES 77-81 .. code-block:: Python meshes_41 = ops.mesh.meshes_provider(data_sources=ds_4).eval() print(meshes_41) .. rst-class:: sphx-glr-script-out .. code-block:: none DPF Meshes Container with 5 mesh(es) defined on labels: time zone with: - mesh 0 {time: 1, zone: 5, } with 921 nodes and 0 elements. - mesh 1 {time: 1, zone: 6, } with 102 nodes and 0 elements. - mesh 2 {time: 1, zone: 7, } with 48 nodes and 0 elements. - mesh 3 {time: 1, zone: 8, } with 102 nodes and 0 elements. - mesh 4 {time: 1, zone: 1, } with 6219 nodes and 15695 elements. .. GENERATED FROM PYTHON SOURCE LINES 82-87 Scope the mesh regions to extract — Fluent ------------------------------------------- A region corresponds to a zone for Fluid and CFX results. Specify the mesh regions you want to get by passing zone ids to the ``region_scoping`` argument. .. GENERATED FROM PYTHON SOURCE LINES 87-91 .. code-block:: Python meshes_32 = ops.mesh.meshes_provider(data_sources=ds_3, region_scoping=[3, 12]).eval() print(meshes_32) .. rst-class:: sphx-glr-script-out .. code-block:: none DPF Meshes Container with 2 mesh(es) defined on labels: time zone with: - mesh 0 {time: 1, zone: 3, } with 429 nodes and 0 elements. - mesh 1 {time: 1, zone: 12, } with 68 nodes and 0 elements. .. GENERATED FROM PYTHON SOURCE LINES 92-93 Scope the mesh regions to extract — CFX .. GENERATED FROM PYTHON SOURCE LINES 93-96 .. code-block:: Python meshes_42 = ops.mesh.meshes_provider(data_sources=ds_4, region_scoping=[5, 8]).eval() print(meshes_42) .. rst-class:: sphx-glr-script-out .. code-block:: none DPF Meshes Container with 2 mesh(es) defined on labels: time zone with: - mesh 0 {time: 1, zone: 5, } with 921 nodes and 0 elements. - mesh 1 {time: 1, zone: 8, } with 102 nodes and 0 elements. .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 20.509 seconds) .. _sphx_glr_download_tutorials_mesh_extract_mesh_in_split_parts.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: extract_mesh_in_split_parts.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: extract_mesh_in_split_parts.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: extract_mesh_in_split_parts.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_