Skip to content

Conversation

@Canzian
Copy link

@Canzian Canzian commented Nov 10, 2025

Description

Depletion chain validation could be useful for users who want to provide a custom chain file. Additionally, the validation step could be applied before OpenMC parses the file, thus avoiding unnecessary computation in the event of an invalid chain.

A validation procedure based on the definition of an XML Schema is proposed. This schema is written in XSD 1.1, drawing inspiration from the validation method implemented in the Chain class. Version 1.1 enables straightforward testing of the XML file, in this case by checking the sum of branching ratios and fission yields.
Furthermore, the schema checks the file structure according to the information provided in the OpenMC documentation.

Feedback on the schema's structure could help to ensure greater adherence to OpenMC requirements. Currently, the schema uses a threshold when checking for yield normalisation. The degree of precision with which the normalisation is preserved depends on the number of fission product (FP) considered when building the chain. This means that some simplified chains may not pass the test if too many FPs have been discarded. For this reason, fine-tuning of the threshold may be necessary based on current requirements.

The proposed modifications require an additional package, xmlschemas.
This is necessary to ensure compatibility with XSD 1.1.
Another version of the schema based on version 1.0 can be implemented. In this case, no additional packages are required; however, it will not be possible to check normalisations directly with the schema.

One possible solution would be to make the XML Schema package optional while providing both schema versions. This would allow users who do not want to use the additional package to still apply a basic validation procedure through the schema.

Since the modifications only concern the chain.py file and the test suites, no clang-format check has been performed. As the documentation does not currently mention any form of chain validation, I would like to wait for feedback before making any changes to it.

Fixes # 3585

Checklist

  • I have performed a self-review of my own code
  • I have run clang-format (version 15) on any C++ source files (if applicable)
  • I have followed the style guidelines for Python source files (if applicable)
  • I have made corresponding changes to the documentation (if applicable)
  • I have added tests that prove my fix is effective or that my feature works (if applicable)

@Canzian Canzian requested a review from paulromano as a code owner November 10, 2025 11:00
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.

1 participant