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

Support combined single and multiple Coulomb scattering #1230

Merged
merged 21 commits into from
May 23, 2024

Conversation

amandalund
Copy link
Contributor

This refactors and updates the single Coulomb scattering code in preparation for adding the Wentzel VI MSC model and combined single and multiple scattering. The main changes are:

  • Refactor most of the Coulomb scattering model data into a separate Wentzel OK&VI data and params class. This data will also be used by the Wentzel VI MSC model, which samples single scattering for small step lengths and needs the parameters for the quantities calculated in the Wentzel helper class (cross sections, screening factor, etc.)
  • Sample the scattering angle and calculate the Coulomb cross sections for arbitrary min/max scattering angles instead of assuming polar angle limits for single scattering. With combined SS and MSC, Wentzel VI will be used to sample scatterings with angles below a given polar angle limit, and single Coulomb scattering will be used above the limit.
  • Calculate the electron and nuclear cross sections in addition to just the xs ratio (Wentzel VI will need the total xs)
  • Import the MSC theta limit, angle limit factor, and nuclear form factor type from Geant4

@amandalund amandalund added enhancement New feature or request physics Particles, processes, and stepping algorithms labels May 10, 2024
@amandalund amandalund requested review from sethrj, whokion and hhollenb May 10, 2024 00:30
@sethrj sethrj changed the title Update Coulomb scattering implementation to support combined single and multiple scattering Support combined single and multiple Coulomb scattering May 15, 2024
Copy link
Contributor

@whokion whokion left a comment

Choose a reason for hiding this comment

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

Very good! Left some trivial comments just for clarification. Otherwise, good to go for now and hope that the WentzelVI msc model is available soon. We may also need more low/high-level tests/verification/validation for the Coulomb scattering, which belongs to me and @hhollenb. Thanks for the update.

src/celeritas/em/data/WentzelOKVIData.hh Outdated Show resolved Hide resolved
src/celeritas/em/data/WentzelOKVIData.hh Outdated Show resolved Hide resolved
src/celeritas/em/data/WentzelOKVIData.hh Outdated Show resolved Hide resolved
src/celeritas/em/distribution/WentzelDistribution.hh Outdated Show resolved Hide resolved
src/celeritas/em/distribution/WentzelDistribution.hh Outdated Show resolved Hide resolved
src/celeritas/em/params/WentzelOKVIParams.cc Outdated Show resolved Hide resolved
src/celeritas/em/params/WentzelOKVIParams.hh Outdated Show resolved Hide resolved
src/celeritas/em/xs/WentzelHelper.hh Outdated Show resolved Hide resolved
test/celeritas/em/CoulombScattering.test.cc Show resolved Hide resolved
src/celeritas/em/params/WentzelOKVIParams.cc Outdated Show resolved Hide resolved
@amandalund
Copy link
Contributor Author

Thanks @whokion for the helpful feedback! I agree about adding more testing, and I also still need to set the correct lower energy limit for the Coulomb scattering model, which I'm planning do in a follow-up PR.

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.

That's a lot of work, thanks! Just have a couple small comments.

src/celeritas/em/distribution/WentzelDistribution.hh Outdated Show resolved Hide resolved
src/celeritas/em/data/WentzelOKVIData.hh Outdated Show resolved Hide resolved
}
if (!wentzel)
{
// Set the minimum scattering angle for Coulomb single scattering
Copy link
Member

Choose a reason for hiding this comment

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

Is this :

Suggested change
// Set the minimum scattering angle for Coulomb single scattering
// Set the maximum scattering angle for Coulomb single scattering

?
So for wentzel you can fully backscatter, but with coulomb scattering you can't change more than 90 degrees?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It should be the maximum scattering angle for wentzel VI (180° if there's no single coulomb, or the msc theta limit from the EM params if there is) and the minimum scattering angle for coulomb (0° if there's no wentzel VI, else the msc theta limit).

One thing I'm still unsure about is the default value of the msc theta limit... from the literature (e.g. here) it sounds like it should be around 0.2 radians, but as far as I can tell in the EM params it's pi?

src/celeritas/ext/GeantImporter.cc Outdated Show resolved Hide resolved
src/celeritas/mat/MaterialView.hh Outdated Show resolved Hide resolved
@sethrj
Copy link
Member

sethrj commented May 22, 2024

Thanks @amandalund ! @hhollenb Do you want to take a look at this before I merge?

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.

Everything looks really good! With these changes it looks like I'm getting better agreement with Geant4 for just the single Coulomb scattering.

@@ -160,6 +160,17 @@ enum class MscStepLimitAlgorithm
size_,
};

//---------------------------------------------------------------------------//
//! Nuclear form factor model for Coulomb scattering
enum class NuclearFormFactorType
Copy link
Contributor

Choose a reason for hiding this comment

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

If we're moving nuclear form factors to a more general namespace, should we also move their calculation out of WentzelDistribution so there's a single implementation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I moved the enum here because we're now also using it in the import data structs, a lot of our other enums live here, and we shouldn't need additional changes for the SWIG build (#1159), but there wouldn't be any problem with leaving in the wentzel data. I think as long as the form factor calculations are only used in the wentzel distribution we can leave them there.

@amandalund
Copy link
Contributor Author

Thanks @hhollenb, that's great!

@sethrj sethrj enabled auto-merge (squash) May 23, 2024 06:32
@sethrj sethrj merged commit 65ed16e into celeritas-project:develop May 23, 2024
28 checks passed
@amandalund amandalund deleted the coulomb-combined branch May 23, 2024 11:37
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
None yet
Development

Successfully merging this pull request may close these issues.

4 participants