-
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
Merged
Merged
D-T fusion #3153
Changes from 6 commits
Commits
Show all changes
78 commits
Select commit
Hold shift + click to select a range
5cc92e5
initial work
lucafedeli88 fc3334d
fixed bugs and added species
lucafedeli88 d744b7a
update documentation
lucafedeli88 d768660
delete unused file
lucafedeli88 2e5d076
Add properties for neutron, hydrogen isotopes, helium isotopes
RemiLehe 029f3e1
Update code to be more consistent
RemiLehe 8ce861d
Correct typo
RemiLehe f716fea
Parse deuterium-tritium fusion
RemiLehe 9763ad3
Start putting in place the files for deuterium-tritium
RemiLehe ea3217e
Update documentation
RemiLehe c5d067c
Prepare structures for deuterium tritium
RemiLehe 9549830
Fix typo
RemiLehe c0309bd
Merge branch 'more_data' into dt_fusion
RemiLehe 78be34e
Fix compilation
RemiLehe d6639d6
Add neutron
RemiLehe 24a743d
Merge branch 'development' into improve_SpeciesPhysicalProperties
RemiLehe c096d29
Merge branch 'development' into improve_SpeciesPhysicalProperties
RemiLehe 08cd304
Add correct formula for the cross-section
RemiLehe 139eebf
Correct compilation error
RemiLehe c6e7c92
Fix nuclear fusion
RemiLehe 6ab97ec
Reset benchmarks
RemiLehe 6f7e7c0
Prepare creation functor for 2-product fusion
RemiLehe ff08305
First implementation of momentum initialization
RemiLehe 428a179
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] fa01fdd
Use utility function for fusion
RemiLehe 88fcaf5
Minor modification of variable names
RemiLehe 0a59ecd
Merge branch 'dt_fusion' of github.com:RemiLehe/WarpX into dt_fusion
RemiLehe 821356d
Fix GPU compilation
RemiLehe ad24117
Fix single precision compilation
RemiLehe ca278c6
Update types
RemiLehe 2cdd394
Use util function in P-B fusion
RemiLehe 3bc13d4
Correct compilation errors
RemiLehe eb91623
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] d82bb73
Correct errors
RemiLehe 2a5cc53
Merge branch 'dt_fusion' of github.com:RemiLehe/WarpX into dt_fusion
RemiLehe 323950d
Update values of mass and charge
RemiLehe 61b0769
Correct compilation error
RemiLehe bbf95b8
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 70c5fe6
Correct compilation error
RemiLehe 65409f4
Correct compilation error
RemiLehe c82c8e7
Correct compilation error
RemiLehe 9510dee
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 2a41771
Reset benchmark
RemiLehe 24d1fc7
Use helium particle in proton-boron, to avoid resetting benchmark
RemiLehe 73c8d9d
Fixed proton-boron test
RemiLehe 5c31035
Revert "Fixed proton-boron test"
RemiLehe 72fb317
Merge branch 'development' into improve_SpeciesPhysicalProperties
RemiLehe 542d2cb
Incorporate Neil's recommendations
RemiLehe c9a8661
Merge branch 'development' into improve_SpeciesPhysicalProperties
RemiLehe b228c29
Reset benchmarks
RemiLehe 00e5d09
Merge branch 'improve_SpeciesPhysicalProperties' into dt_fusion
RemiLehe dd1ca83
Merge branch 'development' into dt_fusion
RemiLehe 665451f
Correct compilation errors
RemiLehe 284f370
Add new deuterium tritium automated test
RemiLehe c3cff64
Correct formula of cross-section
RemiLehe 67d0ff1
Correct cross-section
RemiLehe 8137f01
Improve analysis script
RemiLehe 637ea1b
Add test of energy conservation
RemiLehe a163b8a
Merge branch 'development' into dt_fusion
RemiLehe b11812d
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] eb76522
Add test of conservation of momentum
RemiLehe a61aef3
Progress in analysis script
RemiLehe 5b6585d
Merge branch 'dt_fusion' of github.com:RemiLehe/WarpX into dt_fusion
RemiLehe d1bd322
Fix error in the initial energy of the deuterium particles
RemiLehe e29d5ab
Add check of isotropy
RemiLehe a117150
Clean up the test script
RemiLehe e787250
Rewrite p_sq formula in a way to avoids machine-precision negative nu…
RemiLehe b45e99d
Add checksum
RemiLehe 471e263
Clean up code
RemiLehe 0629a95
Merge branch 'development' into dt_fusion
RemiLehe 1b847d4
Merge branch 'development' into dt_fusion
RemiLehe 44fd734
Merge branch 'development' into dt_fusion
RemiLehe d931ef7
Merge branch 'dt_fusion' of github.com:RemiLehe/WarpX into dt_fusion
RemiLehe e6efe57
Apply suggestions from code review
RemiLehe fec693e
Update PR according to comments
RemiLehe f11f72e
Update benchmark
RemiLehe c2846d8
Address additional comments
RemiLehe c103462
Numerical Literals
ax3l File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
Source/Particles/Collision/BinaryCollision/NuclearFusion/DeuteriumTritiumCrossSection.H
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| /* Copyright 2022 Remi Lehe | ||
| * | ||
| * This file is part of WarpX. | ||
| * | ||
| * License: BSD-3-Clause-LBNL | ||
| */ | ||
|
|
||
| #ifndef DEUTERIUM_TRITIUM_FUSION_CROSS_SECTION_H | ||
| #define DEUTERIUM_TRITIUM_FUSION_CROSS_SECTION_H | ||
|
|
||
| #include "Utils/WarpXConst.H" | ||
|
|
||
| #include <AMReX_REAL.H> | ||
|
|
||
| #include <cmath> | ||
|
|
||
| /** | ||
| * \brief Computes the total deuterium-tritium fusion cross section. | ||
| * | ||
| * @param[in] E_kin_star the kinetic energy of the deuterium-tritium pair in its center of mass frame, | ||
| * in SI units. | ||
| * @return The total cross section in SI units (square meters). | ||
| */ | ||
| AMREX_GPU_HOST_DEVICE AMREX_INLINE | ||
| amrex::ParticleReal DeuteriumTritiumFusionCrossSection (const amrex::ParticleReal& E_kin_star) | ||
| { | ||
| using namespace amrex::literals; | ||
|
|
||
| // Convert cross section to SI units: barn to square meter | ||
| constexpr auto barn_to_sqm = 1.e-28_prt; | ||
| return 0.*barn_to_sqm; | ||
| } | ||
|
|
||
| #endif // DEUTERIUM_TRITIUM_TRITIUM_FUSION_CROSS_SECTION_H |
64 changes: 64 additions & 0 deletions
64
...ce/Particles/Collision/BinaryCollision/NuclearFusion/DeuteriumTritiumInitializeMomentum.H
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| /* Copyright 2022 Remi Lehe | ||
| * | ||
| * This file is part of WarpX. | ||
| * | ||
| * License: BSD-3-Clause-LBNL | ||
| */ | ||
|
|
||
| #ifndef DEUTERIUM_TRITIUM_FUSION_INITIALIZE_MOMENTUM_H | ||
| #define DEUTERIUM_TRITIUM_FUSION_INITIALIZE_MOMENTUM_H | ||
|
|
||
| #include "Particles/WarpXParticleContainer.H" | ||
| #include "Utils/ParticleUtils.H" | ||
| #include "Utils/WarpXConst.H" | ||
|
|
||
| #include <AMReX_DenseBins.H> | ||
| #include <AMReX_Random.H> | ||
| #include <AMReX_REAL.H> | ||
|
|
||
| #include <cmath> | ||
| #include <limits> | ||
|
|
||
| namespace { | ||
| // Define shortcuts for frequently-used type names | ||
| using SoaData_type = WarpXParticleContainer::ParticleTileType::ParticleTileDataType; | ||
| using ParticleType = WarpXParticleContainer::ParticleType; | ||
| using ParticleBins = amrex::DenseBins<ParticleType>; | ||
| using index_type = ParticleBins::index_type; | ||
|
|
||
| /** | ||
| * \brief This function initializes the momentum of the particles produced from | ||
| * deuterium-tritium fusion. | ||
| * | ||
| * @param[in] soa_1 struct of array data of the first colliding species (can be either deuterium | ||
| * or tritium) | ||
| * @param[in] soa_2 struct of array data of the second colliding species (can be either deuterium | ||
| * or tritium) | ||
| * @param[out] ... | ||
| * @param[in] idx_1 index of first colliding macroparticle | ||
| * @param[in] idx_2 index of second colliding macroparticle | ||
| * @param[in]... | ||
| * @param[in] m1 mass of first colliding species | ||
| * @param[in] m2 mass of second colliding species | ||
| * @param[in] engine the random engine | ||
| */ | ||
| AMREX_GPU_HOST_DEVICE AMREX_INLINE | ||
| void DeuteriumTritiumFusionInitializeMomentum ( | ||
| const SoaData_type& soa_1, const SoaData_type& soa_2, | ||
| SoaData_type& soa_alpha, | ||
| const index_type& idx_1, const index_type& idx_2, | ||
| const index_type& idx_alpha_start, | ||
| const amrex::ParticleReal& m1, const amrex::ParticleReal& m2, | ||
| const amrex::RandomEngine& engine) | ||
| { | ||
| // General notations in this function: | ||
| // x_sq denotes the square of x | ||
| // x_star denotes the value of x in the proton+boron center of mass frame | ||
| // x_Bestar denotes the value of x in the Beryllium rest frame | ||
|
|
||
| using namespace amrex::literals; | ||
| } | ||
|
|
||
| } | ||
|
|
||
| #endif // DEUTERIUM_TRITIUM_FUSION_INITIALIZE_MOMENTUM_H |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,8 +17,9 @@ | |
| #include <map> | ||
| #include <string> | ||
|
|
||
| enum struct PhysicalSpecies{unspecified=0, electron, positron, photon, hydrogen, helium, boron, | ||
| boron10, boron11, carbon, nitrogen, oxygen, argon, copper, xenon}; | ||
| enum struct PhysicalSpecies{unspecified=0, electron, positron, photon, neutron, | ||
| hydrogen, hydrogen2, hydrogen3, helium, helium3, helium4, boron, boron10, | ||
| boron11, carbon, nitrogen, oxygen, argon, copper, xenon}; | ||
|
|
||
| namespace species | ||
| { | ||
|
|
@@ -33,12 +34,20 @@ namespace species | |
| return PhysicalSpecies::positron; | ||
| if( species=="photon" ) | ||
| return PhysicalSpecies::photon; | ||
| if( species=="hydrogen" ) | ||
| return PhysicalSpecies::hydrogen; | ||
| if( species=="proton" ) | ||
| if( species=="neutron" ) | ||
|
||
| return PhysicalSpecies::neutron; | ||
| if( (species=="hydrogen") || (species=="proton") ) | ||
| return PhysicalSpecies::hydrogen; | ||
| if( (species=="hydrogen2") || (species=="deuterium") ) | ||
| return PhysicalSpecies::hydrogen2; | ||
| if (species=="hydrogen3") || (species=="tritium") ) | ||
| return PhysicalSpecies::hydrogen3; | ||
| if( species=="helium" ) | ||
| return PhysicalSpecies::helium; | ||
| if( species=="helium3" ) | ||
| return PhysicalSpecies::helium3; | ||
| if( species=="helium4" ) | ||
| return PhysicalSpecies::helium4; | ||
| if( species=="alpha" ) | ||
| return PhysicalSpecies::helium; | ||
| if( species=="boron" ) | ||
|
|
@@ -75,10 +84,20 @@ namespace species | |
| return PhysConst::q_e; | ||
| case PhysicalSpecies::photon: | ||
| return 0.; | ||
| case PhysicalSpecies::neutron: | ||
| return 0.; | ||
| case PhysicalSpecies::hydrogen: | ||
| return PhysConst::q_e; | ||
| case PhysicalSpecies::hydrogen2: | ||
| return PhysConst::q_e; | ||
| case PhysicalSpecies::hydrogen3: | ||
| return PhysConst::q_e; | ||
| case PhysicalSpecies::helium: | ||
| return PhysConst::q_e * amrex::Real(2.0); | ||
| case PhysicalSpecies::helium3: | ||
| return PhysConst::q_e * amrex::Real(2.0); | ||
| case PhysicalSpecies::helium4: | ||
| return PhysConst::q_e * amrex::Real(2.0); | ||
| case PhysicalSpecies::boron: | ||
| return PhysConst::q_e * amrex::Real(5.0); | ||
| case PhysicalSpecies::boron10: | ||
|
|
@@ -115,10 +134,20 @@ namespace species | |
| return PhysConst::m_e; | ||
| case PhysicalSpecies::photon: | ||
| return 0.; | ||
| case PhysicalSpecies::neutron: | ||
| return PhysConst::m_p * amrex::Real(1.0013784193052508); | ||
| case PhysicalSpecies::hydrogen: | ||
| return PhysConst::m_p; | ||
| case PhysicalSpecies::hydrogen2: | ||
| return PhysConst::m_p * amrex::Real(1.99901); | ||
| case PhysicalSpecies::hydrogen3: | ||
| return PhysConst::m_p * amrex::Real(2.99372); | ||
| case PhysicalSpecies::helium: | ||
| return PhysConst::m_p * amrex::Real(3.97369); | ||
| case PhysicalSpecies::helium3: | ||
| return PhysConst::m_p * amrex::Real(2.99369); | ||
| case PhysicalSpecies::helium4: | ||
| return PhysConst::m_p * amrex::Real(3.97314); | ||
| case PhysicalSpecies::boron: | ||
| return PhysConst::m_p * amrex::Real(10.7319); | ||
| case PhysicalSpecies::boron10: | ||
|
|
@@ -157,8 +186,16 @@ namespace species | |
| return "photon"; | ||
| case PhysicalSpecies::hydrogen: | ||
| return "hydrogen"; | ||
| case PhysicalSpecies::hydrogen2: | ||
| return "hydrogen2"; | ||
| case PhysicalSpecies::hydrogen3: | ||
| return "hydrogen3"; | ||
| case PhysicalSpecies::helium: | ||
| return "helium"; | ||
| case PhysicalSpecies::helium3: | ||
| return "helium3"; | ||
| case PhysicalSpecies::helium4: | ||
| return "helium4"; | ||
| case PhysicalSpecies::boron: | ||
| return "boron"; | ||
| case PhysicalSpecies::boron10: | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.