-
Notifications
You must be signed in to change notification settings - Fork 229
Correct and test fusion module in RZ geometry #3255
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
Changes from all commits
Commits
Show all changes
92 commits
Select commit
Hold shift + click to select a range
1c46d5c
Add particle rotation in NuclearFusionFunc.H
Yin-YinjianZhao be57c60
Minor
Yin-YinjianZhao 1fd6f05
indent
Yin-YinjianZhao 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 4d19e2b
Add test for fusion in RZ geometry
RemiLehe 010c6cc
Update code to take into account actual timestep
RemiLehe e41378d
Update RZ test
RemiLehe 042b5f5
Update RZ test
RemiLehe 8f8afd8
Increase number of particles
RemiLehe 00055ae
Impart radial memory on DT particles
RemiLehe a003d5c
Correct RZ momenta
RemiLehe 51190a0
Merge branch 'dt_rz_test' of github.com:RemiLehe/WarpX into dt_rz_test
RemiLehe 7d188b4
Merge branch 'collision_fusion' into dt_rz_test
RemiLehe c2529a3
Merge branch 'development' into dt_rz_test
RemiLehe 27994fc
Remove unused file
RemiLehe e85d2c5
Update test
RemiLehe f1994ea
Fix definition of theta
RemiLehe 422586b
Add new test
RemiLehe 337b2ed
Add checksum
RemiLehe 70a864e
Update test
RemiLehe 55ad0e0
Update tests
RemiLehe 54ca811
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 65b43eb
Fix Python analysis script
RemiLehe d399ac2
Remove CPU and ID from new benchmark
RemiLehe 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
129 changes: 129 additions & 0 deletions
129
Examples/Modules/nuclear_fusion/inputs_deuterium_tritium_rz
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,129 @@ | ||
| ################################# | ||
| ####### GENERAL PARAMETERS ###### | ||
| ################################# | ||
| ## With these parameters, each cell has a size of exactly 1 by 1 by 1 | ||
| max_step = 1 | ||
| amr.n_cell = 8 16 | ||
| amr.max_grid_size = 8 | ||
| amr.blocking_factor = 8 | ||
| amr.max_level = 0 | ||
| geometry.dims = RZ | ||
| geometry.prob_lo = 0. 0. | ||
| geometry.prob_hi = 8. 16. | ||
|
|
||
| ################################# | ||
| ###### Boundary Condition ####### | ||
| ################################# | ||
| boundary.field_lo = none periodic | ||
| boundary.field_hi = pec periodic | ||
|
|
||
| ################################# | ||
| ############ NUMERICS ########### | ||
| ################################# | ||
| warpx.verbose = 1 | ||
| warpx.cfl = 1.0 | ||
|
|
||
| # Order of particle shape factors | ||
| algo.particle_shape = 1 | ||
|
|
||
| ################################# | ||
| ############ PLASMA ############# | ||
| ################################# | ||
| particles.species_names = deuterium1 tritium1 helium1 neutron1 deuterium2 tritium2 helium2 neutron2 | ||
|
|
||
| my_constants.m_deuterium = 2.01410177812*m_u | ||
| my_constants.m_tritium = 3.0160492779*m_u | ||
| my_constants.m_reduced = m_deuterium*m_tritium/(m_deuterium+m_tritium) | ||
| my_constants.keV_to_J = 1.e3*q_e | ||
| my_constants.Energy_step = 22. * keV_to_J | ||
|
|
||
| deuterium1.species_type = deuterium | ||
| deuterium1.injection_style = "NRandomPerCell" | ||
| deuterium1.num_particles_per_cell = 80000 | ||
| deuterium1.profile = constant | ||
| deuterium1.density = 1. | ||
| deuterium1.momentum_distribution_type = parse_momentum_function | ||
| ## Thanks to the floor, all particles in the same cell have the exact same momentum | ||
| deuterium1.momentum_function_ux(x,y,z) = "u = sqrt(2*m_reduced*Energy_step*(floor(z)**2))/(m_deuterium*clight); if(x*x+y*y>0.0, -u*y/sqrt(x*x+y*y), 0.0)" # azimuthal velocity | ||
| deuterium1.momentum_function_uy(x,y,z) = "u = sqrt(2*m_reduced*Energy_step*(floor(z)**2))/(m_deuterium*clight); if(x*x+y*y>0.0, u*x/sqrt(x*x+y*y), 0.0)" # azimuthal velocity | ||
| deuterium1.momentum_function_uz(x,y,z) = "0" | ||
| deuterium1.do_not_push = 1 | ||
| deuterium1.do_not_deposit = 1 | ||
|
|
||
| tritium1.species_type = tritium | ||
| tritium1.injection_style = "NRandomPerCell" | ||
| tritium1.num_particles_per_cell = 80000 | ||
| tritium1.profile = constant | ||
| tritium1.density = 1. | ||
| tritium1.momentum_distribution_type = "parse_momentum_function" | ||
| ## Thanks to the floor, all particles in the same cell have the exact same momentum | ||
| tritium1.momentum_function_ux(x,y,z) = "u = sqrt(2*m_reduced*Energy_step*(floor(z)**2))/(m_tritium*clight); if(x*x+y*y>0.0, u*y/sqrt(x*x+y*y), 0.0)" # counter-streaming azimuthal velocity | ||
| tritium1.momentum_function_uy(x,y,z) = "u = sqrt(2*m_reduced*Energy_step*(floor(z)**2))/(m_tritium*clight); if(x*x+y*y>0.0, -u*x/sqrt(x*x+y*y), 0.0)" # counter-streaming azimuthal velocity | ||
| tritium1.momentum_function_uz(x,y,z) = 0 | ||
| tritium1.do_not_push = 1 | ||
| tritium1.do_not_deposit = 1 | ||
|
|
||
| helium1.species_type = helium4 | ||
| helium1.do_not_push = 1 | ||
| helium1.do_not_deposit = 1 | ||
|
|
||
| neutron1.species_type = neutron | ||
| neutron1.do_not_push = 1 | ||
| neutron1.do_not_deposit = 1 | ||
|
|
||
| my_constants.background_dens = 1.e26 | ||
| my_constants.beam_dens = 1.e20 | ||
|
|
||
| deuterium2.species_type = deuterium | ||
| deuterium2.injection_style = "NRandomPerCell" | ||
| deuterium2.num_particles_per_cell = 8000 | ||
| deuterium2.profile = "parse_density_function" | ||
| ## A tenth of the macroparticles in each cell is made of immobile high-density background deuteriums. | ||
| ## The other nine tenths are made of fast low-density beam deuteriums. | ||
| deuterium2.density_function(x,y,z) = if(y - floor(y) < 0.1, 10.*background_dens, 10./9.*beam_dens) | ||
| deuterium2.momentum_distribution_type = "parse_momentum_function" | ||
| deuterium2.momentum_function_ux(x,y,z) = 0. | ||
| deuterium2.momentum_function_uy(x,y,z) = 0. | ||
| deuterium2.momentum_function_uz(x,y,z) = "if(y - floor(y) < 0.1, | ||
| 0., sqrt(2*m_deuterium*Energy_step*(floor(z)**2))/(m_deuterium*clight))" | ||
| deuterium2.do_not_push = 1 | ||
| deuterium2.do_not_deposit = 1 | ||
|
|
||
| tritium2.species_type = tritium | ||
| tritium2.injection_style = "NRandomPerCell" | ||
| tritium2.num_particles_per_cell = 800 | ||
| tritium2.profile = constant | ||
| tritium2.density = background_dens | ||
| tritium2.momentum_distribution_type = "constant" | ||
| tritium2.do_not_push = 1 | ||
| tritium2.do_not_deposit = 1 | ||
|
|
||
| helium2.species_type = helium4 | ||
| helium2.do_not_push = 1 | ||
| helium2.do_not_deposit = 1 | ||
|
|
||
| neutron2.species_type = neutron | ||
| neutron2.do_not_push = 1 | ||
| neutron2.do_not_deposit = 1 | ||
|
|
||
| ################################# | ||
| ############ COLLISION ########## | ||
| ################################# | ||
| collisions.collision_names = DTF1 DTF2 | ||
|
|
||
| DTF1.species = deuterium1 tritium1 | ||
| DTF1.product_species = helium1 neutron1 | ||
| DTF1.type = nuclearfusion | ||
| DTF1.fusion_multiplier = 1.e50 | ||
|
|
||
| DTF2.species = deuterium2 tritium2 | ||
| DTF2.product_species = helium2 neutron2 | ||
| DTF2.type = nuclearfusion | ||
| DTF2.fusion_multiplier = 1.e15 | ||
| DTF2.fusion_probability_target_value = 0.02 | ||
|
|
||
| # Diagnostics | ||
| diagnostics.diags_names = diag1 | ||
| diag1.intervals = 1 | ||
| diag1.diag_type = Full | ||
| diag1.fields_to_plot = rho |
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 |
|---|---|---|
|
|
@@ -90,4 +90,4 @@ | |
| "particle_position_z": 819255.8152412223, | ||
| "particle_weight": 1.0239999999424347e+29 | ||
| } | ||
| } | ||
| } | ||
77 changes: 77 additions & 0 deletions
77
Regression/Checksum/benchmarks_json/Deuterium_Tritium_Fusion_RZ.json
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,77 @@ | ||
| { | ||
| "deuterium1": { | ||
| "particle_momentum_x": 1.8388106511899905e-13, | ||
| "particle_momentum_y": 1.837868790009435e-13, | ||
| "particle_momentum_z": 0.0, | ||
| "particle_position_x": 40959919.499819286, | ||
| "particle_position_y": 81919224.48541151, | ||
| "particle_theta": 32166860.23003994, | ||
| "particle_weight": 3216.984554806547 | ||
| }, | ||
| "deuterium2": { | ||
| "particle_momentum_x": 0.0, | ||
| "particle_momentum_y": 0.0, | ||
| "particle_momentum_z": 3.336364094249911e-14, | ||
| "particle_position_x": 4095908.9083809257, | ||
| "particle_position_y": 8192069.080030457, | ||
| "particle_theta": 3216444.348910214, | ||
| "particle_weight": 3.1898417901971444e+29 | ||
| }, | ||
| "helium1": { | ||
| "particle_momentum_x": 1.858124399143442e-15, | ||
| "particle_momentum_y": 1.876715110797694e-15, | ||
| "particle_momentum_z": 1.7098432207359157e-15, | ||
| "particle_position_x": 152920.23233108618, | ||
| "particle_position_y": 323733.9138644398, | ||
| "particle_theta": 120064.13771707338, | ||
| "particle_weight": 1.603083276067953e-27 | ||
| }, | ||
| "helium2": { | ||
| "particle_momentum_x": 1.5195006688950936e-15, | ||
| "particle_momentum_y": 1.52430083815551e-15, | ||
| "particle_momentum_z": 1.7654865863613367e-15, | ||
| "particle_position_x": 136867.63803188328, | ||
| "particle_position_y": 286903.30393175944, | ||
| "particle_theta": 107912.20520382549, | ||
| "particle_weight": 2.0862696876352987e+19 | ||
| }, | ||
| "lev=0": { | ||
| "rho": 0.0 | ||
| }, | ||
| "neutron1": { | ||
| "particle_momentum_x": 1.7160671487712845e-15, | ||
| "particle_momentum_y": 1.7154753069055672e-15, | ||
| "particle_momentum_z": 1.7098432207359157e-15, | ||
| "particle_position_x": 152920.23233108618, | ||
| "particle_position_y": 323733.9138644398, | ||
| "particle_theta": 120064.13771707338, | ||
| "particle_weight": 1.603083276067953e-27 | ||
| }, | ||
| "neutron2": { | ||
| "particle_momentum_x": 1.5195006688950936e-15, | ||
| "particle_momentum_y": 1.52430083815551e-15, | ||
| "particle_momentum_z": 1.5463311225724366e-15, | ||
| "particle_position_x": 136867.63803188328, | ||
| "particle_position_y": 286903.30393175944, | ||
| "particle_theta": 107912.20520382549, | ||
| "particle_weight": 2.0862696876352987e+19 | ||
| }, | ||
| "tritium1": { | ||
| "particle_momentum_x": 1.8384658063720362e-13, | ||
| "particle_momentum_y": 1.8381593257898129e-13, | ||
| "particle_momentum_z": 0.0, | ||
| "particle_position_x": 40961278.052658774, | ||
| "particle_position_y": 81919046.8061561, | ||
| "particle_theta": 32163925.891884565, | ||
| "particle_weight": 3217.0912552970394 | ||
| }, | ||
| "tritium2": { | ||
| "particle_momentum_x": 0.0, | ||
| "particle_momentum_y": 0.0, | ||
| "particle_momentum_z": 0.0, | ||
| "particle_position_x": 409793.9651940968, | ||
| "particle_position_y": 819237.3558155322, | ||
| "particle_theta": 321974.4557387621, | ||
| "particle_weight": 3.218514276139388e+29 | ||
| } | ||
| } |
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
Oops, something went wrong.
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.
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 don't check for isotropy in the RZ case, since the distribution of momentum for the products is not yet correct.