Skip to content

Commit

Permalink
Move warning for Planck peak outside NU_MIN_R, NU_MAX_R from packet p…
Browse files Browse the repository at this point in the history
…rop to grid update
  • Loading branch information
lukeshingles committed Sep 11, 2024
1 parent d59dcb5 commit 94b09bf
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
15 changes: 14 additions & 1 deletion grid.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1876,7 +1876,20 @@ void set_nnetot(const int modelgridindex, const float nnetot) {

void set_kappagrey(const int modelgridindex, const float kappagrey) { modelgrid[modelgridindex].kappagrey = kappagrey; }

void set_Te(const int modelgridindex, const float Te) { modelgrid[modelgridindex].Te = Te; }
void set_Te(const int modelgridindex, const float Te) {
if (Te > 0.) {
// ignore the zero initialisation value for this check
const double nu_peak = 5.879e10 * Te;
if (nu_peak > NU_MAX_R || nu_peak < NU_MIN_R) {
printout(
"[warning] modelgridindex %d B_planck(Te=%g K) peak at %g Hz is outside frequency range NU_MIN_R %g NU_MAX_R "
"%g\n",
modelgridindex, Te, nu_peak, NU_MIN_R, NU_MAX_R);
}
}

modelgrid[modelgridindex].Te = Te;
}

void set_TR(const int modelgridindex, const float TR) { modelgrid[modelgridindex].TR = TR; }

Expand Down
4 changes: 0 additions & 4 deletions kpkt.cc
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,6 @@ auto sample_planck_analytic(const double T) -> double {
// return a randomly chosen frequency according to the Planck distribution of temperature T using a Monte Carlo method
auto sample_planck_montecarlo(const double T) -> double {
const double nu_peak = 5.879e10 * T;
if (nu_peak > NU_MAX_R || nu_peak < NU_MIN_R) {
printout("[warning] sample_planck: intensity peaks outside frequency range\n");
}

const double B_peak = radfield::dbb(nu_peak, T, 1);

while (true) {
Expand Down

0 comments on commit 94b09bf

Please sign in to comment.