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

Add Seltzer-Berger interactor and kernel #241

Conversation

vrpascuzzi
Copy link
Contributor

This commit adds the SB interactor and associated kernel method.

@vrpascuzzi
Copy link
Contributor Author

Looking for first round of reviews while documentation and test updated, and add Modified Tsai sampler for bremsstrahlung and pair-production.

@vrpascuzzi vrpascuzzi added the physics Particles, processes, and stepping algorithms label May 14, 2021
@vrpascuzzi vrpascuzzi added this to the Y1Q4 Goals milestone May 14, 2021
@sethrj sethrj self-requested a review May 15, 2021 12:56
@sethrj sethrj added this to In progress in v0.1.0 via automation May 15, 2021
src/physics/em/detail/SeltzerBerger.cu Outdated Show resolved Hide resolved
src/physics/em/detail/SeltzerBergerInteractor.i.hh Outdated Show resolved Hide resolved
cutoffs_.energy(device_pointers_.ids.gamma),
inc_energy_);
gamma_exit_energy
= Energy{gamma_exit_energy.value() * scale_xs(gamma_exit_energy)};
Copy link
Member

Choose a reason for hiding this comment

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

This block isn't quite right (although we'll need to use the constructor you've enumerated). The XsCorrector needs to be used as part of the energy distribution, which I didn't implement because I didn't want to interfere with your ongoing work on the SB interactor 😬 . The XsCorrector should modify the energy distribution to be sampled from, rather than scaling the exiting energy as written here.

src/physics/em/detail/SeltzerBergerInteractor.i.hh Outdated Show resolved Hide resolved
src/physics/em/detail/SeltzerBergerInteractor.hh Outdated Show resolved Hide resolved
src/physics/em/detail/SeltzerBergerInteractor.i.hh Outdated Show resolved Hide resolved
src/physics/em/detail/SeltzerBergerInteractor.i.hh Outdated Show resolved Hide resolved
@vrpascuzzi vrpascuzzi force-pushed the feature/physics/SeltzerBergerInteractor branch from 78dd506 to b2f848d Compare May 21, 2021 23:08
@vrpascuzzi
Copy link
Contributor Author

Hope to have addressed most of the reviews.

Will continue with remaining documentation and tests Monday.

Vincent R. Pascuzzi added 6 commits May 24, 2021 09:00
This commit adds the SB interactor and associated kernel method.
  * Initialize `material_view` near where first used
  * `migdal` as `constexpr`, and use integer multiplication to
    prevent float->double conversion
  * Make type aliases `public` and add doxygen mark-up
  * Remove unused `energy_val_max_`
  * Add ElementId class member to interactor and supply during
    instantiation of interactor in CUDA source
  * Remove assertion on minimum energy for interactor
  * Do not apply XS correction for positrons yet in interactor;
    to be integrated in energy distribution sampler
  * Remove `energy_val_min_` member from interactor (handled
    before interactor is constructed); instead, check incoming
    particle energy is sufficient to produce secondary at start
    of `operator()`
Used for sampling angular distributions in pair-production and
bremsstrahlung processes (e.g. Seltzer-Berger and Bethe-Heitler
models).
@vrpascuzzi vrpascuzzi force-pushed the feature/physics/SeltzerBergerInteractor branch from b2f848d to 71a3b94 Compare May 24, 2021 16:01
Vincent R. Pascuzzi added 3 commits May 24, 2021 10:46
  * Update class description and other comments
  * Remove photon angular sampler function (using instead common
    TsaiUrbanDistribution)
Sampled electron angle twice. Fixed to sample positron.
@vrpascuzzi vrpascuzzi force-pushed the feature/physics/SeltzerBergerInteractor branch from 1e8fd0f to 3e8470f Compare May 24, 2021 18:21
Vincent R. Pascuzzi added 3 commits May 24, 2021 13:05
  * Use native pointers/refs

\todo Fix issue with min_gamma_energy <= 0
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.

Quite close to being ready to merge! The (mostly superficial) units issue is the only problem that I see for now.

@@ -149,34 +150,20 @@ CELER_FUNCTION Interaction BetheHeitlerInteractor::operator()(Engine& rng)
real_type phi = sample_phi(rng);

// Electron
real_type cost = this->sample_cos_theta(secondaries[0].energy.value(), rng);
TsaiUrbanDistribution sample_electron_angle(
secondaries[0].energy, units::MevMass{shared_.inv_electron_mass});
Copy link
Member

Choose a reason for hiding this comment

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

The units here are wrong but it looks like the quantity is right. The sampler and its G4ModifiedTsai counterpart both expect 1/(m_e c^2) so units of MevMassInv, which you can define (for now, and I'd dprob put it in the TsaiUrbanDistribution) as

using MevMassInv = Quantity<UnitDivide<CLightSq, Mev>>;

src/physics/em/detail/TsaiUrbanDistribution.hh Outdated Show resolved Hide resolved
test/physics/em/SeltzerBerger.test.cc Outdated Show resolved Hide resolved
test/physics/em/TsaiUrbanDistribution.test.cc Outdated Show resolved Hide resolved
v0.1.0 automation moved this from In progress to Review in progress May 24, 2021
Vincent R. Pascuzzi added 4 commits May 25, 2021 06:21
  * Explicitly mark public of type aliases and doxygen
  * EXPECT_VEC_SOFT_EQ for angle comparison with `double` type
  * Store ratio energy [MeV] to mass [MevMass*c^2] instead
    of energy and mass separately
@vrpascuzzi
Copy link
Contributor Author

vrpascuzzi commented May 25, 2021

SB test still failing due to min_gamma_energy being zero in CutoffView. To follow up.

EDIT: Fixed, thanks to @sethrj. Finish test and wrap up tomorrow!

Vincent R. Pascuzzi added 2 commits May 26, 2021 06:52
  * `gamma_secondary` -> `secondaries` (for consistency)
  * Assign secondary energy
  * normalize incident particle outgoing direction
  * Finalize 'basic' test
  * Add 'stress' test
@vrpascuzzi vrpascuzzi marked this pull request as ready for review May 26, 2021 13:54
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 work Vince! Thanks for making it happen! 😄

@sethrj sethrj merged commit 3383cef into celeritas-project:master May 26, 2021
v0.1.0 automation moved this from Review in progress to Done May 26, 2021
@vrpascuzzi
Copy link
Contributor Author

Nice work Vince! Thanks for making it happen!

A bit late to the party but we have it now!

@vrpascuzzi vrpascuzzi deleted the feature/physics/SeltzerBergerInteractor branch May 26, 2021 15:32
@sethrj
Copy link
Member

sethrj commented May 26, 2021

I'm gonna implement the positron XS correction; and then you can add the new Brems process. We shouldn't end up stepping on each other's changes.

@vrpascuzzi
Copy link
Contributor Author

So let's go.

@sethrj sethrj mentioned this pull request May 28, 2021
6 tasks
@sethrj sethrj added the enhancement New feature or request label Feb 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request physics Particles, processes, and stepping algorithms
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

3 participants