Skip to content

Add functional_expansion method to expansion filters - #4132

Open
EdenRochmanSharabi wants to merge 1 commit into
openmc-dev:developfrom
EdenRochmanSharabi:feature/fet-callable
Open

EdenRochmanSharabi wants to merge 1 commit into
openmc-dev:developfrom
EdenRochmanSharabi:feature/fet-callable

Conversation

@EdenRochmanSharabi

Copy link
Copy Markdown
Contributor

Summary

Adds a functional_expansion(coefficients) method to each ExpansionFilter
subclass that constructs a callable function from FET coefficients, so users
can evaluate the expanded flux (or other quantity) at arbitrary coordinates
without reimplementing basis functions.

  • LegendreFilter -> numpy.polynomial.Legendre on [-1, 1]
  • SpatialLegendreFilter -> numpy.polynomial.Legendre on [min, max]
  • ZernikeFilter -> openmc.Zernike
  • ZernikeRadialFilter -> openmc.ZernikeRadial
  • SphericalHarmonicsFilter -> NotImplementedError (needs a new evaluator class, left for future work)

All implementations reuse existing building blocks (legendre_from_expcoef, Zernike, ZernikeRadial), so no new dependencies.

Resolves #3419

Changes

  • openmc/filter_expansion.py: base method on ExpansionFilter + concrete implementations
  • tests/unit_tests/test_filters.py: unit tests and roundtrip reconstruction tests (project known functions onto bases, reconstruct, verify pointwise)

Checklist

  • I have performed a self-review of my own code
  • I have followed the style guidelines for Python source files
  • I have added tests that prove my feature works

Add a method to each ExpansionFilter subclass that constructs a callable
function from FET (functional expansion tally) coefficients. This lets
users evaluate the expanded function at arbitrary coordinates without
reimplementing the basis functions themselves.

Supported filters:
- LegendreFilter: returns numpy.polynomial.Legendre on [-1, 1]
- SpatialLegendreFilter: returns numpy.polynomial.Legendre on [min, max]
- ZernikeFilter: returns openmc.Zernike(coefs, radius)
- ZernikeRadialFilter: returns openmc.ZernikeRadial(coefs, radius)
- SphericalHarmonicsFilter: raises NotImplementedError (future work)

Resolves openmc-dev#3419
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.

Return actual functional representation of funcational expansion tallies in Python API

1 participant