|
64 | 64 | ############################################################################### |
65 | 65 | # Evaluate iso-surfaces |
66 | 66 | # ~~~~~~~~~~~~~~ |
67 | | -# We can finally use the mesh_cut operator on this specific variable. |
68 | | -# We choose to cut the whole with 5 iso-surface equally spaced between min and max. |
69 | | - |
70 | | -max_pressure = 361.8170 # Pa |
71 | | -min_pressure = -153.5356 # Pa |
72 | | -number_of_iso_surface = 5 |
73 | | -step = (max_pressure - min_pressure) / number_of_iso_surface |
| 67 | +# We can finally use the iso_surfaces operator on this specific variable. |
| 68 | +# We choose to cut the whole mesh with 9 iso-surface manually selected between |
| 69 | +# the min and max of the static_pressure variable. |
74 | 70 |
|
75 | 71 | pl = DpfPlotter() |
76 | 72 | c_pos_iso = [ |
|
87 | 83 | opacity=0.3, |
88 | 84 | ) |
89 | 85 |
|
90 | | -for i in range(number_of_iso_surface): |
91 | | - iso_surface = dpf.operators.mesh.mesh_cut( |
92 | | - field=P_S[0], iso_value=min_pressure, closed_surface=0, mesh=whole_mesh, slice_surfaces=True |
93 | | - ).eval() |
94 | | - P_S_step = dpf.Field(location=dpf.locations.overall, nature=dpf.common.natures.scalar) |
95 | | - P_S_step.append([min_pressure], i) |
96 | | - P_S_step.name = "static pressure" |
97 | | - P_S_step.unit = "Pa" |
| 86 | +vec_iso_values = [-153.6, -100.0, -50.0, 50.0, 100.0, 150.0, 200.0, 300.0, 361.8] |
| 87 | + |
| 88 | +iso_surfaces_op = dpf.operators.mesh.iso_surfaces(field=P_S[0], mesh=whole_mesh, slice_surfaces=True, |
| 89 | + vector_iso_values=vec_iso_values) |
| 90 | + |
| 91 | +iso_surfaces_meshes = iso_surfaces_op.outputs.meshes() |
| 92 | + |
| 93 | +iso_surfaces_fields = iso_surfaces_op.outputs.fields_container() |
| 94 | + |
| 95 | +for i in range(len(iso_surfaces_fields)): |
98 | 96 | pl.add_field( |
99 | | - field=P_S_step, meshed_region=iso_surface, style="surface", show_edges=False, show_axes=True |
| 97 | + field=iso_surfaces_fields[i], meshed_region=iso_surfaces_meshes[i], style="surface", show_edges=False, |
| 98 | + show_axes=True |
100 | 99 | ) |
101 | | - min_pressure += step |
102 | 100 |
|
103 | 101 | pl.show_figure(show_axes=True, cpos=c_pos_iso) |
104 | 102 |
|
|
0 commit comments