Skip to content

docs: add tutorial for elemental nodal results on mixed-element meshes - #3296

Open
PProfizi wants to merge 2 commits into
mainfrom
doc/tutorial-mixed-element-results
Open

docs: add tutorial for elemental nodal results on mixed-element meshes#3296
PProfizi wants to merge 2 commits into
mainfrom
doc/tutorial-mixed-element-results

Conversation

@PProfizi

Copy link
Copy Markdown
Contributor

Summary

New PyDPF-Core sphinx-gallery tutorial under post_processing_basics/ titled
Process elemental nodal results on mixed-element meshes.

The tutorial demonstrates the recommended workflow for handling ElementalNodal
results on a mesh that mixes several element types (different node counts per
element):

  1. Discover the element types present in the mesh in bulk via
    Elements.element_types_field (a PropertyField) and map each type to its
    ElementDescriptor (n_nodes, is_solid, is_shell, is_beam,
    is_quadratic).
  2. Read an ElementalNodal stress field; show that
    Field.get_entity_data_by_id() returns a variable-shape array whose row count
    equals the element's n_nodes.
  3. Use the split_shells argument on result operators to obtain a per-shape
    FieldsContainer (carrying the elshape label). Within each per-shape
    sub-field the node count is uniform, so the flat data array can be reshaped
    to (n_elements, n_nodes, n_components) and processed with numpy.
  4. Use extend_to_mid_nodes to fill the mid-side node values of a corner-only
    ElementalNodal field on quadratic elements.

Dataset: examples.download_all_kinds_of_complexity().

Files

  • doc/sphinx_gallery_tutorials/post_processing_basics/mixed_element_results.py
    -- new tutorial (_order: 2, label ref_tutorials_mixed_element_results).
  • doc/sphinx_gallery_tutorials/post_processing_basics/GALLERY_HEADER.rst
    -- new grid card.

Validation

  • python -m py_compile on the tutorial file passes.
  • All APIs used were verified against the source under src/ansys/dpf/core/.
  • Rendering and execution validated by the doc-deploy preview pipeline
    (deploy-pr-doc label).

…ement meshes

Adds a new sphinx-gallery tutorial under post_processing_basics that shows how to:

- Discover element types in bulk via Elements.element_types_field (PropertyField)
  and dpf.element_types.descriptor() (n_nodes, is_solid, is_shell, is_beam,
  is_quadratic).
- Read an ElementalNodal stress field on a mixed-element mesh and use
  Field.get_entity_data_by_id() to expose the variable per-element row count.
- Use the split_shells argument on result operators to obtain a per-shape
  FieldsContainer with an elshape label and run vectorised numpy operations on
  one uniform sub-field.
- Use extend_to_mid_nodes to fill mid-side node values on a corner-only
  ElementalNodal field for quadratic elements.

Dataset: examples.download_all_kinds_of_complexity().
@PProfizi PProfizi added documentation Improvements or additions to documentation deploy-pr-doc For deploying a PR's documentation labels Jun 30, 2026
@github-actions github-actions Bot added the tutorials Related to PyDPF-Core tutorials label Jun 30, 2026
@PProfizi
PProfizi marked this pull request as ready for review June 30, 2026 14:47
@codecov

codecov Bot commented Jun 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.84%. Comparing base (dc3529b) to head (3014450).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3296   +/-   ##
=======================================
  Coverage   82.84%   82.84%           
=======================================
  Files          94       94           
  Lines       11737    11737           
=======================================
  Hits         9724     9724           
  Misses       2013     2013           

split_shells groups by stress category (Solid/Shell-with-N-layers), not geometric type, and mixes Tet10+Hex20 inside elshape=2 so per-shape sub-fields are not uniform. The correct mechanism for uniform per-shape ElementalNodal fields is to build a Scoping from element_types_field via a numpy mask and pass it as mesh_scoping. Also fixes the false 'rows = n_nodes' claim (rows = n_corner_nodes for solids, nodes*layers for shells) and replaces the no-op nodal_to_elemental_nodal->extend_to_mid_nodes demo by feeding the per-shape Tet10 field straight into extend_to_mid_nodes_fc, which now visibly grows (4,6) -> (10,6).
@github-actions

Copy link
Copy Markdown
Contributor

The documentation for this pull request will be available at https://dpf.docs.pyansys.com/pull/3296. Please allow some time for the documentation to be deployed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

deploy-pr-doc For deploying a PR's documentation documentation Improvements or additions to documentation tutorials Related to PyDPF-Core tutorials

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant