Skip to content

Commit

Permalink
Update rpkt.cc
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeshingles committed Oct 25, 2024
1 parent fd27e80 commit 31bd661
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions rpkt.cc
Original file line number Diff line number Diff line change
Expand Up @@ -674,27 +674,27 @@ auto do_rpkt_step(Packet &pkt, const double t2) -> bool {
? globals::rmax * pkt.prop_time / globals::tmin
: 2 * globals::rmax * (pkt.prop_time + sdist / CLIGHT_PROP) / globals::tmin;
if (sdist > maxsdist) {
printout("[fatal] do_rpkt: Unreasonably large sdist for packet %d. Rpkt. Abort. %g %g %g\n", pkt.number,
globals::rmax, pkt.prop_time / globals::tmin, sdist);
printoutln2("[fatal] do_rpkt: Unreasonably large sdist for packet {}. Rpkt. Abort. {:g} {:g} {:g}", pkt.number,
globals::rmax, pkt.prop_time / globals::tmin, sdist);
std::abort();
}

if (sdist < 0) {
const int cellindexnew = pkt.where;
printout("[warning] r_pkt: Negative distance (sdist = %g). Abort.\n", sdist);
printout("[warning] r_pkt: cell %d snext %d\n", cellindexnew, snext);
printout("[warning] r_pkt: pos %g %g %g\n", pkt.pos[0], pkt.pos[1], pkt.pos[2]);
printout("[warning] r_pkt: dir %g %g %g\n", pkt.dir[0], pkt.dir[1], pkt.dir[2]);
printout("[warning] r_pkt: cell corner %g %g %g\n",
grid::get_cellcoordmin(cellindexnew, 0) * pkt.prop_time / globals::tmin,
grid::get_cellcoordmin(cellindexnew, 1) * pkt.prop_time / globals::tmin,
grid::get_cellcoordmin(cellindexnew, 2) * pkt.prop_time / globals::tmin);
printout("[warning] r_pkt: cell width %g\n", grid::wid_init(cellindexnew, 0) * pkt.prop_time / globals::tmin);
printoutln2("[warning] r_pkt: Negative distance (sdist = {:g}). Abort.", sdist);
printoutln2("[warning] r_pkt: cell {} snext {}", cellindexnew, snext);
printoutln2("[warning] r_pkt: pos {:g} {:g} {:g}", pkt.pos[0], pkt.pos[1], pkt.pos[2]);
printoutln2("[warning] r_pkt: dir {:g} {:g} {:g}", pkt.dir[0], pkt.dir[1], pkt.dir[2]);
printoutln2("[warning] r_pkt: cell corner {:g} {:g} {:g}",
grid::get_cellcoordmin(cellindexnew, 0) * pkt.prop_time / globals::tmin,
grid::get_cellcoordmin(cellindexnew, 1) * pkt.prop_time / globals::tmin,
grid::get_cellcoordmin(cellindexnew, 2) * pkt.prop_time / globals::tmin);
printoutln2("[warning] r_pkt: cell width {:g}", grid::wid_init(cellindexnew, 0) * pkt.prop_time / globals::tmin);
assert_always(false);
}
if (((snext != -99) && (snext < 0)) || (snext >= grid::ngrid)) {
printout("[fatal] r_pkt: Heading for inappropriate grid cell. Abort.\n");
printout("[fatal] r_pkt: Current cell %d, target cell %d.\n", pkt.where, snext);
printoutln2("[fatal] r_pkt: Heading for inappropriate grid cell. Abort.");
printoutln2("[fatal] r_pkt: Current cell {}, target cell {}.", pkt.where, snext);
std::abort();
}

Expand Down Expand Up @@ -812,9 +812,9 @@ auto do_rpkt_step(Packet &pkt, const double t2) -> bool {
return false;
}

printout("[fatal] do_rpkt: Failed to identify event . Rpkt. edist %g, sdist %g, tdist %g Abort.\n", edist, sdist,
tdist);
printout("[fatal] do_rpkt: Trouble was due to packet number %d.\n", pkt.number);
printoutln2("[fatal] do_rpkt: Failed to identify event . Rpkt. edist {:g}, sdist {:g}, tdist {:g} Abort.", edist,
sdist, tdist);
printoutln2("[fatal] do_rpkt: Trouble was due to packet number {}.", pkt.number);
std::abort();
}

Expand Down Expand Up @@ -1135,11 +1135,11 @@ void calculate_chi_rpkt_cont(const double nu_cmf, Rpkt_continuum_absorptioncoeff
chi_rpkt_cont.total = chi_rpkt_cont.ffescat + chi_rpkt_cont.bf + chi_rpkt_cont.ffheat;

if (!std::isfinite(chi_rpkt_cont.total)) {
printout("[fatal] calculate_chi_rpkt_cont: resulted in non-finite chi_rpkt_cont.total ... abort\n");
printout("[fatal] es %g, ff %g, bf %g\n", chi_rpkt_cont.ffescat, chi_rpkt_cont.ffheat, chi_rpkt_cont.bf);
printout("[fatal] nbfcontinua %d\n", globals::nbfcontinua);
printout("[fatal] in cell %d with density %g\n", modelgridindex, grid::get_rho(modelgridindex));
printout("[fatal] pkt.nu_cmf %g\n", nu_cmf);
printoutln2("[fatal] calculate_chi_rpkt_cont: resulted in non-finite chi_rpkt_cont.total ... abort");
printoutln2("[fatal] es {:g}, ff {:g}, bf {:g}", chi_rpkt_cont.ffescat, chi_rpkt_cont.ffheat, chi_rpkt_cont.bf);
printoutln2("[fatal] nbfcontinua {}", globals::nbfcontinua);
printoutln2("[fatal] in cell {} with density {:g}", modelgridindex, grid::get_rho(modelgridindex));
printoutln2("[fatal] pkt.nu_cmf {:g}", nu_cmf);
if (std::isfinite(chi_rpkt_cont.ffescat)) {
chi_rpkt_cont.ffheat = 0.;
chi_rpkt_cont.bf = 0.;
Expand Down Expand Up @@ -1175,7 +1175,7 @@ void calculate_expansion_opacities(const int modelgridindex) {
const auto sys_time_start_calc = std::time(nullptr);
const auto temperature = grid::get_TR(modelgridindex);

printout("calculating expansion opacities for cell %d...", modelgridindex);
printout2("calculating expansion opacities for cell {}...", modelgridindex);

const auto t_mid = globals::timesteps[globals::timestep].mid;

Expand Down Expand Up @@ -1222,5 +1222,5 @@ void calculate_expansion_opacities(const int modelgridindex) {
expansionopacity_planck_cumulative[(nonemptymgi * expopac_nbins) + binindex] = kappa_planck_cumulative;
}
}
printout("took %ld seconds\n", std::time(nullptr) - sys_time_start_calc);
printoutln2("took {} seconds", std::time(nullptr) - sys_time_start_calc);
}

0 comments on commit 31bd661

Please sign in to comment.