Skip to content

Commit c6a6f6c

Browse files
authored
Merge branch 'master' into ci/switch_release_to_2024_2_pre0
2 parents e83003e + cb49fad commit c6a6f6c

File tree

4 files changed

+26
-18
lines changed

4 files changed

+26
-18
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2023 ANSYS, Inc. All rights reserved.
3+
Copyright (c) 2024 ANSYS, Inc. All rights reserved.
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

examples/12-fluids/03-fluids_isosurface.py

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,9 @@
6464
###############################################################################
6565
# Evaluate iso-surfaces
6666
# ~~~~~~~~~~~~~~
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.
7470

7571
pl = DpfPlotter()
7672
c_pos_iso = [
@@ -87,18 +83,20 @@
8783
opacity=0.3,
8884
)
8985

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)):
9896
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
10099
)
101-
min_pressure += step
102100

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

src/ansys/dpf/core/__init__.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
import pkg_resources
23

34
from ansys.dpf.core._version import __version__
45

@@ -20,6 +21,14 @@
2021
except: # pragma: no cover
2122
pass
2223

24+
installed = [d.project_name for d in pkg_resources.working_set]
25+
check_for = ["ansys-dpf-gatebin", "ansys-dpf-gate", "ansys-grpc-dpf"]
26+
if any([c in installed for c in check_for]):
27+
raise ImportError(f"Error during import of ansys-dpf-core:\n"
28+
f"detected one of {check_for} installed. "
29+
f"The current version of ansys-dpf-core requires uninstalling these previous "
30+
f"dependencies to run correctly.")
31+
2332
from ansys.dpf.core.dpf_operator import Operator, Config
2433
from ansys.dpf.core.model import Model
2534
from ansys.dpf.core.field import Field, FieldDefinition

src/ansys/dpf/core/_version.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class ServerToAnsysVersion:
2222
"7.0": "2024R1",
2323
"7.1": "2024R1",
2424
"8.0": "2024R2",
25+
"8.1": "2024R2",
2526
}
2627

2728
def __getitem__(self, item):

0 commit comments

Comments
 (0)