Skip to content

Commit 8b0cc5c

Browse files
committed
compton emission routine
1 parent 0d43dd8 commit 8b0cc5c

9 files changed

Lines changed: 287 additions & 255 deletions

File tree

input.example.toml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -225,10 +225,6 @@
225225
# @type: float [> 0.0]
226226
# @default: 1.0
227227
photon_weight = ""
228-
# Sampling rate for the emitted synchrotron photons
229-
# @type: float [> 0.0]
230-
# @default: 1.0
231-
photon_sampling = ""
232228
# Index of species for the emitted photon
233229
# @type: ushort [> 0]
234230
# @required
@@ -247,10 +243,6 @@
247243
# @type: float [> 0.0]
248244
# @default: 1.0
249245
photon_weight = ""
250-
# Sampling rate for the emitted inverse Compton photons
251-
# @type: float [> 0.0]
252-
# @default: 1.0
253-
photon_sampling = ""
254246
# Index of species for the emitted photon
255247
# @type: ushort [> 0]
256248
# @required

src/engines/srpic/particle_pusher.h

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include "enums.h"
55
#include "global.h"
66

7+
#include "utils/comparators.h"
78
#include "utils/log.h"
89
#include "utils/numeric.h"
910
#include "utils/param_container.h"
@@ -16,7 +17,7 @@
1617
#include "framework/domain/grid.h"
1718
#include "framework/parameters/parameters.h"
1819

19-
#include "kernels/emission/emission.hpp"
20+
#include "kernels/emission/compton.hpp"
2021
#include "kernels/particle_pusher_sr.hpp"
2122

