Skip to content

Commit

Permalink
Merge branch 'master' into ci/switch_release_to_2024_2_pre0
Browse files Browse the repository at this point in the history
  • Loading branch information
PProfizi authored Feb 14, 2024
2 parents e83003e + cb49fad commit c6a6f6c
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 18 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 ANSYS, Inc. All rights reserved.
Copyright (c) 2024 ANSYS, Inc. All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
32 changes: 15 additions & 17 deletions examples/12-fluids/03-fluids_isosurface.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,9 @@
###############################################################################
# Evaluate iso-surfaces
# ~~~~~~~~~~~~~~
# 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
# 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.

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

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"
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)):
pl.add_field(
field=P_S_step, meshed_region=iso_surface, style="surface", show_edges=False, show_axes=True
field=iso_surfaces_fields[i], meshed_region=iso_surfaces_meshes[i], style="surface", show_edges=False,
show_axes=True
)
min_pressure += step

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

Expand Down
9 changes: 9 additions & 0 deletions src/ansys/dpf/core/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import pkg_resources

from ansys.dpf.core._version import __version__

Expand All @@ -20,6 +21,14 @@
except: # pragma: no cover
pass

installed = [d.project_name for d in pkg_resources.working_set]
check_for = ["ansys-dpf-gatebin", "ansys-dpf-gate", "ansys-grpc-dpf"]
if any([c in installed for c in check_for]):
raise ImportError(f"Error during import of ansys-dpf-core:\n"
f"detected one of {check_for} installed. "
f"The current version of ansys-dpf-core requires uninstalling these previous "
f"dependencies to run correctly.")

from ansys.dpf.core.dpf_operator import Operator, Config
from ansys.dpf.core.model import Model
from ansys.dpf.core.field import Field, FieldDefinition
Expand Down
1 change: 1 addition & 0 deletions src/ansys/dpf/core/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class ServerToAnsysVersion:
"7.0": "2024R1",
"7.1": "2024R1",
"8.0": "2024R2",
"8.1": "2024R2",
}

def __getitem__(self, item):
Expand Down

0 comments on commit c6a6f6c

Please sign in to comment.