Skip to content

Update particle speed calculation to be more robust against round-off error - #1917

Merged
sethrj merged 4 commits into
celeritas-project:developfrom
amandalund:speed
Aug 28, 2025
Merged

sethrj merged 4 commits into
celeritas-project:developfrom
amandalund:speed

Conversation

@amandalund

Copy link
Copy Markdown
Contributor

Following the suggestion in openmc-dev/openmc#3526 (review), this modifies the calculation of the particle speed to use an expression that's less susceptible to round-off errors.

@amandalund
amandalund requested a review from sethrj August 28, 2025 04:06
@amandalund amandalund added physics Particles, processes, and stepping algorithms minor Refactoring or minor internal changes/fixes labels Aug 28, 2025
@github-actions

Copy link
Copy Markdown

Test summary

 4 572 files   7 281 suites   13m 18s ⏱️
 1 946 tests  1 936 ✅ 10 💤 0 ❌
25 057 runs  24 964 ✅ 93 💤 0 ❌

Results for commit 61457f5.

Comment thread src/celeritas/phys/ParticleTrackView.hh
@sethrj
sethrj enabled auto-merge (squash) August 28, 2025 15:14
@sethrj

sethrj commented Aug 28, 2025

Copy link
Copy Markdown
Member

@amandalund Thanks! I tightened one of the tests to check that the sqrt and extra operations didn't introduce any surprise subluminal/superluminal photons or superluminal electrons.

@sethrj
sethrj merged commit c0e57b5 into celeritas-project:develop Aug 28, 2025
@amandalund
amandalund deleted the speed branch August 28, 2025 16:05
sethrj pushed a commit that referenced this pull request Sep 13, 2025
… error (#1917)

* Add low energy particle speed test

* Use an expression for speed that is robust against round-off error

Remove check for zero speed in `TimeUpdater` and update tests.

* Check exact equality for photon properties
sethrj pushed a commit to sethrj/celeritas that referenced this pull request Sep 13, 2025
… error (celeritas-project#1917)

* Add low energy particle speed test

* Use an expression for speed that is robust against round-off error

Remove check for zero speed in `TimeUpdater` and update tests.

* Check exact equality for photon properties
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

minor Refactoring or minor internal changes/fixes physics Particles, processes, and stepping algorithms

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants