Skip to content

Commit

Permalink
Revert "Update the iso_contours example using iso_surfaces operator (#…
Browse files Browse the repository at this point in the history
…1164)" (#1203)

This reverts commit a900a05.
  • Loading branch information
MichaelNale committed Oct 12, 2023
1 parent 7ad9470 commit 8605173
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions examples/12-fluids/03-fluids_isosurface.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,13 @@
###############################################################################
# Evaluate iso-surfaces
# ~~~~~~~~~~~~~~
# We can finally use the iso_surfaces operator on this specific variable.
# We choose to cut the whole mesh with 9 iso-surface manually selected between
# the min and max of the static_pressure variable.
# We can finally use the mesh_cut operator on this specific variable.
# We choose to cut the whole with 5 iso-surface equally spaced between min and max.

max_pressure = 361.8170 # Pa
min_pressure = -153.5356 # Pa
number_of_iso_surface = 5
step = (max_pressure - min_pressure) / number_of_iso_surface

pl = DpfPlotter()
c_pos_iso = [
Expand All @@ -83,20 +87,18 @@
opacity=0.3,
)

vec_iso_values = [-153.6, -100.0, -50.0, 50.0, 100.0, 150.0, 200.0, 300.0, 361.8]

iso_surfaces_op = dpf.operators.mesh.iso_surfaces(field=P_S[0], mesh=whole_mesh, slice_surfaces=True,
vector_iso_values=vec_iso_values)

iso_surfaces_meshes = iso_surfaces_op.outputs.meshes()

iso_surfaces_fields = iso_surfaces_op.outputs.fields_container()

for i in range(len(iso_surfaces_fields)):
for i in range(number_of_iso_surface):
iso_surface = dpf.operators.mesh.mesh_cut(
field=P_S[0], iso_value=min_pressure, closed_surface=0, mesh=whole_mesh, slice_surfaces=True
).eval()
P_S_step = dpf.Field(location=dpf.locations.overall, nature=dpf.common.natures.scalar)
P_S_step.append([min_pressure], i)
P_S_step.name = "static pressure"
P_S_step.unit = "Pa"
pl.add_field(
field=iso_surfaces_fields[i], meshed_region=iso_surfaces_meshes[i], style="surface", show_edges=False,
show_axes=True
field=P_S_step, meshed_region=iso_surface, style="surface", show_edges=False, show_axes=True
)
min_pressure += step

pl.show_figure(show_axes=True, cpos=c_pos_iso)

Expand Down

0 comments on commit 8605173

Please sign in to comment.