.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples\15-cfx\00-cfx_res_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_15-cfx_00-cfx_res_files.py: .. _ref_cfx_res_files: Read CFX `.res` files --------------------- This example demonstrates how to read Ansys CFX `.res` files. .. note:: This example requires DPF 7.0 (ansys-dpf-server-2024-1-pre0) or above. For more information, see :ref:`ref_compatibility`. .. GENERATED FROM PYTHON SOURCE LINES 38-42 Exploring an Ansys CFX `.res` file ---------------------------------- The first part of the example demonstrates how you can load an Ansys CFX `.res` file in a model. .. GENERATED FROM PYTHON SOURCE LINES 42-50 .. code-block:: Python import ansys.dpf.core as dpf from ansys.dpf.core import examples path = examples.download_cfx_mixing_elbow() model = dpf.Model(path) print(model) .. rst-class:: sphx-glr-script-out .. code-block:: none DPF Model ------------------------------ Static analysis Unit system: SI: m, kg, N, s, V, A, K Physics Type: Fluid Available results: - specific_heat: Nodal Specific Heat - epsilon: Nodal Epsilon - enthalpy: Nodal Enthalpy - turbulent_kinetic_energy: Nodal Turbulent Kinetic Energy - thermal_conductivity: Nodal Thermal Conductivity - dynamic_viscosity: Nodal Dynamic Viscosity - turbulent_viscosity: Nodal Turbulent Viscosity - static_pressure: Nodal Static Pressure - total_pressure: Nodal Total Pressure - density: Nodal Density - entropy: Nodal Entropy - wall_shear_stress: Nodal Wall Shear Stress - temperature: Nodal Temperature - total_temperature: Nodal Total Temperature - velocity: Nodal Velocity Available qualifier labels: - zone: Default (5), main inlet (6), side inlet (7), outlet (8), Default 1 (1) - phase: (1), Water at 25 C (2) ------------------------------ DPF Meshed Region: 6219 nodes 15695 elements Unit: m With solid (3D) elements ------------------------------ DPF Time/Freq Support: Number of sets: 1 Cumulative Frequency () LoadStep Substep 1 0.000000 1 1 .. GENERATED FROM PYTHON SOURCE LINES 51-57 Exploring the mesh ~~~~~~~~~~~~~~~~~~ Explore the mesh through the ``MeshInfo``. The ``MeshInfo`` provides metadata information about the mesh. For fluid models, it is useful to know the bodies and face zones, as well as the topological relationships between them. First get all the available information in the ``MeshInfo``. .. GENERATED FROM PYTHON SOURCE LINES 57-60 .. code-block:: Python mesh_info = model.metadata.mesh_info print(mesh_info) .. rst-class:: sphx-glr-script-out .. code-block:: none DPF MeshInfo ------------------------------ with properties: num_nodes int num_cells int body_names StringField body_cell_topology PropertyField num_faces int body_face_topology PropertyField body_scoping Scoping cell_zone_names StringField cell_zone_elements PropertyField face_zone_names StringField cell_zone_scoping Scoping face_zone_elements PropertyField face_zone_scoping Scoping zone_names StringField num_elem_zone PropertyField zone_scoping Scoping splittable_by StringField .. GENERATED FROM PYTHON SOURCE LINES 61-62 The ``MeshInfo`` exposes several helpers, such as a dictionary of available bodies: .. GENERATED FROM PYTHON SOURCE LINES 62-64 .. code-block:: Python print(mesh_info.bodies) .. rst-class:: sphx-glr-script-out .. code-block:: none {'1': 'Default 1'} .. GENERATED FROM PYTHON SOURCE LINES 65-66 Or the dictionary of available face zones: .. GENERATED FROM PYTHON SOURCE LINES 66-68 .. code-block:: Python print(mesh_info.face_zones) .. rst-class:: sphx-glr-script-out .. code-block:: none {'5': 'Default', '6': 'main inlet', '7': 'side inlet', '8': 'outlet'} .. GENERATED FROM PYTHON SOURCE LINES 69-75 Exploring the results ~~~~~~~~~~~~~~~~~~~~~ Explore the available results through the ``ResultInfo``. The ``ResultInfo`` provides metadata information about the results stored in the files. First get all the available information in the ``ResultInfo``. As you can see above, the ``ResultInfo`` information is also listed when printing the ``Model``. .. GENERATED FROM PYTHON SOURCE LINES 75-78 .. code-block:: Python result_info = model.metadata.result_info print(result_info) .. rst-class:: sphx-glr-script-out .. code-block:: none Static analysis Unit system: SI: m, kg, N, s, V, A, K Physics Type: Fluid Available results: - specific_heat: Nodal Specific Heat - epsilon: Nodal Epsilon - enthalpy: Nodal Enthalpy - turbulent_kinetic_energy: Nodal Turbulent Kinetic Energy - thermal_conductivity: Nodal Thermal Conductivity - dynamic_viscosity: Nodal Dynamic Viscosity - turbulent_viscosity: Nodal Turbulent Viscosity - static_pressure: Nodal Static Pressure - total_pressure: Nodal Total Pressure - density: Nodal Density - entropy: Nodal Entropy - wall_shear_stress: Nodal Wall Shear Stress - temperature: Nodal Temperature - total_temperature: Nodal Total Temperature - velocity: Nodal Velocity Available qualifier labels: - zone: Default (5), main inlet (6), side inlet (7), outlet (8), Default 1 (1) - phase: (1), Water at 25 C (2) .. GENERATED FROM PYTHON SOURCE LINES 79-80 The ``ResultInfo`` class exposes the list of ``AvailableResults``. .. GENERATED FROM PYTHON SOURCE LINES 80-82 .. code-block:: Python print(result_info.available_results) .. rst-class:: sphx-glr-script-out .. code-block:: none [AvailableResult, AvailableResult, AvailableResult, AvailableResult, AvailableResult, AvailableResult, AvailableResult, AvailableResult, AvailableResult, AvailableResult, AvailableResult, AvailableResult, AvailableResult, AvailableResult, AvailableResult] .. GENERATED FROM PYTHON SOURCE LINES 83-86 Extracting data ~~~~~~~~~~~~~~~ Extracting the mesh or results is then the same as for any other file type. .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.889 seconds) .. _sphx_glr_download_examples_15-cfx_00-cfx_res_files.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: 00-cfx_res_files.ipynb <00-cfx_res_files.ipynb>` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: 00-cfx_res_files.py <00-cfx_res_files.py>` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: 00-cfx_res_files.zip <00-cfx_res_files.zip>` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_