Skip to content

Commit b9c6cfa

Browse files
update
1 parent 008dd61 commit b9c6cfa

1 file changed

Lines changed: 8 additions & 15 deletions

File tree

src/kernels/QED_process.hpp

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,11 @@ namespace kernel::QED{
4343
~CurvatureEmission_kernel() = default;
4444

4545
Inline auto CDF(real_t zeta_) const -> real_t{
46-
if (zeta_ < 0.01){
47-
return ONE + 0.346 * zeta_ - (1.232 + 0.033 * SQR(zeta_)) * math::pow(zeta_, ONE / THREE);
48-
}else if (zeta_ < 10.0){
49-
auto i = static_cast<int>((zeta_ - 0.01) / d_zeta);
50-
return cdf_table(i) + (zeta_ - (0.01 + i * d_zeta)) * (cdf_table(i + 1) - cdf_table(i)) / d_zeta;
51-
}else{
52-
return math:exp(-zeta_) * (1.25 + (-0.625 + 0.9375 / zeta_) / zeta_) / math::sqrt(zeta_);
53-
}
46+
return ONE - math::exp(-zeta_);
47+
}
48+
49+
Inline auto inverseCDF(real_t u) const -> real_t{
50+
return -math::log(ONE - u);
5451
}
5552

5653
Inline auto rand_uniform(short mean) const -> short{
@@ -82,14 +79,10 @@ namespace kernel::QED{
8279
}
8380
const real_t zeta = e_min * rho * CUBE(gamma_emit / pp);
8481
auto N_ph = static_cast<short>(coeff_cdf * CDF(zeta) / SQR(pp));
85-
//if N_ph is less than Nmax_ph, generate ramdon N_ph from uniform distribution
86-
if (N_ph < Nmax_ph){
87-
N_ph = rand_uniform(N_ph);
88-
}else{
89-
//if N_ph is greater than Nmax_ph, N_ph is set to Nbin
90-
N_ph = Nbin;
82+
//if N_ph is less than 1, no emission.
83+
if (N_ph < 1){
84+
return;
9185
}
92-
//inject photons
9386
sample_photon(N_ph, zeta, ux1_ph, ux2_ph, ux3_ph, i1_ph, dx1_ph, weight_ph, tag_ph);
9487
}
9588
};

0 commit comments

Comments
 (0)