Skip to content

HDF5 output of element results not necessarily from norm integration#875

Merged
kmokstad merged 6 commits into
OPM:masterfrom
kmokstad:hdf5-norms
May 26, 2026
Merged

HDF5 output of element results not necessarily from norm integration#875
kmokstad merged 6 commits into
OPM:masterfrom
kmokstad:hdf5-norms

Conversation

@kmokstad
Copy link
Copy Markdown
Contributor

@kmokstad kmokstad commented May 22, 2026

The HDF5Writer class can output element-wise results, but so far it has been assumed they originate from norm integration with some complex logic to extract the name of the result components. This logic is now moved to a new SIMbase::extractElmResult() method which extracts a single component together with its component name. The same method is also used int the VTF-export (method SIMoutput::writeGlvn()), simplifying the logic there.

This also fixes a so far undetected bug in the HDF-export: When exporting for many norm groups (i.e., more than one projection method was used), it looks like the same element norm values (those associated with the first group), where exported for all groups, producing identical results. This is fixed now but not tested.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors element-wise result extraction for HDF5 output by moving component-name resolution and single-component extraction into SIMbase::extractElmRes(), so element results no longer need to be assumed to come from norm integration. It also introduces support for element-wise constant fields (material parameters) in the norms/element output path and extends utl::matrix::augmentRows() with optional prepending.

Changes:

  • Refactored HDF5 element-result output to call SIMbase::extractElmRes() for per-component extraction + naming.
  • Added element-wise field introspection APIs (getNoElmFields(), getEFieldName()) and updated VTF norm output to include these fields.
  • Added prepend option to utl::matrix::augmentRows() with unit test coverage.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/Utility/HDF5Writer.C Uses SIMbase::extractElmRes() for element-result extraction/naming during HDF5 writes.
src/SIM/SIMoutput.C Accounts for element-wise fields when writing element norms to VTF.
src/SIM/SIMbase.h Declares new extractElmRes() overloads for row-wise extraction and naming.
src/SIM/SIMbase.C Implements extractElmRes() logic, including name resolution via NormBase.
src/ASM/IntegrandBase.h Adds virtual APIs for element-wise fields (getNoElmFields, getEFieldName).
src/ASM/IntegrandBase.C Provides default implementation of getEFieldName().
src/ASM/ASMbase.h Adds getOutputMaster() and extends element-result extraction helpers.
src/ASM/ASMbase.C Implements matrix-row-to-vector element-result extraction.
src/ASM/LR/ASMu2D.h Adds getOutputMaster() override; updates output-master semantics.
src/ASM/LR/ASMu2D.C Initializes outputMaster and adjusts delegation for grid parameters.
src/ASM/LR/ASMu3D.h Adds getOutputMaster() override; updates output-master semantics.
src/ASM/LR/ASMu3D.C Initializes outputMaster and adjusts delegation for grid parameters.
src/LinAlg/matrix.h Adds prepend option to augmentRows().
src/LinAlg/Test/TestMatrix.C Adds test coverage for augmentRows(..., prepend=true).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/SIM/SIMbase.C Outdated
Comment thread src/SIM/SIMoutput.C Outdated
Comment thread src/SIM/SIMbase.h
Comment thread src/LinAlg/Test/TestMatrix.C
Comment thread src/Utility/HDF5Writer.C
@kmokstad
Copy link
Copy Markdown
Contributor Author

jenkins build this with downstreams ifem-elasticity=221 please

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.

Comment thread src/ASM/ASMbase.h Outdated
Comment thread src/SIM/SIMoutput.C Outdated
kmokstad added 2 commits May 23, 2026 17:15
Added: virtual method getOutputMaster() such that the
extractElmRes() methods do not need to be overridden in the
sub-classes ASMu2D and ASMu3D.
kmokstad added 4 commits May 25, 2026 12:01
extracting only a single row together with its component name.
Use this to hide some logics away from the HDF5Writer method.
Also a Vector-to-Vector extractElmRes() is added, such that we
don't need to convert into a single-row matrix back and forth.
If set to true, the provided matrix is inserted as the first rows
instead of the last.
new SIMbase::extractElmRes() method for the component name extraction
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.

Comment thread src/SIM/SIMoutput.C
@kmokstad kmokstad merged commit 00ae7c9 into OPM:master May 26, 2026
@kmokstad kmokstad deleted the hdf5-norms branch May 26, 2026 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants