Skip to content

Commit b5d6423

Browse files
update quick start
1 parent 8919b22 commit b5d6423

File tree

4 files changed

+52
-31
lines changed

4 files changed

+52
-31
lines changed

assets/quick-lc.png

-4.92 KB
Loading

assets/quick-spec.png

-4.4 KB
Loading

script/quick.ipynb

Lines changed: 36 additions & 7 deletions
Large diffs are not rendered by default.

src/radiation/synchrotron.cpp

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -599,36 +599,28 @@ Real compute_gamma_c(Real t_com, Real B, InverseComptonY const& Ys, Real p) {
599599
* @param I_syn_peak Peak synchrotron intensity
600600
* @param gamma_m Minimum electron Lorentz factor
601601
* @param gamma_c Cooling electron Lorentz factor
602+
* @param p Power-law index of electron distribution
602603
* @return Self-absorption Lorentz factor
603604
* <!-- ************************************************************************************** -->
604605
*/
605-
Real compute_syn_gamma_a(Real Gamma_rel, Real B, Real I_syn_peak, Real gamma_m, Real gamma_c) {
606+
Real compute_syn_gamma_a(Real Gamma_rel, Real B, Real I_syn_peak, Real gamma_m, Real gamma_c, Real p) {
606607
Real gamma_peak = std::min(gamma_m, gamma_c);
607608
Real nu_peak = compute_syn_freq(gamma_peak, B);
608-
Real ad_idx = adiabatic_idx(Gamma_rel);
609609

610-
Real kT = (gamma_peak - 1) * (con::me * con::c2) * (ad_idx - 1);
611-
// 2kT(nu_a/c)^2 = I_peak*(nu_a/nu_peak)^(1/3)
610+
Real kT = (gamma_peak - 1) * (con::me * con::c2) * 2. / 3;
611+
// 2kT(nu_a/c)^2 = I_peak*(nu_a/nu_peak)^(1/3) // first assume nu_a is in the 1/3 segment
612612
Real nu_a = fast_pow(I_syn_peak * con::c2 / (std::cbrt(nu_peak) * 2 * kT), 0.6);
613613

614-
// nu_peak is not real peak, peak at nu_a; kT = (gamma_a-1) * me *c^2*(ad_idx-1), I_syn = I_peak;
615614
// strong absorption
616-
if (nu_a > nu_peak) {
617-
nu_a = fast_pow(
618-
I_syn_peak / (2 * con::me * (ad_idx - 1) * std::sqrt((4 * con::pi * con::me * con::c / (3 * con::e)) / B)),
619-
0.4);
620-
/* Real gamma_a = syn_gamma(nu_a, B);
621-
if (gamma_a > 10) {
622-
return gamma_a;
623-
} else {
624-
double nu_max = syn_nu(10, B);
625-
double nu_min = syn_nu(1, B);
626-
Real C0 = std::sqrt((4 * con::pi * con::me * con::c / (3 * con::e)) / B);
627-
Real C1 = I_syn_peak / (2 * con::me * (ad_idx - 1));
628-
nu_a = rootBisection([=](Real x) -> Real { return C0 * x * x * x * x * x - x * x * x * x - C1; },
629-
std::sqrt(nu_min), std::sqrt(nu_max), 1e-3);
630-
nu_a *= nu_a;
631-
}*/
615+
if (nu_a > nu_peak) { // nu_a is not in the 1/3 segment
616+
Real nu_c = compute_syn_freq(gamma_c, B);
617+
Real factor = I_syn_peak / (4. / 3 * con::me * std::sqrt((4 * con::pi * con::me * con::c / (3 * con::e)) / B));
618+
if (nu_a < nu_c) { // medium absorption, nu_a is in the -(p-1)/2 segment
619+
Real nu_m = compute_syn_freq(gamma_m, B);
620+
nu_a = fast_pow(factor, 2 / (p + 4)) * fast_pow(nu_m, (p - 1) / (p + 4));
621+
} else { // strong absorption, electron pile-up, nu_a reaches I_syn_peak
622+
nu_a = fast_pow(factor, 0.4);
623+
}
632624
}
633625
return compute_syn_gamma(nu_a, B) + 1;
634626
}
@@ -677,7 +669,7 @@ void update_electrons_4Y(SynElectronGrid& e, Shock const& shock) {
677669
electron.gamma_M = electron.gamma_c;
678670
}
679671
electron.gamma_a =
680-
compute_syn_gamma_a(Gamma_rel, B, electron.I_nu_peak, electron.gamma_m, electron.gamma_c);
672+
compute_syn_gamma_a(Gamma_rel, B, electron.I_nu_peak, electron.gamma_m, electron.gamma_c, p);
681673
electron.regime = determine_regime(electron.gamma_a, electron.gamma_c, electron.gamma_m);
682674
electron.Y_c = InverseComptonY::compute_Y_tilt_at_gamma(Ys, electron.gamma_c, p);
683675
}
@@ -722,7 +714,7 @@ SynElectronGrid generate_syn_electrons(Shock const& shock, Real p, Real xi) {
722714
e.gamma_c = electrons(i, j, k_inj).gamma_c * e.gamma_m / electrons(i, j, k_inj).gamma_m;
723715
e.gamma_M = e.gamma_c;
724716
}
725-
e.gamma_a = compute_syn_gamma_a(Gamma_rel, B, e.I_nu_peak, e.gamma_m, e.gamma_c);
717+
e.gamma_a = compute_syn_gamma_a(Gamma_rel, B, e.I_nu_peak, e.gamma_m, e.gamma_c, p);
726718
e.regime = determine_regime(e.gamma_a, e.gamma_c, e.gamma_m);
727719
e.p = p;
728720
}
@@ -767,7 +759,7 @@ void generate_syn_electrons(SynElectronGrid& electrons, Shock const& shock, Real
767759
e.gamma_c = electrons(i, j, k_inj).gamma_c * e.gamma_m / electrons(i, j, k_inj).gamma_m;
768760
e.gamma_M = e.gamma_c;
769761
}
770-
e.gamma_a = compute_syn_gamma_a(Gamma_rel, B, e.I_nu_peak, e.gamma_m, e.gamma_c);
762+
e.gamma_a = compute_syn_gamma_a(Gamma_rel, B, e.I_nu_peak, e.gamma_m, e.gamma_c, p);
771763
e.regime = determine_regime(e.gamma_a, e.gamma_c, e.gamma_m);
772764
e.p = p;
773765
}

0 commit comments

Comments
 (0)