Note
Go to the end to download the full example code.
Explore a mesh metadata#
LSDYNA Fluent CFX
Note
This tutorial requires DPF 9.1 or above (2025 R1).
This tutorial explains how to read mesh metadata (data about the elements, nodes, faces, regions, zones, …) before extracting the mesh from a result file.
The mesh metadata information is stored in a
PropertyField or in a
StringField. It describes the
mesh composition and is mapped to the entity it is defined at. Available metadata
includes:
Properties, parts, faces, bodies, zones
Number of nodes and elements
Element types
Import the necessary modules#
from ansys.dpf import core as dpf
from ansys.dpf.core import examples
LS-DYNA — explore mesh metadata#
Import the result file and create the
Model.
result_file_path_2 = examples.download_d3plot_beam()
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")
model_2 = dpf.Model(data_sources=ds_2)
Access the MeshInfo object to
explore available metadata before extracting the mesh.
mesh_info_2 = model_2.metadata.mesh_info
print(mesh_info_2)
DPF MeshInfo
------------------------------
with properties:
part_names StringField
part_scoping Scoping
Extract specific metadata — here the part names.
cell_zones_2 = mesh_info_2.get_property("part_names")
print(cell_zones_2)
DPF String Field
2 part entities
Data:2 elementary data
part
IDs data
------------ ----------
1
2 ball
Fluent — explore mesh metadata#
result_file_path_3 = examples.download_fluent_axial_comp()["flprj"]
model_3 = dpf.Model(data_sources=result_file_path_3)
mesh_info_3 = model_3.metadata.mesh_info
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
Extract the cell zone names.
cell_zones_3 = mesh_info_3.get_property("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
CFX — explore mesh metadata#
result_file_path_4 = examples.download_cfx_mixing_elbow()
model_4 = dpf.Model(data_sources=result_file_path_4)
mesh_info_4 = model_4.metadata.mesh_info
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
Extract the cell zone names.
cell_zones_4 = mesh_info_4.get_property("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
Total running time of the script: (0 minutes 1.995 seconds)