Explore a mesh metadata#
LSDYNA Fluent CFX
Note
This tutorial requires DPF 9.1 or above (2025 R1).
This tutorial explains how to read a mesh metadata (data about the elements, nodes, faces, region, zone …) before extracting the mesh from a result file.
Download tutorial as Python script
Download tutorial as Jupyter notebook
Get the result file#
First, import a result file. For this tutorial, you can use one available in the |Examples| module. For more information about how to import your own result file in DPF, see the Import Data tutorial section.
# Import the ``ansys.dpf.core`` module
from ansys.dpf import core as dpf
# Import the examples module
from ansys.dpf.core import examples
# Define the result file path
result_file_path_2 = examples.download_d3plot_beam()
# Import the ``ansys.dpf.core`` module
from ansys.dpf import core as dpf
# Import the examples module
from ansys.dpf.core import examples
# Define the result file path
result_file_path_3 = examples.download_fluent_axial_comp()["flprj"]
# Import the ``ansys.dpf.core`` module
from ansys.dpf import core as dpf
# Import the examples module
from ansys.dpf.core import examples
# Define the result file path
result_file_path_4 = examples.download_cfx_mixing_elbow()
Create the |Model|#
Create a |Model| object with the result file. The |Model| is a helper designed to give shortcuts to access the analysis results metadata and to instanciate results providers by opening a |DataSources| or a Streams.
# Create the DataSources object
ds_2 = dpf.DataSources()
ds_2.set_result_file_path(filepath=result_file_path_2[0], key="d3plot")
ds_2.add_file_path(filepath=result_file_path_2[3], key="actunits")
# Create the Model
model_2 = dpf.Model(data_sources=ds_2)
# Create the Model
model_3 = dpf.Model(data_sources=result_file_path_3)
# Create the Model
model_4 = dpf.Model(data_sources=result_file_path_4)
Explore the mesh metadata#
You can access the mesh metadata with the |MeshInfo| object. It reads the metadata information before extracting the |MeshedRegion| from the result file.
The mesh metadata information is stored in a |PropertyField| or in a |StringField|. They contain information that describes the mesh composition and their data is mapped to the entity they are defined at. The mesh metadata information information can be:
Properties
Parts
Faces
Bodies
Zones
Number of nodes and elements
Elements types
You can access which metadata information is available for a given result file.
# Get the mesh metadata information
mesh_info_2 = model_2.metadata.mesh_info
# Print the mesh metadata information
print(mesh_info_2)
DPF MeshInfo
------------------------------
with properties:
part_names StringField
part_scoping Scoping
# Get the mesh metadata information
mesh_info_3 = model_3.metadata.mesh_info
# Print the mesh metadata information
print(mesh_info_3)
DPF MeshInfo
------------------------------
with properties:
num_cells int
num_nodes int
num_faces int
body_names StringField
body_cell_topology PropertyField
body_face_topology PropertyField
body_scoping Scoping
cell_zone_names StringField
cell_zone_elements PropertyField
cell_zone_scoping Scoping
face_zone_names StringField
face_zone_elements PropertyField
face_zone_scoping Scoping
zone_names StringField
num_elem_zone PropertyField
zone_scoping Scoping
splittable_by StringField
# Get the mesh metadata information
mesh_info_4 = model_4.metadata.mesh_info
# Print the mesh metadata information
print(mesh_info_4)
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
You can also extract each of those mesh metadata information by manipulating the |MeshInfo| object properties.
For example, we can check the part names (for the LSDYNA result file) or the cell zone names (for the Fluent or CFX result files):
# Get the part names
cell_zones_2 = mesh_info_2.get_property("part_names")
# Print the part names
print(cell_zones_2)
DPF String Field
2 part entities
Data:2 elementary data
part
IDs data
------------ ----------
1
2 ball
# Get the cell zone names
cell_zones_3 = mesh_info_3.get_property("cell_zone_names")
# Print the cell zone names
print(cell_zones_3)
DPF String Field
2 zone entities
Data:2 elementary data
zone
IDs data
------------ ----------
13 fluid-rotor
28 fluid-stator
# Get the cell zone names
cell_zones_4 = mesh_info_4.get_property("cell_zone_names")
# Print the cell zone names
print(cell_zones_4)
DPF String Field
3 zone entities
Data:3 elementary data
zone
IDs data
------------ ----------
2 ZN1/ES1
3 ZN1/ES2
4 ZN1/ES3
For more information on reading a mesh from a LSDYNA, Fluent or CFX file check the LS-Dyna examples, Fluids examples and CFX examples examples sections.