ansys / pydpf-post

Data Processing Framework - Post Processing Module
https://post.docs.pyansys.com
MIT License
43 stars 10 forks source link

Issues combining mesh skin with scoping #423

Closed FedericoNegri closed 1 month ago

FedericoNegri commented 1 year ago

Before submitting the issue

Description of the bug

I'm playing with scoping in combination with skin mesh, and see something unexpected. In this script

from ansys.dpf import post

rst_path = r"D:\beam_2_mat.rst"

simulation = post.StaticMechanicalSimulation(rst_path)
simulation._model.metadata.meshed_region.plot()

# get an elemental named selection
scoping = simulation._model.metadata.meshed_region.named_selection(
    'X_MIN_SOLID_ELE'
)

seqv_ns_full = simulation.stress_eqv_von_mises_elemental(element_ids=scoping.ids)
seqv_ns_full.plot()

seqv_ns_skin = simulation.stress_eqv_von_mises_elemental(skin=scoping.ids)
seqv_ns_skin._fc[0].meshed_region.plot()

seqv_ns_skin.plot()

I get this (correct) plot for the field on the solid mesh MicrosoftTeams-image

but this one on the skin MicrosoftTeams-image (1)

The same rst file also contains other named selections that can be used for comparison. For instance MG_BODY_ELE and MG_BODY_NODES are named selections covering the same region with elemental and nodal location, respectively. The same applies to ALU_BODY_ELE and ALU_BODY_NODES.

Would be good to validate these kind of comparisons:

# get an elemental named selection
scoping = simulation._model.metadata.meshed_region.named_selection(
    'MG_BODY_ELE'
)

seqv_ns_full = simulation.stress_eqv_von_mises_elemental(element_ids=scoping.ids)
seqv_ns_full.plot()

seqv_ns_skin = simulation.stress_eqv_von_mises_elemental(skin=scoping.ids)
seqv_ns_skin._fc[0].meshed_region.plot()
seqv_ns_skin.plot()

# get a nodal named selection
scoping = simulation._model.metadata.meshed_region.named_selection(
    'MG_BODY_NODES'
)

seqv_ns_full = simulation.stress_eqv_von_mises_nodal(node_ids=scoping.ids)
seqv_ns_full.plot()

seqv_ns_skin = simulation.stress_eqv_von_mises_nodal(skin=True, node_ids=scoping.ids)
seqv_ns_skin._fc[0].meshed_region.plot()
seqv_ns_skin.plot()

The rst file: beam_2_mat.zip

Steps To Reproduce

-

Which Operating System are you using?

Windows

Which DPF/Ansys version are you using?

Ansys 2023 R2

Which Python version are you using?

3.10

Installed packages

-