reduction of std::pow calls; stronger usage of

Cartesian- and CylinderCoordinate objects
This commit is contained in:
2025-06-02 11:09:57 +02:00
parent f510d0a39a
commit d6578e540d
19 changed files with 120 additions and 77 deletions
+21 -8
View File
@@ -173,7 +173,8 @@ std::function<double(double)> eT_elastic_scattering() {
std::function<double(double)> T2pT2_charge_exchange_janev() {
return [=](double energy) {
const double sig_ll =
6.59 / (std::pow(energy, 0.5) * (1 + 2.29 * std::pow(energy, 1.78))) +
// 6.59 / (std::pow(energy, 0.5) * (1 + 2.29 * std::pow(energy, 1.78))) +
6.59 / (std::sqrt(energy) * (1 + 2.29 * std::pow(energy, 1.78))) +
12.85 * std::exp(-1.84 * std::pow(energy, -1.55)) /
(std::pow(energy, 0.0673) * (1 + 2.6E-3 * std::pow(energy, 0.97) +
1.63E-10 * std::pow(energy, 2.76)));
@@ -208,9 +209,13 @@ std::function<double(double)> eT2_ionization_bed() {
const double t = energy / ionization_energy;
const double factor = S_m2 / (t + u + 1);
const double yh = 2. / (t + 1);
const double yh2 = yh*yh;
// const double D =
// c[0] / 3 * (1 - std::pow(yh, 3)) + c[1] / 4 * (1 - std::pow(yh, 4)) +
// c[2] / 5 * (1 - std::pow(yh, 5)) + c[3] / 6 * (1 - std::pow(yh, 6));
const double D =
c[0] / 3 * (1 - std::pow(yh, 3)) + c[1] / 4 * (1 - std::pow(yh, 4)) +
c[2] / 5 * (1 - std::pow(yh, 5)) + c[3] / 6 * (1 - std::pow(yh, 6));
(c[0]/3 + c[1]/4 + c[2]/5 + c[3]/6) -
yh2 * (yh*(c[0]/3 + c[2]/5 * yh2) + yh2 * (c[1]/4 + c[3]/6 * yh2));
const double summand_1 = D * std::log(t);
const double summand_2 =
(2 - Ni / N) * ((t - 1) / t - std::log(t) / (t + 1));
@@ -572,8 +577,12 @@ std::function<double(double)> eT2_excitation_vibrational_janev_first() {
return 0.;
}
const double rel = energy / deltaE_eV;
return 5.78 * std::pow(deltaE_eV, -4) * std::pow(rel, -2) *
std::pow(1 - 1 / rel, 6.11 * std::pow(deltaE_eV, -0.5)) * 1E-20;
// return 5.78 * std::pow(deltaE_eV, -4) * std::pow(rel, -2) *
// std::pow(1 - 1 / rel, 6.11 * std::pow(deltaE_eV, -0.5)) * 1E-20;
// change calculation of deltaE_eV^{-4} to a simple constant? (don't know
// it the compiler already changes that)
return 5.78 * std::pow(deltaE_eV, -4) * 1/(rel*rel) *
std::pow(1 - 1 / rel, 6.11 / std::sqrt(deltaE_eV)) * 1E-20;
};
}
@@ -584,8 +593,11 @@ std::function<double(double)> eT2_excitation_vibrational_janev_second() {
return 0.;
}
const double rel = energy / deltaE_eV;
return 5.78 * 0.628 * std::pow(deltaE_eV, -4) * std::pow(rel, -2) *
std::pow(1 - 1 / rel, 6.11 * std::pow(deltaE_eV, -0.5)) * 1E-20;
// return 5.78 * 0.628 * std::pow(deltaE_eV, -4) * std::pow(rel, -2) *
// std::pow(1 - 1 / rel, 6.11 * std::pow(deltaE_eV, -0.5)) * 1E-20;
// same comment as for the function above
return 5.78 * 0.628 * std::pow(deltaE_eV, -4) / (rel*rel) *
std::pow(1 - 1 / rel, 6.11 / std::sqrt(deltaE_eV)) * 1E-20;
};
}
@@ -640,7 +652,8 @@ std::function<double(double)> eT2p_recombination_janev() {
(1 + 1.1 * std::pow(energy, 0.512) +
0.011 * std::pow(energy, 3.10)),
-1) +
0.133 * std::exp(-0.35 * std::pow(energy - 6.05, 2)));
// 0.133 * std::exp(-0.35 * std::pow(energy - 6.05, 2)));
0.133 * std::exp(-0.35 * (energy - 6.05)*(energy - 6.05)));
};
}
std::function<double(double)> eT3p_recombination_janev() {