2223
namespace ntt {
@@ -49,28 +50,31 @@ namespace ntt {
4950
"Invalid photon_species for Compton emission",
5051
HERE);
5152
auto& emitted_species = domain.species[photon_species - 1];
52-
raise::ErrorIf(not cmp::AlmostEqual_host(emitted_species.mass(), ZERO),
53+
raise::ErrorIf(not cmp::AlmostZero_host(emitted_species.mass()),
5354
"Emitted photon species must have zero mass",
5455
HERE);
55-
raise::ErrorIf(not cmp::AlmostEqual_host(emitted_species.charge(), ZERO),
56+
raise::ErrorIf(not cmp::AlmostZero_host(emitted_species.charge()),
5657
"Emitted photon species must have zero charge",
5758
HERE);
58-
const auto emission_policy = kernel::EmissionPolicy<M, EmissionType::COMPTON>(
59+
const auto emission_policy = kernel::emission::Compton<M>(
5960
emitted_species,
6061
pusher_params.mass,
62+
pusher_params.charge,
63+
pusher_params.radiative_drag_flags,
6164
pusher_params.dt,
6265
domain.index(),
6366
params,
64-
domain.random_pool);
67+
domain.random_pool());
6568
Kokkos::parallel_for(
6669
"ParticlePusher",
6770
range,
68-
kernel::sr::Pusher_kernel<M, F, EmissionType::COMPTON>(pusher_params,
69-
pusher_arrays,
70-
EB,
71-
metric,
72-
force,
73-
emission_policy));
71+
kernel::sr::Pusher_kernel<M, F, decltype(emission_policy)>(
72+
pusher_params,
73+
pusher_arrays,
74+
EB,
75+
metric,
76+
force,
77+
emission_policy));
7478
const auto n_inj = emission_policy.number_injected();
7579
domain.species[photon_species - 1].set_npart(
7680
emitted_species.npart() + n_inj);

src/engines/srpic/particles_bcs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ namespace ntt {
104104

105105
const auto maxwellian = arch::Maxwellian<SimEngine::SRPIC, M> {
106106
domain.mesh.metric,
107-
domain.random_pool,
107+
domain.random_pool(),
108108
temp
109109
};
110110

src/framework/parameters/extra.cpp

Lines changed: 10 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -28,75 +28,63 @@ namespace ntt {
2828
}
2929

3030
if (extra.at("synchrotron_emission")) {
31-
synchrotron_gamma_rad = toml::find_or(toml_data,
31+
synchrotron_gamma_rad = toml::find_or(toml_data,
3232
"radiation",
3333
"drag",
3434
"synchrotron",
3535
"gamma_rad",
3636
defaults::synchrotron::gamma_rad);
37-
synchrotron_gamma_qed = toml::find_or(toml_data,
37+
synchrotron_gamma_qed = toml::find_or(toml_data,
3838
"radiation",
3939
"emission",
4040
"synchrotron",
4141
"gamma_qed",
4242
defaults::synchrotron::gamma_qed);
43-
synchrotron_energy_min = toml::find_or(toml_data,
43+
synchrotron_energy_min = toml::find_or(toml_data,
4444
"radiation",
4545
"emission",
4646
"synchrotron",
4747
"photon_energy_min",
4848
defaults::synchrotron::energy_min);
49-
synchrotron_photon_weight = toml::find_or(toml_data,
49+
synchrotron_photon_weight = toml::find_or(toml_data,
5050
"radiation",
5151
"emission",
5252
"synchrotron",
5353
"photon_weight",
5454
ONE);
55-
synchrotron_photon_sampling_rate = toml::find_or(toml_data,
56-
"radiation",
57-
"emission",
58-
"synchrotron",
59-
"photon_sampling",
60-
ONE);
61-
synchrotron_photon_species = toml::find<spidx_t>(toml_data,
55+
synchrotron_photon_species = toml::find<spidx_t>(toml_data,
6256
"radiation",
6357
"emission",
6458
"synchrotron",
6559
"photon_species");
6660
}
6761

6862
if (extra.at("compton_emission")) {
69-
compton_gamma_rad = toml::find_or(toml_data,
63+
compton_gamma_rad = toml::find_or(toml_data,
7064
"radiation",
7165
"drag",
7266
"compton",
7367
"gamma_rad",
7468
defaults::compton::gamma_rad);
75-
compton_gamma_qed = toml::find_or(toml_data,
69+
compton_gamma_qed = toml::find_or(toml_data,
7670
"radiation",
7771
"emission",
7872
"compton",
7973
"gamma_qed",
8074
defaults::compton::gamma_qed);
81-
compton_energy_min = toml::find_or(toml_data,
75+
compton_energy_min = toml::find_or(toml_data,
8276
"radiation",
8377
"emission",
8478
"compton",
8579
"photon_energy_min",
8680
defaults::compton::energy_min);
87-
compton_photon_weight = toml::find_or(toml_data,
81+
compton_photon_weight = toml::find_or(toml_data,
8882
"radiation",
8983
"emission",
9084
"compton",
9185
"photon_weight",
9286
ONE);
93-
compton_photon_sampling_rate = toml::find_or(toml_data,
94-
"radiation",
95-
"emission",
96-
"compton",
97-
"photon_sampling",
98-
ONE);
99-
compton_photon_species = toml::find<spidx_t>(toml_data,
87+
compton_photon_species = toml::find<spidx_t>(toml_data,
10088
"radiation",
10189
"emission",
10290
"compton",
@@ -122,8 +110,6 @@ namespace ntt {
122110
synchrotron_energy_min);
123111
params->set("radiation.emission.synchrotron.photon_weight",
124112
synchrotron_photon_weight);
125-
params->set("radiation.emission.synchrotron.photon_sampling",
126-
synchrotron_photon_sampling_rate);
127113
params->set("radiation.emission.synchrotron.photon_species",
128114
synchrotron_photon_species);
129115
}
@@ -135,8 +121,6 @@ namespace ntt {
135121
compton_energy_min);
136122
params->set("radiation.emission.compton.photon_weight",
137123
compton_photon_weight);
138-
params->set("radiation.emission.compton.photon_sampling",
139-
compton_photon_sampling_rate);
140124
params->set("radiation.emission.compton.photon_species",
141125
compton_photon_species);
142126
}

src/framework/parameters/extra.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,11 @@ namespace ntt {
3333
real_t synchrotron_energy_min;
3434
real_t synchrotron_gamma_qed;
3535
real_t synchrotron_photon_weight;
36-
real_t synchrotron_photon_sampling_rate;
3736
spidx_t synchrotron_photon_species;
3837

3938
real_t compton_energy_min;
4039
real_t compton_gamma_qed;
4140
real_t compton_photon_weight;
42-
real_t compton_photon_sampling_rate;
4341
spidx_t compton_photon_species;
4442

4543
void read(const std::map<std::string, bool>&, const toml::value&);

0 commit comments

Comments
 (0)