Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix polar angle sampling and Mott factor in Wentzel distribution #1212

Merged
merged 7 commits into from
May 1, 2024

Conversation

amandalund
Copy link
Contributor

This fixes what I think are a couple small errors in the Wentzel distribution:

  • In the sampling of the scattering polar angle, looking through @hhollenb's (excellent!) Coulomb scattering writeup, I think the sampling function for mu (Eq. 2.10) should be
    $$\mu = \mu_1 + \frac{(A + \mu_1) \xi (\mu_2 - \mu_1)}{A + \mu_2 - \xi (\mu_2 - \mu_1)}$$.
    With $\mu = \frac{1}{2}(1 - \cos \theta)$ and $\mu_1 = \mu(0) = 0$, this gives
    $$\cos \theta = 1 - \frac{2 A \xi \mu_2}{A + (1 - \xi) \mu_2}$$.
    The sampled angle should now always be in [-1, 1), so we can remove the clamp.
  • In both Geant4 and the writeup (section 8) the Mott factor is given as $1 + 2\times 10^{-4} Z^2$. Updating this did get rid of an assertion failure in the rejection sampling where the p_true in the Bernoulli distribution was greater than one.

It would be good if @hhollenb could confirm that these changes are correct and I'm not missing something.

@amandalund amandalund added bug Something isn't working physics Particles, processes, and stepping algorithms labels Apr 29, 2024
@amandalund amandalund requested review from sethrj and hhollenb April 29, 2024 14:24
Copy link
Member

@sethrj sethrj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice find! Good to justify our general avoidance of clamp and its ilk...

@sethrj
Copy link
Member

sethrj commented May 1, 2024

Darn it, I guess we'll never replace multiple scattering with single coulomb at this rate...

I'm happy either to wait for @hhollenb 's double check before merging this or to let you go ahead and merge yourself.

@hhollenb
Copy link
Contributor

hhollenb commented May 1, 2024

This looks great, and may fix some of the small discrepancies in the scattering angle.

I used clamp out of a concern for other parts of the code requiring $|\cos\theta| \leq 1$ and there being small rounding errors. More than happy to replace it with an ensure post-condition.

I'll approve it and merge it into the tests I have right now. Finding that source for @amandalund coulomb limit made me want to revisit the weird false scattering code and make sure its assumptions are correct.

Copy link
Contributor

@hhollenb hhollenb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll revisit the Coulomb scattering limit with Soon once he returns and I review the paper.

@amandalund amandalund enabled auto-merge (squash) May 1, 2024 18:19
@amandalund amandalund merged commit a082c32 into celeritas-project:develop May 1, 2024
27 of 28 checks passed
@amandalund amandalund deleted the wentzel-dist-fix branch May 1, 2024 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working physics Particles, processes, and stepping algorithms
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants