neams-th-coe / cardinal

High-Fidelity Multiphysics
https://cardinal.cels.anl.gov/
Other
91 stars 45 forks source link

Addition of a filter system and `[Filters]` block #951

Closed nuclearkevin closed 1 week ago

nuclearkevin commented 1 month ago

Reason

This PR implements a filter system, an associated block in Cardinal's input syntax ([Problem/Filters]), and four new filters which tallies added through the [Problem/Tallies] block can access. The added filter objects are:

The input syntax is similar to the recently added tally system:

[Problem]
  type = OpenMCCellAverageProblem
  verbose = true
  power = 1e4
  temperature_blocks = '100'
  cell_level = 0
  initial_properties = xml

  source_rate_normalization = 'kappa_fission'

  [Tallies]
    [Heating]
      type = CellTally
      score = 'kappa_fission'
      blocks = '100 200'
    []
    [Flux]
      type = CellTally
      score = 'flux'
      blocks = '100 200'
      filters = 'Energy Polar'
    []
  []

  [Filters]
    [Energy]
      type = EnergyFilter
      # CASMO 2 group structure for testing. May result in some missed particles
      energy_boundaries = '0.0 6.25e-1 2.0e7'
    []
    [Polar]
      type = PolarAngleFilter
      num_equal_divisions = 2
    []
  []
[]

(tests/neutronics/filters/multi_filter.i)

Design

The new filters system has the following objects other than the previously mentioned filters:

The filters added through the filters system must use discrete bins as the tallies are still normalized by a sum over all bins. This restriction could be lifted, however this would require a substantial change to tally normalization to allow bins that contain coefficients to be skipped when computing the sum over the entire tally.

In addition to the above, this PR modifies the tally system to reduce the amount of duplicate code and fixes a bug in both MeshTally and CellTally which caused a memory leak when using a MOABSkinner. These changes can be removed from this PR and submitted in their own PR to expedite merging, if that's preferred.

Impact

Closes #602.

moosebuild commented 1 month ago

Job Documentation on 51cfa7f wanted to post the following:

View the site here

This comment will be updated on new commits.

moosebuild commented 1 month ago

Job Coverage on 51cfa7f wanted to post the following:

Coverage

d46e57 #951 51cfa7
Total Total +/- New
Rate 93.40% 93.19% -0.21% 86.55%
Hits 7472 7620 +148 206
Misses 528 557 +29 32

Diff coverage report

Full coverage report

Warnings

This comment will be updated on new commits.

tjlaboss commented 1 month ago

👀

moosebuild commented 1 week ago

Job Precheck on 544eedb wanted to post the following:

Your code requires style changes.

A patch was auto generated and copied here
You can directly apply the patch by running, in the top level of your repository:

curl -s https://mooseframework.inl.gov/cardinal/docs/PRs/951/clang_format/style.patch | git apply -v

Alternatively, with your repository up to date and in the top level of your repository:

git clang-format d46e57f4d038ff25544f4ab0fcd2f1bf66045212

aprilnovak commented 1 week ago

just needs a rebase and then I am good to merge

moosebuild commented 1 week ago

Job Documentation, step Sync to remote on e76ca06 wanted to post the following:

View the site here

This comment will be updated on new commits.

moosebuild commented 1 week ago

Job Coverage, step Generate coverage on e76ca06 wanted to post the following:

Coverage

a458e5 #951 e76ca0
Total Total +/- New
Rate 93.42% 93.20% -0.21% 86.55%
Hits 7477 7625 +148 206
Misses 527 556 +29 32

Diff coverage report

Full coverage report

Warnings

This comment will be updated on new commits.

nuclearkevin commented 1 week ago

@aprilnovak I've finished rebasing this, it should be good to go now!