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

Skin extraction with elemental averaging fails with mixed models #686

Open
3 tasks done
janvonrickenbach opened this issue Aug 26, 2024 · 3 comments
Open
3 tasks done
Labels
bug Something isn't working

Comments

@janvonrickenbach
Copy link
Contributor

janvonrickenbach commented Aug 26, 2024

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

Installed packages

@janvonrickenbach janvonrickenbach added the bug Something isn't working label Aug 26, 2024
@janvonrickenbach janvonrickenbach changed the title Skin extraction with elemental averaging fails with shell elements Skin extraction with elemental averaging fails with mixed models Aug 26, 2024
@janvonrickenbach
Copy link
Contributor Author

@FedericoNegri

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants
@janvonrickenbach and others