Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add examples for Fluids models #1021

Merged
merged 43 commits into from
Jul 21, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
88bb45b
Add better support for plotting on faces
rafacanton Jul 10, 2023
545eeaa
Merge branch 'master' into rcanton/improve_faces
rafacanton Jul 11, 2023
7867f00
deep_copy mesh with an operator
rafacanton Jul 12, 2023
de24843
use passed server
rafacanton Jul 12, 2023
084e884
legacy behavior for legacy server
rafacanton Jul 12, 2023
aa8f336
Merge branch 'master' into rcanton/improve_faces
rafacanton Jul 12, 2023
66122eb
Improve MeshInfo api. Begin example
rafacanton Jul 12, 2023
33fd1bb
Update all get_property calls
rafacanton Jul 12, 2023
9e499f8
fix missing test
rafacanton Jul 12, 2023
91d4396
Merge branch 'master' into rcanton/improve_faces
rafacanton Jul 12, 2023
446a781
remove topology and name tests to avoid TFS pipelines failing
rafacanton Jul 13, 2023
c67c681
Merge branch 'master' into rcanton/improve_faces
rafacanton Jul 13, 2023
949d90b
Merge branch 'master' into rcanton/improve_faces
rafacanton Jul 13, 2023
02f3672
Add simple example
rafacanton Jul 13, 2023
ce2c0b5
Merge branch 'master' into rcanton/improve_faces
rafacanton Jul 14, 2023
197b897
Revert complete mesh_info tests
rafacanton Jul 14, 2023
634dbae
README for fluids examples
rafacanton Jul 17, 2023
1a4de8d
Merge branch 'master' into rcanton/improve_faces
rafacanton Jul 17, 2023
0e76fb1
Merge branch 'master' into rcanton/improve_faces
rafacanton Jul 18, 2023
826115b
Second fluid example
rafacanton Jul 18, 2023
ffa7bd9
Merge branch 'master' into rcanton/improve_faces
rafacanton Jul 18, 2023
d44d02f
fix fluid examples
rafacanton Jul 18, 2023
a5f819d
Merge branch 'master' into rcanton/improve_faces
rafacanton Jul 18, 2023
0fc15a9
Remove unneded map
rafacanton Jul 18, 2023
2c7cc0a
Merge branch 'master' into rcanton/improve_faces
rafacanton Jul 19, 2023
30342ad
Merge branch 'master' into rcanton/improve_faces
rafacanton Jul 19, 2023
41c9db7
Update docs.yml check for success conditional
PProfizi Jul 19, 2023
405d753
Merge branch 'master' into rcanton/improve_faces
rafacanton Jul 19, 2023
1a86743
Implement rev comments
rafacanton Jul 20, 2023
bbf40fe
Merge branch 'rcanton/improve_faces' of https://github.com/ansys/pydp…
rafacanton Jul 20, 2023
4854514
More examples
rafacanton Jul 20, 2023
e1da7c7
Merge branch 'master' into rcanton/improve_faces
rafacanton Jul 20, 2023
e1dd02c
continue
rafacanton Jul 20, 2023
c903c5c
Merge branch 'master' into rcanton/improve_faces
rafacanton Jul 20, 2023
7ad84db
averaging
rafacanton Jul 20, 2023
a0b5743
Merge branch 'master' into rcanton/improve_faces
rafacanton Jul 21, 2023
65c4475
Changes to mesh_info halfway-through
rafacanton Jul 21, 2023
61cf142
Merge branch 'master' into rcanton/improve_faces
rafacanton Jul 21, 2023
b95918c
Merge branch 'rcanton/improve_faces' of https://github.com/ansys/pydp…
rafacanton Jul 21, 2023
6d87f31
Remove type in mesh_info and gdc docstring
rafacanton Jul 21, 2023
0737b84
fix issue
rafacanton Jul 21, 2023
8ab5038
Merge branch 'master' into rcanton/improve_faces
rafacanton Jul 21, 2023
4813dc7
Cosmetic changes
rafacanton Jul 21, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/ansys/dpf/core/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,9 @@ class elemental_properties:

apdl_element_type = "apdl_element_type"
apdl element type property data is provided

