@@ -6,88 +6,98 @@ Read a mesh metadata
6
6
7
7
:bdg-lsdyna: `LSDYNA ` :bdg-fluent: `Fluent ` :bdg-cfx: `CFX `
8
8
9
- .. |MeshedRegion | replace :: :class: `MeshedRegion <ansys.dpf.core.meshed_region.MeshedRegion> `
10
- .. |Model | replace :: :class: `Model <ansys.dpf.core.model.Model> `
11
- .. |DataSources | replace :: :class: `Model <ansys.dpf.core.data_sources.DataSources> `
12
- .. |MeshInfo | replace :: :class: `MeshInfo <ansys.dpf.core.mesh_info.MeshInfo> `
13
- .. |Examples | replace :: :mod: `Examples<ansys.dpf.core.examples> `
9
+ .. include :: ../../../links_and_refs.rst
14
10
15
11
This tutorial explains how to read a mesh metadata (data about the elements, nodes, faces, region, zone ...)
16
- for LSDYNA, Fluent or CFX result files .
12
+ before extracting the mesh from a result file .
17
13
18
- The mesh object in DPF is a |MeshedRegion |. You can obtain a |MeshedRegion | by creating your
19
- own by scratch or by getting it from a result file. For more information check the
20
- :ref: `tutorials_create_a_mesh_from_scratch ` and :ref: `tutorials_get_mesh_from_result_file ` tutorials.
14
+ :jupyter-download-script: `Download tutorial as Python script<read_mesh_metadata> `
15
+ :jupyter-download-notebook: `Download tutorial as Jupyter notebook<read_mesh_metadata> `
21
16
22
- We have the | MeshInfo | object to read metadata information before extracting the | MeshedRegion |.
23
- You can obtain this object by creating a | Model | with a result file.
17
+ Get the result file
18
+ -------------------
24
19
25
- Define the |Model |
26
- ------------------
27
-
28
- Here we we will download result files available in our |Examples | package.
29
- For more information about how to import your result file in DPF check
30
- the :ref: `ref_tutorials_import_data ` tutorial section.
20
+ First, import a result file. For this tutorial, you can use one available in the |Examples | module.
21
+ For more information about how to import your own result file in DPF, see the :ref: `ref_tutorials_import_data `
22
+ tutorial section.
31
23
32
24
.. tab-set ::
33
25
34
26
.. tab-item :: LSDYNA
35
27
36
28
.. jupyter-execute ::
37
29
38
- # Import the ``ansys.dpf.core `` module, including examples files and the operators subpackage
30
+ # Import the ``ansys.dpf.core `` module
39
31
from ansys.dpf import core as dpf
32
+ # Import the examples module
40
33
from ansys.dpf.core import examples
41
- from ansys.dpf.core import operators as ops
42
- # Define the result file
34
+
35
+ # Define the result file path
43
36
result_file_path_2 = examples.download_d3plot_beam()
44
- # Create the DataSources object
45
- my_data_sources_2 = dpf.DataSources()
46
- my_data_sources_2.set_result_file_path(filepath=result_file_path_2[0], key="d3plot")
47
- my_data_sources_2.add_file_path(filepath=result_file_path_2[3], key="actunits")
48
- # Create the model
49
- my_model_2 = dpf.Model(data_sources=my_data_sources_2)
50
- # Get the mesh
51
- my_meshed_region_2 = my_model_2.metadata.meshed_region
52
37
53
38
.. tab-item :: Fluent
54
39
55
40
.. jupyter-execute ::
56
41
57
- # Import the ``ansys.dpf.core `` module, including examples files and the operators subpackage
42
+ # Import the ``ansys.dpf.core `` module
58
43
from ansys.dpf import core as dpf
44
+ # Import the examples module
59
45
from ansys.dpf.core import examples
60
- from ansys.dpf.core import operators as ops
61
- # Define the result file
46
+
47
+ # Define the result file path
62
48
result_file_path_3 = examples.download_fluent_axial_comp()["flprj"]
63
- # Create the model
64
- my_model_3 = dpf.Model(data_sources=result_file_path_3)
65
- # Get the mesh
66
- my_meshed_region_3 = my_model_3.metadata.meshed_region
67
49
68
50
.. tab-item :: CFX
69
51
70
52
.. jupyter-execute ::
71
53
72
- # Import the ``ansys.dpf.core `` module, including examples files and the operators subpackage
54
+ # Import the ``ansys.dpf.core `` module
73
55
from ansys.dpf import core as dpf
56
+ # Import the examples module
74
57
from ansys.dpf.core import examples
75
- from ansys.dpf.core import operators as ops
76
- # Define the result file
58
+
59
+ # Define the result file path
77
60
result_file_path_4 = examples.download_cfx_mixing_elbow()
78
- # Create the model
79
- my_model_4 = dpf.Model(data_sources=result_file_path_4)
80
- # Get the mesh
81
- my_meshed_region_4 = my_model_4.metadata.meshed_region
61
+
62
+ Create the |Model |
63
+ ------------------
64
+
65
+ Create a |Model | object with the result file. The |Model | is a helper designed to give shortcuts to
66
+ access the analysis results metadata and to instanciate results providers by opening a |DataSources | or a Streams.
67
+
68
+ .. tab-set ::
69
+
70
+ .. tab-item :: LSDYNA
71
+
72
+ .. jupyter-execute ::
73
+
74
+ # Create the DataSources object
75
+ ds_2 = dpf.DataSources()
76
+ ds_2.set_result_file_path(filepath=result_file_path_2[0], key="d3plot")
77
+ ds_2.add_file_path(filepath=result_file_path_2[3], key="actunits")
78
+ # Create the Model
79
+ model_2 = dpf.Model(data_sources=ds_2)
80
+
81
+ .. tab-item :: Fluent
82
+
83
+ .. jupyter-execute ::
84
+
85
+ # Create the Model
86
+ model_3 = dpf.Model(data_sources=result_file_path_3)
87
+
88
+ .. tab-item :: CFX
89
+
90
+ .. jupyter-execute ::
91
+
92
+ # Create the Model
93
+ model_4 = dpf.Model(data_sources=result_file_path_4)
82
94
83
95
Read the mesh metadata
84
96
----------------------
85
97
86
- The |Model | is a helper designed to give shortcuts to access the analysis results
87
- metadata, by opening a DataSources or a Streams, and to instanciate results provider
88
- for it.
98
+ You can access the mesh metadata with the |MeshInfo | object. It reads the metadata information before extracting
99
+ the MeshedRegion from the result file.
89
100
90
- From the |Model | you can access the |MeshedRegion | metadata information with the |MeshInfo | object.
91
101
The mesh metadata information includes :
92
102
93
103
- Properties;
@@ -98,7 +108,7 @@ The mesh metadata information includes :
98
108
- Number of nodes and elements;
99
109
- Elements types.
100
110
101
- Get the the mesh metadata information and print the available ones:
111
+ Get the the mesh metadata information and print the available ones.
102
112
103
113
.. tab-set ::
104
114
@@ -107,30 +117,34 @@ Get the the mesh metadata information and print the available ones:
107
117
.. jupyter-execute ::
108
118
109
119
# Get the mesh metadata information
110
- my_mesh_info_2 = my_model_2.metadata.mesh_info
120
+ mesh_info_2 = model_2.metadata.mesh_info
121
+
111
122
# Print the mesh metadata information
112
- print(my_mesh_info_2 )
123
+ print(mesh_info_2 )
113
124
114
125
.. tab-item :: Fluent
115
126
116
127
.. jupyter-execute ::
117
128
118
129
# Get the mesh metadata information
119
- my_mesh_info_3 = my_model_3.metadata.mesh_info
130
+ mesh_info_3 = model_3.metadata.mesh_info
131
+
120
132
# Print the mesh metadata information
121
- print(my_mesh_info_3 )
133
+ print(mesh_info_3 )
122
134
123
135
.. tab-item :: CFX
124
136
125
137
.. jupyter-execute ::
126
138
127
139
# Get the mesh metadata information
128
- my_mesh_info_4 = my_model_4.metadata.mesh_info
140
+ mesh_info_4 = model_4.metadata.mesh_info
141
+
129
142
# Print the mesh metadata information
130
- print(my_mesh_info_4 )
143
+ print(mesh_info_4 )
131
144
132
145
You can extract each of those mesh information by manipulating the |MeshInfo | object properties.
133
- For example we can check the part names (for the LSDYNA result file) or the cell zone names
146
+
147
+ For example, we can check the part names (for the LSDYNA result file) or the cell zone names
134
148
(for the Fluent or CFX result files):
135
149
136
150
.. tab-set ::
@@ -140,24 +154,30 @@ For example we can check the part names (for the LSDYNA result file) or the cell
140
154
.. jupyter-execute ::
141
155
142
156
# Get the part names
143
- my_cell_zones_2 = my_mesh_info_2.get_property("part_names")
144
- print(my_cell_zones_2)
157
+ cell_zones_2 = mesh_info_2.get_property("part_names")
158
+
159
+ # Print the part names
160
+ print(cell_zones_2)
145
161
146
162
.. tab-item :: Fluent
147
163
148
164
.. jupyter-execute ::
149
165
150
166
# Get the cell zone names
151
- my_cell_zones_3 = my_mesh_info_3.get_property("cell_zone_names")
152
- print(my_cell_zones_3)
167
+ cell_zones_3 = mesh_info_3.get_property("cell_zone_names")
168
+
169
+ # Print the cell zone names
170
+ print(cell_zones_3)
153
171
154
172
.. tab-item :: CFX
155
173
156
174
.. jupyter-execute ::
157
175
158
176
# Get the cell zone names
159
- my_cell_zones_4 = my_mesh_info_4.get_property("cell_zone_names")
160
- print(my_cell_zones_4)
177
+ cell_zones_4 = mesh_info_4.get_property("cell_zone_names")
178
+
179
+ # Print the cell zone names
180
+ print(cell_zones_4)
161
181
162
- For more information on reading a mesh from a LSDYNA, Fluent or CFX file check the examples sections:
163
- :ref: `examples_lsdyna `, :ref: ` fluids_examples ` and :ref: `examples_cfx `.
182
+ For more information on reading a mesh from a LSDYNA, Fluent or CFX file check the :ref: ` examples_lsdyna `,
183
+ :ref: `fluids_examples ` and :ref: `examples_cfx ` examples sections .
0 commit comments