celeritas-project / celeritas

Celeritas is a new Monte Carlo transport code designed to accelerate scientific discovery in high energy physics by improving detector simulation throughput and energy efficiency using GPUs.
https://celeritas-project.github.io/celeritas/
Other
64 stars 35 forks source link

Implement spline interpolation for cross-section calculation #1444

Closed lebuller closed 3 weeks ago

lebuller commented 1 month ago

Adds new file in grid, SplineXsCalculator.hh that contains a new class, SplineXsCalculator. This class contains similar functions and members to the existing XsCalculator with the addition of a member variable for the order of the interpolation to be performed.

This class performs an interpolation on cross section grid data similar to XsCalculator except it allows an arbitrary order of interpolation (limited by the number of cross section data points). When interpolation near the min or max grid data point are requested, the order of the interpolation may be clipped to prevent indexing out-of-bounds.

A unit test for the Spline cross-section calculation was added that performs the same tests as the existing XsCalculator tests with interpolation orders ranging from 1-3

github-actions[bot] commented 1 month ago

Test summary

 3 371 files   5 194 suites   3m 52s :stopwatch:  1 577 tests  1 549 :white_check_mark: 28 :zzz: 0 :x: 17 384 runs  17 318 :white_check_mark: 66 :zzz: 0 :x:

Results for commit 33b0a4b6.

:recycle: This comment has been updated with latest results.

sethrj commented 1 month ago

Thanks @lebuller ! For development I strongly recommend building with -Wall -Wextra -pedantic -Werror; you should consider creating scripts/cmake-presets/${HOSTNAME}.json with your build options to configure repeatably. Check out the other presets in that directory for examples.

/home/runner/work/celeritas/celeritas/src/celeritas/grid/SplineXsCalculator.hh:156:14: error: variable 'clipped' set but not used [-Werror,-Wunused-but-set-variable]
        bool clipped = false;
             ^
sethrj commented 3 weeks ago

Hi @lebuller , I'm sorry for not giving this more attention over the last couple of weeks: they've been extremely busy. I'll give this another look this afternoon!

lebuller commented 3 weeks ago

@sethrj I think all your comments should have been addressed with my recent push. If the float build still fails, I can try to decrease the energy grid size in the quadratic tests so that the values for neighboring bins are fewer orders of magnitude different. That should help the single-precision build