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

Fix Field Indexer and get_element_indices for layered solids and add example of a thermal analysis #512

Merged
merged 24 commits into from
Sep 9, 2024

Conversation

roosre
Copy link
Collaborator

@roosre roosre commented Sep 4, 2024

While adding an example for a thermal analysis (examples/013_thermal_example.py), several issues were found in the result extraction for layered solid elements where the field indexers are used. The main issue is that fields which have one entry per entity behave slightly different if compared with one that has multiple entries per entity. This became visible because a solid model with "analysis ply-wise" extrusion was used. So there is only one entry per entity for the layered fields such as angles, materials etc.

Here are some details:

  • FieldIndexer has to handle cases where the data pointers of a field are set in DPF or not. This is a performance optimization in DPF. The data pointers are only available if multiple entries are set per entity. This is addressed by implementing helper functions get_property_field_indexer and get_field_indexer which automatically returns the correct indexer.
  • The Protocol of the (Property)FieldIndexer was enriched by by_id_as_array to clearly distinguish between a single value and an array of values because the return type was dependent on if data pointers are available or not.
  • An issue with the DPF container/server 2024 R1 pre0 on extracting laminate offsets is fixed. This did not show up before because the FieldIndexer which returns a single value was used explicitly. get_field_indexer returns now the correct indexer but the bug in the backend becomes visible now.
  • By accident, the number of corner nodes was used instead of number of nodes per spot when computing the indices. This makes a difference if layered solid elements are processed. See get_selected_indices in src/ansys/dpf/composites/select_indices.py.

@github-actions github-actions bot added the maintenance Package and maintenance related label Sep 4, 2024
@greschd
Copy link
Member

greschd commented Sep 5, 2024

General question: are we planning to backport these fixes to the 0.6 release branch and 2024R2 pyansys metapackage?

@roosre roosre closed this Sep 5, 2024
@roosre roosre reopened this Sep 5, 2024
@roosre roosre marked this pull request as draft September 5, 2024 08:33
src/ansys/dpf/composites/_indexer.py Outdated Show resolved Hide resolved
src/ansys/dpf/composites/_indexer.py Show resolved Hide resolved
src/ansys/dpf/composites/_indexer.py Show resolved Hide resolved
@roosre
Copy link
Collaborator Author

roosre commented Sep 5, 2024

General question: are we planning to backport these fixes to the 0.6 release branch and 2024R2 pyansys metapackage?

Hi @greschd , yes. That would make sense from my point of view.

@codecov-commenter
Copy link

codecov-commenter commented Sep 6, 2024

Codecov Report

Attention: Patch coverage is 87.17949% with 15 lines in your changes missing coverage. Please review.

Project coverage is 91.66%. Comparing base (d8d8cc6) to head (83d1310).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/ansys/dpf/composites/_indexer.py 83.33% 15 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #512      +/-   ##
==========================================
- Coverage   92.21%   91.66%   -0.55%     
==========================================
  Files          50       50              
  Lines        3352     3397      +45     
==========================================
+ Hits         3091     3114      +23     
- Misses        261      283      +22     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@roosre roosre marked this pull request as ready for review September 6, 2024 06:34
@roosre roosre changed the title Fix result indexer for layered solids and add example of a thermal analysis Fix Field Indexer and get_element_indices for layered solids and add example of a thermal analysis Sep 6, 2024
@roosre roosre enabled auto-merge (squash) September 9, 2024 12:20
@roosre roosre merged commit a5d3831 into main Sep 9, 2024
25 checks passed
@roosre roosre deleted the maint/add_thermal_example_and_fix_indexer branch September 9, 2024 14:23
roosre added a commit that referenced this pull request Sep 9, 2024
…example of a thermal analysis (#512)

* Fix Field Indexer by distinguish between fields with data pointers and without
Add draft of an example for a thermal analysis

* fix `select_indices` for layered solid elements

* verify `get_selected_indices` for all types of layered elements
roosre added a commit that referenced this pull request Sep 9, 2024
* Fix Field Indexer and get_element_indices for layered solids and add example of a thermal analysis (#512)

* Fix Field Indexer by distinguish between fields with data pointers and without
Add draft of an example for a thermal analysis

* Bump version 0.6.1

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Dominik Gresch <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Package and maintenance related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants