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

[WIP]Implementation of Bremsstrahlung collisions #5537

Open
wants to merge 38 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
c1a5536
Initial implementation of Bremmstrahlung collisions
dpgrote Jan 3, 2025
7f0f53e
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 3, 2025
03d96e0
Fix typo
dpgrote Jan 3, 2025
edf04f9
Small cleanup
dpgrote Jan 3, 2025
e1105c3
Small fixes
dpgrote Jan 4, 2025
2926baa
More cleanup, including const's and prt's
dpgrote Jan 4, 2025
0ab5247
Small fixes
dpgrote Jan 6, 2025
8a147cb
Bug fix
dpgrote Jan 6, 2025
d3b22d7
Fix a variable name
dpgrote Jan 7, 2025
2dcd95a
Initialize p_mask to zero
dpgrote Jan 7, 2025
c50b855
Fix the energy scaling of the generated photons
dpgrote Jan 8, 2025
1bb5422
Improvements to the algorithm
dpgrote Jan 8, 2025
27fe428
Add CI test
dpgrote Jan 13, 2025
3d26245
Make creation of photons optional
dpgrote Jan 13, 2025
43939ca
Add documentation
dpgrote Jan 13, 2025
fd4a0be
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 13, 2025
ed08970
Fix missing semicolon
dpgrote Jan 13, 2025
180a51e
Rewrite the interpolation in Photon_energy
dpgrote Jan 13, 2025
0808815
Fix setting of p_mask when photons are not created
dpgrote Jan 13, 2025
21eaf31
Another small cleanup
dpgrote Jan 13, 2025
2548c27
Small fixes
dpgrote Jan 14, 2025
32a2a2f
Only scale kdsigdk_cut for io_cut == 0
dpgrote Jan 14, 2025
bb265a7
Add comment
dpgrote Jan 14, 2025
f2f34fc
Fix typo
dpgrote Jan 14, 2025
56d5042
Add precalculated cross section
dpgrote Jan 14, 2025
98bc9e8
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 14, 2025
eeadf9a
Clean up in analysis_collision_1d_Bremsstrahlung.py
dpgrote Jan 15, 2025
54ff053
Clean up inputs_test_1d_collision_z_Bremsstrahlung
dpgrote Jan 15, 2025
f9756fd
Revert to using the midpoint value of k
dpgrote Jan 20, 2025
7a91252
Fix the sign of the photon energy
dpgrote Jan 20, 2025
2b087e8
Fix const
dpgrote Jan 20, 2025
3267344
Fix CI analysis script
dpgrote Jan 21, 2025
d9b05ca
Clean up auto in Bremsstrahlung/PhotonCreationFunc
dpgrote Jan 21, 2025
0f3e881
Ions are updated, now conserving energy and momentum
dpgrote Jan 22, 2025
0e524a3
Rework the collision to conserve energy and momentum
dpgrote Jan 25, 2025
3e356fe
Use const
dpgrote Jan 27, 2025
0ed4e3e
Expanding some expressions allows cancelling of some terms
dpgrote Jan 27, 2025
87107f2
Update CI benchmark after adding conservation of momentum
dpgrote Jan 27, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions Source/Particles/Collision/BinaryCollision/BinaryCollision.H
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "Particles/Collision/BinaryCollision/Coulomb/ComputeTemperature.H"
#include "Particles/Collision/BinaryCollision/DSMC/DSMCFunc.H"
#include "Particles/Collision/BinaryCollision/NuclearFusion/NuclearFusionFunc.H"
#include "Particles/Collision/BinaryCollision/Bremsstrahlung/BremsstrahlungFunc.H"
#include "Particles/Collision/BinaryCollision/ParticleCreationFunc.H"
#include "Particles/Collision/BinaryCollision/ShuffleFisherYates.H"
#include "Particles/Collision/CollisionBase.H"
Expand Down Expand Up @@ -363,6 +364,10 @@ public:
amrex::Gpu::DeviceVector<amrex::ParticleReal> pair_reaction_weight(n_total_pairs);
amrex::ParticleReal* AMREX_RESTRICT p_pair_reaction_weight =
pair_reaction_weight.dataPtr();
// Extra data needed when products are created
int const n_product_data = (binary_collision_functor.m_need_product_data ? n_total_pairs : 0);
amrex::Gpu::DeviceVector<amrex::ParticleReal> product_data(n_product_data);
amrex::ParticleReal* AMREX_RESTRICT p_product_data = product_data.dataPtr();
/*
End of calculations only required when creating product particles
*/
Expand Down Expand Up @@ -458,7 +463,7 @@ public:

