-
Notifications
You must be signed in to change notification settings - Fork 226
D-T fusion #3153
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
D-T fusion #3153
Conversation
| if( species=="hydrogen" ) | ||
| return PhysicalSpecies::hydrogen; | ||
| if( species=="proton" ) | ||
| if( species=="neutron" ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: #3090
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for this PR, it looks good to me! 👍
My comments are mainly for minor things.
| constexpr amrex::ParticleReal m_D = 2.01410177812 * PhysConst::m_u; | ||
| constexpr amrex::ParticleReal m_T = 3.0160492779 * PhysConst::m_u; | ||
| constexpr amrex::ParticleReal m_reduced = m_D / (1._prt + m_D/m_T); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering if we should not pass the masses to the cross section functors rather than redefining them.
For instance, I've noticed that I've forgotten to update the boron mass in the p-B fusion cross section functor. I guess it's probably safer to define the masses once and then use them everywhere.
Could also be done in a follow-up PR though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very good point. I think that I'll address this in the next PR I am planning, which would add the D-D fusion and would reuse/generalize this cross-section function.
Source/Particles/Collision/BinaryCollision/NuclearFusion/DeuteriumTritiumFusionCrossSection.H
Outdated
Show resolved
Hide resolved
Source/Particles/Collision/BinaryCollision/NuclearFusion/NuclearFusionFunc.H
Outdated
Show resolved
Hide resolved
Source/Particles/Collision/BinaryCollision/NuclearFusion/TwoProductFusionInitializeMomentum.H
Outdated
Show resolved
Hide resolved
Source/Particles/Collision/BinaryCollision/NuclearFusion/TwoProductFusionInitializeMomentum.H
Outdated
Show resolved
Hide resolved
| MeV_to_Joule = scc.e*1e6 | ||
| barn_to_square_meter = 1.e-28 | ||
|
|
||
| E_fusion = 17.6*MeV_to_Joule # Energy released during the fusion reaction |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In case you update the value in the C++ code, you might need to update it here as well
| def check_macroparticle_number(data, fusion_probability_target_value, num_pair_per_cell): | ||
| ## Checks that the number of macroparticles is as expected for the first and second tests | ||
|
|
||
| ## The first slice 0 < z < 1 does not contribute to alpha creation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| ## The first slice 0 < z < 1 does not contribute to alpha creation | |
| ## The first slice 0 < z < 1 does not contribute to product species creation |
| assert(is_close(average_px_sq, average_pz_sq, rtol = relative_tolerance)) | ||
|
|
||
| def check_xy_isotropy(data): | ||
| ## Checks that the alpha particles are emitted isotropically in x and y |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| ## Checks that the alpha particles are emitted isotropically in x and y | |
| ## Checks that the product particles are emitted isotropically in x and y |
| ## physical case of two beams colliding with each other. The kinetic energy of the colliding | ||
| ## particles depends on the cell number in the z direction and varies in the few keV to few MeV | ||
| ## range. All the particles within a cell have the exact same momentum, which allows detailed | ||
| ## checks of the energy of produced alpha particles. The reactant species have the same |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably remove alpha here. But I don't think we're checking the produced particles energies here, so it's probably best to remove this sentence altogether
| ## The second test is performed in the rest frame of the second reactant. It corresponds to the | ||
| ## physical case of a low density beam colliding with a high-density mixed target. The energy of the | ||
| ## beam particles is varied in the few keV to few MeV range, depending on the cell number in the z | ||
| ## direction. As in the previous case, all the particles within a cell have the exact same |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, we should probably remove
"As in the previous case, all the particles within a cell have the exact same momentum, which allows detailed checks of the energy of product particles."
|
Thanks for these great comments! I updated the PR accordingly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking my comments into account, looks good to me now!
Source/Particles/Collision/BinaryCollision/NuclearFusion/NuclearFusionFunc.H
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, great work! :)
* initial work * fixed bugs and added species * update documentation * delete unused file * Add properties for neutron, hydrogen isotopes, helium isotopes * Update code to be more consistent * Correct typo * Parse deuterium-tritium fusion * Start putting in place the files for deuterium-tritium * Update documentation * Prepare structures for deuterium tritium * Fix typo * Fix compilation * Add neutron * Add correct formula for the cross-section * Correct compilation error * Fix nuclear fusion * Reset benchmarks * Prepare creation functor for 2-product fusion * First implementation of momentum initialization * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Use utility function for fusion * Minor modification of variable names * Fix GPU compilation * Fix single precision compilation * Update types * Use util function in P-B fusion * Correct compilation errors * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Correct errors * Update values of mass and charge * Correct compilation error * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Correct compilation error * Correct compilation error * Correct compilation error * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Reset benchmark * Use helium particle in proton-boron, to avoid resetting benchmark * Fixed proton-boron test * Revert "Fixed proton-boron test" This reverts commit 73c8d9d. * Incorporate Neil's recommendations * Reset benchmarks * Correct compilation errors * Add new deuterium tritium automated test * Correct formula of cross-section * Correct cross-section * Improve analysis script * Add test of energy conservation * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Add test of conservation of momentum * Progress in analysis script * Fix error in the initial energy of the deuterium particles * Add check of isotropy * Clean up the test script * Rewrite p_sq formula in a way to avoids machine-precision negative numbers * Add checksum * Clean up code * Apply suggestions from code review * Update PR according to comments * Update benchmark * Address additional comments * Numerical Literals Co-authored-by: Luca Fedeli <[email protected]> Co-authored-by: Neïl Zaim <[email protected]>
* initial work * fixed bugs and added species * update documentation * delete unused file * Add properties for neutron, hydrogen isotopes, helium isotopes * Update code to be more consistent * Correct typo * Parse deuterium-tritium fusion * Start putting in place the files for deuterium-tritium * Update documentation * Prepare structures for deuterium tritium * Fix typo * Fix compilation * Add neutron * Add correct formula for the cross-section * Correct compilation error * Fix nuclear fusion * Reset benchmarks * Prepare creation functor for 2-product fusion * First implementation of momentum initialization * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Use utility function for fusion * Minor modification of variable names * Fix GPU compilation * Fix single precision compilation * Update types * Use util function in P-B fusion * Correct compilation errors * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Correct errors * Update values of mass and charge * Correct compilation error * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Correct compilation error * Correct compilation error * Correct compilation error * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Reset benchmark * Use helium particle in proton-boron, to avoid resetting benchmark * Fixed proton-boron test * Revert "Fixed proton-boron test" This reverts commit 73c8d9d. * Incorporate Neil's recommendations * Reset benchmarks * Correct compilation errors * Add new deuterium tritium automated test * Correct formula of cross-section * Correct cross-section * Improve analysis script * Add test of energy conservation * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Add test of conservation of momentum * Progress in analysis script * Fix error in the initial energy of the deuterium particles * Add check of isotropy * Clean up the test script * Rewrite p_sq formula in a way to avoids machine-precision negative numbers * Add checksum * Clean up code * Apply suggestions from code review * Update PR according to comments * Update benchmark * Address additional comments * Numerical Literals Co-authored-by: Luca Fedeli <[email protected]> Co-authored-by: Neïl Zaim <[email protected]>
* Initial version of accelerator lattice * Clean up EOL white space * Small clean up for GPU * Fixed up consts * Added hard edge fraction plus other clean ups * More clean up * Restructure to work on GPUs * Now this grabs its own copies of particle info * Updates, including adding dBdx * Small cleanup in Quad * Small fixes for GPU * More cleanup for GPU * More GPU cleanup * Rewrite of the accelerator lattice implementation to better handle GPU * Fix struct forward definition * Another forward definition fix * Bug fix * Added LatticeElementBase * Removed zcenters array * Added CI test case * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Clean up in CI analysis.py * Cleanup of coding * Added CI test hard_edged_quadrupoles_moving * Added Lorentz transform between boosted frame and lab frame * Fixes for working in the boosted frame * Added boosted CI test * Change input name, adding the prefix "lattice." * Added plasma lens lattice element This will replace the external field plasma lens * Fixed CI analysis script to look for "lattice.quad" * Added checks of lattice element input * Added documentation * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Removed duplicate call to lattice finder UpdateIndices * Added extensive comments * Reworked the input to use the MAD like description This is the same as the method used in ImpactX * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Remove old lines from inputs_lattice_3d * Added "lattice" element type * Fixed some Real and ParticleReals * [pre-commit.ci] pre-commit autoupdate (#3246) updates: - [github.com/hadialqattan/pycln: v2.0.1 → v2.0.3](hadialqattan/pycln@v2.0.1...v2.0.3) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * ABLASTR: Update Poisson Solver API (#3243) Update the Poisson Solver API to be more usable. Needed for ImpactX. * Docs: New OLCF Machine (#3228) * D-T fusion (#3153) * initial work * fixed bugs and added species * update documentation * delete unused file * Add properties for neutron, hydrogen isotopes, helium isotopes * Update code to be more consistent * Correct typo * Parse deuterium-tritium fusion * Start putting in place the files for deuterium-tritium * Update documentation * Prepare structures for deuterium tritium * Fix typo * Fix compilation * Add neutron * Add correct formula for the cross-section * Correct compilation error * Fix nuclear fusion * Reset benchmarks * Prepare creation functor for 2-product fusion * First implementation of momentum initialization * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Use utility function for fusion * Minor modification of variable names * Fix GPU compilation * Fix single precision compilation * Update types * Use util function in P-B fusion * Correct compilation errors * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Correct errors * Update values of mass and charge * Correct compilation error * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Correct compilation error * Correct compilation error * Correct compilation error * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Reset benchmark * Use helium particle in proton-boron, to avoid resetting benchmark * Fixed proton-boron test * Revert "Fixed proton-boron test" This reverts commit 73c8d9d. * Incorporate Neil's recommendations * Reset benchmarks * Correct compilation errors * Add new deuterium tritium automated test * Correct formula of cross-section * Correct cross-section * Improve analysis script * Add test of energy conservation * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Add test of conservation of momentum * Progress in analysis script * Fix error in the initial energy of the deuterium particles * Add check of isotropy * Clean up the test script * Rewrite p_sq formula in a way to avoids machine-precision negative numbers * Add checksum * Clean up code * Apply suggestions from code review * Update PR according to comments * Update benchmark * Address additional comments * Numerical Literals Co-authored-by: Luca Fedeli <[email protected]> Co-authored-by: Neïl Zaim <[email protected]> * Docs: gaussian beam `q_tot` is not optional (#3249) * Fix a bug in GPU version of Hankel Transform (#3253) amrex::Array4 is a 4D array that can be accessed with three spatial indices plus an optional component index. We must always provide all three spatial indices even in 2D. * Add Python Callback Call when Checkpointing Signal is Received (#3251) * CI: Add Missing Regression Analysis (NCI corrector) (#3252) * Fixes to allow mixed precision, ParticleReal float, Real double (#3239) * Fixes to allow mixed precision, ParticleReal float, Real double * Fix for the optical depth * A different way of fixing QuantumSynchrotronEvolveOpticalDepth * In the QED code, consistently use ParticleReal * Use ParticleReal type consistently * Fix typo Docs/source/usage/parameters.rst Co-authored-by: Edoardo Zoni <[email protected]> * Fix typo Docs/source/usage/parameters.rst Co-authored-by: Edoardo Zoni <[email protected]> * Fix small error in plasma lens lattice documentation * Small addition to the documentation * Fix the residence correction to allow short elements * Updated CI benchmarks * Added check of lattice to isNoOp * Updated the hard_edged_quadrupoles CI benchmarks It is not clear why there was a change, but the difference is essentially round off in the E field. The important thing is that the particles are still correct. * Update Source/AcceleratorLattice/AcceleratorLattice.H Add include statements Co-authored-by: Axel Huebl <[email protected]> * Update Source/AcceleratorLattice/LatticeElements/LatticeElementBase.H Add includes Co-authored-by: Axel Huebl <[email protected]> * Renamed to README.rst and updated headers * Made d_lattice_element_finder optional type * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Include `<optional>` * Docs: Developer AccLattice Inclusion Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Axel Huebl <[email protected]> Co-authored-by: Remi Lehe <[email protected]> Co-authored-by: Luca Fedeli <[email protected]> Co-authored-by: Neïl Zaim <[email protected]> Co-authored-by: Weiqun Zhang <[email protected]> Co-authored-by: Roelof Groenewald <[email protected]> Co-authored-by: Edoardo Zoni <[email protected]>
This PR implements a Monte-Carlo Deuterium-Tritium fusion module, and builds upon the previously-existing proton-Boron fusion module (See #2290).
Overview of the underlying model
The cross-section analytical fits for the D-T cross-section are taken from this paper, which expresses the cross-sections as

where
S(E)is the "astrophysical factor", which is expressed as a ratio of two polynomials, whose coefficients have been fitted to experimental data.The momentum of the two product particles (a helium4 nucleus and a neutron) are found by a simple conservation of energy and momenta, and by assuming isotropic emission in the center-of-mass frame.
As much as possible, the code was written in a way that could be easily extensible to other fusion reactions that lead to 2 product species (e.g. D-D fusion). As such, the mass of the product species is now passed as an argument in the
ParticleCreationFunc(instead of using hard-coded values).Automated tests
The automated tests are very similar to the proton-Boron fusion tests, but with Deuterium and Tritium instead of proton and Boron. For the sake of simplification, I only retained the first two tests:
We still check the conservation of energy, momentum, and number of particles, and we check that the fusion rate corresponds to the expected analytical rates.