elements_faces_connectivity = "elements_faces_connectivity"
element faces connectivity property data is provided
"""

element_shape = "elshape"
Expand All @@ -210,6 +213,7 @@ class elemental_properties:
material = "mat"
element_properties = "elprops"
apdl_element_type = "apdl_element_type"
elements_faces_connectivity = "elements_faces_connectivity"


class nodal_properties:
Expand Down
35 changes: 28 additions & 7 deletions src/ansys/dpf/core/meshed_region.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@

from ansys.dpf.core import scoping, field, property_field
from ansys.dpf.core.check_version import server_meet_version, version_requires
from ansys.dpf.core.common import locations, types, nodal_properties
from ansys.dpf.core.common import (
locations,
types,
nodal_properties,
face_properties,
elemental_properties,
)
from ansys.dpf.core.elements import Elements, element_types
from ansys.dpf.core.nodes import Nodes
from ansys.dpf.core.faces import Faces
Expand Down Expand Up @@ -622,12 +628,27 @@
for i, node in enumerate(mesh.nodes.add_nodes(len(node_ids))):
node.id = node_ids[i]
node.coordinates = coord.get_entity_data(i)
with self.elements.connectivities_field.as_local_field() as connect:
with self.elements.element_types_field.as_local_field() as types:
for i, elem in enumerate(mesh.elements.add_elements(len(element_ids))):
elem.id = element_ids[i]
elem.connectivity = connect.get_entity_data(i)
elem.shape = element_types.shape(types.get_entity_data(i)[0])
if len(element_ids) > 0:
with self.elements.connectivities_field.as_local_field() as connect:
rafacanton marked this conversation as resolved.
Show resolved Hide resolved
with self.elements.element_types_field.as_local_field() as types:
for i, elem in enumerate(mesh.elements.add_elements(len(element_ids))):
elem.id = element_ids[i]
elem.connectivity = connect.get_entity_data(i)
elem.shape = element_types.shape(types.get_entity_data(i)[0])
if len(self.faces.scoping.ids) > 0:
with self.property_field(

Check warning on line 639 in src/ansys/dpf/core/meshed_region.py

View check run for this annotation

Codecov / codecov/patch

src/ansys/dpf/core/meshed_region.py#L639

Added line #L639 was not covered by tests
face_properties.faces_nodes_connectivity
).as_local_field() as f_n_conn:
mesh.set_property_field(face_properties.faces_nodes_connectivity, f_n_conn)
with self.property_field(face_properties.faces_type).as_local_field() as f_types:
mesh.set_property_field(face_properties.faces_type, f_types)
if elemental_properties.elements_faces_connectivity in self.available_property_fields:
with self.property_field(

Check warning on line 646 in src/ansys/dpf/core/meshed_region.py

View check run for this annotation

Codecov / codecov/patch

src/ansys/dpf/core/meshed_region.py#L642-L646

Added lines #L642 - L646 were not covered by tests
elemental_properties.elements_faces_connectivity
).as_local_field() as c_f_conn:
mesh.set_property_field(

Check warning on line 649 in src/ansys/dpf/core/meshed_region.py

View check run for this annotation

Codecov / codecov/patch

src/ansys/dpf/core/meshed_region.py#L649

Added line #L649 was not covered by tests
elemental_properties.elements_faces_connectivity, c_f_conn
)
mesh.unit = self.unit
return mesh

Expand Down
8 changes: 7 additions & 1 deletion src/ansys/dpf/core/plotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,14 @@
warnings.warn("`show_max` and `show_min` is only supported for Nodal results.")
show_max = False
show_min = False
elif location == locations.faces:
mesh_location = meshed_region.faces
if show_max or show_min:
warnings.warn("`show_max` and `show_min` is only supported for Nodal results.")
show_max = False
show_min = False

Check warning on line 275 in src/ansys/dpf/core/plotter.py

View check run for this annotation

Codecov / codecov/patch

src/ansys/dpf/core/plotter.py#L270-L275

Added lines #L270 - L275 were not covered by tests
else:
raise ValueError("Only elemental or nodal location are supported for plotting.")
raise ValueError("Only elemental, nodal or faces location are supported for plotting.")

Check warning on line 277 in src/ansys/dpf/core/plotter.py

View check run for this annotation

Codecov / codecov/patch

src/ansys/dpf/core/plotter.py#L277

Added line #L277 was not covered by tests
component_count = field.component_count
if component_count > 1:
overall_data = np.full((len(mesh_location), component_count), np.nan)
Expand Down