Skip to content

Create fz-Serpent plugin for Serpent Monte Carlo code - #1

Merged
yannrichet-asnr merged 4 commits into
mainfrom
copilot/create-serpent-model-repo
Dec 5, 2025
Merged

Create fz-Serpent plugin for Serpent Monte Carlo code#1
yannrichet-asnr merged 4 commits into
mainfrom
copilot/create-serpent-model-repo

Conversation

Copilot AI commented Dec 5, 2025

Copy link
Copy Markdown
Contributor

A Funz plugin for running parametric studies with the Serpent Monte Carlo reactor physics code. Uses serpentTools to parse result files.

Plugin Structure

  • .fz/models/Serpent.json - Model configuration with % comments, ${var} syntax, output extraction via serpentTools
  • .fz/calculators/Serpent.sh - Calculator script that detects and runs sss2/serpent executable
  • .fz/calculators/localhost_Serpent.json - Local calculator configuration

Output Variables

All outputs are formatted as JSON arrays/matrices for easy parsing:

Variable Description
absKeff Absorption-based k-effective [value, rel_error] per burnup step
anaKeff Analog k-effective estimate per burnup step
colKeff Collision-based k-effective per burnup step
impKeff Implicit k-effective estimate per burnup step
burnup Burnup values [MWd/kgU, ...] per burnup step (empty for non-depletion)
burnDays Burnup time [days] per burnup step (empty for non-depletion)

Example Files

  • examples/Serpent/input.inp - UOX fuel pin cell with parameterized enrichment, water density, geometry, and MC settings
  • examples/Serpent/input_res.m - Sample Serpent result file for serpentTools parsing validation
  • example_usage.ipynb - Jupyter notebook demonstrating plugin usage

CI/Testing

  • .github/workflows/ci.yml - CI workflow with JSON validation, shell script checks, fzi/fzc tests, and serpentTools parsing tests
  • tests/test_plugin.py - Plugin test suite
Original prompt

Create a repository for Serpent model (see doc at https://serpent.vtt.fi/docs/index.html) to fz. See https://github.com/Funz/fz-Model to get the template of fz "model" plugins (mostly files in .fz/models/... and .fz/calculators/...). Choose a basic test from serpent doc (like UOX_lattice_geometry) and use serpentTools to parse its output (see https://serpent-tools.readthedocs.io/), mainly results prented in https://serpent-tools.readthedocs.io/en/master/examples/ResultsReader.html#results-data


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: yannrichet-asnr <148193180+yannrichet-asnr@users.noreply.github.com>
Copilot AI changed the title [WIP] Create repository for Serpent model integration Create fz-Serpent plugin for Serpent Monte Carlo code Dec 5, 2025
Copilot AI requested a review from yannrichet-asnr December 5, 2025 10:46
@yannrichet-asnr

Copy link
Copy Markdown
Member

@copilot in ouptut, also get burnup and burnDays output, that should be arrays or matrix (like all previous results). Check that all these output are formatted as json matrix/array, for latter parsing (use json dump if needed).

Co-authored-by: yannrichet-asnr <148193180+yannrichet-asnr@users.noreply.github.com>

Copilot AI commented Dec 5, 2025

Copy link
Copy Markdown
Contributor Author

@copilot in ouptut, also get burnup and burnDays output, that should be arrays or matrix (like all previous results). Check that all these output are formatted as json matrix/array, for latter parsing...

Added burnup and burnDays output variables in commit 816b031. All outputs are now formatted as JSON arrays using json.dumps():

  • k-effective values: [value, rel_error] per burnup step (2D array for depletion cases)
  • burnup: [[MWd/kgU, ...], ...] per burnup step
  • burnDays: [[days], ...] per burnup step

Empty arrays [] returned for non-depletion cases.

@yannrichet-asnr
yannrichet-asnr marked this pull request as ready for review December 5, 2025 11:23
@yannrichet-asnr

Copy link
Copy Markdown
Member

@copilot Also, the notebook is missing, as well as the CI (like in the template)

Co-authored-by: yannrichet-asnr <148193180+yannrichet-asnr@users.noreply.github.com>

Copilot AI commented Dec 5, 2025

Copy link
Copy Markdown
Contributor Author

@copilot Also, the notebook is missing, as well as the CI (like in the template)

Added in commit ea0efef:

  • example_usage.ipynb - Jupyter notebook demonstrating variable parsing, input compilation, and serpentTools result parsing
  • .github/workflows/ci.yml - CI workflow with JSON validation, shell script checks, fzi/fzc tests, and serpentTools parsing tests

@yannrichet-asnr
yannrichet-asnr merged commit d92fa76 into main Dec 5, 2025
6 checks passed
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