Skip to content

Commit

Permalink
bgk: inline some vars
Browse files Browse the repository at this point in the history
  • Loading branch information
James committed Jul 16, 2024
1 parent 925c415 commit 40af700
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/psc_bgk.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -211,22 +211,18 @@ double v_phi_cdf(double v_phi, double rho)
rho /= g.beta;
A_phi /= g.beta;

double sqrt2 = std::sqrt(2);

double rho_sqr = sqr(rho);

double gamma = 1 + 8 * g.k * rho_sqr;
double gamma = 1 + 8 * g.k * sqr(rho);
double alpha =
1 - g.h0 / std::sqrt(gamma) * std::exp(-4 * g.k * sqr(A_phi * rho) / gamma);

double mean0 = 0;
double stdev0 = 1;

double mean1 = 8 * g.k * A_phi * rho_sqr / gamma;
double mean1 = 8 * g.k * A_phi * sqr(rho) / gamma;
double stdev1 = 1 / std::sqrt(gamma);

double m0 = (1 + std::erf((v_phi - mean0) / (stdev0 * sqrt2))) / 2;
double m1 = (1 + std::erf((v_phi - mean1) / (stdev1 * sqrt2))) / 2;
double m0 = (1 + std::erf((v_phi - mean0) / (stdev0 * std::sqrt(2)))) / 2;
double m1 = (1 + std::erf((v_phi - mean1) / (stdev1 * std::sqrt(2)))) / 2;

return m0 / alpha + m1 * (1 - 1 / alpha);
}
Expand Down

0 comments on commit 40af700

Please sign in to comment.