|
64 | 64 | ############################################################################### |
65 | 65 | # Evaluate iso-surfaces |
66 | 66 | # ~~~~~~~~~~~~~~ |
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. |
| 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 |
70 | 74 |
|
71 | 75 | pl = DpfPlotter() |
72 | 76 | c_pos_iso = [ |
|
83 | 87 | opacity=0.3, |
84 | 88 | ) |
85 | 89 |
|
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)): |
| 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" |
96 | 98 | pl.add_field( |
97 | | - field=iso_surfaces_fields[i], meshed_region=iso_surfaces_meshes[i], style="surface", show_edges=False, |
98 | | - show_axes=True |
| 99 | + field=P_S_step, meshed_region=iso_surface, style="surface", show_edges=False, show_axes=True |
99 | 100 | ) |
| 101 | + min_pressure += step |
100 | 102 |
|
101 | 103 | pl.show_figure(show_axes=True, cpos=c_pos_iso) |
102 | 104 |
|
|
0 commit comments