|
34 | 34 | # ~~~~~~~~~~~~~~~~~~~
|
35 | 35 | # Create plane passing through the mid point
|
36 | 36 | plane1 = Plane(
|
37 |
| - [0.015, 0.045, 0.015], |
38 |
| - [1, 1, 0], |
| 37 | + center=[0.015, 0.045, 0.015], |
| 38 | + normal=[1, 1, 0], |
39 | 39 | width=0.03,
|
40 | 40 | height=0.03,
|
41 | 41 | n_cells_x=10,
|
42 | 42 | n_cells_y=10,
|
43 | 43 | )
|
44 | 44 |
|
45 | 45 | plane2 = Plane(
|
46 |
| - [0.015, 0.045, 0.015], |
47 |
| - [1, 1, 1], |
| 46 | + center=[0.015, 0.045, 0.015], |
| 47 | + normal=[1, 1, 1], |
48 | 48 | width=0.03,
|
49 | 49 | height=0.03,
|
50 | 50 | n_cells_x=10,
|
|
69 | 69 | plane1.plot(mesh, cpos=cpos)
|
70 | 70 | plane2.plot(mesh, cpos=cpos)
|
71 | 71 |
|
| 72 | +############################################################################### |
| 73 | +# Get plane's properties |
| 74 | +print(f"Center of the plane = {plane1.center}") |
| 75 | +print(f"Normal direction of the plane = {plane1.normal_dir}") |
| 76 | +print(f"Number of cells in the x axis to discretize the plane = {plane1.n_cells_x}") |
| 77 | +print(f"Number of cells in the y axis to discretize the plane = {plane1.n_cells_y}") |
| 78 | +print(f"Height of the discretized plane = {plane1.height}") |
| 79 | +print(f"Width of the discretized plane = {plane1.width}") |
| 80 | + |
72 | 81 | ###############################################################################
|
73 | 82 | # Map displacements to plane
|
74 | 83 | # ~~~~~~~~~~~~~~~~~~~~~~~~~~
|
75 | 84 | # Map displacement field to points in plane object using
|
76 |
| -# :class:`on_coordinates <ansys.dpf.core.operators.mapping.on_coordinates.on_coordinates>:` |
| 85 | +# :class:`on_coordinates <ansys.dpf.core.operators.mapping.on_coordinates.on_coordinates>` |
77 | 86 | disp = model.results.displacement
|
78 | 87 | mapping_operator = ops.mapping.on_coordinates(
|
79 | 88 | fields_container=disp,
|
|
91 | 100 | # Extract the only field (0th entry) available in ``disp_plane1_fc`` FieldsContainer
|
92 | 101 | field_plane1 = disp_plane1_fc[0]
|
93 | 102 |
|
| 103 | +############################################################################### |
| 104 | +# Repeat process for plane2 |
94 | 105 | mapping_operator = ops.mapping.on_coordinates(
|
95 | 106 | fields_container=disp,
|
96 | 107 | coordinates=plane2.mesh.nodes.coordinates_field,
|
97 | 108 | create_support=True,
|
98 | 109 | mesh=mesh,
|
99 | 110 | )
|
100 | 111 | disp_plane2_fc = mapping_operator.outputs.fields_container()
|
101 |
| - |
102 |
| -############################################################################### |
103 |
| -# Print ``disp_plane2_fc`` information |
104 |
| -print(disp_plane2_fc) |
105 |
| - |
106 |
| -############################################################################### |
107 |
| -# Extract the only field (0th entry) available in ``disp_plane2_fc`` FieldsContainer |
108 | 112 | field_plane2 = disp_plane2_fc[0]
|
109 | 113 |
|
110 | 114 | ###############################################################################
|
|
134 | 138 | # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
135 | 139 | # Obtain the levelset of the plane with respect to the mesh using
|
136 | 140 | # :class:`make_plane_levelset <ansys.dpf.core.operators.mesh.make_plane_levelset.
|
137 |
| -# make_plane_levelset>`: |
| 141 | +# make_plane_levelset>` |
138 | 142 | # A levelset is a scalar Field representing the normal distance between the plane
|
139 | 143 | # and the nodes of the mesh.
|
140 | 144 | # Note that origin and normal must be ``dpf.locations.overall`` 3D vectors.
|
|
171 | 175 | ###############################################################################
|
172 | 176 | # Compute intersection plane / mesh
|
173 | 177 | # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
174 |
| -# Use the :class:`mesh_cut <ansys.dpf.core.operators.mesh.mesh_cut.mesh_cut>`: |
| 178 | +# Use the :class:`mesh_cut <ansys.dpf.core.operators.mesh.mesh_cut.mesh_cut>` |
175 | 179 | # operator to obtain the intersection of the plane with the mesh from the levelset
|
176 | 180 | mesh_cutter_op = ops.mesh.mesh_cut()
|
177 | 181 | mesh_cutter_op.inputs.field.connect(levelset1)
|
178 | 182 | mesh_cutter_op.inputs.iso_value.connect(float(0))
|
179 | 183 | mesh_cutter_op.connect(2, 0)
|
180 |
| -# mesh_cutter_op.inputs.mesh.connect(mesh) |
181 | 184 | mesh_cutter_op.connect(3, mesh)
|
182 | 185 | mesh_cutter_op.inputs.slice_surfaces.connect(True)
|
183 | 186 | intersection1 = mesh_cutter_op.outputs.mesh()
|
|
186 | 189 | mesh_cutter_op.inputs.field.connect(levelset2)
|
187 | 190 | mesh_cutter_op.inputs.iso_value.connect(float(0))
|
188 | 191 | mesh_cutter_op.connect(2, 0)
|
189 |
| -# mesh_cutter_op.inputs.mesh.connect(mesh) |
190 | 192 | mesh_cutter_op.connect(3, mesh)
|
191 | 193 | mesh_cutter_op.inputs.slice_surfaces.connect(True)
|
192 | 194 | intersection2 = mesh_cutter_op.outputs.mesh()
|
|
0 commit comments