// Call the function in order to perform collisions
// If there are product species, mask, p_pair_indices_1/2, and
// p_pair_reaction_weight are filled here
// p_pair_reaction_weight and p_product_data are filled here
binary_collision_functor(
cell_start_1, cell_half_1,
cell_half_1, cell_stop_1,
Expand All @@ -467,7 +472,7 @@ public:
n1, n1, T1, T1,
q1, q1, m1, m1, dt, dV*volume_factor(i_cell), coll_idx,
cell_start_pair, p_mask, p_pair_indices_1, p_pair_indices_2,
p_pair_reaction_weight, engine);
p_pair_reaction_weight, p_product_data, engine);
}
);

Expand All @@ -481,7 +486,7 @@ public:
products_mass, p_mask, products_np,
copy_species1, copy_species2,
p_pair_indices_1, p_pair_indices_2,
p_pair_reaction_weight);
p_pair_reaction_weight, p_product_data);

for (int i = 0; i < n_product_species; i++)
{
Expand Down Expand Up @@ -589,6 +594,10 @@ public:
amrex::Gpu::DeviceVector<amrex::ParticleReal> pair_reaction_weight(n_total_pairs);
amrex::ParticleReal* AMREX_RESTRICT p_pair_reaction_weight =
pair_reaction_weight.dataPtr();
// Extra data needed when products are created
int const n_product_data = (binary_collision_functor.m_need_product_data ? n_total_pairs : 0);
amrex::Gpu::DeviceVector<amrex::ParticleReal> product_data(n_product_data);
amrex::ParticleReal* AMREX_RESTRICT p_product_data = product_data.dataPtr();
/*
End of calculations only required when creating product particles
*/
Expand Down Expand Up @@ -717,15 +726,15 @@ public:

// Call the function in order to perform collisions
// If there are product species, p_mask, p_pair_indices_1/2, and
// p_pair_reaction_weight are filled here
// p_pair_reaction_weight and p_product_data are filled here
binary_collision_functor(
cell_start_1, cell_stop_1, cell_start_2, cell_stop_2,
indices_1, indices_2,
soa_1, soa_2, get_position_1, get_position_2,
n1, n2, T1, T2,
q1, q2, m1, m2, dt, dV*volume_factor(i_cell), coll_idx,
cell_start_pair, p_mask, p_pair_indices_1, p_pair_indices_2,
p_pair_reaction_weight, engine);
p_pair_reaction_weight, p_product_data, engine);
}
);

Expand All @@ -739,7 +748,7 @@ public:
products_mass, p_mask, products_np,
copy_species1, copy_species2,
p_pair_indices_1, p_pair_indices_2,
p_pair_reaction_weight);
p_pair_reaction_weight, p_product_data);

for (int i = 0; i < n_product_species; i++)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ enum struct CollisionType { DeuteriumTritiumToNeutronHeliumFusion,
DeuteriumDeuteriumToNeutronHeliumFusion,
DeuteriumHeliumToProtonHeliumFusion,
ProtonBoronToAlphasFusion,
Bremsstrahlung,
DSMC,
PairwiseCoulomb,
Undefined };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ namespace BinaryCollisionUtils{
const NuclearFusionType fusion_type = get_nuclear_fusion_type(collision_name, mypc);
return nuclear_fusion_type_to_collision_type(fusion_type);
}
else if (type == "bremsstrahlung") {
return CollisionType::Bremsstrahlung;
}
else if (type == "dsmc") {
return CollisionType::DSMC;
}
Expand Down
Loading
Loading