Skin extraction with elemental averaging fails with mixed models
Opened this issue · 1 comments
Before submitting the issue
- I have checked for Compatibility issues
- I have searched among the existing issues
- I am using a Python virtual environment
Description of the bug
Skin extraction for a model that contains both solid and shell elements returns too many elementary data for elemental skin results. I think the root cause is that the ShellLayers property of a field has a single value (derived from the original shell elements). For a mixed model the skin elements have only a single value whereas the original shell elements have multiple shell layers. The to_elemental operator therefore assumes the skin elements have also three shell layers and returns three values per element instead of one.
Note: We could integrate the shell layer selection in the result extraction workflow and force the user to select a shell layer when shell data is combined with skin data.
Steps To Reproduce
Run the following snippet. The assertion in the end fails, we get 3 elementary data.
Use: examples.download_all_kinds_of_complexity_modal()
from ansys.dpf import post
rst_path = r"modal_allKindOfComplexity.rst"
sim = post.StaticMechanicalSimulation(rst_path)
fc_all = sim.stress_elemental()._fc
all_elements = fc_all[0].meshed_region.elements
solid_elements = [e for e in all_elements if e.type.name == "Hex20"]
fc_skin = sim.stress_elemental(skin=True)._fc
skin_mesh = fc_skin[0].meshed_region
skin_node_ids = skin_mesh.nodes.scoping.ids
# Find a skin node (fc_skin contains skin as well as shell elements)
skin_node_id = None
for solid_element in solid_elements:
for node_id in solid_element.node_ids:
if node_id in skin_node_ids:
skin_node_id = node_id
break
assert skin_node_id is not None
# Elements attached to skin node
skin_element_ids = skin_mesh.elements.scoping.ids[skin_mesh.nodes.nodal_connectivity_field.get_entity_data_by_id(node_id)]
# Get data of first skin element
skin_element_data = fc_skin[0].get_entity_data_by_id(skin_element_ids[0])
assert skin_element_data.shape[0] == 1, skin_element_data.shape[0]
Which Operating System are you using?
Windows
Which DPF/Ansys version are you using?
DPF Server 2025.1.pre0
Which Python version are you using?
3.10