Skip to content

Commit dc3e238

Browse files
update the extract_mesh_in_split_parts.rst to the tutorials guidelines
1 parent 6dbd1c1 commit dc3e238

File tree

2 files changed

+118
-106
lines changed

2 files changed

+118
-106
lines changed
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
.. _ref_tutorials_extract_mesh_in_split_parts:
2+
3+
=============================
4+
Extract a mesh in split parts
5+
=============================
6+
7+
:bdg-fluent:`Fluent` :bdg-cfx:`CFX`
8+
9+
.. include:: ../../../links_and_refs.rst
10+
.. |MeshesContainer| replace:: :class:`MeshesContainer <ansys.dpf.core.meshes_container.MeshesContainer>`
11+
.. |meshes_provider| replace:: :class:`mesh_provider <ansys.dpf.core.operators.mesh.mesh_provider.mesh_provider>`
12+
13+
This tutorial shows how to extract meshes split on a given space or time from a result file.
14+
15+
To accomplish this goal, you must use the |meshes_provider| operator.
16+
17+
:jupyter-download-script:`Download tutorial as Python script<extract_mesh_in_split_parts>`
18+
:jupyter-download-notebook:`Download tutorial as Jupyter notebook<extract_mesh_in_split_parts>`
19+
20+
Define the |DataSources|
21+
------------------------
22+
23+
We must create a |DataSources| object so the |meshes_provider| operator can access the mesh. This object
24+
manages paths to their files.
25+
26+
For this tutorial, you can use a result file available in the |Examples| module.
27+
For more information about how to import your own result file in DPF, see the :ref:`ref_tutorials_import_data`
28+
tutorial section.
29+
30+
.. tab-set::
31+
32+
.. tab-item:: Fluent
33+
34+
.. jupyter-execute::
35+
36+
# Import the ``ansys.dpf.core`` module
37+
from ansys.dpf import core as dpf
38+
# Import the examples module
39+
from ansys.dpf.core import examples
40+
# Import the operators module
41+
from ansys.dpf.core import operators as ops
42+
43+
# Define the result file path
44+
result_file_path_3 = examples.download_fluent_axial_comp()["flprj"]
45+
# Create the DataSources object
46+
ds_3 = dpf.DataSources(result_path=result_file_path_3)
47+
48+
.. tab-item:: CFX
49+
50+
.. jupyter-execute::
51+
52+
# Import the ``ansys.dpf.core`` module
53+
from ansys.dpf import core as dpf
54+
# Import the examples module
55+
from ansys.dpf.core import examples
56+
# Import the operators module
57+
from ansys.dpf.core import operators as ops
58+
59+
# Define the result file path
60+
result_file_path_4 = examples.download_cfx_mixing_elbow()
61+
# Create the DataSources object
62+
ds_4 = dpf.DataSources(result_path=result_file_path_4)
63+
64+
Extract the mesh in split parts
65+
-------------------------------
66+
67+
Instanciate and evaluate the |meshes_provider| operator.
68+
The split meshes are given in a |MeshesContainer| and can be spatially or temporally varying.
69+
70+
.. tab-set::
71+
72+
.. tab-item:: Fluent
73+
74+
.. jupyter-execute::
75+
76+
# Instanciate the meshes_provider operator
77+
meshes_31 = ops.mesh.meshes_provider(data_sources=ds_3).eval()
78+
79+
# Print the meshes
80+
print(meshes_31)
81+
82+
.. tab-item:: CFX
83+
84+
.. jupyter-execute::
85+
86+
# Instanciate the meshes_provider operator
87+
meshes_41 = ops.mesh.meshes_provider(data_sources=ds_4).eval()
88+
89+
# Print the meshes
90+
print(meshes_41)
91+
92+
Scope the mesh regions to be extracted in split parts
93+
-----------------------------------------------------
94+
95+
A region corresponds to a zone for Fluid and CFX results. You can specify the mesh regions you want to get by giving
96+
the zones ids to the ``region_scoping`` argument.
97+
98+
.. tab-set::
99+
100+
.. tab-item:: Fluent
101+
102+
.. jupyter-execute::
103+
104+
# Instanciate the meshes_provider operator and specify a region
105+
meshes_32 = ops.mesh.meshes_provider(data_sources=ds_3, region_scoping=[3,12]).eval()
106+
107+
# Print the meshes
108+
print(meshes_32)
109+
110+
.. tab-item:: CFX
111+
112+
.. jupyter-execute::
113+
114+
# Instanciate the meshes_provider operator specifying a region
115+
meshes_42 = ops.mesh.meshes_provider(data_sources=ds_4, region_scoping=[5,8]).eval()
116+
117+
# Print the meshes
118+
print(meshes_42)

doc/source/user_guide/tutorials/mesh/get_specific_part_mesh.rst

Lines changed: 0 additions & 106 deletions
This file was deleted.

0 commit comments

Comments
 (0)