diff --git a/atomic.h b/atomic.h index 0a70bed84..b624ee689 100644 --- a/atomic.h +++ b/atomic.h @@ -230,8 +230,8 @@ inline auto get_elementindex(const int Z) -> int { return static_cast(elem - globals::elements.begin()); } - // printoutf("[debug] get_elementindex: element Z=%d was not found in atomic data ... skip readin of cross sections - // for this element\n",Z); printoutf("[fatal] get_elementindex: element Z=%d was not found in atomic data ... + // printout("[debug] get_elementindex: element Z=%d was not found in atomic data ... skip readin of cross sections + // for this element\n",Z); printout("[fatal] get_elementindex: element Z=%d was not found in atomic data ... // abort\n"); abort();; return -100; } diff --git a/decay.cc b/decay.cc index dc169d8a1..113bf1c0e 100644 --- a/decay.cc +++ b/decay.cc @@ -183,17 +183,17 @@ MPI_Win win_decaypath_energy_per_mass{MPI_WIN_NULL}; return nuclides[nucindex].meanlife; } -void printout_nuclidename(const int z, const int a) { printoutf("(Z=%d)%s%d", z, get_elname(z).c_str(), a); } +void printout_nuclidename(const int z, const int a) { printout("(Z=%d)%s%d", z, get_elname(z).c_str(), a); } void printout_nuclidemeanlife(const int z, const int a) { const int nucindex = get_nucindex_or_neg_one(z, a); const bool exists = (nucindex >= 0); if (exists && get_meanlife(nucindex) > 0.) { - printoutf("[tau %.1es]", get_meanlife(nucindex)); + printout("[tau %.1es]", get_meanlife(nucindex)); } else if (exists) { - printoutf("[stable,in_net]"); + printout("[stable,in_net]"); } else { - printoutf("[stable,offnet]"); + printout("[stable,offnet]"); } } @@ -275,23 +275,23 @@ void printout_nuclidemeanlife(const int z, const int a) { void printout_decaytype(const int decaytype) { switch (decaytype) { case decaytypes::DECAYTYPE_ALPHA: { - printoutf("alpha"); + printout("alpha"); break; } case decaytypes::DECAYTYPE_BETAPLUS: { - printoutf("beta+"); + printout("beta+"); break; } case decaytypes::DECAYTYPE_ELECTRONCAPTURE: { - printoutf("ec"); + printout("ec"); break; } case decaytypes::DECAYTYPE_BETAMINUS: { - printoutf("beta-"); + printout("beta-"); break; } case decaytypes::DECAYTYPE_NONE: { - printoutf("none"); + printout("none"); break; } default: @@ -302,16 +302,16 @@ void printout_decaytype(const int decaytype) { void printout_decaypath(const int decaypathindex) { assert_always(!decaypaths.empty()); const auto &decaypath = decaypaths[decaypathindex]; - printoutf(" decaypath %d: ", decaypathindex); + printout(" decaypath %d: ", decaypathindex); for (int i = 0; i < get_decaypathlength(decaypathindex); i++) { printout_nuclidename(decaypath.z[i], decaypath.a[i]); printout_nuclidemeanlife(decaypath.z[i], decaypath.a[i]); if (decaypath.decaytypes[i] != DECAYTYPE_NONE) { - printoutf(" -> "); + printout(" -> "); printout_decaytype(decaypath.decaytypes[i]); - printoutf(" -> "); + printout(" -> "); } } @@ -321,7 +321,7 @@ void printout_decaypath(const int decaypathindex) { printout_nuclidemeanlife(decaypath.final_daughter_z(), decaypath.final_daughter_a()); } - printoutf("\n"); + printout("\n"); } void extend_lastdecaypath() @@ -342,7 +342,7 @@ void extend_lastdecaypath() // check for nuclide in existing path, which would indicate a loop for (int i = 0; i < get_decaypathlength(startdecaypathindex); i++) { if (decaypaths[startdecaypathindex].z[i] == daughter_z && decaypaths[startdecaypathindex].a[i] == daughter_a) { - printoutf("\nERROR: Loop found in nuclear decay chain.\n"); + printout("\nERROR: Loop found in nuclear decay chain.\n"); std::abort(); } } @@ -471,7 +471,7 @@ void filter_unused_nuclides(const std::vector &custom_zlist, const std::vec return false; } - printoutf("removing unused nuclide (Z=%d)%s%d\n", nuc.z, get_elname(nuc.z).c_str(), nuc.a); + printout("removing unused nuclide (Z=%d)%s%d\n", nuc.z, get_elname(nuc.z).c_str(), nuc.a); return true; }); nuclides.shrink_to_fit(); @@ -688,9 +688,9 @@ auto get_endecay_per_ejectamass_t0_to_time_withexpansion_chain_numerical(const i (get_endecay_to_tinf_per_ejectamass_at_time(modelgridindex, decaypathindex, grid::get_t_model()) - get_endecay_to_tinf_per_ejectamass_at_time(modelgridindex, decaypathindex, tstart)); - printoutf(" chain_endecay: %g\n", chain_endecay); - printoutf(" chain_endecay_noexpansion: %g\n", chain_endecay_noexpansion); - printoutf(" expansion energy factor: %g\n", chain_endecay / chain_endecay_noexpansion); + printout(" chain_endecay: %g\n", chain_endecay); + printout(" chain_endecay_noexpansion: %g\n", chain_endecay_noexpansion); + printout(" expansion energy factor: %g\n", chain_endecay / chain_endecay_noexpansion); return chain_endecay; } @@ -796,7 +796,7 @@ auto get_decaypath_power_per_ejectamass(const int decaypathindex, const int mode if (nucindex >= 0) { return nucindex; } - printoutf("Could not find nuclide Z=%d A=%d\n", z, a); + printout("Could not find nuclide Z=%d A=%d\n", z, a); assert_always(false); // nuclide not found return -1; } @@ -833,7 +833,7 @@ auto get_nucstring_z(const std::string &strnuc) -> int { return z; } } - printoutf("Could not get atomic number of '%s' '%s'\n", strnuc.c_str(), elcode.c_str()); + printout("Could not get atomic number of '%s' '%s'\n", strnuc.c_str(), elcode.c_str()); assert_always(false); // could not match to an element return -1; } @@ -974,7 +974,7 @@ void init_nuclides(const std::vector &custom_zlist, const std::vector nuclides[alphanucindex].branchprobs[DECAYTYPE_ALPHA] = branch_alpha; nuclides[alphanucindex].endecay_q[DECAYTYPE_ALPHA] = Q_total_alphadec * MEV; - // printoutf("alphadecay file: Adding (Z=%d)%s%d endecay_alpha %g endecay_gamma %g tau_s %g\n", + // printout("alphadecay file: Adding (Z=%d)%s%d endecay_alpha %g endecay_gamma %g tau_s %g\n", // z, get_elname(z), a, e_alpha_mev, e_gamma_mev, tau_sec); } } @@ -985,35 +985,35 @@ void init_nuclides(const std::vector &custom_zlist, const std::vector const int z = custom_zlist[i]; const int a = custom_alist[i]; if (!nuc_exists(z, a)) { - // printoutf("Adding Z %d A %d with no decay data (assuming stable)\n", z, a); + // printout("Adding Z %d A %d with no decay data (assuming stable)\n", z, a); nuclides.push_back({.z = z, .a = a, .meanlife = -1}); } } - printoutf("Number of nuclides before filtering: %d\n", get_num_nuclides()); + printout("Number of nuclides before filtering: %d\n", get_num_nuclides()); find_decaypaths(custom_zlist, custom_alist, standard_nuclides); filter_unused_nuclides(custom_zlist, custom_alist, standard_nuclides); - printoutf("Number of nuclides: %d\n", get_num_nuclides()); + printout("Number of nuclides: %d\n", get_num_nuclides()); const int maxdecaypathlength = std::accumulate( decaypaths.cbegin(), decaypaths.cend(), 0, [](const int maxlen, const auto &decaypath) { return std::max(maxlen, get_decaypathlength(decaypath)); }); - printoutf("Number of decay paths: %d (max length %d)\n", get_num_decaypaths(), maxdecaypathlength); + printout("Number of decay paths: %d (max length %d)\n", get_num_decaypaths(), maxdecaypathlength); // Read in data for gamma ray lines and make a list of them in energy order. gammapkt::init_gamma_data(); // TODO: generalise this to all included nuclides - printoutf("decayenergy(NI56), decayenergy(CO56), decayenergy_gamma(CO56): %g, %g, %g\n", - nucdecayenergytotal(28, 56) / MEV, nucdecayenergytotal(27, 56) / MEV, nucdecayenergygamma(27, 56) / MEV); - printoutf("decayenergy(NI57), decayenergy_gamma(NI57), nucdecayenergy(CO57): %g, %g, %g\n", - nucdecayenergytotal(28, 57) / MEV, nucdecayenergygamma(28, 57) / MEV, nucdecayenergytotal(27, 57) / MEV); - printoutf("decayenergy(CR48), decayenergy(V48): %g %g\n", nucdecayenergytotal(24, 48) / MEV, - nucdecayenergytotal(23, 48) / MEV); - printoutf("decayenergy(FE52), decayenergy(MN52): %g %g\n", nucdecayenergytotal(26, 52) / MEV, - nucdecayenergytotal(25, 52) / MEV); + printout("decayenergy(NI56), decayenergy(CO56), decayenergy_gamma(CO56): %g, %g, %g\n", + nucdecayenergytotal(28, 56) / MEV, nucdecayenergytotal(27, 56) / MEV, nucdecayenergygamma(27, 56) / MEV); + printout("decayenergy(NI57), decayenergy_gamma(NI57), nucdecayenergy(CO57): %g, %g, %g\n", + nucdecayenergytotal(28, 57) / MEV, nucdecayenergygamma(28, 57) / MEV, nucdecayenergytotal(27, 57) / MEV); + printout("decayenergy(CR48), decayenergy(V48): %g %g\n", nucdecayenergytotal(24, 48) / MEV, + nucdecayenergytotal(23, 48) / MEV); + printout("decayenergy(FE52), decayenergy(MN52): %g %g\n", nucdecayenergytotal(26, 52) / MEV, + nucdecayenergytotal(25, 52) / MEV); } // calculate the decay energy per unit mass [erg/g] released from time t_model to tstart, accounting for @@ -1051,7 +1051,7 @@ auto get_modelcell_simtime_endecay_per_mass(const int mgi) -> double { void setup_decaypath_energy_per_mass() { const int nonempty_npts_model = grid::get_nonempty_npts_model(); - printoutf( + printout( "[info] mem_usage: decaypath_energy_per_mass[nonempty_npts_model*num_decaypaths] occupies %.1f MB (node " "shared)...", nonempty_npts_model * get_num_decaypaths() * sizeof(double) / 1024. / 1024.); @@ -1071,13 +1071,13 @@ void setup_decaypath_energy_per_mass() { static_cast(malloc(nonempty_npts_model * get_num_decaypaths() * sizeof(double))); #endif decaypath_energy_per_mass = std::span(decaypath_energy_per_mass_data, nonempty_npts_model * get_num_decaypaths()); - printoutf("done.\n"); + printout("done.\n"); #ifdef MPI_ON MPI_Barrier(MPI_COMM_WORLD); #endif - printoutf("Calculating decaypath_energy_per_mass for all cells..."); + printout("Calculating decaypath_energy_per_mass for all cells..."); const ptrdiff_t num_decaypaths = get_num_decaypaths(); for (int nonemptymgi = 0; nonemptymgi < nonempty_npts_model; nonemptymgi++) { if (nonemptymgi % globals::node_nprocs == globals::rank_in_node) { @@ -1088,7 +1088,7 @@ void setup_decaypath_energy_per_mass() { } } } - printoutf("done.\n"); + printout("done.\n"); #ifdef MPI_ON MPI_Barrier(MPI_COMM_WORLD); @@ -1098,13 +1098,13 @@ void setup_decaypath_energy_per_mass() { void free_decaypath_energy_per_mass() { #ifdef MPI_ON if (win_decaypath_energy_per_mass != MPI_WIN_NULL) { - printoutf("[info] mem_usage: decaypath_energy_per_mass was freed\n"); + printout("[info] mem_usage: decaypath_energy_per_mass was freed\n"); MPI_Win_free(&win_decaypath_energy_per_mass); win_decaypath_energy_per_mass = MPI_WIN_NULL; } #else if (decaypath_energy_per_mass.data() != nullptr) { - printoutf("[info] mem_usage: decaypath_energy_per_mass was freed\n"); + printout("[info] mem_usage: decaypath_energy_per_mass was freed\n"); free(decaypath_energy_per_mass.data()); } #endif @@ -1198,7 +1198,7 @@ auto get_global_etot_t0_tinf() -> double { // Update the mass fractions of elements using the current abundances of nuclides void update_abundances(const int modelgridindex, const int timestep, const double t_current) { - printoutf("update_abundances for cell %d timestep %d\n", modelgridindex, timestep); + printout("update_abundances for cell %d timestep %d\n", modelgridindex, timestep); for (int element = get_nelements() - 1; element >= 0; element--) { const int atomic_number = get_atomicnumber(element); @@ -1277,7 +1277,7 @@ void update_abundances(const int modelgridindex, const int timestep, const doubl // nucfracsum += get_nuc_massfrac(modelgridindex, z, a, t_current); // // // printout_nuclidename(z, a); - // // printoutf(" init: %g now: %g\n", grid::get_modelinitnucmassfrac(modelgridindex, z, a), + // // printout(" init: %g now: %g\n", grid::get_modelinitnucmassfrac(modelgridindex, z, a), // get_nuc_massfrac(modelgridindex, z, a, t_current)); // // for (int dectypeindex = 0; dectypeindex < decaytypes::DECAYTYPE_COUNT; dectypeindex++) @@ -1286,7 +1286,7 @@ void update_abundances(const int modelgridindex, const int timestep, const doubl // get_nuc_decaybranchprob(z, a, dectypeindex) > 0.) // { // // printout_nuclidename(decay_daughter_z(z, a), decay_daughter_a(z, a)); - // // printoutf("(stable) init: 0 now: %g\n", get_nuc_massfrac(modelgridindex, decay_daughter_z(z, a), + // // printout("(stable) init: 0 now: %g\n", get_nuc_massfrac(modelgridindex, decay_daughter_z(z, a), // decay_daughter_a(z, a), t_current)); // // this decay steps off the nuclide list, so add its daughter abundance to the total // nucfracsum += get_nuc_massfrac(modelgridindex, decay_daughter_z(z, a, dectypeindex), decay_daughter_a(z, a, @@ -1295,8 +1295,8 @@ void update_abundances(const int modelgridindex, const int timestep, const doubl // } // } - // printoutf("initnucfracsum %g\n", initnucfracsum); - // printoutf("nucfracsum %g\n", nucfracsum); + // printout("initnucfracsum %g\n", initnucfracsum); + // printout("nucfracsum %g\n", nucfracsum); // assert_always(fabs(nucfracsum - initnucfracsum) < 0.001); // decays shouldn't change nuclear mass fraction sum } diff --git a/exspec.cc b/exspec.cc index f7c6a6da6..a877b3a0d 100644 --- a/exspec.cc +++ b/exspec.cc @@ -58,13 +58,13 @@ void do_angle_bin(const int a, Packet *pkts, bool load_allrank_packets, Spectra if (a == -1 || !load_allrank_packets) { char pktfilename[MAXFILENAMELENGTH]; snprintf(pktfilename, MAXFILENAMELENGTH, "packets%.2d_%.4d.out", 0, p); - printoutf("reading %s (file %d of %d)\n", pktfilename, p + 1, globals::nprocs_exspec); + printout("reading %s (file %d of %d)\n", pktfilename, p + 1, globals::nprocs_exspec); if (std::filesystem::exists(pktfilename)) { read_packets(pktfilename, pkts_start); } else { - printoutf(" WARNING %s does not exist - trying temp packets file at beginning of timestep %d...\n", - pktfilename, globals::timestep_initial); + printout(" WARNING %s does not exist - trying temp packets file at beginning of timestep %d...\n", + pktfilename, globals::timestep_initial); read_temp_packetsfile(globals::timestep_initial, p, pkts_start); } } @@ -74,7 +74,7 @@ void do_angle_bin(const int a, Packet *pkts, bool load_allrank_packets, Spectra #endif if (p % globals::nprocs != globals::rank_global) { - printoutf("skipping packets file %d %d\n", p + 1, globals::nprocs); + printout("skipping packets file %d %d\n", p + 1, globals::nprocs); continue; } @@ -82,7 +82,7 @@ void do_angle_bin(const int a, Packet *pkts, bool load_allrank_packets, Spectra int nesc_gamma = 0; int nesc_rpkt = 0; for (int ii = 0; ii < globals::npkts; ii++) { - // printoutf("packet %d escape_type %d type %d", ii, pkts[ii].escape_type, pkts[ii].type); + // printout("packet %d escape_type %d type %d", ii, pkts[ii].escape_type, pkts[ii].type); if (pkts_start[ii].type == TYPE_ESCAPE) { nesc_tot++; if (pkts_start[ii].escape_type == TYPE_RPKT) { @@ -100,8 +100,8 @@ void do_angle_bin(const int a, Packet *pkts, bool load_allrank_packets, Spectra } } if (a == -1 || !load_allrank_packets) { - printoutf(" %d of %d packets escaped (%d gamma-pkts and %d r-pkts)\n", nesc_tot, globals::npkts, nesc_gamma, - nesc_rpkt); + printout(" %d of %d packets escaped (%d gamma-pkts and %d r-pkts)\n", nesc_tot, globals::npkts, nesc_gamma, + nesc_rpkt); } } @@ -119,7 +119,7 @@ void do_angle_bin(const int a, Packet *pkts, bool load_allrank_packets, Spectra write_spectrum("gamma_spec.out", "", "", "", gamma_spectra, globals::ntimesteps); - printoutf("finished angle-averaged stuff\n"); + printout("finished angle-averaged stuff\n"); } else { // direction bin a // line-of-sight dependent spectra and light curves @@ -156,7 +156,7 @@ void do_angle_bin(const int a, Packet *pkts, bool load_allrank_packets, Spectra write_specpol(specpol_filename, emissionpol_filename, absorptionpol_filename, &stokes_i, &stokes_q, &stokes_u); } - printoutf("Did %d of %d angle bins.\n", a + 1, MABINS); + printout("Did %d of %d angle bins.\n", a + 1, MABINS); } } @@ -180,38 +180,38 @@ auto main(int argc, char *argv[]) -> int { // NOLINT(misc-unused-parameters) assert_always(output_file.is_open()); } - printoutf("git branch %s\n", GIT_BRANCH); + printout("git branch %s\n", GIT_BRANCH); - printoutf("git version: %s\n", GIT_VERSION); + printout("git version: %s\n", GIT_VERSION); - printoutf("git status %s\n", GIT_STATUS); + printout("git status %s\n", GIT_STATUS); - printoutf("exspec compiled at %s on %s\n", __TIME__, __DATE__); + printout("exspec compiled at %s on %s\n", __TIME__, __DATE__); #if defined TESTMODE && TESTMODE - printoutf("TESTMODE is ON\n"); + printout("TESTMODE is ON\n"); #endif #ifdef MPI_ON - printoutf("process id (pid): %d\n", getpid()); - printoutf("MPI enabled:\n"); - printoutf(" rank_global %d of [0..%d] in MPI_COMM_WORLD\n", globals::rank_global, globals::nprocs - 1); - printoutf(" rank_in_node %d of [0..%d] in node %d of [0..%d]\n", globals::rank_in_node, globals::node_nprocs - 1, - globals::node_id, globals::node_count - 1); + printout("process id (pid): %d\n", getpid()); + printout("MPI enabled:\n"); + printout(" rank_global %d of [0..%d] in MPI_COMM_WORLD\n", globals::rank_global, globals::nprocs - 1); + printout(" rank_in_node %d of [0..%d] in node %d of [0..%d]\n", globals::rank_in_node, globals::node_nprocs - 1, + globals::node_id, globals::node_count - 1); #else - printoutf("MPI is disabled in this build\n"); + printout("MPI is disabled in this build\n"); #endif // single rank only for now assert_always(globals::rank_global == 0); assert_always(globals::nprocs == 1); - printoutf("Beginning exspec.\n"); + printout("Beginning exspec.\n"); // Get input stuff - printoutf("time before input %ld\n", std::time(nullptr)); + printout("time before input %ld\n", std::time(nullptr)); input(globals::rank_global); - printoutf("time after input %ld\n", std::time(nullptr)); + printout("time after input %ld\n", std::time(nullptr)); // nprocs_exspec is the number of rank output files to process with expec // however, we might be running exspec with 1 or just a few ranks @@ -219,13 +219,12 @@ auto main(int argc, char *argv[]) -> int { // NOLINT(misc-unused-parameters) auto *pkts = static_cast(malloc(globals::nprocs_exspec * globals::npkts * sizeof(Packet))); const bool load_allrank_packets = (pkts != nullptr); if (load_allrank_packets) { - printoutf( - "mem_usage: loading %d packets from each %d processes simultaneously (total %d packets, %.1f MB memory)\n", - globals::npkts, globals::nprocs_exspec, globals::nprocs_exspec * globals::npkts, - globals::nprocs_exspec * globals::npkts * sizeof(Packet) / 1024. / 1024.); + printout("mem_usage: loading %d packets from each %d processes simultaneously (total %d packets, %.1f MB memory)\n", + globals::npkts, globals::nprocs_exspec, globals::nprocs_exspec * globals::npkts, + globals::nprocs_exspec * globals::npkts * sizeof(Packet) / 1024. / 1024.); } else { - printoutf("mem_usage: malloc failed to allocate memory for all packets\n"); - printoutf( + printout("mem_usage: malloc failed to allocate memory for all packets\n"); + printout( "mem_usage: loading %d packets from each of %d processes sequentially (total %d packets, %.1f MB memory)\n", globals::npkts, globals::nprocs_exspec, globals::nprocs_exspec * globals::npkts, globals::nprocs_exspec * globals::npkts * sizeof(Packet) / 1024. / 1024.); @@ -253,7 +252,7 @@ auto main(int argc, char *argv[]) -> int { // NOLINT(misc-unused-parameters) free(pkts); decay::cleanup(); - printoutf("exspec finished at %ld (tstart + %ld seconds)\n", std::time(nullptr), std::time(nullptr) - sys_time_start); + printout("exspec finished at %ld (tstart + %ld seconds)\n", std::time(nullptr), std::time(nullptr) - sys_time_start); #ifdef MPI_ON MPI_Finalize(); diff --git a/gammapkt.cc b/gammapkt.cc index 69cfae638..594de2336 100644 --- a/gammapkt.cc +++ b/gammapkt.cc @@ -57,8 +57,8 @@ std::vector allnuc_gamma_line_list; void read_gamma_spectrum(const int nucindex, const char filename[50]) // reads in gamma_spectra and returns the average energy in gamma rays per nuclear decay { - printoutf("reading gamma spectrum for Z=%d A=%d from %s...", decay::get_nuc_z(nucindex), decay::get_nuc_a(nucindex), - filename); + printout("reading gamma spectrum for Z=%d A=%d from %s...", decay::get_nuc_z(nucindex), decay::get_nuc_a(nucindex), + filename); FILE *filein = fopen_required(filename, "r"); int nlines = 0; @@ -79,11 +79,11 @@ void read_gamma_spectrum(const int nucindex, const char filename[50]) decay::set_nucdecayenergygamma(nucindex, E_gamma_avg); - printoutf("nlines %d avg_en_gamma %g MeV\n", nlines, E_gamma_avg / MEV); + printout("nlines %d avg_en_gamma %g MeV\n", nlines, E_gamma_avg / MEV); } void set_trivial_gamma_spectrum(const int nucindex) { - // printoutf("Setting trivial gamma spectrum for z %d a %d engamma %g\n", z, a, decay::nucdecayenergygamma(z, a)); + // printout("Setting trivial gamma spectrum for z %d a %d engamma %g\n", z, a, decay::nucdecayenergygamma(z, a)); const int nlines = 1; gamma_spectra[nucindex].resize(nlines, {}); gamma_spectra[nucindex][0].energy = decay::nucdecayenergygamma(nucindex); @@ -93,13 +93,13 @@ void set_trivial_gamma_spectrum(const int nucindex) { void read_decaydata() { // migrate from old filename if (!std::filesystem::exists("ni56_lines.txt") && std::filesystem::exists("ni_lines.txt")) { - printoutf("Moving ni_lines.txt to ni56_lines.txt\n"); + printout("Moving ni_lines.txt to ni56_lines.txt\n"); std::rename("ni_lines.txt", "ni56_lines.txt"); } // migrate from old filename if (!std::filesystem::exists("co56_lines.txt") && std::filesystem::exists("co_lines.txt")) { - printoutf("Moving co_lines.txt to co56_lines.txt\n"); + printout("Moving co_lines.txt to co56_lines.txt\n"); std::rename("co_lines.txt", "co56_lines.txt"); } @@ -129,7 +129,7 @@ void read_decaydata() { } else if (std::ifstream(filename2)) { read_gamma_spectrum(nucindex, filename2); } else if (decay::nucdecayenergygamma(nucindex) > 0.) { - // printoutf("%s does not exist. Setting 100%% chance of single gamma-line with energy %g MeV\n", + // printout("%s does not exist. Setting 100%% chance of single gamma-line with energy %g MeV\n", // filename, decay::nucdecayenergygamma(z, a) / EV / 1e6); set_trivial_gamma_spectrum(nucindex); @@ -140,7 +140,7 @@ void read_decaydata() { assert_always(z != 28 || a != 57); // Ni-57 must have a gamma spectrum if present in list of nuclides assert_always(z != 28 || a != 57); // Co-57 must have a gamma spectrum if present in list of nuclides } else { - // printoutf("%s does not exist. No gamma decay from this nuclide.\n", filename); + // printout("%s does not exist. No gamma decay from this nuclide.\n", filename); } } @@ -162,7 +162,7 @@ void init_gamma_linelist() { for (int nucindex = 0; nucindex < decay::get_num_nuclides(); nucindex++) { total_lines += std::ssize(gamma_spectra[nucindex]); } - printoutf("total gamma-ray lines %td\n", total_lines); + printout("total gamma-ray lines %td\n", total_lines); allnuc_gamma_line_list = std::vector(); allnuc_gamma_line_list.reserve(total_lines); @@ -205,7 +205,7 @@ void init_gamma_linelist() { void init_xcom_photoion_data() { // read the file - printoutf("reading XCOM photoionization data...\n"); + printout("reading XCOM photoionization data...\n"); // reserve memory for (int Z = 0; Z < numb_xcom_elements; Z++) { photoion_data[Z].reserve(100); @@ -247,7 +247,7 @@ __host__ __device__ auto choose_gamma_ray(const int nucindex) -> double { } } - printoutf("Failure to choose line (pellet_nucindex %d). Abort. zrand %g runtot %g\n", nucindex, zrand, runtot); + printout("Failure to choose line (pellet_nucindex %d). Abort. zrand %g runtot %g\n", nucindex, zrand, runtot); assert_always(false); } @@ -296,13 +296,13 @@ auto choose_f(const double xx, const double zrand) -> double int count = 0; double err = 1e20; - // printoutf("new\n"); + // printout("new\n"); double ftry = (f_max + f_min) / 2; while ((err > 1.e-4) && (count < 1000)) { ftry = (f_max + f_min) / 2; const double sigma_try = sigma_compton_partial(xx, ftry); - // printoutf("ftry %g %g %g %g %g\n",ftry, f_min, f_max, try, norm); + // printout("ftry %g %g %g %g %g\n",ftry, f_min, f_max, try, norm); if (sigma_try > norm) { f_max = ftry; err = (sigma_try - norm) / norm; @@ -310,10 +310,10 @@ auto choose_f(const double xx, const double zrand) -> double f_min = ftry; err = (norm - sigma_try) / norm; } - // printoutf("error %g\n",err); + // printout("error %g\n",err); count++; if (count == 1000) { - printoutf("Compton hit 1000 tries. %g %g %g %g %g\n", f_max, f_min, ftry, sigma_try, norm); + printout("Compton hit 1000 tries. %g %g %g %g %g\n", f_max, f_min, ftry, sigma_try, norm); } } @@ -373,7 +373,7 @@ auto thomson_angle() -> double { // handle physical Compton scattering event void compton_scatter(Packet &pkt) { - // printoutf("Compton scattering.\n"); + // printout("Compton scattering.\n"); const double xx = H * pkt.nu_cmf / ME / CLIGHT / CLIGHT; @@ -605,7 +605,7 @@ auto get_chi_pair_prod_rf(const Packet &pkt) -> double { double chi_rf = chi_cmf * calculate_doppler_nucmf_on_nurf(pkt.pos, pkt.dir, pkt.prop_time); if (chi_rf < 0) { - printoutf("Negative pair production sigma. Setting to zero. Abort? %g\n", chi_rf); + printout("Negative pair production sigma. Setting to zero. Abort? %g\n", chi_rf); chi_rf = 0.; } @@ -730,19 +730,19 @@ void transport_gamma(Packet &pkt, const double t2) { ? globals::rmax * pkt.prop_time / globals::tmin : 2 * globals::rmax * (pkt.prop_time + sdist / CLIGHT_PROP) / globals::tmin; if (sdist > maxsdist) { - printoutf("Unreasonably large sdist (gamma). Abort. %g %g %g\n", globals::rmax, pkt.prop_time / globals::tmin, - sdist); + printout("Unreasonably large sdist (gamma). Abort. %g %g %g\n", globals::rmax, pkt.prop_time / globals::tmin, + sdist); assert_always(false); } if (sdist < 0) { - printoutf("Negative distance (sdist). Abort?\n"); + printout("Negative distance (sdist). Abort?\n"); sdist = 0; } if (((snext < 0) && (snext != -99)) || (snext >= grid::ngrid)) { - printoutf("Heading for inappropriate grid cell. Abort.\n"); - printoutf("Current cell %d, target cell %d.\n", pkt.where, snext); + printout("Heading for inappropriate grid cell. Abort.\n"); + printout("Current cell %d, target cell %d.\n", pkt.where, snext); assert_always(false); } @@ -780,7 +780,7 @@ void transport_gamma(Packet &pkt, const double t2) { assert_always(tdist >= 0); - // printoutf("sdist, tdist, edist %g %g %g\n",sdist, tdist, edist); + // printout("sdist, tdist, edist %g %g %g\n",sdist, tdist, edist); if ((sdist < tdist) && (sdist < edist)) { move_pkt_withtime(pkt, sdist / 2.); @@ -976,8 +976,8 @@ void guttman_thermalisation(Packet &pkt) { for (int i = 0; i < numb_rnd_dirs; i++) { const double summand = width * (1 - std::exp(-std::pow(t_gamma, 2.) / std::pow(t, 2.) * column_densities[i] / avg_column_density)); - printoutf("width: %f t_gamma: %f t: %f column_densities[i]: %f avg_column_density: %f summand: %f", width, t_gamma, - t, column_densities[i], avg_column_density, summand); + printout("width: %f t_gamma: %f t: %f column_densities[i]: %f avg_column_density: %f summand: %f", width, t_gamma, + t, column_densities[i], avg_column_density, summand); f_gamma += summand; } f_gamma /= (4 * PI); @@ -1056,9 +1056,9 @@ __host__ __device__ void pellet_gamma_decay(Packet &pkt) { } pkt.pol_dir = vec_norm(pkt.pol_dir); - // printoutf("initialise pol state of packet %g, %g, %g, %g, + // printout("initialise pol state of packet %g, %g, %g, %g, // %g\n",pkt.stokes_qu[0],pkt.stokes_qu[1],pkt.pol_dir[0],pkt.pol_dir[1],pkt.pol_dir[2]); - // printoutf("pkt direction %g, %g, %g\n",pkt.dir[0],pkt.dir[1],pkt.dir[2]); + // printout("pkt direction %g, %g, %g\n",pkt.dir[0],pkt.dir[1],pkt.dir[2]); } __host__ __device__ void do_gamma(Packet &pkt, const int nts, const double t2) { diff --git a/grid.cc b/grid.cc index 033fcf8d9..3c5f88c78 100644 --- a/grid.cc +++ b/grid.cc @@ -96,7 +96,7 @@ void set_initelectronfrac(const int modelgridindex, const double electronfrac) { void read_possible_yefile() { if (!std::filesystem::exists("Ye.txt")) { - printoutf("Ye.txt not found\n"); + printout("Ye.txt not found\n"); return; } @@ -111,9 +111,9 @@ void read_possible_yefile() { const int mgi = mgiplusone - 1; if (mgi >= 0 && mgi < get_npts_model()) { set_initelectronfrac(mgi, initelecfrac); - // printoutf("Ye.txt: setting mgi %d init_ye %g\n", mgi, initelecfrac); + // printout("Ye.txt: setting mgi %d init_ye %g\n", mgi, initelecfrac); } else { - // printoutf("Ye.txt: ignoring mgi %d init_ye %g\n", mgi, initelecfrac); + // printout("Ye.txt: ignoring mgi %d init_ye %g\n", mgi, initelecfrac); } } fclose(filein); @@ -148,7 +148,7 @@ void allocate_initradiobund() { #else initnucmassfrac_allcells = static_cast(malloc(totalradioabundsize)); #endif - printoutf( + printout( "[info] mem_usage: radioabundance data for %td nuclides for %td cells occupies %.3f MB (node shared memory)\n", num_nuclides, npts_model, static_cast(totalradioabundsize) / 1024. / 1024.); @@ -195,7 +195,7 @@ auto get_cell_r_inner(const int cellindex) -> double { void set_ffegrp(const int modelgridindex, float x) { if (!(x >= 0.)) { - printoutf("WARNING: Fe-group mass fraction %g is negative in cell %d\n", x, modelgridindex); + printout("WARNING: Fe-group mass fraction %g is negative in cell %d\n", x, modelgridindex); assert_always(x > -1e-6); x = 0.; } @@ -216,8 +216,8 @@ void set_modelinitnucmassfrac(const int modelgridindex, const int nucindex, floa // initnucmassfrac array is in node shared memory assert_always(nucindex >= 0); if (!(abund >= 0.)) { - printoutf("WARNING: nuclear mass fraction for nucindex %d = %g is negative in cell %d\n", nucindex, abund, - modelgridindex); + printout("WARNING: nuclear mass fraction for nucindex %d = %g is negative in cell %d\n", nucindex, abund, + modelgridindex); assert_always(abund > -1e-6); abund = 0.; } @@ -253,10 +253,10 @@ void set_elem_untrackedstable_abund_from_total(const int mgi, const int element, if (massfrac_untrackedstable < 0.) { //  allow some roundoff error before we complain if ((isofracsum - elemabundance - 1.) > 1e-4 && std::abs(isofracsum - elemabundance) > 1e-6) { - printoutf("WARNING: cell %d Z=%d element abundance is less than the sum of its radioisotope abundances\n", mgi, - atomic_number); - printoutf(" massfrac(Z) %g massfrac_radioisotopes(Z) %g\n", elemabundance, isofracsum); - printoutf(" increasing elemental abundance to %g and setting stable isotopic abundance to zero\n", isofracsum); + printout("WARNING: cell %d Z=%d element abundance is less than the sum of its radioisotope abundances\n", mgi, + atomic_number); + printout(" massfrac(Z) %g massfrac_radioisotopes(Z) %g\n", elemabundance, isofracsum); + printout(" increasing elemental abundance to %g and setting stable isotopic abundance to zero\n", isofracsum); } assert_always(massfrac_untrackedstable >= -1e-2); // result is allowed to be slightly negative due to roundoff error @@ -332,8 +332,7 @@ void allocate_nonemptycells_composition_cooling() modelgrid[modelgridindex].elem_massfracs = static_cast(malloc(get_nelements() * sizeof(float))); if (modelgrid[modelgridindex].elem_massfracs == nullptr) { - printoutf("[fatal] input: not enough memory to initialize compositionlist for cell %d... abort\n", - modelgridindex); + printout("[fatal] input: not enough memory to initialize compositionlist for cell %d... abort\n", modelgridindex); std::abort(); } @@ -359,23 +358,23 @@ void allocate_nonemptycells_composition_cooling() modelgrid[modelgridindex].ion_groundlevelpops = static_cast(calloc(get_includedions(), sizeof(float))); if (modelgrid[modelgridindex].ion_groundlevelpops == nullptr) { - printoutf("[fatal] input: not enough memory to initialize ion_groundlevelpops in cell %d... abort\n", - modelgridindex); + printout("[fatal] input: not enough memory to initialize ion_groundlevelpops in cell %d... abort\n", + modelgridindex); std::abort(); } modelgrid[modelgridindex].ion_partfuncts = static_cast(calloc(get_includedions(), sizeof(float))); if (modelgrid[modelgridindex].ion_partfuncts == nullptr) { - printoutf("[fatal] input: not enough memory to initialize partfunctlist in cell %d... abort\n", modelgridindex); + printout("[fatal] input: not enough memory to initialize partfunctlist in cell %d... abort\n", modelgridindex); std::abort(); } modelgrid[modelgridindex].ion_cooling_contribs = static_cast(malloc(get_includedions() * sizeof(double))); if (modelgrid[modelgridindex].ion_cooling_contribs == nullptr) { - printoutf("[fatal] input: not enough memory to initialize ion_cooling_contribs for cell %d... abort\n", - modelgridindex); + printout("[fatal] input: not enough memory to initialize ion_cooling_contribs for cell %d... abort\n", + modelgridindex); std::abort(); } } @@ -423,7 +422,7 @@ void allocate_nonemptymodelcells() { for (int mgi = 0; mgi < get_npts_model(); mgi++) { if (get_numassociatedcells(mgi) > 0) { if (get_rho_tmin(mgi) <= 0) { - printoutf("Error: negative or zero density. Abort.\n"); + printout("Error: negative or zero density. Abort.\n"); std::abort(); } nonemptymgi_of_mgi[mgi] = nonemptymgi; @@ -507,13 +506,13 @@ void allocate_nonemptymodelcells() { MPI_Barrier(MPI_COMM_WORLD); #endif - printoutf("[info] mem_usage: the modelgrid array occupies %.3f MB\n", - (get_npts_model() + 1) * sizeof(modelgrid[0]) / 1024. / 1024.); + printout("[info] mem_usage: the modelgrid array occupies %.3f MB\n", + (get_npts_model() + 1) * sizeof(modelgrid[0]) / 1024. / 1024.); - printoutf("There are %td modelgrid cells with associated propagation cells (nonempty_npts_model)\n", - nonempty_npts_model); + printout("There are %td modelgrid cells with associated propagation cells (nonempty_npts_model)\n", + nonempty_npts_model); - printoutf( + printout( "[info] mem_usage: NLTE populations for all allocated cells occupy a total of %.3f MB (node shared memory)\n", get_nonempty_npts_model() * globals::total_nlte_levels * sizeof(double) / 1024. / 1024.); } @@ -581,7 +580,7 @@ void abundances_read() { // barrier to make sure node master has set values in node shared memory MPI_Barrier(MPI_COMM_WORLD); #endif - printoutf("reading abundances.txt..."); + printout("reading abundances.txt..."); const bool threedimensional = (get_model_type() == GridType::CARTESIAN3D); // Open the abundances file @@ -647,7 +646,7 @@ void abundances_read() { // barrier to make sure node master has set values in node shared memory MPI_Barrier(MPI_COMM_WORLD); #endif - printoutf("done.\n"); + printout("done.\n"); } void parse_model_headerline(const std::string &line, std::vector &zlist, std::vector &alist, @@ -689,11 +688,11 @@ void parse_model_headerline(const std::string &line, std::vector &zlist, st const int a = decay::get_nucstring_a(token.substr(2)); assert_always(z >= 0); assert_always(a >= 0); - // printoutf("Custom column: '%s' Z %d A %d\n", token.c_str(), z, a); + // printout("Custom column: '%s' Z %d A %d\n", token.c_str(), z, a); zlist.push_back(z); alist.push_back(a); } else { - // printoutf("Custom column: '%s' Z %d A %d\n", token.c_str(), -1, -1); + // printout("Custom column: '%s' Z %d A %d\n", token.c_str(), -1, -1); colnames.push_back(token); zlist.push_back(-1); alist.push_back(-1); @@ -745,8 +744,8 @@ void read_model_radioabundances(std::fstream &fmodel, std::istringstream &ssline ; } else { if (mgi == 0) { - printoutf("WARNING: ignoring column '%s' nucindex %d valuein[mgi=0] %lg\n", colnames[i].c_str(), - nucindexlist[i], valuein); + printout("WARNING: ignoring column '%s' nucindex %d valuein[mgi=0] %lg\n", colnames[i].c_str(), nucindexlist[i], + valuein); } } } @@ -793,7 +792,7 @@ auto read_model_columns(std::fstream &fmodel) -> std::tuple= get_token_count(headerline)); - printoutf("model.txt has %s line per cell format\n", one_line_per_cell ? "one" : "two"); + printout("model.txt has %s line per cell format\n", one_line_per_cell ? "one" : "two"); if (!one_line_per_cell) { // add columns from the second line std::getline(fmodel, line); @@ -809,9 +808,9 @@ auto read_model_columns(std::fstream &fmodel) -> std::tuple> cellnumberin >> vout_kmps >> log_rho) { if (mgi == 0) { first_cellindex = cellnumberin; - printoutf("first_cellindex %d\n", first_cellindex); + printout("first_cellindex %d\n", first_cellindex); } assert_always(cellnumberin == mgi + first_cellindex); @@ -879,8 +878,8 @@ void read_1d_model() { set_rho_tmin(mgi, rho_tmin); set_rho(mgi, rho_tmin); } else { - printoutf("Unexpected number of values in model.txt\n"); - printoutf("line: %s\n", line.c_str()); + printout("Unexpected number of values in model.txt\n"); + printout("line: %s\n", line.c_str()); assert_always(false); } read_model_radioabundances(fmodel, ssline, mgi, true, colnames, nucindexlist, one_line_per_cell); @@ -892,7 +891,7 @@ void read_1d_model() { } if (mgi != get_npts_model()) { - printoutf("ERROR in model.txt. Found only %d cells instead of %d expected.\n", mgi - 1, get_npts_model()); + printout("ERROR in model.txt. Found only %d cells instead of %d expected.\n", mgi - 1, get_npts_model()); std::abort(); } @@ -951,7 +950,7 @@ void read_2d_model() { assert_always(fabs((cell_z_in / pos_z_mid) - 1) < 1e-3); if (rho_tmodel < 0) { - printoutf("negative input density %g %d\n", rho_tmodel, mgi); + printout("negative input density %g %d\n", rho_tmodel, mgi); std::abort(); } @@ -966,7 +965,7 @@ void read_2d_model() { } if (mgi != get_npts_model()) { - printoutf("ERROR in model.txt. Found %d only cells instead of %d expected.\n", mgi - 1, get_npts_model()); + printout("ERROR in model.txt. Found %d only cells instead of %d expected.\n", mgi - 1, get_npts_model()); std::abort(); } } @@ -1022,7 +1021,7 @@ void read_3d_model() { std::istringstream ssline(line); assert_always(ssline >> cellnumberin >> cellpos_in[0] >> cellpos_in[1] >> cellpos_in[2] >> rho_model); - // printoutf("cell %d, posz %g, posy %g, posx %g, rho %g, rho_init %g\n",dum1,dum3,dum4,dum5,rho_model,rho_model* + // printout("cell %d, posz %g, posy %g, posx %g, rho %g, rho_init %g\n",dum1,dum3,dum4,dum5,rho_model,rho_model* // pow( (t_model/globals::tmin), 3.)); if (mgi == 0) { @@ -1031,7 +1030,7 @@ void read_3d_model() { assert_always(cellnumberin == mgi + first_cellindex); if (mgi % (ncoord_model[1] * ncoord_model[2]) == 0) { - printoutf("read up to cell mgi %d\n", mgi); + printout("read up to cell mgi %d\n", mgi); } // cell coordinates in the 3D model.txt file are sometimes reordered by the scaling script @@ -1040,7 +1039,7 @@ void read_3d_model() { for (int axis = 0; axis < 3; axis++) { const double cellwidth = 2 * xmax_tmodel / ncoordgrid[axis]; const double cellpos_expected = -xmax_tmodel + (cellwidth * get_cellcoordpointnum(mgi, axis)); - // printoutf("mgi %d coord %d expected %g found %g or %g rmax %g get_cellcoordpointnum(mgi, axis) %d ncoordgrid + // printout("mgi %d coord %d expected %g found %g or %g rmax %g get_cellcoordpointnum(mgi, axis) %d ncoordgrid // %d\n", // mgi, axis, cellpos_expected, cellpos_in[axis], cellpos_in[2 - axis], xmax_tmodel, // get_cellcoordpointnum(mgi, axis), ncoordgrid[axis]); @@ -1053,7 +1052,7 @@ void read_3d_model() { } if (rho_model < 0) { - printoutf("negative input density %g %d\n", rho_model, mgi); + printout("negative input density %g %d\n", rho_model, mgi); std::abort(); } @@ -1072,25 +1071,25 @@ void read_3d_model() { mgi++; } if (mgi != npts_model_in) { - printoutf("ERROR in model.txt. Found %d cells instead of %d expected.\n", mgi, npts_model_in); + printout("ERROR in model.txt. Found %d cells instead of %d expected.\n", mgi, npts_model_in); std::abort(); } // assert_always(posmatch_zyx ^ posmatch_xyz); // xor because if both match then probably an infinity occurred if (posmatch_xyz) { - printoutf("Cell positions in model.txt are consistent with calculated values when x-y-z column order is used.\n"); + printout("Cell positions in model.txt are consistent with calculated values when x-y-z column order is used.\n"); } if (posmatch_zyx) { - printoutf("Cell positions in model.txt are consistent with calculated values when z-y-x column order is used.\n"); + printout("Cell positions in model.txt are consistent with calculated values when z-y-x column order is used.\n"); } if (!posmatch_xyz && !posmatch_zyx) { - printoutf( + printout( "WARNING: Cell positions in model.txt are not consistent with calculated values in either x-y-z or z-y-x " "order.\n"); } - printoutf("min_den %g [g/cm3]\n", min_den); + printout("min_den %g [g/cm3]\n", min_den); } void calc_modelinit_totmassradionuclides() { @@ -1140,20 +1139,20 @@ void calc_modelinit_totmassradionuclides() { mfegroup += mass_in_shell * get_ffegrp(mgi); } - printoutf("Total input model mass: %9.3e [Msun]\n", mtot_input / MSUN); - printoutf("Nuclide masses at t=t_model_init [Msun]:"); - printoutf(" 56Ni: %9.3e 56Co: %9.3e 52Fe: %9.3e 48Cr: %9.3e\n", get_totmassradionuclide(28, 56) / MSUN, - get_totmassradionuclide(27, 56) / MSUN, get_totmassradionuclide(26, 52) / MSUN, - get_totmassradionuclide(24, 48) / MSUN); - printoutf(" Fe-group: %9.3e 57Ni: %9.3e 57Co: %9.3e\n", mfegroup / MSUN, get_totmassradionuclide(28, 57) / MSUN, - get_totmassradionuclide(27, 57) / MSUN); + printout("Total input model mass: %9.3e [Msun]\n", mtot_input / MSUN); + printout("Nuclide masses at t=t_model_init [Msun]:"); + printout(" 56Ni: %9.3e 56Co: %9.3e 52Fe: %9.3e 48Cr: %9.3e\n", get_totmassradionuclide(28, 56) / MSUN, + get_totmassradionuclide(27, 56) / MSUN, get_totmassradionuclide(26, 52) / MSUN, + get_totmassradionuclide(24, 48) / MSUN); + printout(" Fe-group: %9.3e 57Ni: %9.3e 57Co: %9.3e\n", mfegroup / MSUN, get_totmassradionuclide(28, 57) / MSUN, + get_totmassradionuclide(27, 57) / MSUN); } void read_grid_restart_data(const int timestep) { char filename[MAXFILENAMELENGTH]; snprintf(filename, MAXFILENAMELENGTH, "gridsave_ts%d.tmp", timestep); - printoutf("READIN GRID SNAPSHOT from %s\n", filename); + printout("READIN GRID SNAPSHOT from %s\n", filename); FILE *gridsave_file = fopen_required(filename, "r"); int ntimesteps_in = -1; @@ -1201,8 +1200,8 @@ void read_grid_restart_data(const int timestep) { &modelgrid[mgi].nnetot) == 12); if (mgi_in != mgi) { - printoutf("[fatal] read_grid_restart_data: cell mismatch in reading input gridsave.dat ... abort\n"); - printoutf("[fatal] read_grid_restart_data: read cellnumber %d, expected cellnumber %d\n", mgi_in, mgi); + printout("[fatal] read_grid_restart_data: cell mismatch in reading input gridsave.dat ... abort\n"); + printout("[fatal] read_grid_restart_data: read cellnumber %d, expected cellnumber %d\n", mgi_in, mgi); assert_always(mgi_in == mgi); } @@ -1250,7 +1249,7 @@ void assign_initial_temperatures() { // according to the local energy density resulting from the 56Ni decay. // The dilution factor is W=1 in LTE. - printoutf("Assigning initial temperatures...\n"); + printout("Assigning initial temperatures...\n"); const double tstart = globals::timesteps[0].mid; int cells_below_mintemp = 0; @@ -1268,15 +1267,15 @@ void assign_initial_temperatures() { pow(CLIGHT / 4 / STEBO * pow(globals::tmin / tstart, 3) * get_rho_tmin(mgi) * decayedenergy_per_mass, 1. / 4.); if (T_initial < MINTEMP) { - // printoutf("mgi %d: T_initial of %g is below MINTEMP %g K, setting to MINTEMP.\n", mgi, T_initial, MINTEMP); + // printout("mgi %d: T_initial of %g is below MINTEMP %g K, setting to MINTEMP.\n", mgi, T_initial, MINTEMP); T_initial = MINTEMP; cells_below_mintemp++; } else if (T_initial > MAXTEMP) { - // printoutf("mgi %d: T_initial of %g is above MAXTEMP %g K, setting to MAXTEMP.\n", mgi, T_initial, MAXTEMP); + // printout("mgi %d: T_initial of %g is above MAXTEMP %g K, setting to MAXTEMP.\n", mgi, T_initial, MAXTEMP); T_initial = MAXTEMP; cells_above_maxtemp++; } else if (!std::isfinite(T_initial)) { - printoutf("mgi %d: T_initial of %g is infinite!\n", mgi, T_initial); + printout("mgi %d: T_initial of %g is infinite!\n", mgi, T_initial); } assert_always(std::isfinite(T_initial)); @@ -1287,8 +1286,8 @@ void assign_initial_temperatures() { set_W(mgi, 1.); modelgrid[mgi].thick = 0; } - printoutf(" cells below MINTEMP %g: %d\n", MINTEMP, cells_below_mintemp); - printoutf(" cells above MAXTEMP %g: %d\n", MAXTEMP, cells_above_maxtemp); + printout(" cells below MINTEMP %g: %d\n", MINTEMP, cells_below_mintemp); + printout(" cells above MAXTEMP %g: %d\n", MAXTEMP, cells_above_maxtemp); } void setup_nstart_ndo() { @@ -1362,7 +1361,7 @@ void setup_grid_cartesian_3d() { // vmax is per coordinate, but the simulation volume corners will // have a higher expansion velocity than the sides const double vmax_corner = sqrt(3 * pow(globals::vmax, 2)); - printoutf("corner vmax %g [cm/s] (%.2fc)\n", vmax_corner, vmax_corner / CLIGHT); + printout("corner vmax %g [cm/s] (%.2fc)\n", vmax_corner, vmax_corner / CLIGHT); if (!FORCE_SPHERICAL_ESCAPE_SURFACE) { assert_always(vmax_corner < CLIGHT); } @@ -1426,7 +1425,7 @@ void setup_grid_spherical1d() { void setup_grid_cylindrical_2d() { const double vmax_corner = sqrt(2 * pow(globals::vmax, 2)); - printoutf("corner vmax %g [cm/s] (%.2fc)\n", vmax_corner, vmax_corner / CLIGHT); + printout("corner vmax %g [cm/s] (%.2fc)\n", vmax_corner, vmax_corner / CLIGHT); assert_always(vmax_corner < CLIGHT); assert_always(get_model_type() == GridType::CYLINDRICAL2D); @@ -1759,7 +1758,7 @@ auto get_coordcellindexincrement(const int axis) -> int { default: if constexpr (TESTMODE) { - printoutf("invalid coordinate index %d", axis); + printout("invalid coordinate index %d", axis); assert_testmodeonly(false); } else { __builtin_unreachable(); @@ -1784,7 +1783,7 @@ auto get_cellcoordpointnum(const int cellindex, const int axis) -> int { default: if constexpr (TESTMODE) { - printoutf("invalid coordinate index %d", axis); + printout("invalid coordinate index %d", axis); assert_testmodeonly(false); } else { __builtin_unreachable(); @@ -1889,7 +1888,7 @@ void set_Te(const int modelgridindex, const float Te) { // 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) { - printoutf( + 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); @@ -2072,7 +2071,7 @@ void calculate_kappagrey() { } else if (get_rho_tmin(mgi) == 0.) { set_kappagrey(mgi, 0.); } else if (get_rho_tmin(mgi) < 0.) { - printoutf("Error: negative density. Abort.\n"); + printout("Error: negative density. Abort.\n"); std::abort(); } opcase3_sum += get_kappagrey(mgi) * get_rho_tmin(mgi); @@ -2144,7 +2143,7 @@ void calculate_kappagrey() { kappa *= pow(T_rad / 2000., 5.); } } else { - printoutf("Unknown opacity case. Abort.\n"); + printout("Unknown opacity case. Abort.\n"); std::abort(); } @@ -2152,7 +2151,7 @@ void calculate_kappagrey() { } else if (get_rho_tmin(mgi) == 0.) { set_kappagrey(mgi, 0.); } else if (get_rho_tmin(mgi) < 0.) { - printoutf("Error: negative density. Abort.\n"); + printout("Error: negative density. Abort.\n"); std::abort(); } @@ -2160,38 +2159,38 @@ void calculate_kappagrey() { check2 = check2 + get_rho_tmin(mgi); } - printoutf("Grey normalisation check: %g\n", check1 / check2); + printout("Grey normalisation check: %g\n", check1 / check2); } void read_ejecta_model() { switch (get_model_type()) { case GridType::SPHERICAL1D: { - printoutf("Read 1D model\n"); + printout("Read 1D model\n"); read_1d_model(); break; } case GridType::CYLINDRICAL2D: { - printoutf("Read 2D model\n"); + printout("Read 2D model\n"); read_2d_model(); break; } case GridType::CARTESIAN3D: { - printoutf("Read 3D model\n"); + printout("Read 3D model\n"); read_3d_model(); break; } } - printoutf("npts_model: %d\n", get_npts_model()); + printout("npts_model: %d\n", get_npts_model()); globals::rmax = globals::vmax * globals::tmin; - printoutf("vmax %g [cm/s] (%.2fc)\n", globals::vmax, globals::vmax / CLIGHT); + printout("vmax %g [cm/s] (%.2fc)\n", globals::vmax, globals::vmax / CLIGHT); assert_always(globals::vmax < CLIGHT); - printoutf("tmin %g [s] = %.2f [d]\n", globals::tmin, globals::tmin / 86400.); - printoutf("rmax %g [cm] (at t=tmin)\n", globals::rmax); + printout("tmin %g [s] = %.2f [d]\n", globals::tmin, globals::tmin / 86400.); + printout("rmax %g [cm] (at t=tmin)\n", globals::rmax); calc_modelinit_totmassradionuclides(); @@ -2203,7 +2202,7 @@ void write_grid_restart_data(const int timestep) { snprintf(filename, MAXFILENAMELENGTH, "gridsave_ts%d.tmp", timestep); const auto sys_time_start_write_restart = std::time(nullptr); - printoutf("Write grid restart data to %s...", filename); + printout("Write grid restart data to %s...", filename); FILE *gridsave_file = fopen_required(filename, "w"); @@ -2250,7 +2249,7 @@ void write_grid_restart_data(const int timestep) { nonthermal::write_restart_data(gridsave_file); nltepop_write_restart_data(gridsave_file); fclose(gridsave_file); - printoutf("done in %ld seconds.\n", std::time(nullptr) - sys_time_start_write_restart); + printout("done in %ld seconds.\n", std::time(nullptr) - sys_time_start_write_restart); } auto get_maxndo() -> int { @@ -2293,16 +2292,16 @@ void grid_init(const int my_rank) { } else if (GRID_TYPE == GridType::SPHERICAL1D) { setup_grid_spherical1d(); } else { - printoutf("[fatal] grid_init: Error: Unknown grid type. Abort."); + printout("[fatal] grid_init: Error: Unknown grid type. Abort."); std::abort(); } - printoutf("propagation grid: %d-dimensional %s\n", get_ngriddimensions(), get_grid_type_name().c_str()); + printout("propagation grid: %d-dimensional %s\n", get_ngriddimensions(), get_grid_type_name().c_str()); for (int d = 0; d < get_ngriddimensions(); d++) { - printoutf(" coordinate %d '%c': cells have %d position values\n", d, coordlabel[d], ncoordgrid[d]); + printout(" coordinate %d '%c': cells have %d position values\n", d, coordlabel[d], ncoordgrid[d]); } - printoutf(" total propagation cells: %d\n", ngrid); + printout(" total propagation cells: %d\n", ngrid); // Now set up the density in each cell. @@ -2312,7 +2311,7 @@ void grid_init(const int my_rank) { // tau_sobolev = PI*QE*QE/(ME*C) * rho_crit_para * rho/nucmass(28, 56) * 3000e-8 * globals::timesteps[m].mid; globals::rho_crit = ME * CLIGHT * decay::nucmass(28, 56) / (PI * QE * QE * globals::rho_crit_para * 3000e-8 * globals::tmin); - printoutf("grid_init: rho_crit = %g [g/cm3]\n", globals::rho_crit); + printout("grid_init: rho_crit = %g [g/cm3]\n", globals::rho_crit); if (get_model_type() == GRID_TYPE) { if (get_model_type() == GridType::CARTESIAN3D) { @@ -2329,7 +2328,7 @@ void grid_init(const int my_rank) { assert_always(GRID_TYPE == GridType::CARTESIAN3D); map_2dmodelto3dgrid(); } else { - printoutf("[fatal] grid_init: Error: Unknown density type. Abort."); + printout("[fatal] grid_init: Error: Unknown density type. Abort."); std::abort(); } @@ -2380,7 +2379,7 @@ void grid_init(const int my_rank) { if (totmassradionuclide_actual > 0.) { const double ratio = totmassradionuclide[nucindex] / totmassradionuclide_actual; - // printoutf("nuclide %d ratio %g\n", nucindex, ratio); + // printout("nuclide %d ratio %g\n", nucindex, ratio); for (int nonemptymgi = 0; nonemptymgi < get_nonempty_npts_model(); nonemptymgi++) { const int mgi = grid::get_mgi_of_nonemptymgi(nonemptymgi); const double prev_abund = get_modelinitnucmassfrac(mgi, nucindex); @@ -2395,8 +2394,8 @@ void grid_init(const int my_rank) { for (int mgi = 0; mgi < get_npts_model(); mgi++) { mtot_mapped += get_rho_tmin(mgi) * get_modelcell_assocvolume_tmin(mgi); } - printoutf("Total grid-mapped mass: %9.3e [Msun] (%.1f%% of input mass)\n", mtot_mapped / MSUN, - mtot_mapped / mtot_input * 100.); + printout("Total grid-mapped mass: %9.3e [Msun] (%.1f%% of input mass)\n", mtot_mapped / MSUN, + mtot_mapped / mtot_input * 100.); #ifdef MPI_ON MPI_Barrier(MPI_COMM_WORLD); @@ -2471,7 +2470,7 @@ auto get_totmassradionuclide(const int z, const int a) -> double { const auto negdirections = std::array{COORD0_MIN, COORD1_MIN, COORD2_MIN}; const auto posdirections = std::array{COORD0_MAX, COORD1_MAX, COORD2_MAX}; - // printoutf("checking inside cell boundary\n"); + // printout("checking inside cell boundary\n"); for (int d = 0; d < ndim; d++) { // flip is either zero or one to indicate +ve and -ve boundaries along the selected axis for (int flip = 0; flip < 2; flip++) { @@ -2498,43 +2497,42 @@ auto get_totmassradionuclide(const int z, const int a) -> double { // for (int d2 = 0; d2 < ndim; d2++) const int d2 = d; { - printoutf( + printout( "[warning] packet outside coord %d %c%c boundary of cell %d. vel %g initpos %g " "cellcoordmin %g, cellcoordmax %g\n", d, flip != 0 ? '-' : '+', grid::coordlabel[d], cellindex, pktvelgridcoord[d2], pktposgridcoord[d2], grid::get_cellcoordmin(cellindex, d2) / globals::tmin * tstart, cellcoordmax[d2] / globals::tmin * tstart); } - printoutf("globals::tmin %g tstart %g tstart/globals::tmin %g\n", globals::tmin, tstart, - tstart / globals::tmin); - printoutf("[warning] delta %g\n", delta); + printout("globals::tmin %g tstart %g tstart/globals::tmin %g\n", globals::tmin, tstart, tstart / globals::tmin); + printout("[warning] delta %g\n", delta); - printoutf("[warning] dir [%g, %g, %g]\n", dir[0], dir[1], dir[2]); + printout("[warning] dir [%g, %g, %g]\n", dir[0], dir[1], dir[2]); if ((pktvelgridcoord[d] - (pktposgridcoord[d] / tstart)) > 0) { if ((grid::get_cellcoordpointnum(cellindex, d) == (grid::ncoordgrid[d] - 1) && cellindexstride > 0) || (grid::get_cellcoordpointnum(cellindex, d) == 0 && cellindexstride < 0)) { - printoutf("escaping packet\n"); + printout("escaping packet\n"); return {0., -99}; } const int snext = cellindex + cellindexstride; *pkt_last_cross = invdirection; - printoutf("[warning] swapping packet cellindex from %d to %d and setting last_cross to %d\n", cellindex, - snext, *pkt_last_cross); + printout("[warning] swapping packet cellindex from %d to %d and setting last_cross to %d\n", cellindex, snext, + *pkt_last_cross); return {0., snext}; } - printoutf("pretending last_cross is %d\n", direction); + printout("pretending last_cross is %d\n", direction); last_cross = direction; } } } - // printoutf("pkt.number %d\n", pkt.number); - // printoutf("delta1x %g delta2x %g\n", (initpos[0] * globals::tmin/tstart)-grid::get_cellcoordmin(cellindex, 0), - // cellcoordmax[0] - (initpos[0] * globals::tmin/tstart)); printoutf("delta1y %g delta2y %g\n", (initpos[1] * + // printout("pkt.number %d\n", pkt.number); + // printout("delta1x %g delta2x %g\n", (initpos[0] * globals::tmin/tstart)-grid::get_cellcoordmin(cellindex, 0), + // cellcoordmax[0] - (initpos[0] * globals::tmin/tstart)); printout("delta1y %g delta2y %g\n", (initpos[1] * // globals::tmin/tstart)-grid::get_cellcoordmin(cellindex, 1), cellcoordmax[1] - (initpos[1] * - // globals::tmin/tstart)); printoutf("delta1z %g delta2z %g\n", (initpos[2] * + // globals::tmin/tstart)); printout("delta1z %g delta2z %g\n", (initpos[2] * // globals::tmin/tstart)-grid::get_cellcoordmin(cellindex, 2), cellcoordmax[2] - (initpos[2] * - // globals::tmin/tstart)); printoutf("dir [%g, %g, %g]\n", dir[0],dir[1],dir[2]); + // globals::tmin/tstart)); printout("dir [%g, %g, %g]\n", dir[0],dir[1],dir[2]); // distance to reach the cell's upper boundary on each coordinate auto d_coordmaxboundary = std::array{-1}; @@ -2624,22 +2622,22 @@ auto get_totmassradionuclide(const int z, const int a) -> double { if (choice == BOUNDARY_NONE) { if constexpr (TESTMODE) { - printoutf("Something wrong in boundary crossing - didn't find anything.\n"); - printoutf("packet cell %d\n", cellindex); - printoutf("choice %d\n", choice); - printoutf("globals::tmin %g tstart %g\n", globals::tmin, tstart); - printoutf("last_cross %d\n", last_cross); + printout("Something wrong in boundary crossing - didn't find anything.\n"); + printout("packet cell %d\n", cellindex); + printout("choice %d\n", choice); + printout("globals::tmin %g tstart %g\n", globals::tmin, tstart); + printout("last_cross %d\n", last_cross); for (int d2 = 0; d2 < 3; d2++) { - printoutf("coord %d: initpos %g dir %g\n", d2, pos[d2], dir[d2]); + printout("coord %d: initpos %g dir %g\n", d2, pos[d2], dir[d2]); } - printoutf("|initpos| %g |dir| %g |pos.dir| %g\n", vec_len(pos), vec_len(dir), dot(pos, dir)); + printout("|initpos| %g |dir| %g |pos.dir| %g\n", vec_len(pos), vec_len(dir), dot(pos, dir)); for (int d2 = 0; d2 < ndim; d2++) { - printoutf("coord %d: dist_posmax %g dist_posmin %g\n", d2, d_coordmaxboundary[d2], d_coordminboundary[d2]); - printoutf("coord %d: cellcoordmin %g cellcoordmax %g\n", d2, - grid::get_cellcoordmin(cellindex, d2) * tstart / globals::tmin, - cellcoordmax[d2] * tstart / globals::tmin); + printout("coord %d: dist_posmax %g dist_posmin %g\n", d2, d_coordmaxboundary[d2], d_coordminboundary[d2]); + printout("coord %d: cellcoordmin %g cellcoordmax %g\n", d2, + grid::get_cellcoordmin(cellindex, d2) * tstart / globals::tmin, + cellcoordmax[d2] * tstart / globals::tmin); } - printoutf("tstart %g\n", tstart); + printout("tstart %g\n", tstart); assert_always(false); } else { diff --git a/input.cc b/input.cc index 5ebeb3391..14281fb60 100644 --- a/input.cc +++ b/input.cc @@ -130,8 +130,8 @@ void read_phixs_data_table(std::fstream &phixsfile, const int nphixspoints_input probability_sum += phixstargetprobability; } if (fabs(probability_sum - 1.0) > 0.01) { - printoutf("WARNING: photoionisation table for Z=%d ionstage %d has probabilities that sum to %g", - get_atomicnumber(element), get_ionstage(element, lowerion), probability_sum); + printout("WARNING: photoionisation table for Z=%d ionstage %d has probabilities that sum to %g", + get_atomicnumber(element), get_ionstage(element, lowerion), probability_sum); } } else { // file has table of target states and probabilities but our top ion is limited to one level globals::elements[element].ions[lowerion].levels[lowerlevel].nphixstargets = 1; @@ -224,7 +224,7 @@ void read_phixs_data_table(std::fstream &phixsfile, const int nphixspoints_input } // nbfcontinua++; - // printoutf("[debug] element %d, ion %d, level %d: phixs exists %g\n",element,lowerion,lowerlevel,phixs*1e-18); + // printout("[debug] element %d, ion %d, level %d: phixs exists %g\n",element,lowerion,lowerlevel,phixs*1e-18); globals::nbfcontinua += get_nphixstargets(element, lowerion, lowerlevel); if (lowerlevel == 0 && get_nphixstargets(element, lowerion, lowerlevel) > 0) { globals::nbfcontinua_ground++; @@ -234,13 +234,13 @@ void read_phixs_data_table(std::fstream &phixsfile, const int nphixspoints_input void read_phixs_file(const int phixs_file_version, std::vector &tmpallphixs) { size_t mem_usage_phixs = 0; - printoutf("readin phixs data from %s\n", phixsdata_filenames[phixs_file_version]); + printout("readin phixs data from %s\n", phixsdata_filenames[phixs_file_version]); auto phixsfile = fstream_required(phixsdata_filenames[phixs_file_version], std::ios::in); std::string phixsline; if (phixs_file_version == 1 && phixs_file_version_exists[2]) { - printoutf( + printout( "using NPHIXSPOINTS = %d and NPHIXSNUINCREMENT = %lg from phixsdata_v2.txt to interpolate " "phixsdata.txt data\n", globals::NPHIXSPOINTS, globals::NPHIXSNUINCREMENT); @@ -250,8 +250,8 @@ void read_phixs_file(const int phixs_file_version, std::vector &tmpallphi globals::NPHIXSNUINCREMENT = .1; // not exactly where the last point is, but classic integrals go from nu_edge to 10*nu_edge last_phixs_nuovernuedge = 10; - printoutf("using NPHIXSPOINTS = %d and NPHIXSNUINCREMENT = %lg set in input.cc\n", globals::NPHIXSPOINTS, - globals::NPHIXSNUINCREMENT); + printout("using NPHIXSPOINTS = %d and NPHIXSNUINCREMENT = %lg set in input.cc\n", globals::NPHIXSPOINTS, + globals::NPHIXSNUINCREMENT); } else { assert_always(phixsfile >> globals::NPHIXSPOINTS); assert_always(globals::NPHIXSPOINTS > 0); @@ -329,7 +329,7 @@ void read_phixs_file(const int phixs_file_version, std::vector &tmpallphi } } - printoutf("[info] mem_usage: photoionisation tables occupy %.3f MB\n", mem_usage_phixs / 1024. / 1024.); + printout("[info] mem_usage: photoionisation tables occupy %.3f MB\n", mem_usage_phixs / 1024. / 1024.); } constexpr auto downtranslevelstart(const int level) { @@ -446,7 +446,7 @@ void read_ion_transitions(std::fstream &ftransitiondata, const int tottransition if (tmplevel == prev_lower) { continue; } - // printoutf("+adding transition index %d Z=%02d ionstage %d lower %d upper %d\n", i, Z, ionstage, prev_lower, + // printout("+adding transition index %d Z=%02d ionstage %d lower %d upper %d\n", i, Z, ionstage, prev_lower, // tmplevel); tottransitions++; assert_always(tmplevel >= 0); @@ -457,8 +457,8 @@ void read_ion_transitions(std::fstream &ftransitiondata, const int tottransition iontransitiontable.push_back( {.lower = lower, .upper = upper, .A = A, .coll_str = coll_str, .forbidden = (intforbidden == 1)}); - // printoutf("index %d, lower %d, upper %d, A %g\n",transitionindex,lower,upper,A); - // printoutf("reading transition index %d lower %d upper %d\n", i, transitiontable[i].lower, + // printout("index %d, lower %d, upper %d, A %g\n",transitionindex,lower,upper,A); + // printout("reading transition index %d lower %d upper %d\n", i, transitiontable[i].lower, // transitiontable[i].upper); prev_lower = lower; prev_upper = upper; @@ -574,11 +574,11 @@ void add_transitions_to_unsorted_linelist(const int element, const int ion, cons (temp_linelist[downtranslineindex].ionindex != ion) || (temp_linelist[downtranslineindex].upperlevelindex != level) || (temp_linelist[downtranslineindex].lowerlevelindex != lowerlevel)) { - printoutf("[input] Failure to identify level pair for duplicate bb-transition ... going to abort now\n"); - printoutf("[input] element %d ion %d targetlevel %d level %d\n", element, ion, lowerlevel, level); - printoutf("[input] transitions[level].to[targetlevel]=lineindex %d\n", downtranslineindex); - printoutf("[input] A_ul %g, coll_str %g\n", transition.A, transition.coll_str); - printoutf( + printout("[input] Failure to identify level pair for duplicate bb-transition ... going to abort now\n"); + printout("[input] element %d ion %d targetlevel %d level %d\n", element, ion, lowerlevel, level); + printout("[input] transitions[level].to[targetlevel]=lineindex %d\n", downtranslineindex); + printout("[input] A_ul %g, coll_str %g\n", transition.A, transition.coll_str); + printout( "[input] globals::linelist[lineindex].elementindex %d, " "globals::linelist[lineindex].ionindex %d, globals::linelist[lineindex].upperlevelindex " "%d, globals::linelist[lineindex].lowerlevelindex %d\n", @@ -686,23 +686,23 @@ auto search_groundphixslist(const double nu_edge, const int element_in, const in return i - 1; } - printoutf( + printout( "[fatal] search_groundphixslist: element %d, ion %d, level %d has edge_frequency %g equal to the " "bluest ground-level continuum\n", element_in, ion_in, level_in, nu_edge); - printoutf( + printout( "[fatal] search_groundphixslist: bluest ground level continuum is element %d, ion %d at " "nu_edge %g\n", element, ion, globals::groundcont[i - 1].nu_edge); - printoutf("[fatal] search_groundphixslist: i %d, nbfcontinua_ground %d\n", i, globals::nbfcontinua_ground); - printoutf( + printout("[fatal] search_groundphixslist: i %d, nbfcontinua_ground %d\n", i, globals::nbfcontinua_ground); + printout( "[fatal] This shouldn't happen, is hoewever possible if there are multiple levels in the adata file at " "energy=0\n"); for (int looplevels = 0; looplevels < get_nlevels(element_in, ion_in); looplevels++) { - printoutf("[fatal] element %d, ion %d, level %d, energy %g\n", element_in, ion_in, looplevels, - epsilon(element_in, ion_in, looplevels)); + printout("[fatal] element %d, ion %d, level %d, energy %g\n", element_in, ion_in, looplevels, + epsilon(element_in, ion_in, looplevels)); } - printoutf("[fatal] Abort omitted ... MAKE SURE ATOMIC DATA ARE CONSISTENT\n"); + printout("[fatal] Abort omitted ... MAKE SURE ATOMIC DATA ARE CONSISTENT\n"); return i - 1; // abort(); } @@ -715,8 +715,8 @@ auto search_groundphixslist(const double nu_edge, const int element_in, const in // set up the photoionisation transition lists // and temporary gamma/kappa lists for each thread void setup_phixs_list() { - printoutf("[info] read_atomicdata: number of bfcontinua %d\n", globals::nbfcontinua); - printoutf("[info] read_atomicdata: number of ground-level bfcontinua %d\n", globals::nbfcontinua_ground); + printout("[info] read_atomicdata: number of bfcontinua %d\n", globals::nbfcontinua); + printout("[info] read_atomicdata: number of ground-level bfcontinua %d\n", globals::nbfcontinua_ground); if constexpr (USE_LUT_PHOTOION || USE_LUT_BFHEATING) { globals::groundcont.resize(globals::nbfcontinua_ground); @@ -745,8 +745,8 @@ void setup_phixs_list() { auto *nonconstallcont = static_cast(malloc(globals::nbfcontinua * sizeof(FullPhotoionTransition))); - printoutf("[info] mem_usage: photoionisation list occupies %.3f MB\n", - globals::nbfcontinua * (sizeof(FullPhotoionTransition)) / 1024. / 1024.); + printout("[info] mem_usage: photoionisation list occupies %.3f MB\n", + globals::nbfcontinua * (sizeof(FullPhotoionTransition)) / 1024. / 1024.); int allcontindex = 0; for (int element = 0; element < get_nelements(); element++) { const int nions = get_nions(element); @@ -833,7 +833,7 @@ void setup_phixs_list() { assert_always(nonconstallcont[i].photoion_xs != nullptr); } } - printoutf("[info] bound-free estimators track bfestimcount %d photoionisation transitions\n", globals::bfestimcount); + printout("[info] bound-free estimators track bfestimcount %d photoionisation transitions\n", globals::bfestimcount); globals::allcont = nonconstallcont; nonconstallcont = nullptr; } @@ -855,7 +855,7 @@ void read_phixs_data() { #endif assert_always(phixs_file_version_exists[1] || phixs_file_version_exists[2]); // at least one must exist if (phixs_file_version_exists[1] && phixs_file_version_exists[2]) { - printoutf( + printout( "Reading two phixs files: Reading phixsdata_v2.txt first so we use NPHIXSPOINTS and NPHIXSNUINCREMENT " "from phixsdata_v2.txt to interpolate the phixsdata.txt data\n"); } @@ -891,11 +891,11 @@ void read_phixs_data() { const int phixstargetlevels = get_phixsupperlevel(element, ion - 1, 0, nphixstargets - 1) + 1; if (nlevels_groundterm != phixstargetlevels) { - printoutf("WARNING: Z=%d ionstage %d nlevels_groundterm %d phixstargetlevels(ion-1) %d.\n", - get_atomicnumber(element), get_ionstage(element, ion), nlevels_groundterm, phixstargetlevels); + printout("WARNING: Z=%d ionstage %d nlevels_groundterm %d phixstargetlevels(ion-1) %d.\n", + get_atomicnumber(element), get_ionstage(element, ion), nlevels_groundterm, phixstargetlevels); // if (nlevels_groundterm < phixstargetlevels) // { - // printoutf(" -> setting to %d\n", phixstargetlevels); + // printout(" -> setting to %d\n", phixstargetlevels); // globals::elements[element].ions[ion].nlevels_groundterm = phixstargetlevels; // } } @@ -904,7 +904,7 @@ void read_phixs_data() { } } - printoutf("cont_index %d\n", cont_index); + printout("cont_index %d\n", cont_index); if (!tmpallphixs.empty()) { assert_always((nbftables * globals::NPHIXSPOINTS) == std::ssize(tmpallphixs)); @@ -952,8 +952,8 @@ void read_atomicdata_files() { auto adata = fstream_required("adata.txt", std::ios::in); - printoutf("single_level_top_ion: %s\n", single_level_top_ion ? "true" : "false"); - printoutf("single_ground_level: %s\n", single_ground_level ? "true" : "false"); + printout("single_level_top_ion: %s\n", single_level_top_ion ? "true" : "false"); + printout("single_ground_level: %s\n", single_ground_level ? "true" : "false"); // initialize atomic data structure to number of elements int nelements_in = 0; assert_always(compositiondata >> nelements_in); @@ -992,8 +992,8 @@ void read_atomicdata_files() { double mass_amu{NAN}; assert_always(compositiondata >> Z >> nions >> lowermost_ionstage >> uppermost_ionstage >> nlevelsmax_readin >> uniformabundance >> mass_amu); - printoutf("readin compositiondata: next element Z %d, nions %d, lowermost %d, uppermost %d, nlevelsmax %d\n", Z, - nions, lowermost_ionstage, uppermost_ionstage, nlevelsmax_readin); + printout("readin compositiondata: next element Z %d, nions %d, lowermost %d, uppermost %d, nlevelsmax %d\n", Z, + nions, lowermost_ionstage, uppermost_ionstage, nlevelsmax_readin); assert_always(Z > 0); assert_always(nions >= 0); assert_always(nions == 0 || (nions == uppermost_ionstage - lowermost_ionstage + 1)); @@ -1017,7 +1017,7 @@ void read_atomicdata_files() { double ionpot = 0.; for (int ion = 0; ion < nions; ion++) { int nlevelsmax = nlevelsmax_readin; - // printoutf("element %d ion %d\n", element, ion); + // printout("element %d ion %d\n", element, ion); // calculate the current levels ground level energy assert_always(ionpot >= 0); energyoffset += ionpot; @@ -1030,7 +1030,7 @@ void read_atomicdata_files() { while (adata_Z_in != Z || ionstage != lowermost_ionstage + ion) // skip over this ion block { if (adata_Z_in == Z) { - printoutf("increasing energyoffset by ionpot %g\n", ionpot); + printout("increasing energyoffset by ionpot %g\n", ionpot); energyoffset += ionpot; } for (int i = 0; i < nlevels; i++) { @@ -1049,7 +1049,7 @@ void read_atomicdata_files() { assert_always(std::istringstream(line) >> adata_Z_in >> ionstage >> nlevels >> ionpot); } - printoutf("adata header matched: Z %d, ionstage %d, nlevels %d\n", adata_Z_in, ionstage, nlevels); + printout("adata header matched: Z %d, ionstage %d, nlevels %d\n", adata_Z_in, ionstage, nlevels); if (single_level_top_ion && ion == nions - 1) // limit the top ion to one level and no transitions { @@ -1064,10 +1064,10 @@ void read_atomicdata_files() { if (nlevelsmax < 0) { nlevelsmax = nlevels; } else if (nlevels >= nlevelsmax) { - printoutf("[info] read_atomicdata: reduce number of levels from %d to %d for Z %2d ionstage %d\n", nlevels, - nlevelsmax, adata_Z_in, ionstage); + printout("[info] read_atomicdata: reduce number of levels from %d to %d for Z %2d ionstage %d\n", nlevels, + nlevelsmax, adata_Z_in, ionstage); } else { - printoutf( + printout( "[warning] read_atomicdata: requested nlevelsmax=%d > nlevels=%d for ion %d of element %d ... reduced " "nlevelsmax to nlevels\n", nlevelsmax, nlevels, ion, element); @@ -1088,8 +1088,8 @@ void read_atomicdata_files() { assert_always(std::istringstream(line) >> transdata_Z_in >> transdata_ionstage_in >> tottransitions_in_file); } - printoutf("transdata header matched: transdata_Z_in %d, transdata_ionstage_in %d, tottransitions %d\n", - transdata_Z_in, transdata_ionstage_in, tottransitions_in_file); + printout("transdata header matched: transdata_Z_in %d, transdata_ionstage_in %d, tottransitions %d\n", + transdata_Z_in, transdata_ionstage_in, tottransitions_in_file); assert_always(tottransitions_in_file >= 0); // read the data for the levels and set up the list of possible transitions for each level @@ -1149,11 +1149,11 @@ void read_atomicdata_files() { uniqueionindex++; } } - printoutf("nbfcheck %d\n", nbfcheck); + printout("nbfcheck %d\n", nbfcheck); // Save the linecounters value to the global variable containing the number of lines globals::nlines = lineindex; - printoutf("nlines %d\n", globals::nlines); + printout("nlines %d\n", globals::nlines); if (globals::rank_in_node == 0) { assert_always(globals::nlines == static_cast(temp_linelist.size())); temp_linelist.shrink_to_fit(); @@ -1164,11 +1164,11 @@ void read_atomicdata_files() { } // Set up the list of allowed upward transitions for each level - printoutf("total uptrans %d\n", totaluptrans); - printoutf("total downtrans %d\n", totaldowntrans); + printout("total uptrans %d\n", totaluptrans); + printout("total downtrans %d\n", totaldowntrans); - printoutf("[info] mem_usage: transition lists occupy %.3f MB (shared on node)\n", - (totaluptrans + totaldowntrans) * sizeof(LevelTransition) / 1024. / 1024.); + printout("[info] mem_usage: transition lists occupy %.3f MB (shared on node)\n", + (totaluptrans + totaldowntrans) * sizeof(LevelTransition) / 1024. / 1024.); if (globals::rank_in_node == 0) { // sort the lineline in descending frequency @@ -1184,13 +1184,13 @@ void read_atomicdata_files() { if ((a1.elementindex == a2.elementindex) && (a1.ionindex == a2.ionindex) && (a1.lowerlevelindex == a2.lowerlevelindex) && (a1.upperlevelindex == a2.upperlevelindex)) { - printoutf("Duplicate transition line? %s\n", a1.nu == a2.nu ? "nu match exact" : "close to nu match"); - printoutf("a: Z=%d ionstage %d lower %d upper %d nu %g lambda %g\n", get_atomicnumber(a1.elementindex), - get_ionstage(a1.elementindex, a1.ionindex), a1.lowerlevelindex, a1.upperlevelindex, a1.nu, - 1e8 * CLIGHT / a1.nu); - printoutf("b: Z=%d ionstage %d lower %d upper %d nu %g lambda %g\n", get_atomicnumber(a2.elementindex), - get_ionstage(a2.elementindex, a2.ionindex), a2.lowerlevelindex, a2.upperlevelindex, a2.nu, - 1e8 * CLIGHT / a2.nu); + printout("Duplicate transition line? %s\n", a1.nu == a2.nu ? "nu match exact" : "close to nu match"); + printout("a: Z=%d ionstage %d lower %d upper %d nu %g lambda %g\n", get_atomicnumber(a1.elementindex), + get_ionstage(a1.elementindex, a1.ionindex), a1.lowerlevelindex, a1.upperlevelindex, a1.nu, + 1e8 * CLIGHT / a1.nu); + printout("b: Z=%d ionstage %d lower %d upper %d nu %g lambda %g\n", get_atomicnumber(a2.elementindex), + get_ionstage(a2.elementindex, a2.ionindex), a2.lowerlevelindex, a2.upperlevelindex, a2.nu, + 1e8 * CLIGHT / a2.nu); } } } @@ -1252,8 +1252,8 @@ void read_atomicdata_files() { #endif globals::linelist = nonconstlinelist; nonconstlinelist = nullptr; - printoutf("[info] mem_usage: linelist occupies %.3f MB (node shared memory)\n", - globals::nlines * sizeof(TransitionLine) / 1024. / 1024); + printout("[info] mem_usage: linelist occupies %.3f MB (node shared memory)\n", + globals::nlines * sizeof(TransitionLine) / 1024. / 1024); // Save sorted linelist into a file // if (rank_global == 0) @@ -1271,7 +1271,7 @@ void read_atomicdata_files() { // fclose(linelist_file); // } - printoutf("establishing connection between transitions and sorted linelist...\n"); + printout("establishing connection between transitions and sorted linelist...\n"); auto const time_start_establish_linelist_connections = std::time(nullptr); #ifdef _OPENMP @@ -1309,7 +1309,7 @@ void read_atomicdata_files() { uptransition->lineindex = lineindex; } - printoutf(" took %lds\n", std::time(nullptr) - time_start_establish_linelist_connections); + printout(" took %lds\n", std::time(nullptr) - time_start_establish_linelist_connections); #ifdef MPI_ON MPI_Barrier(MPI_COMM_WORLD); #endif @@ -1343,7 +1343,7 @@ void setup_cellcache() { size_t mem_usage_cellcache = 0; mem_usage_cellcache += sizeof(CellCache); - printoutf("[info] input: initializing cellcache for thread %d ...\n", cellcachenum); + printout("[info] input: initializing cellcache for thread %d ...\n", cellcachenum); globals::cellcache[cellcachenum].cellnumber = -99; @@ -1351,8 +1351,8 @@ void setup_cellcache() { mem_usage_cellcache += ncoolingterms * sizeof(double); globals::cellcache[cellcachenum].cooling_contrib = static_cast(calloc(ncoolingterms, sizeof(double))); - printoutf("[info] mem_usage: cellcache coolinglist contribs for thread %d occupies %.3f MB\n", cellcachenum, - ncoolingterms * sizeof(double) / 1024. / 1024.); + printout("[info] mem_usage: cellcache coolinglist contribs for thread %d occupies %.3f MB\n", cellcachenum, + ncoolingterms * sizeof(double) / 1024. / 1024.); mem_usage_cellcache += get_nelements() * sizeof(CellCacheElements); globals::cellcache[cellcachenum].chelements = @@ -1446,8 +1446,8 @@ void setup_cellcache() { globals::cellcache[cellcachenum].ch_keep_this_cont.resize(globals::nbfcontinua); mem_usage_cellcache += 2 * globals::nbfcontinua * sizeof(double); - printoutf("[info] mem_usage: cellcache for thread %d occupies %.3f MB\n", cellcachenum, - mem_usage_cellcache / 1024. / 1024.); + printout("[info] mem_usage: cellcache for thread %d occupies %.3f MB\n", cellcachenum, + mem_usage_cellcache / 1024. / 1024.); } } @@ -1535,14 +1535,14 @@ void setup_nlte_levels() { assert_always(has_superlevel == ion_has_superlevel(element, ion)); - printoutf("[input] element %2d Z=%2d ionstage %2d has %5d NLTE excited levels%s. Starting at %d\n", element, - get_atomicnumber(element), get_ionstage(element, ion), fullnlteexcitedlevelcount, - has_superlevel ? " plus a superlevel" : "", globals::elements[element].ions[ion].first_nlte); + printout("[input] element %2d Z=%2d ionstage %2d has %5d NLTE excited levels%s. Starting at %d\n", element, + get_atomicnumber(element), get_ionstage(element, ion), fullnlteexcitedlevelcount, + has_superlevel ? " plus a superlevel" : "", globals::elements[element].ions[ion].first_nlte); } } } - printoutf("[input] Total NLTE levels: %d, of which %d are superlevels\n", globals::total_nlte_levels, n_super_levels); + printout("[input] Total NLTE levels: %d, of which %d are superlevels\n", globals::total_nlte_levels, n_super_levels); } void read_atomicdata() { @@ -1563,11 +1563,11 @@ void read_atomicdata() { int includedionisinglevels = 0; int includedboundboundtransitions = 0; int includedphotoiontransitions = 0; - printoutf("[input] this simulation contains\n"); - printoutf("----------------------------------\n"); + printout("[input] this simulation contains\n"); + printout("----------------------------------\n"); for (int element = 0; element < get_nelements(); element++) { - printoutf("[input] element %d (Z=%2d %s)\n", element, get_atomicnumber(element), - decay::get_elname(get_atomicnumber(element)).c_str()); + printout("[input] element %d (Z=%2d %s)\n", element, get_atomicnumber(element), + decay::get_elname(get_atomicnumber(element)).c_str()); const int nions = get_nions(element); for (int ion = 0; ion < nions; ion++) { int ion_photoiontransitions = 0; @@ -1577,7 +1577,7 @@ void read_atomicdata() { ion_bbtransitions += get_nuptrans(element, ion, level); } - printoutf( + printout( "[input] ionstage %d: %4d levels (%d in groundterm, %4d ionising) %7d lines %6d bf transitions " "(epsilon_ground: %7.2f eV)\n", get_ionstage(element, ion), get_nlevels(element, ion), get_nlevels_groundterm(element, ion), @@ -1591,8 +1591,8 @@ void read_atomicdata() { assert_always(includedphotoiontransitions == globals::nbfcontinua); assert_always(globals::nlines == includedboundboundtransitions); - printoutf("[input] in total %d ions, %d levels (%d ionising), %d lines, %d photoionisation transitions\n", - get_includedions(), get_includedlevels(), includedionisinglevels, globals::nlines, globals::nbfcontinua); + printout("[input] in total %d ions, %d levels (%d ionising), %d lines, %d photoionisation transitions\n", + get_includedions(), get_includedlevels(), includedionisinglevels, globals::nlines, globals::nbfcontinua); write_bflist_file(); @@ -1606,18 +1606,18 @@ void input(int rank) { globals::n_titer = 1; globals::lte_iteration = false; - printoutf("[info] input: do n_titer %d iterations per timestep\n", globals::n_titer); + printout("[info] input: do n_titer %d iterations per timestep\n", globals::n_titer); if (globals::n_titer > 1) { #ifndef DO_TITER - printoutf("[fatal] input: n_titer > 1, but DO_TITER not defined ... abort\n"); + printout("[fatal] input: n_titer > 1, but DO_TITER not defined ... abort\n"); std::abort(); #endif } else if (globals::n_titer == 1) { #ifdef DO_TITER - printoutf("[warning] input: n_titer = 1 but DO_TITER defined, remove DO_TITER to save memory\n"); + printout("[warning] input: n_titer = 1 but DO_TITER defined, remove DO_TITER to save memory\n"); #endif } else { - printoutf("[fatal] input: no valid value for n_titer selected\n"); + printout("[fatal] input: no valid value for n_titer selected\n"); std::abort(); } @@ -1633,10 +1633,10 @@ void input(int rank) { #ifdef MPI_ON const auto time_before_barrier = std::time(nullptr); - printoutf("barrier after read_atomicdata(): time before barrier %d, ", static_cast(time_before_barrier)); + printout("barrier after read_atomicdata(): time before barrier %d, ", static_cast(time_before_barrier)); MPI_Barrier(MPI_COMM_WORLD); - printoutf("time after barrier %d (waited %d seconds)\n", static_cast(time(nullptr)), - static_cast(time(nullptr) - time_before_barrier)); + printout("time after barrier %d (waited %d seconds)\n", static_cast(time(nullptr)), + static_cast(time(nullptr) - time_before_barrier)); #endif grid::read_ejecta_model(); @@ -1646,7 +1646,7 @@ void input(int rank) { auto get_noncommentline(std::fstream &input, std::string &line) -> bool { while (true) { const bool linefound = !(!std::getline(input, line)); - // printoutf("LINE: >%s< linefound: %s commentonly: %s \n", line.c_str(), linefound ? "true" : "false", + // printout("LINE: >%s< linefound: %s commentonly: %s \n", line.c_str(), linefound ? "true" : "false", // lineiscommentonly(line) ? "true" : "false"); if (!linefound) { return false; @@ -1669,7 +1669,7 @@ void read_parameterfile(int rank) { std::istringstream(line) >> pre_zseed; if (pre_zseed > 0) { - printoutf("using input.txt specified random number seed of %" PRId64 "\n", pre_zseed); + printout("using input.txt specified random number seed of %" PRId64 "\n", pre_zseed); } else { #ifndef GPU_ON pre_zseed = std::random_device{}(); @@ -1678,9 +1678,9 @@ void read_parameterfile(int rank) { // broadcast randomly-generated seed from rank 0 to all ranks MPI_Bcast(&pre_zseed, 1, MPI_INT64_T, 0, MPI_COMM_WORLD); #endif - printoutf("randomly-generated random number seed is %" PRId64 "\n", pre_zseed); + printout("randomly-generated random number seed is %" PRId64 "\n", pre_zseed); #if defined REPRODUCIBLE && REPRODUCIBLE - printoutf("ERROR: reproducible mode is on, so random number seed is required.\n"); + printout("ERROR: reproducible mode is on, so random number seed is required.\n"); std::abort(); #endif } @@ -1697,8 +1697,8 @@ void read_parameterfile(int rank) { #ifndef GPU_ON stdrng.seed(rngseed); #endif - printoutf("rank %d: thread %d has rngseed %" PRId64 "\n", rank, tid, rngseed); - printoutf("rng is a std::mt19937 generator\n"); + printout("rank %d: thread %d has rngseed %" PRId64 "\n", rank, tid, rngseed); + printout("rng is a std::mt19937 generator\n"); // call it a few times for (int n = 0; n < 100; n++) { @@ -1713,7 +1713,7 @@ void read_parameterfile(int rank) { assert_always(get_noncommentline(file, line)); std::istringstream(line) >> globals::timestep_initial >> globals::timestep_finish; // number of start and end time step - printoutf("input: timestep_start %d timestep_finish %d\n", globals::timestep_initial, globals::timestep_finish); + printout("input: timestep_start %d timestep_finish %d\n", globals::timestep_initial, globals::timestep_finish); assert_always(globals::timestep_initial < globals::ntimesteps); assert_always(globals::timestep_initial <= globals::timestep_finish); assert_always(globals::timestep_finish <= globals::ntimesteps); @@ -1773,7 +1773,7 @@ void read_parameterfile(int rank) { assert_always(get_noncommentline(file, line)); std::istringstream(line) >> globals::rho_crit_para; // free parameter for calculation of rho_crit - printoutf("input: rho_crit_para %g\n", globals::rho_crit_para); + printout("input: rho_crit_para %g\n", globals::rho_crit_para); // he calculation of rho_crit itself depends on the time, therefore it happens in grid_init and update_grid assert_always(get_noncommentline(file, line)); @@ -1788,9 +1788,9 @@ void read_parameterfile(int rank) { std::istringstream(line) >> continue_flag; globals::simulation_continued_from_saved = (continue_flag == 1); if (globals::simulation_continued_from_saved) { - printoutf("input: resuming simulation from saved point\n"); + printout("input: resuming simulation from saved point\n"); } else { - printoutf("input: starting a new simulation\n"); + printout("input: starting a new simulation\n"); assert_always(globals::timestep_initial == 0); } @@ -1800,37 +1800,37 @@ void read_parameterfile(int rank) { assert_always(get_noncommentline(file, line)); std::istringstream(line) >> dum2; // free parameter for calculation of rho_crit globals::nu_rfcut = CLIGHT / (dum2 * 1e-8); - printoutf("input: nu_rfcut %g\n", globals::nu_rfcut); + printout("input: nu_rfcut %g\n", globals::nu_rfcut); // Sets the number of initial LTE timesteps for NLTE runs assert_always(get_noncommentline(file, line)); std::istringstream(line) >> globals::num_lte_timesteps; - printoutf("input: doing the first %d timesteps in LTE\n", globals::num_lte_timesteps); + printout("input: doing the first %d timesteps in LTE\n", globals::num_lte_timesteps); if (NT_ON) { if (NT_SOLVE_SPENCERFANO) { - printoutf("input: Non-thermal ionisation with a Spencer-Fano solution is switched on for this run.\n"); + printout("input: Non-thermal ionisation with a Spencer-Fano solution is switched on for this run.\n"); } else { - printoutf("input: Non-thermal ionisation with the work function approximation is switched on for this run.\n"); + printout("input: Non-thermal ionisation with the work function approximation is switched on for this run.\n"); } } else { - printoutf("input: No non-thermal ionisation is used in this run.\n"); + printout("input: No non-thermal ionisation is used in this run.\n"); } if (USE_LUT_PHOTOION) { - printoutf( + printout( "Corrphotoioncoeff is calculated from LTE lookup tables (ratecoeff.dat) and corrphotoionrenorm " "estimator.\n"); } else { - printoutf( + printout( "Corrphotoioncoeff is calculated from the radiation field at each timestep in each modelgrid cell (no " "LUT).\n"); } if (USE_LUT_BFHEATING) { - printoutf("bfheating coefficients are calculated from LTE lookup tables (ratecoeff.dat) and bfheatingestimator.\n"); + printout("bfheating coefficients are calculated from LTE lookup tables (ratecoeff.dat) and bfheatingestimator.\n"); } else { - printoutf( + printout( "bfheating coefficients are calculated from the radiation field at each timestep in each modelgrid cell (no " "LUT).\n"); } @@ -1838,7 +1838,7 @@ void read_parameterfile(int rank) { // Set up initial grey approximation? assert_always(get_noncommentline(file, line)); std::istringstream(line) >> globals::cell_is_optically_thick >> globals::num_grey_timesteps; - printoutf( + printout( "input: cells with Thomson optical depth > %g are treated in grey approximation for the first %d timesteps\n", globals::cell_is_optically_thick, globals::num_grey_timesteps); @@ -1883,9 +1883,9 @@ void update_parameterfile(int nts) { assert_always(globals::rank_global == 0); if (nts >= 0) { - printoutf("Update input.txt for restart at timestep %d...", nts); + printout("Update input.txt for restart at timestep %d...", nts); } else { - printoutf("Copying input.txt to input-newrun.txt..."); + printout("Copying input.txt to input-newrun.txt..."); } std::ifstream file("input.txt"); @@ -1953,7 +1953,7 @@ void update_parameterfile(int nts) std::rename("input.txt.tmp", "input.txt"); } - printoutf("done\n"); + printout("done\n"); } // initialize the time steps @@ -2069,7 +2069,7 @@ void time_init() { // } // else if (n < globals::ntimesteps - 1 && globals::timesteps[n + 1].width > maxt) // { - // printoutf("TIME: Keeping logarithmic durations for timesteps <= %d\n", n); + // printout("TIME: Keeping logarithmic durations for timesteps <= %d\n", n); // } // } // assert_always(globals::timesteps[0].width <= maxt); // no solution is possible with these constraints! diff --git a/kpkt.cc b/kpkt.cc index e385f936c..2b84e9b66 100644 --- a/kpkt.cc +++ b/kpkt.cc @@ -62,7 +62,7 @@ auto calculate_cooling_rates_ion(const int modelgridindex, const int element, co // ff creation of rpkt const int ioncharge = get_ionstage(element, ion) - 1; - // printoutf("[debug] ioncharge %d, nncurrention %g, nne %g\n",ion,nncurrention,nne); + // printout("[debug] ioncharge %d, nncurrention %g, nne %g\n",ion,nncurrention,nne); if (ioncharge > 0) { const double C_ff_ion = 1.426e-27 * sqrt(T_e) * pow(ioncharge, 2) * nncurrention * nne; C_ion += C_ff_ion; @@ -81,7 +81,7 @@ auto calculate_cooling_rates_ion(const int modelgridindex, const int element, co // excitation to same ionization stage const int nlevels = get_nlevels(element, ion); for (int level = 0; level < nlevels; level++) { - // printoutf("[debug] do_kpkt: element %d, ion %d, level %d\n", element, ion, level); + // printout("[debug] do_kpkt: element %d, ion %d, level %d\n", element, ion, level); const double nnlevel = get_levelpop(modelgridindex, element, ion, level); const double epsilon_current = epsilon(element, ion, level); const double statweight = stat_weight(element, ion, level); @@ -212,7 +212,7 @@ void set_ncoolingterms() { auto sample_planck_analytic(const double T) -> double { const double nu_peak = 5.879e10 * T; if (nu_peak > NU_MAX_R || nu_peak < NU_MIN_R) { - printoutf("[warning] sample_planck: intensity peaks outside frequency range\n"); + printout("[warning] sample_planck: intensity peaks outside frequency range\n"); } constexpr ptrdiff_t nubins = 500; @@ -249,7 +249,7 @@ auto sample_planck_montecarlo(const double T) -> double { if (rng_uniform() * B_peak <= radfield::dbb(nu, T, 1)) { return nu; } - // printoutf("[debug] sample_planck: planck_sampling %d\n", i); + // printout("[debug] sample_planck: planck_sampling %d\n", i); } } } // anonymous namespace @@ -286,8 +286,8 @@ void calculate_cooling_rates(const int modelgridindex, HeatingCoolingRates *heat void set_kpktdiffusion(const float kpktdiffusion_timescale_in, const int n_kpktdiffusion_timesteps_in) { kpktdiffusion_timescale = kpktdiffusion_timescale_in; n_kpktdiffusion_timesteps = n_kpktdiffusion_timesteps_in; - printoutf("input: kpkts diffuse %g of a time step's length for the first %d time steps\n", kpktdiffusion_timescale, - n_kpktdiffusion_timesteps); + printout("input: kpkts diffuse %g of a time step's length for the first %d time steps\n", kpktdiffusion_timescale, + n_kpktdiffusion_timesteps); } void setup_coolinglist() { @@ -301,7 +301,7 @@ void setup_coolinglist() { const size_t mem_usage_coolinglist = ncoolingterms * sizeof(CellCacheCoolingList); assert_always(ncoolingterms > 0); coolinglist.resize(ncoolingterms); - printoutf("[info] mem_usage: coolinglist occupies %.3f MB\n", mem_usage_coolinglist / 1024. / 1024.); + printout("[info] mem_usage: coolinglist occupies %.3f MB\n", mem_usage_coolinglist / 1024. / 1024.); int i = 0; // cooling list index for (int element = 0; element < get_nelements(); element++) { @@ -314,7 +314,7 @@ void setup_coolinglist() { // ff creation of rpkt // ------------------- const int ioncharge = get_ionstage(element, ion) - 1; - // printoutf("[debug] ioncharge %d, nncurrention %g, nne %g\n",ion,nncurrention,nne); + // printout("[debug] ioncharge %d, nncurrention %g, nne %g\n",ion,nncurrention,nne); if (ioncharge > 0) { coolinglist[i].type = CoolingType::FREEFREE; coolinglist[i].level = -99; @@ -364,7 +364,7 @@ void setup_coolinglist() { } assert_always(ncoolingterms == i); // if this doesn't match, we miscalculated the number of cooling terms - printoutf("[info] read_atomicdata: number of coolingterms %d\n", ncoolingterms); + printout("[info] read_atomicdata: number of coolingterms %d\n", ncoolingterms); } __host__ __device__ void do_kpkt_blackbody(Packet &pkt) @@ -384,7 +384,7 @@ __host__ __device__ void do_kpkt_blackbody(Packet &pkt) assert_always(std::isfinite(pkt.nu_cmf)); // and then emit the packet randomly in the comoving frame emit_rpkt(pkt); - // printoutf("[debug] calculate_chi_rpkt after kpkt to rpkt by ff\n"); + // printout("[debug] calculate_chi_rpkt after kpkt to rpkt by ff\n"); pkt.next_trans = -1; // FLAG: transition history here not important, cont. process // if (tid == 0) k_stat_to_r_bb++; stats::increment(stats::COUNTER_K_STAT_TO_R_BB); @@ -404,7 +404,7 @@ __host__ __device__ void do_kpkt(Packet &pkt, const double t2, const int nts) { // don't calculate cooling rates after each cell crossings any longer // but only if we really get a kpkt and they hadn't been calculated already - // printoutf("[debug] do_kpkt: propagate k-pkt\n"); + // printout("[debug] do_kpkt: propagate k-pkt\n"); const double deltat = (nts < n_kpktdiffusion_timesteps) ? kpktdiffusion_timescale * globals::timesteps[nts].width : 0.; @@ -433,7 +433,7 @@ __host__ __device__ void do_kpkt(Packet &pkt, const double t2, const int nts) { for (ion = 0; ion < nions; ion++) { const int uniqueionindex = get_uniqueionindex(element, ion); coolingsum += grid::modelgrid[modelgridindex].ion_cooling_contribs[uniqueionindex]; - // printoutf("Z=%d, ionstage %d, coolingsum %g\n", get_atomicnumber(element), get_ionstage(element, ion), + // printout("Z=%d, ionstage %d, coolingsum %g\n", get_atomicnumber(element), get_ionstage(element, ion), // coolingsum); if (coolingsum > rndcool_ion) { break; @@ -445,18 +445,18 @@ __host__ __device__ void do_kpkt(Packet &pkt, const double t2, const int nts) { } if (element >= get_nelements() || element < 0 || ion >= get_nions(element) || ion < 0) { - printoutf("do_kpkt: problem selecting a cooling process ... abort\n"); - printoutf("do_kpkt: modelgridindex %d element %d ion %d\n", modelgridindex, element, ion); - printoutf("do_kpkt: totalcooling %g, coolingsum %g, rndcool_ion %g\n", grid::modelgrid[modelgridindex].totalcooling, - coolingsum, rndcool_ion); - printoutf("do_kpkt: modelgridindex %d, cellno %d, nne %g\n", modelgridindex, pkt.where, - grid::get_nne(modelgridindex)); + printout("do_kpkt: problem selecting a cooling process ... abort\n"); + printout("do_kpkt: modelgridindex %d element %d ion %d\n", modelgridindex, element, ion); + printout("do_kpkt: totalcooling %g, coolingsum %g, rndcool_ion %g\n", grid::modelgrid[modelgridindex].totalcooling, + coolingsum, rndcool_ion); + printout("do_kpkt: modelgridindex %d, cellno %d, nne %g\n", modelgridindex, pkt.where, + grid::get_nne(modelgridindex)); for (element = 0; element < get_nelements(); element++) { const int nions = get_nions(element); for (ion = 0; ion < nions; ion++) { const int uniqueionindex = get_uniqueionindex(element, ion); - printoutf("do_kpkt: element %d, ion %d, coolingcontr %g\n", element, ion, - grid::modelgrid[modelgridindex].ion_cooling_contribs[uniqueionindex]); + printout("do_kpkt: element %d, ion %d, coolingcontr %g\n", element, ion, + grid::modelgrid[modelgridindex].ion_cooling_contribs[uniqueionindex]); } } std::abort(); @@ -468,7 +468,7 @@ __host__ __device__ void do_kpkt(Packet &pkt, const double t2, const int nts) { double C_ion_procsum = globals::cellcache[cellcacheslotid].cooling_contrib[ihigh]; if (C_ion_procsum < 0.) { - // printoutf("calculate kpkt rates on demand modelgridindex %d element %d ion %d ilow %d ihigh %d + // printout("calculate kpkt rates on demand modelgridindex %d element %d ion %d ilow %d ihigh %d // oldcoolingsum %g\n", // modelgridindex, element, ion, ilow, high, oldcoolingsum); C_ion_procsum = calculate_cooling_rates_ion(modelgridindex, element, ion, ilow, cellcacheslotid, nullptr, @@ -489,15 +489,15 @@ __host__ __device__ void do_kpkt(Packet &pkt, const double t2, const int nts) { globals::cellcache[cellcacheslotid].cooling_contrib; if (i > ihigh) { - printoutf("do_kpkt: error occurred while selecting a cooling channel: low %d, high %d, i %td, rndcool %g\n", ilow, - ihigh, i, rndcool_ion_process); - printoutf("element %d, ion %d, offset %d, terms %d, coolingsum %g\n", element, ion, ilow, ncoolingterms_ion, - coolingsum); + printout("do_kpkt: error occurred while selecting a cooling channel: low %d, high %d, i %td, rndcool %g\n", ilow, + ihigh, i, rndcool_ion_process); + printout("element %d, ion %d, offset %d, terms %d, coolingsum %g\n", element, ion, ilow, ncoolingterms_ion, + coolingsum); } assert_always(i <= ihigh); - // printoutf("do_kpkt: selected process %d, coolingsum %g\n", i, coolingsum); + // printout("do_kpkt: selected process %d, coolingsum %g\n", i, coolingsum); const auto rndcoolingtype = coolinglist[i].type; const auto T_e = grid::get_Te(modelgridindex); @@ -505,7 +505,7 @@ __host__ __device__ void do_kpkt(Packet &pkt, const double t2, const int nts) { // The k-packet converts directly into a r-packet by free-free-emission. // Need to select the r-packets frequency and a random direction in the // co-moving frame. - // printoutf("[debug] do_kpkt: k-pkt -> free-free\n"); + // printout("[debug] do_kpkt: k-pkt -> free-free\n"); // Sample the packets comoving frame frequency according to paperII 5.4.3 eq.41 @@ -570,7 +570,7 @@ __host__ __device__ void do_kpkt(Packet &pkt, const double t2, const int nts) { } } else if (rndcoolingtype == CoolingType::COLLEXC) { // the k-packet activates a macro-atom due to collisional excitation - // printoutf("[debug] do_kpkt: k-pkt -> collisional excitation of MA\n"); + // printout("[debug] do_kpkt: k-pkt -> collisional excitation of MA\n"); const float nne = grid::get_nne(modelgridindex); // if the previous entry belongs to the same ion, then pick up the cumulative sum from @@ -588,7 +588,7 @@ __host__ __device__ void do_kpkt(Packet &pkt, const double t2, const int nts) { const auto *const uptranslist = get_uptranslist(element, ion, level); for (int ii = 0; ii < nuptrans; ii++) { const int tmpupper = uptranslist[ii].targetlevelindex; - // printoutf(" excitation to level %d possible\n",upper); + // printout(" excitation to level %d possible\n",upper); const double epsilon_trans = epsilon(element, ion, tmpupper) - epsilon_current; const double C = nnlevel * col_excitation_ratecoeff(T_e, nne, element, ion, level, ii, epsilon_trans, statweight) * @@ -617,7 +617,7 @@ __host__ __device__ void do_kpkt(Packet &pkt, const double t2, const int nts) { do_macroatom(pkt, {.element = element, .ion = ion, .level = upper, .activatingline = -99}); } else if (rndcoolingtype == CoolingType::COLLION) { // the k-packet activates a macro-atom due to collisional ionisation - // printoutf("[debug] do_kpkt: k-pkt -> collisional ionisation of MA\n"); + // printout("[debug] do_kpkt: k-pkt -> collisional ionisation of MA\n"); const int upperion = ion + 1; const int upper = coolinglist[i].upperlevel; diff --git a/ltepop.cc b/ltepop.cc index e798993d2..47d999f6d 100644 --- a/ltepop.cc +++ b/ltepop.cc @@ -82,7 +82,7 @@ auto phi_ion_equilib(const int element, const int ion, const int modelgridindex, if (Gamma == 0. && (!NT_ON || (globals::dep_estimator_gamma[nonemptymgi] == 0. && grid::get_modelinitnucmassfrac(modelgridindex, decay::get_nucindex(24, 48)) == 0. && grid::get_modelinitnucmassfrac(modelgridindex, decay::get_nucindex(28, 56)) == 0.))) { - printoutf("Fatal: Gamma = 0 for element %d, ion %d in phi ... abort\n", element, ion); + printout("Fatal: Gamma = 0 for element %d, ion %d in phi ... abort\n", element, ion); std::abort(); } @@ -100,16 +100,16 @@ auto phi_ion_equilib(const int element, const int ion, const int modelgridindex, if (!std::isfinite(phi) || phi == 0.) { const auto partfunc_upperion = grid::modelgrid[modelgridindex].ion_partfuncts[uniqueionindex + 1]; - printoutf( + printout( "[fatal] phi: phi %g exceeds numerically possible range for element %d, ion %d, T_e %g ... remove higher or " "lower ionisation stages\n", phi, element, ion, T_e); - printoutf("[fatal] phi: Alpha_sp %g, Gamma %g, partfunct %g, stat_weight %g\n", Alpha_sp, Gamma, partfunc_ion, - stat_weight(element, ion, 0)); - printoutf("[fatal] phi: upperionpartfunct %g, upperionstatweight %g\n", partfunc_upperion, - stat_weight(element, ion + 1, 0)); - printoutf("[fatal] phi: gamma_nt %g Col_rec %g grid::get_nne(modelgridindex) %g\n", gamma_nt, Col_rec, - grid::get_nne(modelgridindex)); + printout("[fatal] phi: Alpha_sp %g, Gamma %g, partfunct %g, stat_weight %g\n", Alpha_sp, Gamma, partfunc_ion, + stat_weight(element, ion, 0)); + printout("[fatal] phi: upperionpartfunct %g, upperionstatweight %g\n", partfunc_upperion, + stat_weight(element, ion + 1, 0)); + printout("[fatal] phi: gamma_nt %g Col_rec %g grid::get_nne(modelgridindex) %g\n", gamma_nt, Col_rec, + grid::get_nne(modelgridindex)); std::abort(); } @@ -185,13 +185,13 @@ auto calculate_levelpop_nominpop(const int modelgridindex, const int element, co // Case for when no NLTE level information is available yet nn = calculate_levelpop_lte(modelgridindex, element, ion, level); } else { - // printoutf("Using an nlte population!\n"); + // printout("Using an nlte population!\n"); nn = nltepop_over_rho * grid::get_rho(modelgridindex); if (!std::isfinite(nn)) { - printoutf("[fatal] NLTE population failure.\n"); - printoutf("element %d ion %d level %d\n", element, ion, level); - printoutf("nn %g nltepop_over_rho %g rho %g\n", nn, nltepop_over_rho, grid::get_rho(modelgridindex)); - printoutf("ground level %g\n", get_groundlevelpop(modelgridindex, element, ion)); + printout("[fatal] NLTE population failure.\n"); + printout("element %d ion %d level %d\n", element, ion, level); + printout("nn %g nltepop_over_rho %g rho %g\n", nn, nltepop_over_rho, grid::get_rho(modelgridindex)); + printout("ground level %g\n", get_groundlevelpop(modelgridindex, element, ion)); std::abort(); } *skipminpop = true; @@ -209,15 +209,15 @@ auto calculate_levelpop_nominpop(const int modelgridindex, const int element, co // Case for when no NLTE level information is available yet nn = calculate_levelpop_lte(modelgridindex, element, ion, level); } else { - // printoutf("Using a superlevel population!\n"); + // printout("Using a superlevel population!\n"); nn = superlevelpop_over_rho * grid::get_rho(modelgridindex) * superlevel_boltzmann(modelgridindex, element, ion, level); if (!std::isfinite(nn)) { - printoutf("[fatal] NLTE population failure.\n"); - printoutf("element %d ion %d level %d\n", element, ion, level); - printoutf("nn %g superlevelpop_over_rho %g rho %g\n", nn, superlevelpop_over_rho, - grid::get_rho(modelgridindex)); - printoutf("ground level %g\n", get_groundlevelpop(modelgridindex, element, ion)); + printout("[fatal] NLTE population failure.\n"); + printout("element %d ion %d level %d\n", element, ion, level); + printout("nn %g superlevelpop_over_rho %g rho %g\n", nn, superlevelpop_over_rho, + grid::get_rho(modelgridindex)); + printout("ground level %g\n", get_groundlevelpop(modelgridindex, element, ion)); std::abort(); } *skipminpop = true; @@ -264,10 +264,10 @@ auto calculate_partfunct(const int element, const int ion, const int modelgridin U *= stat_weight(element, ion, 0); if (!std::isfinite(U)) { - printoutf("element %d ion %d\n", element, ion); - printoutf("modelgridindex %d\n", modelgridindex); - printoutf("nlevels %d\n", nlevels); - printoutf("sw %g\n", stat_weight(element, ion, 0)); + printout("element %d ion %d\n", element, ion); + printout("modelgridindex %d\n", modelgridindex); + printout("nlevels %d\n", nlevels); + printout("sw %g\n", stat_weight(element, ion, 0)); std::abort(); } @@ -313,7 +313,7 @@ auto find_uppermost_ion(const int modelgridindex, const int element, const doubl factor *= nne_hi * phifactor; if (!std::isfinite(factor)) { - printoutf( + printout( "[info] calculate_ion_balance_nne: uppermost_ion limited by phi factors for element " "Z=%d, ionstage %d in cell %d\n", get_atomicnumber(element), get_ionstage(element, ion), modelgridindex); @@ -336,7 +336,7 @@ void set_calculated_nne(const int modelgridindex) { // Special case of only neutral ions, set nne to some finite value so that packets are not lost in kpkts void set_groundlevelpops_neutral(const int modelgridindex) { - printoutf("[warning] calculate_ion_balance_nne: only neutral ions in cell modelgridindex %d\n", modelgridindex); + printout("[warning] calculate_ion_balance_nne: only neutral ions in cell modelgridindex %d\n", modelgridindex); for (int element = 0; element < get_nelements(); element++) { const auto nnelement = grid::get_elem_numberdens(modelgridindex, element); const int nions = get_nions(element); @@ -370,20 +370,20 @@ auto find_converged_nne(const int modelgridindex, double nne_hi, const bool forc const auto T_R = grid::get_TR(modelgridindex); const auto T_e = grid::get_Te(modelgridindex); const auto W = grid::get_W(modelgridindex); - printoutf("n, nne_lo, nne_hi, T_R, T_e, W, rho %d, %g, %g, %g, %g, %g, %g\n", modelgridindex, nne_lo, nne_hi, T_R, - T_e, W, grid::get_rho(modelgridindex)); - printoutf("nne@x_lo %g\n", nne_solution_f(nne_lo, f.params)); - printoutf("nne@x_hi %g\n", nne_solution_f(nne_hi, f.params)); + printout("n, nne_lo, nne_hi, T_R, T_e, W, rho %d, %g, %g, %g, %g, %g, %g\n", modelgridindex, nne_lo, nne_hi, T_R, + T_e, W, grid::get_rho(modelgridindex)); + printout("nne@x_lo %g\n", nne_solution_f(nne_lo, f.params)); + printout("nne@x_hi %g\n", nne_solution_f(nne_hi, f.params)); for (int element = 0; element < get_nelements(); element++) { - printoutf("cell %d, element %d, uppermost_ion is %d\n", modelgridindex, element, - grid::get_elements_uppermost_ion(modelgridindex, element)); + printout("cell %d, element %d, uppermost_ion is %d\n", modelgridindex, element, + grid::get_elements_uppermost_ion(modelgridindex, element)); if constexpr (USE_LUT_PHOTOION) { for (int ion = 0; ion <= grid::get_elements_uppermost_ion(modelgridindex, element); ion++) { - printoutf("element %d, ion %d, gammaionest %g\n", element, ion, - globals::gammaestimator[get_ionestimindex_nonemptymgi( - grid::get_modelcell_nonemptymgi(modelgridindex), element, ion)]); + printout("element %d, ion %d, gammaionest %g\n", element, ion, + globals::gammaestimator[get_ionestimindex_nonemptymgi( + grid::get_modelcell_nonemptymgi(modelgridindex), element, ion)]); } } } @@ -409,7 +409,7 @@ auto find_converged_nne(const int modelgridindex, double nne_hi, const bool forc } } if (status == GSL_CONTINUE) { - printoutf("[warning] calculate_ion_balance_nne: nne did not converge within %d iterations\n", iter + 1); + printout("[warning] calculate_ion_balance_nne: nne did not converge within %d iterations\n", iter + 1); } gsl_root_fsolver_free(solver); @@ -449,9 +449,9 @@ auto find_converged_nne(const int modelgridindex, double nne_hi, const bool forc ionfractions[ion] = ionfractions[ion] / normfactor; if (normfactor == 0. || !std::isfinite(ionfractions[ion])) { - printoutf("[warning] ionfract set to zero for ionstage %d of Z=%d in cell %d with T_e %g, T_R %g\n", - get_ionstage(element, ion), get_atomicnumber(element), modelgridindex, grid::get_Te(modelgridindex), - grid::get_TR(modelgridindex)); + printout("[warning] ionfract set to zero for ionstage %d of Z=%d in cell %d with T_e %g, T_R %g\n", + get_ionstage(element, ion), get_atomicnumber(element), modelgridindex, grid::get_Te(modelgridindex), + grid::get_TR(modelgridindex)); ionfractions[ion] = 0; } } @@ -544,10 +544,10 @@ __host__ __device__ auto calculate_sahafact(const int element, const int ion, co const double g_lower = stat_weight(element, ion, level); const double g_upper = stat_weight(element, ion + 1, upperionlevel); const double sf = SAHACONST * g_lower / g_upper * pow(T, -1.5) * exp(E_threshold / KB / T); - // printoutf("element %d, ion %d, level %d, T, %g, E %g has sf %g (g_l %g g_u %g)\n", element, ion, level, T, + // printout("element %d, ion %d, level %d, T, %g, E %g has sf %g (g_l %g g_u %g)\n", element, ion, level, T, // E_threshold, sf,stat_weight(element,ion,level),stat_weight(element,ion+1,0) ); if (sf < 0) { - printoutf( + printout( "[fatal] calculate_sahafact: Negative Saha factor. sfac %g element %d ion %d level %d upperionlevel %d " "g_lower %g g_upper %g T %g E_threshold %g exppart %g\n", sf, element, ion, level, upperionlevel, g_lower, g_upper, T, E_threshold, exp(E_threshold / KB / T)); @@ -600,7 +600,7 @@ void set_groundlevelpops(const int modelgridindex, const int element, const floa nnion * stat_weight(element, ion, 0) / grid::modelgrid[modelgridindex].ion_partfuncts[uniqueionindex]; if (!std::isfinite(groundpop)) { - printoutf("[warning] calculate_ion_balance_nne: groundlevelpop infinite in connection with MINPOP\n"); + printout("[warning] calculate_ion_balance_nne: groundlevelpop infinite in connection with MINPOP\n"); } grid::modelgrid[modelgridindex].ion_groundlevelpops[uniqueionindex] = groundpop; diff --git a/macroatom.cc b/macroatom.cc index 022e0ad54..e1642e998 100644 --- a/macroatom.cc +++ b/macroatom.cc @@ -36,7 +36,7 @@ FILE *macroatom_file{}; auto calculate_macroatom_transitionrates(const int modelgridindex, const int element, const int ion, const int level, const double t_mid, CellCacheLevels &chlevel) { - // printoutf("Calculating transition rates for element %d ion %d level %d\n", element, ion, level); + // printout("Calculating transition rates for element %d ion %d level %d\n", element, ion, level); auto processrates = std::array{}; const auto T_e = grid::get_Te(modelgridindex); @@ -72,7 +72,7 @@ auto calculate_macroatom_transitionrates(const int modelgridindex, const int ele arr_sum_epstrans_rad_deexc[i] = sum_raddeexc; arr_sum_internal_down_same[i] = sum_internal_down_same; - // printoutf("checking downtrans %d to level %d: R %g, C %g, epsilon_trans %g\n",i,lower,R,C,epsilon_trans); + // printout("checking downtrans %d to level %d: R %g, C %g, epsilon_trans %g\n",i,lower,R,C,epsilon_trans); } processrates[MA_ACTION_RADDEEXC] = sum_raddeexc; processrates[MA_ACTION_COLDEEXC] = sum_coldeexc; @@ -155,7 +155,7 @@ auto do_macroatom_internal_down_same(const int element, const int ion, const int -> int { const int ndowntrans = get_ndowntrans(element, ion, level); - // printoutf("[debug] do_ma: internal downward jump within current ionstage\n"); + // printout("[debug] do_ma: internal downward jump within current ionstage\n"); const double *sum_internal_down_same = chlevel.sum_internal_down_same; @@ -245,7 +245,7 @@ void do_macroatom_raddeexcitation(Packet &pkt, const int element, const int ion, } } if (targetval >= rate) { - printoutf( + printout( "%s: From Z=%d ionstage %d level %d, could not select lower level to recombine to. targetval %g * rad_recomb " "%g >= " "rate %g", @@ -315,7 +315,7 @@ __host__ __device__ void do_macroatom(Packet &pkt, const MacroAtomState &pktmast const double t_mid = globals::timesteps[globals::timestep].mid; - // printoutf("[debug] do MA\n"); + // printout("[debug] do MA\n"); const auto nne = grid::get_nne(modelgridindex); @@ -376,7 +376,7 @@ __host__ __device__ void do_macroatom(Packet &pkt, const MacroAtomState &pktmast // for debugging the transition rates: // { - // printoutf("macroatom element %d ion %d level %d\n", element, ion, level); + // printout("macroatom element %d ion %d level %d\n", element, ion, level); // const char *actionlabel[MA_ACTION_COUNT] = { // "MA_ACTION_RADDEEXC", "MA_ACTION_COLDEEXC", "MA_ACTION_RADRECOMB", @@ -384,7 +384,7 @@ __host__ __device__ void do_macroatom(Packet &pkt, const MacroAtomState &pktmast // "MA_ACTION_INTERNALUPSAME", "MA_ACTION_INTERNALUPHIGHER", "MA_ACTION_INTERNALUPHIGHERNT"}; // for (int action = 0; action < MA_ACTION_COUNT; action++) - // printoutf("actions: %30s %g\n", actionlabel[action], processrates[action]); + // printout("actions: %30s %g\n", actionlabel[action], processrates[action]); // } // select transition according to probabilities @@ -399,7 +399,7 @@ __host__ __device__ void do_macroatom(Packet &pkt, const MacroAtomState &pktmast switch (selected_action) { case MA_ACTION_RADDEEXC: { - // printoutf("[debug] do_ma: radiative deexcitation\n"); + // printout("[debug] do_ma: radiative deexcitation\n"); do_macroatom_raddeexcitation(pkt, element, ion, level, activatingline, chlevel); @@ -424,7 +424,7 @@ __host__ __device__ void do_macroatom(Packet &pkt, const MacroAtomState &pktmast case MA_ACTION_COLDEEXC: { // collisional deexcitation of macro atom => convert the packet into a k-packet - // printoutf("[debug] do_ma: collisional deexcitation\n"); + // printout("[debug] do_ma: collisional deexcitation\n"); stats::increment(stats::COUNTER_MA_STAT_DEACTIVATION_COLLDEEXC); stats::increment(stats::COUNTER_INTERACTIONS); @@ -450,8 +450,8 @@ __host__ __device__ void do_macroatom(Packet &pkt, const MacroAtomState &pktmast case MA_ACTION_RADRECOMB: { // Radiative recombination of MA: emitt a continuum-rpkt - // printoutf("[debug] do_ma: radiative recombination\n"); - // printoutf("[debug] do_ma: element %d, ion %d, level %d\n", element, ion, level); + // printout("[debug] do_ma: radiative recombination\n"); + // printout("[debug] do_ma: element %d, ion %d, level %d\n", element, ion, level); if constexpr (TRACK_ION_STATS) { // stats::increment_ion_stats(modelgridindex, element, ion, stats::ION_MACROATOM_ENERGYOUT_RADRECOMB, @@ -467,7 +467,7 @@ __host__ __device__ void do_macroatom(Packet &pkt, const MacroAtomState &pktmast case MA_ACTION_COLRECOMB: { // collisional recombination of macro atom => convert the packet into a k-packet - // printoutf("[debug] do_ma: collisonal recombination\n"); + // printout("[debug] do_ma: collisonal recombination\n"); stats::increment(stats::COUNTER_MA_STAT_DEACTIVATION_COLLRECOMB); stats::increment(stats::COUNTER_INTERACTIONS); pkt.last_event = 11; @@ -485,7 +485,7 @@ __host__ __device__ void do_macroatom(Packet &pkt, const MacroAtomState &pktmast } case MA_ACTION_INTERNALDOWNLOWER: { - // printoutf("[debug] do_ma: internal downward jump to lower ionstage\n"); + // printout("[debug] do_ma: internal downward jump to lower ionstage\n"); stats::increment(stats::COUNTER_INTERACTIONS); stats::increment(stats::COUNTER_MA_STAT_INTERNALDOWNLOWER); @@ -523,23 +523,23 @@ __host__ __device__ void do_macroatom(Packet &pkt, const MacroAtomState &pktmast } if (lower >= nlevels) { - printoutf("internal_down_lower %g\n", processrates[MA_ACTION_INTERNALDOWNLOWER]); - printoutf("abort at rate %g, targetrate %g\n", rate, targetrate); + printout("internal_down_lower %g\n", processrates[MA_ACTION_INTERNALDOWNLOWER]); + printout("abort at rate %g, targetrate %g\n", rate, targetrate); std::abort(); } if (get_ionstage(element, ion) == 0 && lower == 0) { - printoutf("internal downward transition to ground level occurred ... abort\n"); - printoutf("element %d, ion %d, level %d, lower %d\n", element, ion, level, lower); - printoutf("Z %d, ionstage %d, energy %g\n", get_atomicnumber(element), get_ionstage(element, ion - 1), - globals::elements[element].ions[ion - 1].levels[lower].epsilon); - printoutf("[debug] do_ma: internal downward jump to lower ionstage\n"); + printout("internal downward transition to ground level occurred ... abort\n"); + printout("element %d, ion %d, level %d, lower %d\n", element, ion, level, lower); + printout("Z %d, ionstage %d, energy %g\n", get_atomicnumber(element), get_ionstage(element, ion - 1), + globals::elements[element].ions[ion - 1].levels[lower].epsilon); + printout("[debug] do_ma: internal downward jump to lower ionstage\n"); std::abort(); } break; } case MA_ACTION_INTERNALUPSAME: { - // printoutf("[debug] do_ma: internal upward jump within current ionstage\n"); + // printout("[debug] do_ma: internal upward jump within current ionstage\n"); stats::increment(stats::COUNTER_INTERACTIONS); // randomly select the occurring transition @@ -559,7 +559,7 @@ __host__ __device__ void do_macroatom(Packet &pkt, const MacroAtomState &pktmast } case MA_ACTION_INTERNALUPHIGHER: { - // printoutf("[debug] do_ma: internal upward jump to next ionstage\n"); + // printout("[debug] do_ma: internal upward jump to next ionstage\n"); stats::increment(stats::COUNTER_INTERACTIONS); stats::increment(stats::COUNTER_MA_STAT_INTERNALUPHIGHER); @@ -597,13 +597,13 @@ __host__ __device__ void do_macroatom(Packet &pkt, const MacroAtomState &pktmast } case MA_ACTION_COUNT: { - printoutf("ERROR: Problem selecting MA_ACTION\n"); + printout("ERROR: Problem selecting MA_ACTION\n"); std::abort(); } default: if constexpr (TESTMODE) { - printoutf("ERROR: Unknown macroatom selected_action type %d\n", selected_action); + printout("ERROR: Unknown macroatom selected_action type %d\n", selected_action); assert_testmodeonly(false); } else { __builtin_unreachable(); @@ -671,18 +671,18 @@ auto rad_deexcitation_ratecoeff(const int modelgridindex, const int element, con // const double beta = 1.; R = A_ul * beta; } else { - // printoutf("[warning] rad_deexcitation: tau_sobolev %g <= 0, set beta=1\n",tau_sobolev); - // printoutf("[warning] rad_deexcitation: element %d, ion %d, upper %d, lower %d\n",element,ion,upper,lower); - // printoutf("[warning] rad_deexcitation: n_l %g, n_u %g, B_lu %g, B_ul %g\n",n_l,n_u,B_lu,B_ul); - // printoutf("[warning] rad_deexcitation: T_e %g, T_R %g, W %g in model cell + // printout("[warning] rad_deexcitation: tau_sobolev %g <= 0, set beta=1\n",tau_sobolev); + // printout("[warning] rad_deexcitation: element %d, ion %d, upper %d, lower %d\n",element,ion,upper,lower); + // printout("[warning] rad_deexcitation: n_l %g, n_u %g, B_lu %g, B_ul %g\n",n_l,n_u,B_lu,B_ul); + // printout("[warning] rad_deexcitation: T_e %g, T_R %g, W %g in model cell // %d\n",grid::get_Te(modelgridindex),get_TR(modelgridindex),get_W(modelgridindex),modelgridindex); R = 0.; - // printoutf("[fatal] rad_excitation: tau_sobolev <= 0 ... %g abort",tau_sobolev); + // printout("[fatal] rad_excitation: tau_sobolev <= 0 ... %g abort",tau_sobolev); // abort(); } - // printoutf("[debug] rad_rates_down: Z=%d, ionstage %d, upper %d, lower %d\n", get_atomicnumber(element), - // get_ionstage(element, ion), upper, lower); printoutf("[debug] rad_deexc: A_ul %g, tau_sobolev %g, n_u %g\n", + // printout("[debug] rad_rates_down: Z=%d, ionstage %d, upper %d, lower %d\n", get_atomicnumber(element), + // get_ionstage(element, ion), upper, lower); printout("[debug] rad_deexc: A_ul %g, tau_sobolev %g, n_u %g\n", // A_ul, tau_sobolev, n_u); assert_testmodeonly(std::isfinite(R)); } @@ -850,7 +850,7 @@ auto col_ionization_ratecoeff(const float T_e, const float nne, const int elemen get_phixs_table(element, ion, lower)[0] * get_phixsprobability(element, ion, lower, phixstargetindex); const double C = nne * 1.55e13 * pow(T_e, -0.5) * g * sigma_bf * exp(-fac1) / fac1; // photoionization at the edge - // printoutf("[debug] col_ion: nne %g, T_e %g, g %g, epsilon_trans %g, sigma_bf %g\n", + // printout("[debug] col_ion: nne %g, T_e %g, g %g, epsilon_trans %g, sigma_bf %g\n", // nne,T_e,g,epsilon_trans,sigma_bf); assert_testmodeonly(std::isfinite(C)); diff --git a/nltepop.cc b/nltepop.cc index f8b380bde..381cd0edb 100644 --- a/nltepop.cc +++ b/nltepop.cc @@ -100,22 +100,22 @@ void filter_nlte_matrix(const int element, gsl_matrix *rate_matrix, gsl_vector * col_max = std::max(element_value, col_max); } const auto [ion, level] = get_ion_level_of_nlte_vector_index(index, element); - // printoutf("index%4d (ionstage%2d level%4d) row_max %.1e col_max %.1e ", + // printout("index%4d (ionstage%2d level%4d) row_max %.1e col_max %.1e ", // index,get_ionstage(element,ion),level,row_max,col_max); if ((row_max < 1e-100) || (col_max < 1e-100)) { if (level == 0) { - // printoutf("(Would eliminate but it's a ground state, so keeping it)"); - // printoutf("(Would eliminate but it's a ground state, so forcing pop=MINPOP=%g)",MINPOP); + // printout("(Would eliminate but it's a ground state, so keeping it)"); + // printout("(Would eliminate but it's a ground state, so forcing pop=MINPOP=%g)",MINPOP); // gsl_vector_set(balance_vector, index, MINPOP / get_vector_get(pop_norm_factor_vec, index)); - // printoutf("(Eliminating this ground state)"); + // printout("(Eliminating this ground state)"); } else { const int gs_index = get_nlte_vector_index(element, ion, 0); eliminate_nlte_matrix_rowcol(index, gs_index, rate_matrix, balance_vector); - // printoutf("(forcing LTE population)"); + // printout("(forcing LTE population)"); } } - // printoutf("\n"); + // printout("\n"); } } @@ -189,13 +189,13 @@ void print_level_rates_summary(const int element, const int selected_ion, const if (i == 0) { const int nlevels_nlte = get_nlevels_nlte(element, selected_ion); if (ion_has_superlevel(element, selected_ion) && (selected_level == nlevels_nlte + 1)) { - printoutf(" superlevel "); + printout(" superlevel "); } else { - printoutf(" level%7d ", selected_level); + printout(" level%7d ", selected_level); } - printoutf(" %10.2e ", gsl_vector_get(popvec, selected_index)); + printout(" %10.2e ", gsl_vector_get(popvec, selected_index)); } else { - printoutf(" "); + printout(" "); } const bool into_level = (i <= 1); @@ -218,21 +218,21 @@ void print_level_rates_summary(const int element, const int selected_ion, const if (into_level) { // into this level if (only_levels_below) { - printoutf(" from below "); + printout(" from below "); } else { - printoutf(" from above "); + printout(" from above "); } } else { // out of this level if (only_levels_below) { - printoutf(" to below "); + printout(" to below "); } else { - printoutf(" to above "); + printout(" to above "); } } - printoutf("%10.2e %10.2e %10.2e %10.2e %10.2e %10.2e\n", rad_bb_total, coll_bb_total, ntcoll_bb_total, rad_bf_total, - coll_bf_total, ntcoll_bf_total); + printout("%10.2e %10.2e %10.2e %10.2e %10.2e %10.2e\n", rad_bb_total, coll_bb_total, ntcoll_bb_total, rad_bf_total, + coll_bf_total, ntcoll_bf_total); } } @@ -253,11 +253,10 @@ void print_element_rates_summary(const int element, const int modelgridindex, co for (int level = 0; (level < max_printed_levels) && (level < nlevels) && (level <= nlevels_nlte + 1); level++) { if (level == 0) { - printoutf( - " modelgridindex %d timestep %d NLTE iteration %d Te %g nne %g: NLTE summary for Z=%d ionstage %d:\n", - modelgridindex, timestep, nlte_iter, grid::get_Te(modelgridindex), grid::get_nne(modelgridindex), - atomic_number, ionstage); - printoutf( + printout(" modelgridindex %d timestep %d NLTE iteration %d Te %g nne %g: NLTE summary for Z=%d ionstage %d:\n", + modelgridindex, timestep, nlte_iter, grid::get_Te(modelgridindex), grid::get_nne(modelgridindex), + atomic_number, ionstage); + printout( " pop rates bb_rad bb_col bb_ntcol bf_rad bf_col " "bf_ntcol\n"); } @@ -285,12 +284,12 @@ void print_level_rates(const int modelgridindex, const int timestep, const int e if (element > get_nelements() - 1 || selected_ion > get_nions(element) - 1 || selected_level > (get_nlevels_nlte(element, selected_ion) + (ion_has_superlevel(element, selected_ion) ? 1 : 0))) { - printoutf("print_level_rates: invalid element/ion/level arguments\n"); + printout("print_level_rates: invalid element/ion/level arguments\n"); std::abort(); } if (rate_matrix_rad_bb == rate_matrix_coll_bb) { - printoutf( + printout( "print_level_rates: rate_matrix_rad_bb == rate_matrix_coll_bb. check individual_process_matrices is off\n"); std::abort(); } @@ -301,7 +300,7 @@ void print_level_rates(const int modelgridindex, const int timestep, const int e const int selected_ionstage = get_ionstage(element, selected_ion); const int selected_index = get_nlte_vector_index(element, selected_ion, selected_level); const double pop_selectedlevel = gsl_vector_get(popvec, selected_index); - printoutf( + printout( "timestep %d cell %d Te %g nne %g NLTE level diagnostics for Z=%d ionstage %d level %d rates into and out of " "this level\n", timestep, modelgridindex, grid::get_Te(modelgridindex), grid::get_nne(modelgridindex), atomic_number, @@ -315,7 +314,7 @@ void print_level_rates(const int modelgridindex, const int timestep, const int e const double ntcoll_bf_in_total = get_total_rate_in(selected_index, rate_matrix_ntcoll_bf, popvec); const double total_rate_in = rad_bb_in_total + coll_bb_in_total + rad_bf_in_total + coll_bf_in_total + ntcoll_bf_in_total; - printoutf( + printout( " TOTAL rates in: rad_bb_in %8.2e coll_bb_in %8.2e ntcoll_bb_in %8.2e rad_bf_in %8.2e " "coll_bf_in %8.2e ntcoll_bf_in %8.2e\n", rad_bb_in_total, coll_bb_in_total, ntcoll_bb_in_total, rad_bf_in_total, coll_bf_in_total, ntcoll_bf_in_total); @@ -328,7 +327,7 @@ void print_level_rates(const int modelgridindex, const int timestep, const int e const double ntcoll_bf_out_total = get_total_rate_out(selected_index, rate_matrix_ntcoll_bf, popvec); const double total_rate_out = rad_bb_out_total + coll_bb_out_total + rad_bf_out_total + coll_bf_out_total + ntcoll_bf_out_total; - printoutf( + printout( " TOTAL rates out: rad_bb_out %8.2e coll_bb_out %8.2e ntcoll_bb_out %8.2e rad_bf_out %8.2e " "coll_bf_out %8.2e ntcoll_bf_out %8.2e\n", rad_bb_out_total, coll_bb_out_total, ntcoll_bb_out_total, rad_bf_out_total, coll_bf_out_total, @@ -368,19 +367,19 @@ void print_level_rates(const int modelgridindex, const int timestep, const int e const double level_percent_in = level_rate_in / total_rate_in * 100.; const double level_percent_out = level_rate_out / total_rate_out * 100.; - printoutf( + printout( " ionstage %d level %4d (%5.1f%% of in) rad_bb_in %8.2e coll_bb_in %8.2e ntcoll_bb_in %8.2e rad_bf_in " "%8.2e coll_bf_in %8.2e ntcoll_bf_in %8.2e lambda %6.0f\n", ionstage, level, level_percent_in, rad_bb_in, coll_bb_in, ntcoll_bb_in, rad_bf_in, coll_bf_in, ntcoll_bf_in, lambda); - printoutf( + printout( " ionstage %d level %4d (%5.1f%% of out) rad_bb_out %8.2e coll_bb_out %8.2e ntcoll_bb_out %8.2e rad_bf_out " "%8.2e coll_bf_out %8.2e ntcoll_bf_out %8.2e lambda %6.0f\n", ionstage, level, level_percent_out, rad_bb_out, coll_bb_out, ntcoll_bb_out, rad_bf_out, coll_bf_out, ntcoll_bf_out, lambda); } } - printoutf("\n"); + printout("\n"); } void nltepop_reset_element(const int modelgridindex, const int element) { @@ -470,8 +469,8 @@ void nltepop_matrix_add_boundbound(const int modelgridindex, const int element, *gsl_matrix_ptr(rate_matrix_coll_bb, upper_index, upper_index) -= C; *gsl_matrix_ptr(rate_matrix_coll_bb, lower_index, upper_index) += C; if ((R < 0) || (C < 0)) { - printoutf(" WARNING: Negative de-excitation rate from ionstage %d level %d to level %d\n", - get_ionstage(element, ion), level, lower); + printout(" WARNING: Negative de-excitation rate from ionstage %d level %d to level %d\n", + get_ionstage(element, ion), level, lower); } } @@ -507,8 +506,8 @@ void nltepop_matrix_add_boundbound(const int modelgridindex, const int element, *gsl_matrix_ptr(rate_matrix_ntcoll_bb, lower_index, lower_index) -= NTC; *gsl_matrix_ptr(rate_matrix_ntcoll_bb, upper_index, lower_index) += NTC; if ((R < 0) || (C < 0)) { - printoutf(" WARNING: Negative excitation rate from ion %d level %d to level %d\n", get_ionstage(element, ion), - level, upper); + printout(" WARNING: Negative excitation rate from ion %d level %d to level %d\n", get_ionstage(element, ion), + level, upper); } } } @@ -548,8 +547,8 @@ void nltepop_matrix_add_ionisation(const int modelgridindex, const int element, *gsl_matrix_ptr(rate_matrix_coll_bf, upper_index, lower_index) += C_ionisation * s_renorm[level]; if ((R_ionisation < 0) || (C_ionisation < 0)) { - printoutf(" WARNING: Negative ionization rate from ionstage %d level %d phixstargetindex %d\n", - get_ionstage(element, ion), level, phixstargetindex); + printout(" WARNING: Negative ionization rate from ionstage %d level %d phixstargetindex %d\n", + get_ionstage(element, ion), level, phixstargetindex); } // recombination @@ -565,8 +564,8 @@ void nltepop_matrix_add_ionisation(const int modelgridindex, const int element, *gsl_matrix_ptr(rate_matrix_coll_bf, lower_index, upper_index) += C_recomb * s_renorm[upper]; if ((R_recomb < 0) || (C_recomb < 0)) { - printoutf(" WARNING: Negative recombination rate to ionstage %d level %d phixstargetindex %d\n", - get_ionstage(element, ion), level, phixstargetindex); + printout(" WARNING: Negative recombination rate to ionstage %d level %d phixstargetindex %d\n", + get_ionstage(element, ion), level, phixstargetindex); } } } @@ -580,7 +579,7 @@ void nltepop_matrix_add_nt_ionisation(const int modelgridindex, const int elemen assert_always(ion + 1 < get_nions(element)); // can't ionise the top ion const double Y_nt = nonthermal::nt_ionization_ratecoeff(modelgridindex, element, ion); if (Y_nt < 0.) { - printoutf(" WARNING: Negative NT_ionization rate from ionstage %d\n", get_ionstage(element, ion)); + printout(" WARNING: Negative NT_ionization rate from ionstage %d\n", get_ionstage(element, ion)); } const int nlevels = get_nlevels(element, ion); @@ -626,7 +625,7 @@ void nltepop_matrix_normalise(const int modelgridindex, const int element, gsl_m } // NOTE: above calculation is not always equal to the sum of LTE populations // since calculate_levelpop_lte imposes MINPOP minimum - // printoutf("superlevel norm factor index %d is %g, partfunc is %g, partfunc*levelpop(SL)/g(SL) %g\n", + // printout("superlevel norm factor index %d is %g, partfunc is %g, partfunc*levelpop(SL)/g(SL) %g\n", // column, gsl_vector_get(pop_norm_factor_vec, column), superlevel_partfunc[ion], // superlevel_partfunc[ion] * calculate_levelpop_lte(modelgridindex,element,ion,level) / // stat_weight(element,ion,level)); @@ -653,11 +652,11 @@ void set_element_pops_lte(const int modelgridindex, const int element) { if (u == 0) { const auto [ion, level] = get_ion_level_of_nlte_vector_index(i, element); if (is_nlte(element, ion, level)) { - printoutf("NLTE disconnected level: Z=%d ionstage %d level %d\n", get_atomicnumber(element), - get_ionstage(element, ion), level); + printout("NLTE disconnected level: Z=%d ionstage %d level %d\n", get_atomicnumber(element), + get_ionstage(element, ion), level); } else { - printoutf("NLTE disconnected superlevel: Z=%d ionstage %d\n", get_atomicnumber(element), - get_ionstage(element, ion)); + printout("NLTE disconnected superlevel: Z=%d ionstage %d\n", get_atomicnumber(element), + get_ionstage(element, ion)); } return true; } @@ -698,7 +697,7 @@ void set_element_pops_lte(const int modelgridindex, const int element) { gsl_linalg_LU_decomp(&rate_matrix_LU_decomp, &p, &s); if (lumatrix_is_singular(&rate_matrix_LU_decomp, element)) { - printoutf("ERROR: NLTE matrix is singular for element Z=%d!\n", get_atomicnumber(element)); + printout("ERROR: NLTE matrix is singular for element Z=%d!\n", get_atomicnumber(element)); // abort(); return false; } @@ -743,16 +742,16 @@ void set_element_pops_lte(const int modelgridindex, const int element) { gsl_vector_memcpy(&gsl_x_best, &x); error_best = error; } - // printoutf("Linear algebra solver iteration %d has a maximum residual of %g\n",iteration,error); + // printout("Linear algebra solver iteration %d has a maximum residual of %g\n",iteration,error); if (error < TOLERANCE) { break; } } if (error_best >= 0.) { - // printoutf(" NLTE solver matrix LU_refine: After %d iterations, keeping solution vector with a max residual of + // printout(" NLTE solver matrix LU_refine: After %d iterations, keeping solution vector with a max residual of // %g\n",iteration,error_best); if (error_best > 1e-10) { - printoutf( + printout( " NLTE solver matrix LU_refine: After %d iterations, best solution vector has a max residual of %g " "(WARNING!)\n", iteration, error_best); @@ -773,7 +772,7 @@ void set_element_pops_lte(const int modelgridindex, const int element) { const auto [ion, level] = get_ion_level_of_nlte_vector_index(row, element); - // printoutf("index %4d (ionstage %d level%4d): residual %+.2e recovered balance: %+.2e normed pop %.2e pop %.2e + // printout("index %4d (ionstage %d level%4d): residual %+.2e recovered balance: %+.2e normed pop %.2e pop %.2e // departure ratio %.4f\n", // row,get_ionstage(element,ion),level, gsl_vector_get(residual_vector,row), // recovered_balance_vector_elem, gsl_vector_get(x,row), @@ -781,7 +780,7 @@ void set_element_pops_lte(const int modelgridindex, const int element) { // gsl_vector_get(x, row) / gsl_vector_get(x,get_nlte_vector_index(element,ion,0))); if (gsl_vector_get(popvec, row) < 0.0) { - printoutf( + printout( " WARNING: NLTE solver gave negative population to index %zud (Z=%d ionstage %d level %d), pop = %g. " "Replacing with LTE pop of %g\n", row, get_atomicnumber(element), get_ionstage(element, ion), level, @@ -803,8 +802,8 @@ void solve_nlte_pops_element(const int element, const int modelgridindex, const if (grid::get_elem_abundance(modelgridindex, element) <= 0.) { // abundance of this element is zero, so do not store any NLTE populations - printoutf("Not solving for NLTE populations in cell %d at timestep %d for element Z=%d due to zero abundance\n", - modelgridindex, timestep, atomic_number); + printout("Not solving for NLTE populations in cell %d at timestep %d for element Z=%d due to zero abundance\n", + modelgridindex, timestep, atomic_number); nltepop_reset_element(modelgridindex, element); return; @@ -813,7 +812,7 @@ void solve_nlte_pops_element(const int element, const int modelgridindex, const const double cell_Te = grid::get_Te(modelgridindex); if (cell_Te == MINTEMP) { - printoutf( + printout( "Not solving for NLTE populations in cell %d at timestep %d for element Z=%d due to low temperature Te=%g\n", modelgridindex, timestep, atomic_number, cell_Te); set_element_pops_lte(modelgridindex, element); @@ -826,7 +825,7 @@ void solve_nlte_pops_element(const int element, const int modelgridindex, const const int nions = get_nions(element); const double nnelement = grid::get_elem_numberdens(modelgridindex, element); - printoutf( + printout( "Solving for NLTE populations in cell %d at timestep %d NLTE iteration %d for element Z=%d (mass fraction %.2e, " "nnelement %.2e cm^-3)\n", modelgridindex, timestep, nlte_iter, atomic_number, grid::get_elem_abundance(modelgridindex, element), nnelement); @@ -834,7 +833,7 @@ void solve_nlte_pops_element(const int element, const int modelgridindex, const const auto superlevel_partfunc = get_element_superlevelpartfuncs(modelgridindex, element); const int nlte_dimension = get_element_nlte_dimension(element); - // printoutf("NLTE: the vector dimension is %d", nlte_dimension); + // printout("NLTE: the vector dimension is %d", nlte_dimension); const auto max_nlte_dimension = get_max_nlte_dimension(); @@ -893,10 +892,10 @@ void solve_nlte_pops_element(const int element, const int modelgridindex, const rate_matrix_ntcoll_bf = rate_matrix; } - // printoutf(" Adding rates for ion stages:"); + // printout(" Adding rates for ion stages:"); for (int ion = 0; ion < nions; ion++) { // const int ionstage = get_ionstage(element, ion); - // printoutf(" %d", ionstage); + // printout(" %d", ionstage); const int nlevels = get_nlevels(element, ion); const int nlevels_nlte = get_nlevels_nlte(element, ion); // does not count the ground state! @@ -919,7 +918,7 @@ void solve_nlte_pops_element(const int element, const int modelgridindex, const } } } - // printoutf("\n"); + // printout("\n"); if (individual_process_matrices) { // sum the matrices for each transition type to get a total rate matrix @@ -971,21 +970,21 @@ void solve_nlte_pops_element(const int element, const int modelgridindex, const nltepop_matrix_normalise(modelgridindex, element, &rate_matrix, &pop_norm_factor_vec); - // printoutf("Rate matrix | balance vector:\n"); + // printout("Rate matrix | balance vector:\n"); // for (int row = 0; row < nlte_dimension; row++) // { // for (int column = 0; column < nlte_dimension; column++) // { // char str[15]; // snprintf(str, 15, "%+.1e ", gsl_matrix_get(rate_matrix, row, column)); - // printoutf(str); + // printout(str); // } - // printoutf("| "); + // printout("| "); // char str[15]; // snprintf(str, 15, "%+.1e\n", gsl_vector_get(balance_vector, row)); - // printoutf(str); + // printout(str); // } - // printoutf("\n"); + // printout("\n"); // eliminate barely-interacting levels from the NLTE matrix by removing // their interactions and setting their normalised populations (probably departure coeff) to 1.0 @@ -1000,7 +999,7 @@ void solve_nlte_pops_element(const int element, const int modelgridindex, const nltepop_matrix_solve(element, &rate_matrix, &balance_vector, &popvec, &pop_norm_factor_vec, max_nlte_dimension); if (!matrix_solve_success) { - printoutf( + printout( "WARNING: Can't solve for NLTE populations in cell %d at timestep %d for element Z=%d due to singular matrix. " "Attempting to use LTE solution instead\n", modelgridindex, timestep, atomic_number); @@ -1016,9 +1015,9 @@ void solve_nlte_pops_element(const int element, const int modelgridindex, const const int nlevels_nlte = get_nlevels_nlte(element, ion); const int index_gs = get_nlte_vector_index(element, ion, 0); // const int ionstage = get_ionstage(element, ion); - // printoutf(" [ionstage %d]\n", ionstage); + // printout(" [ionstage %d]\n", ionstage); // - // printoutf(" For ionstage %d, the ground state populations are %g (function) and %g (matrix result with + // printout(" For ionstage %d, the ground state populations are %g (function) and %g (matrix result with // normed pop %g, ltepopnormfactor %g)\n",get_ionstage(element,ion), // get_groundlevelpop(modelgridindex, element, ion), gsl_vector_get(popvec, index_gs), // gsl_vector_get(x, index_gs), gsl_vector_get(pop_norm_factor_vec, index_gs)); @@ -1052,7 +1051,7 @@ void solve_nlte_pops_element(const int element, const int modelgridindex, const const double elem_pop_matrix = gsl_blas_dasum(&popvec); const double elem_pop_error_percent = fabs((nnelement / elem_pop_matrix) - 1) * 100; if (elem_pop_error_percent > 1.0) { - printoutf( + printout( " WARNING: The Z=%d element population is: %g (from abundance) and %g (from matrix solution sum of level " "pops), error: %.1f%%. Forcing element pops to LTE.\n", atomic_number, nnelement, elem_pop_matrix, elem_pop_error_percent); @@ -1095,7 +1094,7 @@ void solve_nlte_pops_element(const int element, const int modelgridindex, const const int duration_nltesolver = std::time(nullptr) - sys_time_start_nltesolver; if (duration_nltesolver > 2) { - printoutf("NLTE population solver call for Z=%d took %d seconds\n", get_atomicnumber(element), duration_nltesolver); + printout("NLTE population solver call for Z=%d took %d seconds\n", get_atomicnumber(element), duration_nltesolver); } } @@ -1177,7 +1176,7 @@ void nltepop_write_to_file(const int modelgridindex, const int timestep) { nnlevelnlte = slpopfactor * superlevel_partfunc; - // printoutf("nltepop_write_to_file: The Z=%d ionstage %d superlevel population is %g with rho %g and + // printout("nltepop_write_to_file: The Z=%d ionstage %d superlevel population is %g with rho %g and // superlevel_partfunc %g Te %g scaled pop stored as %g\n", get_atomicnumber(element), get_ionstage(element, // ion), nnlevelnlte, grid::modelgrid[modelgridindex].rho, superlevel_partfunc, grid::get_Te(modelgridindex), // grid::modelgrid[modelgridindex].nlte_pops[ion_first_nlte + nlevels_nlte]); @@ -1193,7 +1192,7 @@ void nltepop_write_to_file(const int modelgridindex, const int timestep) { } void nltepop_write_restart_data(FILE *restart_file) { - printoutf("populations, "); + printout("populations, "); fprintf(restart_file, "%d\n", 75618527); // special number marking the beginning of nlte data @@ -1219,20 +1218,20 @@ void nltepop_write_restart_data(FILE *restart_file) { } void nltepop_read_restart_data(FILE *restart_file) { - printoutf("Reading restart data for populations\n"); + printout("Reading restart data for populations\n"); int code_check = 0; assert_always(fscanf(restart_file, "%d\n", &code_check) == 1); if (code_check != 75618527) { - printoutf("ERROR: Beginning of NLTE restart data not found!\n"); + printout("ERROR: Beginning of NLTE restart data not found!\n"); std::abort(); } int total_nlte_levels_in = 0; assert_always(fscanf(restart_file, "%d\n", &total_nlte_levels_in) == 1); if (total_nlte_levels_in != globals::total_nlte_levels) { - printoutf("ERROR: Expected %d NLTE levels but found %d in restart file\n", globals::total_nlte_levels, - total_nlte_levels_in); + printout("ERROR: Expected %d NLTE levels but found %d in restart file\n", globals::total_nlte_levels, + total_nlte_levels_in); std::abort(); } @@ -1241,7 +1240,7 @@ void nltepop_read_restart_data(FILE *restart_file) { int mgi_in = 0; assert_always(fscanf(restart_file, "%d %la\n", &mgi_in, &grid::modelgrid[modelgridindex].totalcooling) == 2); if (mgi_in != modelgridindex) { - printoutf("ERROR: expected data for cell %d but found cell %d\n", modelgridindex, mgi_in); + printout("ERROR: expected data for cell %d but found cell %d\n", modelgridindex, mgi_in); std::abort(); } @@ -1255,7 +1254,7 @@ void nltepop_read_restart_data(FILE *restart_file) { &grid::modelgrid[modelgridindex].ion_partfuncts[uniqueionindex], &grid::modelgrid[modelgridindex].ion_cooling_contribs[uniqueionindex]) == 4); if (ion_in != ion) { - printoutf("ERROR: expected data for ion %d but found ion %d\n", ion, ion_in); + printout("ERROR: expected data for ion %d but found ion %d\n", ion, ion_in); std::abort(); } } diff --git a/nonthermal.cc b/nonthermal.cc index 7d78ec154..e89eb06f6 100644 --- a/nonthermal.cc +++ b/nonthermal.cc @@ -234,7 +234,7 @@ void read_shell_configs() { std::string line; assert_always(get_noncommentline(shells_file, line)); std::istringstream(line) >> nshells >> n_z_binding; - printoutf("Reading electron_shell_occupancy.txt with %d elements and %d shells\n", n_z_binding, nshells); + printout("Reading electron_shell_occupancy.txt with %d elements and %d shells\n", n_z_binding, nshells); elements_shells_q.resize(n_z_binding, std::vector(nshells, 0.)); @@ -277,7 +277,7 @@ void read_binding_energies() { std::string line; assert_always(get_noncommentline(binding_energies_file, line)); std::istringstream(line) >> nshells >> n_z_binding; - printoutf("Reading binding energies file '%s' with %d elements and %d shells\n", filename, n_z_binding, nshells); + printout("Reading binding energies file '%s' with %d elements and %d shells\n", filename, n_z_binding, nshells); elements_electron_binding.resize(n_z_binding, std::vector(nshells, 0.)); @@ -299,7 +299,7 @@ void read_binding_energies() { if constexpr (NT_WORKFUNCTION_USE_SHELL_OCCUPANCY_FILE) { if (!binding_en_newformat) { - printoutf( + printout( "NT_WORKFUNCTION_USE_SHELL_OCCUPANCY_FILE is true, but could not find binding_energies_lotz_tab1and2.txt\n"); } assert_always(binding_en_newformat); @@ -332,19 +332,19 @@ void check_auger_probabilities(int modelgridindex) { } if (fabs(prob_sum - 1.0) > 0.001) { - printoutf("Problem with Auger probabilities for cell %d Z=%d ionstage %d prob_sum %g\n", modelgridindex, - get_atomicnumber(element), get_ionstage(element, ion), prob_sum); + printout("Problem with Auger probabilities for cell %d Z=%d ionstage %d prob_sum %g\n", modelgridindex, + get_atomicnumber(element), get_ionstage(element, ion), prob_sum); for (int a = 0; a <= NT_MAX_AUGER_ELECTRONS; a++) { - printoutf("%d: %g\n", a, get_auger_probability(modelgridindex, element, ion, a)); + printout("%d: %g\n", a, get_auger_probability(modelgridindex, element, ion, a)); } problem_found = true; } if (fabs(ionenfrac_sum - 1.0) > 0.001) { - printoutf("Problem with Auger energy frac sum for cell %d Z=%d ionstage %d ionenfrac_sum %g\n", modelgridindex, - get_atomicnumber(element), get_ionstage(element, ion), ionenfrac_sum); + printout("Problem with Auger energy frac sum for cell %d Z=%d ionstage %d ionenfrac_sum %g\n", modelgridindex, + get_atomicnumber(element), get_ionstage(element, ion), ionenfrac_sum); for (int a = 0; a <= NT_MAX_AUGER_ELECTRONS; a++) { - printoutf("%d: %g\n", a, get_ion_auger_enfrac(modelgridindex, element, ion, a)); + printout("%d: %g\n", a, get_ion_auger_enfrac(modelgridindex, element, ion, a)); } problem_found = true; } @@ -357,7 +357,7 @@ void check_auger_probabilities(int modelgridindex) { } void read_auger_data() { - printoutf("Reading Auger effect data...\n"); + printout("Reading Auger effect data...\n"); FILE *augerfile = fopen_required("auger-km1993-table2.txt", "r"); char line[151] = ""; @@ -430,15 +430,15 @@ void read_auger_data() { const int g = xrayg[shellnum - 1]; if (!std::isfinite(en_auger_ev) || en_auger_ev < 0) { - printoutf(" WARNING: Z=%2d ionstage %2d shellnum %d en_auger_ev is %g. Setting to zero.\n", Z, ionstage, - shellnum, en_auger_ev); + printout(" WARNING: Z=%2d ionstage %2d shellnum %d en_auger_ev is %g. Setting to zero.\n", Z, ionstage, + shellnum, en_auger_ev); en_auger_ev = 0.; } // now loop through shells with impact ionisation cross sections and apply Auger data that matches n, l values for (auto &collionrow : colliondata) { if (collionrow.Z == Z && collionrow.ionstage == ionstage && collionrow.n == n && collionrow.l == l) { - printoutf( + printout( "Z=%2d ionstage %2d shellnum %d n %d l %d ionpot %7.2f E_A %8.1f E_A' %8.1f epsilon %6d %5.1f " "P(n_Auger)", Z, ionstage, shellnum, n, l, ionpot_ev, en_auger_ev_total_nocorrection, en_auger_ev, epsilon_e3, @@ -447,12 +447,12 @@ void read_auger_data() { double prob_sum = 0.; for (int a = 0; a <= NT_MAX_AUGER_ELECTRONS; a++) { prob_sum += prob_num_auger[a]; - printoutf(" %d: %4.2f", a, prob_num_auger[a]); + printout(" %d: %4.2f", a, prob_num_auger[a]); } assert_always(fabs(prob_sum - 1.0) < 0.001); - printoutf("\n"); - // printoutf("ionpot %g %g, g %d\n", colliondata[i].ionpot_ev, ionpot_ev, g); + printout("\n"); + // printout("ionpot %g %g, g %d\n", colliondata[i].ionpot_ev, ionpot_ev, g); const bool found_existing_data = (collionrow.auger_g_accumulated > 0.); // keep existing data but update according to statistical weight represented by existing and new data @@ -472,12 +472,12 @@ void read_auger_data() { assert_always(fabs(prob_sum - 1.0) < 0.001); if (found_existing_data) { - printoutf(" same NL shell already has data from another X-ray shell. New g-weighted values: P(n_Auger)"); + printout(" same NL shell already has data from another X-ray shell. New g-weighted values: P(n_Auger)"); for (int a = 0; a <= NT_MAX_AUGER_ELECTRONS; a++) { - printoutf(" %d: %4.2f", a, collionrow.prob_num_auger[a]); + printout(" %d: %4.2f", a, collionrow.prob_num_auger[a]); } - printoutf("\n"); + printout("\n"); } } } @@ -516,7 +516,7 @@ auto get_approx_shell_occupancies(const int nbound, const int ioncharge) { } else if (q[8] < 6) { q[8]++; // M5 3d[5/2] } else { - printoutf("Going beyond the 4s shell in NT calculation. Abort!\n"); + printout("Going beyond the 4s shell in NT calculation. Abort!\n"); std::abort(); } } else if (ioncharge == 1) { @@ -527,7 +527,7 @@ auto get_approx_shell_occupancies(const int nbound, const int ioncharge) { } else if (q[8] < 6) { q[8]++; // M5 3d[5/2] } else { - printoutf("Going beyond the 4s shell in NT calculation. Abort!\n"); + printout("Going beyond the 4s shell in NT calculation. Abort!\n"); std::abort(); } } else if (ioncharge > 1) { @@ -536,7 +536,7 @@ auto get_approx_shell_occupancies(const int nbound, const int ioncharge) { } else if (q[8] < 6) { q[8]++; // M5 3d[5/2] } else { - printoutf("Going beyond the 4s shell in NT calculation. Abort!\n"); + printout("Going beyond the 4s shell in NT calculation. Abort!\n"); std::abort(); } } @@ -610,12 +610,12 @@ auto get_sum_q_over_binding_energy(const int element, const int ion) -> double { } void read_collion_data() { - printoutf("Reading collisional ionization data from collion.txt...\n"); + printout("Reading collisional ionization data from collion.txt...\n"); FILE *cifile = fopen_required("collion.txt", "r"); int colliondatacount = 0; assert_always(fscanf(cifile, "%d", &colliondatacount) == 1); - printoutf("Reading %d collisional transition rows\n", colliondatacount); + printout("Reading %d collisional transition rows\n", colliondatacount); assert_always(colliondatacount >= 0); for (int i = 0; i < colliondatacount; i++) { @@ -643,10 +643,10 @@ void read_collion_data() { colliondata.push_back(collionrow); - // printoutf("ci row: %2d %2d %1d %1d %lg %lg %lg %lg %lg\n", collionrow.Z, collionrow.nelec, collionrow.n, + // printout("ci row: %2d %2d %1d %1d %lg %lg %lg %lg %lg\n", collionrow.Z, collionrow.nelec, collionrow.n, // collionrow.l, collionrow.ionpot_ev, collionrow.A, collionrow.B, collionrow.C, collionrow.D); } - printoutf("Stored %zu of %d input shell cross sections\n", colliondata.size(), colliondatacount); + printout("Stored %zu of %d input shell cross sections\n", colliondata.size(), colliondatacount); for (int element = 0; element < get_nelements(); element++) { const int Z = get_atomicnumber(element); for (int ion = 0; ion < get_nions(element); ion++) { @@ -656,8 +656,8 @@ void read_collion_data() { [Z, ionstage](const collionrow &collionrow) { return collionrow.Z == Z && collionrow.ionstage == ionstage; }); if (!any_data_matched) { const double ionpot_ev = globals::elements[element].ions[ion].ionpot / EV; - printoutf("No collisional ionisation data for Z=%d ionstage %d. Using Lotz approximation with ionpot = %g eV\n", - Z, ionstage, ionpot_ev); + printout("No collisional ionisation data for Z=%d ionstage %d. Using Lotz approximation with ionpot = %g eV\n", + Z, ionstage, ionpot_ev); const int ioncharge = ionstage - 1; const int nbound = Z - ioncharge; // number of bound electrons @@ -805,7 +805,7 @@ void nt_write_to_file(const int modelgridindex, const int timestep, const int it { #endif if (!nonthermal_initialized || nonthermalfile == nullptr) { - printoutf("Call to nonthermal_write_to_file before nonthermal_init"); + printout("Call to nonthermal_write_to_file before nonthermal_init"); std::abort(); } @@ -1133,12 +1133,12 @@ auto calculate_frac_heating(const int modelgridindex, const std::array 1.0) { - printoutf("WARNING: calculate_frac_heating: invalid result of %g. Setting to 1.0 instead\n", frac_heating); + printout("WARNING: calculate_frac_heating: invalid result of %g. Setting to 1.0 instead\n", frac_heating); return 1.; } @@ -1157,8 +1157,8 @@ auto get_nt_frac_ionization(const int modelgridindex) -> float { const float frac_ionization = nt_solution[modelgridindex].frac_ionization; if (frac_ionization < 0 || !std::isfinite(frac_ionization)) { - printoutf("ERROR: get_nt_frac_ionization called with no valid solution stored for cell %d. frac_ionization = %g\n", - modelgridindex, frac_ionization); + printout("ERROR: get_nt_frac_ionization called with no valid solution stored for cell %d. frac_ionization = %g\n", + modelgridindex, frac_ionization); std::abort(); } @@ -1174,8 +1174,8 @@ auto get_nt_frac_excitation(const int modelgridindex) -> float { const float frac_excitation = nt_solution[modelgridindex].frac_excitation; if (frac_excitation < 0 || !std::isfinite(frac_excitation)) { - printoutf("ERROR: get_nt_frac_excitation called with no valid solution stored for cell %d. frac_excitation = %g\n", - modelgridindex, frac_excitation); + printout("ERROR: get_nt_frac_excitation called with no valid solution stored for cell %d. frac_excitation = %g\n", + modelgridindex, frac_excitation); std::abort(); } @@ -1370,9 +1370,9 @@ void calculate_eff_ionpot_auger_rates(const int modelgridindex, const int elemen } nt_solution[modelgridindex].allions[uniqueionindex].eff_ionpot = eff_ionpot; } else { - printoutf("WARNING! No matching subshells in NT impact ionisation cross section data for Z=%d ionstage %d.\n", - get_atomicnumber(element), get_ionstage(element, ion)); - printoutf( + printout("WARNING! No matching subshells in NT impact ionisation cross section data for Z=%d ionstage %d.\n", + get_atomicnumber(element), get_ionstage(element, ion)); + printout( "-> Defaulting to work function approximation and ionisation energy is not accounted for in Spencer-Fano " "solution.\n"); @@ -1593,9 +1593,9 @@ void analyse_sf_solution(const int modelgridindex, const int timestep, const boo double frac_ionization_ion = 0.; double frac_excitation_ion = 0.; - printoutf(" Z=%d ionstage %d:\n", Z, ionstage); - // printoutf(" nnion: %g\n", nnion); - printoutf(" nnion/nntot: %g\n", nnion / nntot); + printout(" Z=%d ionstage %d:\n", Z, ionstage); + // printout(" nnion: %g\n", nnion); + printout(" nnion/nntot: %g\n", nnion / nntot); calculate_eff_ionpot_auger_rates(modelgridindex, element, ion, yfunc); @@ -1606,21 +1606,21 @@ void analyse_sf_solution(const int modelgridindex, const int timestep, const boo calculate_nt_frac_ionization_shell(modelgridindex, element, ion, collionrow, yfunc); frac_ionization_ion += frac_ionization_ion_shell; matching_subshell_count++; - printoutf(" shell "); + printout(" shell "); if (collionrow.n >= 0) { - printoutf("n %d, l %d", collionrow.n, collionrow.l); + printout("n %d, l %d", collionrow.n, collionrow.l); } else { - printoutf("%s (Lotz)", shellnames.at(-collionrow.l).c_str()); + printout("%s (Lotz)", shellnames.at(-collionrow.l).c_str()); } - printoutf(" I %5.1f eV: frac_ionization %10.4e", collionrow.ionpot_ev, frac_ionization_ion_shell); + printout(" I %5.1f eV: frac_ionization %10.4e", collionrow.ionpot_ev, frac_ionization_ion_shell); if (NT_MAX_AUGER_ELECTRONS > 0) { - printoutf(" prob(n Auger elec):"); + printout(" prob(n Auger elec):"); for (int a = 0; a <= NT_MAX_AUGER_ELECTRONS; a++) { - printoutf(" %d: %.2f", a, collionrow.prob_num_auger[a]); + printout(" %d: %.2f", a, collionrow.prob_num_auger[a]); } } - printoutf("\n"); + printout("\n"); } } @@ -1632,7 +1632,7 @@ void analyse_sf_solution(const int modelgridindex, const int timestep, const boo } else { nt_solution[modelgridindex].allions[uniqueionindex].fracdep_ionization_ion = 0.; } - printoutf(" frac_ionization: %g (%d subshells)\n", frac_ionization_ion, matching_subshell_count); + printout(" frac_ionization: %g (%d subshells)\n", frac_ionization_ion, matching_subshell_count); // excitation from all levels is very SLOW const int nlevels_all = get_nlevels(element, ion); @@ -1681,51 +1681,51 @@ void analyse_sf_solution(const int modelgridindex, const int timestep, const boo } // for t } // for lower - printoutf(" frac_excitation: %g\n", frac_excitation_ion); + printout(" frac_excitation: %g\n", frac_excitation_ion); if (frac_excitation_ion > 1. || !std::isfinite(frac_excitation_ion)) { - printoutf(" WARNING: invalid frac_excitation. Replacing with zero\n"); + printout(" WARNING: invalid frac_excitation. Replacing with zero\n"); frac_excitation_ion = 0.; } frac_excitation_total += frac_excitation_ion; - printoutf(" workfn: %9.2f eV\n", (1. / get_oneoverw(element, ion, modelgridindex)) / EV); - printoutf(" eff_ionpot: %9.2f eV (always use valence potential is %s)\n", - get_eff_ionpot(modelgridindex, element, ion) / EV, (NT_USE_VALENCE_IONPOTENTIAL ? "true" : "false")); + printout(" workfn: %9.2f eV\n", (1. / get_oneoverw(element, ion, modelgridindex)) / EV); + printout(" eff_ionpot: %9.2f eV (always use valence potential is %s)\n", + get_eff_ionpot(modelgridindex, element, ion) / EV, (NT_USE_VALENCE_IONPOTENTIAL ? "true" : "false")); - printoutf(" workfn approx Gamma: %9.3e\n", nt_ionization_ratecoeff_wfapprox(modelgridindex, element, ion)); + printout(" workfn approx Gamma: %9.3e\n", nt_ionization_ratecoeff_wfapprox(modelgridindex, element, ion)); - printoutf(" SF integral Gamma: %9.3e\n", - calculate_nt_ionization_ratecoeff(modelgridindex, element, ion, false, yfunc)); + printout(" SF integral Gamma: %9.3e\n", + calculate_nt_ionization_ratecoeff(modelgridindex, element, ion, false, yfunc)); - printoutf(" SF integral(I=Iv) Gamma: %9.3e (if always use valence potential)\n", - calculate_nt_ionization_ratecoeff(modelgridindex, element, ion, true, yfunc)); + printout(" SF integral(I=Iv) Gamma: %9.3e (if always use valence potential)\n", + calculate_nt_ionization_ratecoeff(modelgridindex, element, ion, true, yfunc)); - printoutf(" ARTIS using Gamma: %9.3e\n", nt_ionization_ratecoeff(modelgridindex, element, ion)); + printout(" ARTIS using Gamma: %9.3e\n", nt_ionization_ratecoeff(modelgridindex, element, ion)); // the ion values (unlike shell ones) have been collapsed down to ensure that upperion < nions if (ion < nions - 1) { - printoutf(" probability to ionstage:"); + printout(" probability to ionstage:"); double prob_sum = 0.; for (int upperion = ion + 1; upperion <= nt_ionisation_maxupperion(element, ion); upperion++) { const double probability = nt_ionization_upperion_probability(modelgridindex, element, ion, upperion, false); prob_sum += probability; if (probability > 0.) { - printoutf(" %d: %.3f", get_ionstage(element, upperion), probability); + printout(" %d: %.3f", get_ionstage(element, upperion), probability); } } - printoutf("\n"); + printout("\n"); assert_always((fabs(prob_sum - 1.0) <= 1e-2) || (nt_ionization_ratecoeff_sf(modelgridindex, element, ion) < 1e-20)); - printoutf(" enfrac to ionstage:"); + printout(" enfrac to ionstage:"); double enfrac_sum = 0.; for (int upperion = ion + 1; upperion <= nt_ionisation_maxupperion(element, ion); upperion++) { const double probability = nt_ionization_upperion_probability(modelgridindex, element, ion, upperion, true); enfrac_sum += probability; if (probability > 0.) { - printoutf(" %d: %.3f", get_ionstage(element, upperion), probability); + printout(" %d: %.3f", get_ionstage(element, upperion), probability); } } - printoutf("\n"); + printout("\n"); assert_always(fabs(enfrac_sum - 1.0) <= 1e-2 || (nt_ionization_ratecoeff_sf(modelgridindex, element, ion) < 1e-20)); } @@ -1742,8 +1742,8 @@ void analyse_sf_solution(const int modelgridindex, const int timestep, const boo if (std::ssize(tmp_excitation_list) > nt_excitations_stored) { // truncate the sorted list to save memory - printoutf(" Truncating non-thermal excitation list from %zu to %d transitions.\n", tmp_excitation_list.size(), - nt_excitations_stored); + printout(" Truncating non-thermal excitation list from %zu to %d transitions.\n", tmp_excitation_list.size(), + nt_excitations_stored); tmp_excitation_list.resize(nt_excitations_stored); } @@ -1751,13 +1751,13 @@ void analyse_sf_solution(const int modelgridindex, const int timestep, const boo std::copy(tmp_excitation_list.begin(), tmp_excitation_list.end(), nt_solution[modelgridindex].frac_excitations_list); - printoutf("[info] mem_usage: non-thermal excitations for cell %d at this timestep occupy %.3f MB\n", modelgridindex, - nt_solution[modelgridindex].frac_excitations_list_size * - sizeof(nt_solution[modelgridindex].frac_excitations_list[0]) / 1024. / 1024.); + printout("[info] mem_usage: non-thermal excitations for cell %d at this timestep occupy %.3f MB\n", modelgridindex, + nt_solution[modelgridindex].frac_excitations_list_size * + sizeof(nt_solution[modelgridindex].frac_excitations_list[0]) / 1024. / 1024.); const auto T_e = grid::get_Te(modelgridindex); - printoutf(" Top non-thermal excitation fractions (total excitations = %d):\n", - nt_solution[modelgridindex].frac_excitations_list_size); + printout(" Top non-thermal excitation fractions (total excitations = %d):\n", + nt_solution[modelgridindex].frac_excitations_list_size); const int ntransdisplayed = std::min(50, nt_solution[modelgridindex].frac_excitations_list_size); for (int excitationindex = 0; excitationindex < ntransdisplayed; excitationindex++) { @@ -1786,7 +1786,7 @@ void analyse_sf_solution(const int modelgridindex, const int timestep, const boo const double exc_ratecoeff = radexc_ratecoeff + collexc_ratecoeff + ntcollexc_ratecoeff; const auto coll_str = get_uptranslist(element, ion, lower)[uptransindex].coll_str; - printoutf( + printout( " frac_deposition %.3e Z=%2d ionstage %d lower %4d upper %4d rad_exc %.1e coll_exc %.1e nt_exc %.1e " "nt/tot %.1e collstr %.1e lineindex %d\n", ntexc.frac_deposition, get_atomicnumber(element), get_ionstage(element, ion), lower, upper, @@ -1817,25 +1817,25 @@ void analyse_sf_solution(const int modelgridindex, const int timestep, const boo nt_solution[modelgridindex].frac_excitation = frac_excitation_total; nt_solution[modelgridindex].frac_ionization = frac_ionization_total; - printoutf(" E_init: %9.2f eV/s/cm^3\n", E_init_ev); - printoutf(" deposition: %9.2f eV/s/cm^3\n", deposition_rate_density_ev); - printoutf(" nne: %9.3e e-/cm^3\n", nne); - printoutf(" nnetot: %9.3e e-/cm^3\n", nnetot); - printoutf(" nne_nt < %9.3e e-/cm^3\n", nne_nt_max); - printoutf(" nne_nt/nne < %9.3e\n", nne_nt_max / nne); + printout(" E_init: %9.2f eV/s/cm^3\n", E_init_ev); + printout(" deposition: %9.2f eV/s/cm^3\n", deposition_rate_density_ev); + printout(" nne: %9.3e e-/cm^3\n", nne); + printout(" nnetot: %9.3e e-/cm^3\n", nnetot); + printout(" nne_nt < %9.3e e-/cm^3\n", nne_nt_max); + printout(" nne_nt/nne < %9.3e\n", nne_nt_max / nne); // store the solution properties now while the NT spectrum is in memory (in case we free before packet prop) nt_solution[modelgridindex].frac_heating = calculate_frac_heating(modelgridindex, yfunc); - printoutf(" frac_heating_tot: %g\n", nt_solution[modelgridindex].frac_heating); - printoutf(" frac_excitation_tot: %g\n", frac_excitation_total); - printoutf(" frac_ionization_tot: %g\n", frac_ionization_total); + printout(" frac_heating_tot: %g\n", nt_solution[modelgridindex].frac_heating); + printout(" frac_excitation_tot: %g\n", frac_excitation_total); + printout(" frac_ionization_tot: %g\n", frac_ionization_total); const double frac_sum = nt_solution[modelgridindex].frac_heating + frac_excitation_total + frac_ionization_total; - printoutf(" frac_sum: %g (should be close to 1.0)\n", frac_sum); + printout(" frac_sum: %g (should be close to 1.0)\n", frac_sum); nt_solution[modelgridindex].frac_heating = 1. - frac_excitation_total - frac_ionization_total; - printoutf(" (replacing calculated frac_heating_tot with %g to make frac_sum = 1.0)\n", - nt_solution[modelgridindex].frac_heating); + printout(" (replacing calculated frac_heating_tot with %g to make frac_sum = 1.0)\n", + nt_solution[modelgridindex].frac_heating); } void sfmatrix_add_excitation(std::vector &sfmatrixuppertri, const int modelgridindex, const int element, @@ -1900,7 +1900,7 @@ void sfmatrix_add_ionization(std::vector &sfmatrixuppertri, const int Z, assert_always(ionpot_ev >= SF_EMIN); - // printoutf("Z=%2d ionstage %d n %d l %d ionpot %g eV\n", + // printout("Z=%2d ionstage %d n %d l %d ionpot %g eV\n", // Z, ionstage, colliondata[n].n, colliondata[n].l, ionpot_ev); const int xsstartindex = get_xs_ionization_vector(vec_xs_ionization, collionrow); @@ -1987,7 +1987,7 @@ void sfmatrix_add_ionization(std::vector &sfmatrixuppertri, const int Z, } } else { assert_always(en < en_auger_ev); - // printoutf("SFAuger E %g < en_auger_ev %g so subtracting %g from element with value %g\n", en, + // printout("SFAuger E %g < en_auger_ev %g so subtracting %g from element with value %g\n", en, // en_auger_ev, nnion * xs, ij_contribution); sfmatrixuppertri[rowoffset + j] -= nnion * xs; // * n_auger_elec_avg; // * en_auger_ev??? } @@ -2012,7 +2012,7 @@ auto sfmatrix_solve(const std::vector &sfmatrix) -> std::array sfmatrix_LU{}; // auto gsl_sfmatrix_LU = gsl_matrix_view_array(sfmatrix_LU.data(), SFPTS, SFPTS).matrix; @@ -2020,7 +2020,7 @@ auto sfmatrix_solve(const std::vector &sfmatrix) -> std::array yvec_arr{}; auto gsl_yvec = gsl_vector_view_array(yvec_arr.data(), SFPTS).vector; @@ -2029,7 +2029,7 @@ auto sfmatrix_solve(const std::vector &sfmatrix) -> std::array yvec_best{}; @@ -2057,18 +2057,18 @@ auto sfmatrix_solve(const std::vector &sfmatrix) -> std::array= 0.) { if (error_best > 1e-10) { - printoutf(" SF solver LU_refine: After %d iterations, best solution vector has a max residual of %g (WARNING)\n", - iteration, error_best); + printout(" SF solver LU_refine: After %d iterations, best solution vector has a max residual of %g (WARNING)\n", + iteration, error_best); } gsl_vector_memcpy(&gsl_yvec, &gsl_yvec_best); } if (gsl_vector_isnonneg(&gsl_yvec) == 0) { - printoutf("solve_sfmatrix: WARNING: y function goes negative!\n"); + printout("solve_sfmatrix: WARNING: y function goes negative!\n"); } return yvec_arr; } @@ -2093,18 +2093,18 @@ void init(const int my_rank, const int ndo_nonempty) { return; } - printoutf("Initializing non-thermal solver with:\n"); - printoutf(" NT_EXCITATION %s\n", NT_EXCITATION_ON ? "on" : "off"); - printoutf(" MAX_NT_EXCITATIONS_STORED %d\n", MAX_NT_EXCITATIONS_STORED); - printoutf(" NTEXCITATION_MAXNLEVELS_LOWER %d\n", NTEXCITATION_MAXNLEVELS_LOWER); - printoutf(" NTEXCITATION_MAXNLEVELS_UPPER %d\n", NTEXCITATION_MAXNLEVELS_UPPER); - printoutf(" SFPTS %d\n", SFPTS); - printoutf(" SF_EMIN %g eV\n", SF_EMIN); - printoutf(" SF_EMAX %g eV\n", SF_EMAX); - printoutf(" NT_USE_VALENCE_IONPOTENTIAL %s\n", NT_USE_VALENCE_IONPOTENTIAL ? "on" : "off"); - printoutf(" NT_MAX_AUGER_ELECTRONS %d\n", NT_MAX_AUGER_ELECTRONS); - printoutf(" SF_AUGER_CONTRIBUTION %s\n", SF_AUGER_CONTRIBUTION_ON ? "on" : "off"); - printoutf(" SF_AUGER_CONTRIBUTION_DISTRIBUTE_EN %s\n", SF_AUGER_CONTRIBUTION_DISTRIBUTE_EN ? "on" : "off"); + printout("Initializing non-thermal solver with:\n"); + printout(" NT_EXCITATION %s\n", NT_EXCITATION_ON ? "on" : "off"); + printout(" MAX_NT_EXCITATIONS_STORED %d\n", MAX_NT_EXCITATIONS_STORED); + printout(" NTEXCITATION_MAXNLEVELS_LOWER %d\n", NTEXCITATION_MAXNLEVELS_LOWER); + printout(" NTEXCITATION_MAXNLEVELS_UPPER %d\n", NTEXCITATION_MAXNLEVELS_UPPER); + printout(" SFPTS %d\n", SFPTS); + printout(" SF_EMIN %g eV\n", SF_EMIN); + printout(" SF_EMAX %g eV\n", SF_EMAX); + printout(" NT_USE_VALENCE_IONPOTENTIAL %s\n", NT_USE_VALENCE_IONPOTENTIAL ? "on" : "off"); + printout(" NT_MAX_AUGER_ELECTRONS %d\n", NT_MAX_AUGER_ELECTRONS); + printout(" SF_AUGER_CONTRIBUTION %s\n", SF_AUGER_CONTRIBUTION_ON ? "on" : "off"); + printout(" SF_AUGER_CONTRIBUTION_DISTRIBUTE_EN %s\n", SF_AUGER_CONTRIBUTION_DISTRIBUTE_EN ? "on" : "off"); if (ndo_nonempty > 0) { char filename[MAXFILENAMELENGTH]; @@ -2116,9 +2116,9 @@ void init(const int my_rank, const int ndo_nonempty) { if (NT_EXCITATION_ON) { nt_excitations_stored = std::min(MAX_NT_EXCITATIONS_STORED, get_possible_nt_excitation_count()); - printoutf("[info] mem_usage: storing %d non-thermal excitations for non-empty cells occupies %.3f MB\n", - nt_excitations_stored, - grid::get_nonempty_npts_model() * sizeof(NonThermalExcitation) * nt_excitations_stored / 1024. / 1024.); + printout("[info] mem_usage: storing %d non-thermal excitations for non-empty cells occupies %.3f MB\n", + nt_excitations_stored, + grid::get_nonempty_npts_model() * sizeof(NonThermalExcitation) * nt_excitations_stored / 1024. / 1024.); const auto nonempty_npts_model = grid::get_nonempty_npts_model(); @@ -2183,13 +2183,13 @@ void init(const int my_rank, const int ndo_nonempty) { sourceintegral += sourcevec(s) * DELTA_E; } - printoutf("E_init: %14.7e eV/s/cm3\n", E_init_ev); - printoutf("source function integral: %14.7e\n", sourceintegral); + printout("E_init: %14.7e eV/s/cm3\n", E_init_ev); + printout("source function integral: %14.7e\n", sourceintegral); read_collion_data(); nonthermal_initialized = true; - printoutf("Finished initializing non-thermal solver\n"); + printout("Finished initializing non-thermal solver\n"); } // set total non-thermal deposition rate from individual gamma/positron/electron/alpha rates. This should be called @@ -2302,18 +2302,18 @@ __host__ __device__ auto nt_ionization_upperion_probability(const int modelgridi } else { if (fabs(prob_remaining - nt_solution[modelgridindex].allions[uniqueionindex].prob_num_auger[numaugerelec]) >= 0.001) { - printoutf("Auger probabilities issue for cell %d Z=%02d ionstage %d to %d\n", modelgridindex, - get_atomicnumber(element), get_ionstage(element, lowerion), get_ionstage(element, upperion)); + printout("Auger probabilities issue for cell %d Z=%02d ionstage %d to %d\n", modelgridindex, + get_atomicnumber(element), get_ionstage(element, lowerion), get_ionstage(element, upperion)); for (int a = 0; a <= NT_MAX_AUGER_ELECTRONS; a++) { - printoutf(" a %d prob %g\n", a, nt_solution[modelgridindex].allions[uniqueionindex].prob_num_auger[a]); + printout(" a %d prob %g\n", a, nt_solution[modelgridindex].allions[uniqueionindex].prob_num_auger[a]); } std::abort(); } } return prob_remaining; } - printoutf("WARNING: tried to ionise from Z=%02d ionstage %d to %d\n", get_atomicnumber(element), - get_ionstage(element, lowerion), get_ionstage(element, upperion)); + printout("WARNING: tried to ionise from Z=%02d ionstage %d to %d\n", get_atomicnumber(element), + get_ionstage(element, lowerion), get_ionstage(element, upperion)); return 0.; } return (upperion == lowerion + 1) ? 1.0 : 0.; @@ -2349,7 +2349,7 @@ __host__ __device__ auto nt_random_upperion(const int modelgridindex, const int } } - printoutf( + printout( "ERROR: nt_ionization_upperion_probability did not sum to more than zrand = %lg, prob_sum = %lg (Z=%d " "ionstage %d). Retrying with new random number.\n", zrand, prob_sum, get_atomicnumber(element), get_ionstage(element, lowerion)); @@ -2370,7 +2370,7 @@ __host__ __device__ auto nt_ionization_ratecoeff(const int modelgridindex, const // probably because eff_ionpot = 0 because the solver hasn't been run yet, or no impact ionization cross sections // exist const double Y_nt_wfapprox = nt_ionization_ratecoeff_wfapprox(modelgridindex, element, ion); - // printoutf("Warning: Spencer-Fano solver gives non-finite ionization rate (%g) for element %d ionstage %d for + // printout("Warning: Spencer-Fano solver gives non-finite ionization rate (%g) for element %d ionstage %d for // cell %d. Using WF approx instead = %g\n", // Y_nt, get_atomicnumber(element), get_ionstage(element, ion), modelgridindex, Y_nt_wfapprox); return Y_nt_wfapprox; @@ -2378,7 +2378,7 @@ __host__ __device__ auto nt_ionization_ratecoeff(const int modelgridindex, const if (Y_nt <= 0) { const double Y_nt_wfapprox = nt_ionization_ratecoeff_wfapprox(modelgridindex, element, ion); if (Y_nt_wfapprox > 0) { - printoutf( + printout( "Warning: Spencer-Fano solver gives negative or zero ionization rate (%g) for element Z=%d ionstage %d " "cell %d. Using WF approx instead = %g\n", Y_nt, get_atomicnumber(element), get_ionstage(element, ion), modelgridindex, Y_nt_wfapprox); @@ -2448,7 +2448,7 @@ __host__ __device__ void do_ntlepton_deposit(Packet &pkt) { // const double frac_ionization = get_nt_frac_ionization(modelgridindex); const double frac_ionization = get_ntion_energyrate(modelgridindex) / get_deposition_rate_density(modelgridindex); - // printoutf("frac_ionization compare %g and %g\n", frac_ionization, get_nt_frac_ionization(modelgridindex)); + // printout("frac_ionization compare %g and %g\n", frac_ionization, get_nt_frac_ionization(modelgridindex)); // const double frac_ionization = 0.; if (zrand < frac_ionization) { @@ -2474,7 +2474,7 @@ __host__ __device__ void do_ntlepton_deposit(Packet &pkt) { pkt.e_cmf); } - // printoutf("NTLEPTON packet in cell %d selected ionization of Z=%d ionstage %d to %d\n", + // printout("NTLEPTON packet in cell %d selected ionization of Z=%d ionstage %d to %d\n", // modelgridindex, get_atomicnumber(element), get_ionstage(element, lowerion), get_ionstage(element, // upperion)); do_macroatom(pkt, {.element = element, .ion = upperion, .level = 0, .activatingline = -99}); @@ -2506,7 +2506,7 @@ __host__ __device__ void do_ntlepton_deposit(Packet &pkt) { stats::increment(stats::COUNTER_NT_STAT_TO_EXCITATION); - // printoutf("NTLEPTON packet selected in cell %d excitation of Z=%d ionstage %d level %d upperlevel %d\n", + // printout("NTLEPTON packet selected in cell %d excitation of Z=%d ionstage %d level %d upperlevel %d\n", // modelgridindex, get_atomicnumber(element), get_ionstage(element, ion), lower, upper); do_macroatom(pkt, {.element = element, .ion = ion, .level = upper, .activatingline = -99}); @@ -2529,16 +2529,16 @@ __host__ __device__ void do_ntlepton_deposit(Packet &pkt) { void solve_spencerfano(const int modelgridindex, const int timestep, const int iteration) { bool skip_solution = false; if (grid::get_numassociatedcells(modelgridindex) < 1) { - printoutf("Associated_cells < 1 in cell %d at timestep %d. Skipping Spencer-Fano solution.\n", modelgridindex, - timestep); + printout("Associated_cells < 1 in cell %d at timestep %d. Skipping Spencer-Fano solution.\n", modelgridindex, + timestep); return; } if (timestep < globals::num_lte_timesteps + 1) { - printoutf("Skipping Spencer-Fano solution for first NLTE timestep\n"); + printout("Skipping Spencer-Fano solution for first NLTE timestep\n"); skip_solution = true; } else if (get_deposition_rate_density(modelgridindex) / EV < MINDEPRATE) { - printoutf( + printout( "Non-thermal deposition rate of %g eV/cm/s/cm^3 below MINDEPRATE %g in cell %d at timestep %d. Skipping " "Spencer-Fano solution.\n", get_deposition_rate_density(modelgridindex) / EV, MINDEPRATE, modelgridindex, timestep); @@ -2567,7 +2567,7 @@ void solve_spencerfano(const int modelgridindex, const int timestep, const int i const double nne_per_ion_fracdiff = fabs((nne_per_ion_last / nne_per_ion) - 1.); const int timestep_last_solved = nt_solution[modelgridindex].timestep_last_solved; - printoutf( + printout( "Spencer-Fano solver at timestep %d (last solution was at timestep %d) nne/niontot = %g, at last solution was %g " "fracdiff %g\n", timestep, timestep_last_solved, nne_per_ion, nne_per_ion_last, nne_per_ion_fracdiff); @@ -2575,7 +2575,7 @@ void solve_spencerfano(const int modelgridindex, const int timestep, const int i if ((nne_per_ion_fracdiff < NT_MAX_FRACDIFF_NNEPERION_BETWEEN_SOLUTIONS) && (timestep - timestep_last_solved <= SF_MAX_TIMESTEPS_BETWEEN_SOLUTIONS) && timestep_last_solved > globals::num_lte_timesteps) { - printoutf( + printout( "Keeping Spencer-Fano solution from timestep %d because x_e fracdiff %g < %g and because timestep %d - %d < " "%d\n", timestep_last_solved, nne_per_ion_fracdiff, NT_MAX_FRACDIFF_NNEPERION_BETWEEN_SOLUTIONS, timestep, @@ -2583,7 +2583,7 @@ void solve_spencerfano(const int modelgridindex, const int timestep, const int i return; } - printoutf( + printout( "Setting up Spencer-Fano equation with %d energy points from %g eV to %g eV in cell %d at timestep %d iteration " "%d (nne=%g e-/cm^3)\n", SFPTS, SF_EMIN, SF_EMAX, modelgridindex, timestep, iteration, nne); @@ -2601,7 +2601,7 @@ void solve_spencerfano(const int modelgridindex, const int timestep, const int i // enable_sfexcitation = false; // enable_sfionization = false; // - // printoutf("Doing a fast initial solution without ionization or excitation in the SF equation for the first NLTE + // printout("Doing a fast initial solution without ionization or excitation in the SF equation for the first NLTE // timestep.\n"); // } // if (timestep <= globals::num_lte_timesteps + 2) @@ -2611,7 +2611,7 @@ void solve_spencerfano(const int modelgridindex, const int timestep, const int i // enable_sfexcitation = false; // // enable_sfionization = false; // - // printoutf("Doing a faster solution without excitation in the SF equation for the first couple of NLTE + // printout("Doing a faster solution without excitation in the SF equation for the first couple of NLTE // timesteps.\n"); // } @@ -2640,14 +2640,14 @@ void solve_spencerfano(const int modelgridindex, const int timestep, const int i const int ionstage = get_ionstage(element, ion); if (first_included_ion_of_element) { - printoutf(" including Z=%2d ionstages: ", Z); + printout(" including Z=%2d ionstages: ", Z); for (int i = 1; i < get_ionstage(element, ion); i++) { - printoutf(" "); + printout(" "); } first_included_ion_of_element = false; } - printoutf("%d ", ionstage); + printout("%d ", ionstage); if (enable_sfexcitation) { sfmatrix_add_excitation(sfmatrix, modelgridindex, element, ion); @@ -2658,26 +2658,26 @@ void solve_spencerfano(const int modelgridindex, const int timestep, const int i } } if (!first_included_ion_of_element) { - printoutf("\n"); + printout("\n"); } } } - // printoutf("SF matrix | RHS vector:\n"); + // printout("SF matrix | RHS vector:\n"); // for (int row = 0; row < 10; row++) // { // for (int column = 0; column < 10; column++) // { // char str[15]; // snprintf(str, 15, "%+.1e ", gsl_matrix_get(sfmatrix, row, column)); - // printoutf(str); + // printout(str); // } - // printoutf("| "); + // printout("| "); // char str[15]; // snprintf(str, 15, "%+.1e\n", gsl_vector_get(rhsvec, row)); - // printoutf(str); + // printout(str); // } - // printoutf("\n"); + // printout("\n"); decompactify_triangular_matrix(sfmatrix); const auto yfunc = sfmatrix_solve(sfmatrix); @@ -2690,7 +2690,7 @@ void solve_spencerfano(const int modelgridindex, const int timestep, const int i } void write_restart_data(FILE *gridsave_file) { - printoutf("non-thermal solver, "); + printout("non-thermal solver, "); fprintf(gridsave_file, "%d\n", 24724518); // special number marking the beginning of NT data fprintf(gridsave_file, "%d %la %la\n", SFPTS, SF_EMIN, SF_EMAX); @@ -2729,12 +2729,12 @@ void write_restart_data(FILE *gridsave_file) { } void read_restart_data(FILE *gridsave_file) { - printoutf("Reading restart data for non-thermal solver\n"); + printout("Reading restart data for non-thermal solver\n"); int code_check = 0; assert_always(fscanf(gridsave_file, "%d\n", &code_check) == 1); if (code_check != 24724518) { - printoutf("ERROR: Beginning of non-thermal restart data not found! Found %d instead of 24724518\n", code_check); + printout("ERROR: Beginning of non-thermal restart data not found! Found %d instead of 24724518\n", code_check); std::abort(); } @@ -2744,9 +2744,9 @@ void read_restart_data(FILE *gridsave_file) { assert_always(fscanf(gridsave_file, "%d %la %la\n", &sfpts_in, &SF_EMIN_in, &SF_EMAX_in) == 3); if (sfpts_in != SFPTS || SF_EMIN_in != SF_EMIN || SF_EMAX_in != SF_EMAX) { - printoutf("ERROR: gridsave file specifies %d Spencer-Fano samples, SF_EMIN %lg SF_EMAX %lg\n", sfpts_in, SF_EMIN_in, - SF_EMAX_in); - printoutf("ERROR: This simulation has %d Spencer-Fano samples, SF_EMIN %lg SF_EMAX %lg\n", SFPTS, SF_EMIN, SF_EMAX); + printout("ERROR: gridsave file specifies %d Spencer-Fano samples, SF_EMIN %lg SF_EMAX %lg\n", sfpts_in, SF_EMIN_in, + SF_EMAX_in); + printout("ERROR: This simulation has %d Spencer-Fano samples, SF_EMIN %lg SF_EMAX %lg\n", SFPTS, SF_EMIN, SF_EMAX); std::abort(); } @@ -2762,7 +2762,7 @@ void read_restart_data(FILE *gridsave_file) { &nt_solution[modelgridindex].frac_excitation) == 4); if (mgi_in != modelgridindex) { - printoutf("ERROR: expected data for cell %d but found cell %d\n", modelgridindex, mgi_in); + printout("ERROR: expected data for cell %d but found cell %d\n", modelgridindex, mgi_in); std::abort(); } @@ -2803,7 +2803,7 @@ void nt_MPI_Bcast(const int modelgridindex, const int root, const int root_node_ return; } - // printoutf("nonthermal_MPI_Bcast cell %d before: ratecoeff(Z=%d ionstage %d): %g, eff_ionpot %g eV\n", + // printout("nonthermal_MPI_Bcast cell %d before: ratecoeff(Z=%d ionstage %d): %g, eff_ionpot %g eV\n", // modelgridindex, logged_element_z, logged_ionstage, // nt_ionization_ratecoeff_sf(modelgridindex, logged_element_index, logged_ion_index), // get_eff_ionpot(modelgridindex, logged_element_index, logged_ion_index) / EV); @@ -2844,7 +2844,7 @@ void nt_reset_stats() { nt_energy_deposited = 0.; } void nt_print_stats(const double modelvolume, const double deltat) { const double deposition_rate_density_montecarlo = nt_energy_deposited / EV / modelvolume / deltat; - printoutf("nt_energy_deposited = %g [eV/s/cm^3]\n", deposition_rate_density_montecarlo); + printout("nt_energy_deposited = %g [eV/s/cm^3]\n", deposition_rate_density_montecarlo); } } // namespace nonthermal diff --git a/packet.cc b/packet.cc index aa34d9597..822eb11c2 100644 --- a/packet.cc +++ b/packet.cc @@ -91,18 +91,18 @@ void packet_init(Packet *pkt) #ifdef MPI_ON MPI_Barrier(MPI_COMM_WORLD); #endif - printoutf("UNIFORM_PELLET_ENERGIES is %s\n", (UNIFORM_PELLET_ENERGIES ? "true" : "false")); + printout("UNIFORM_PELLET_ENERGIES is %s\n", (UNIFORM_PELLET_ENERGIES ? "true" : "false")); - printoutf("INITIAL_PACKETS_ON is %s\n", (INITIAL_PACKETS_ON ? "on" : "off")); + printout("INITIAL_PACKETS_ON is %s\n", (INITIAL_PACKETS_ON ? "on" : "off")); // The total number of pellets that we want to start with is just // npkts. The total energy of the pellets is given by etot. const double etot_tinf = decay::get_global_etot_t0_tinf(); - printoutf("etot %g (t_0 to t_inf)\n", etot_tinf); + printout("etot %g (t_0 to t_inf)\n", etot_tinf); const double e0_tinf = etot_tinf / globals::npkts; - printoutf("packet e0 (t_0 to t_inf) %g erg\n", e0_tinf); + printout("packet e0 (t_0 to t_inf) %g erg\n", e0_tinf); decay::setup_decaypath_energy_per_mass(); @@ -127,13 +127,13 @@ void packet_init(Packet *pkt) const double etot = norm; // So energy per pellet is const double e0 = etot / globals::npkts; - printoutf("packet e0 (in time range) %g erg\n", e0); + printout("packet e0 (in time range) %g erg\n", e0); - printoutf("etot %g erg (in time range) erg\n", etot); + printout("etot %g erg (in time range) erg\n", etot); // Now place the pellets in the ejecta and decide at what time they will decay. - printoutf("Placing pellets...\n"); + printout("Placing pellets...\n"); auto allpkts = std::ranges::iota_view{0, globals::npkts}; std::ranges::for_each(allpkts, [&, norm, e0](const int n) { pkt[n] = Packet{}; @@ -153,14 +153,14 @@ void packet_init(Packet *pkt) e_cmf_total += pkt[n].e_cmf; } const double e_ratio = etot / e_cmf_total; - printoutf("packet energy sum %g should be %g normalisation factor: %g\n", e_cmf_total, etot, e_ratio); + printout("packet energy sum %g should be %g normalisation factor: %g\n", e_cmf_total, etot, e_ratio); assert_always(std::isfinite(e_cmf_total)); e_cmf_total *= e_ratio; for (int n = 0; n < globals::npkts; n++) { pkt[n].e_cmf *= e_ratio; pkt[n].e_rf *= e_ratio; } - printoutf("total energy that will be freed during simulation time: %g erg\n", e_cmf_total); + printout("total energy that will be freed during simulation time: %g erg\n", e_cmf_total); } // write packets text file @@ -212,12 +212,12 @@ void read_temp_packetsfile(const int timestep, const int my_rank, Packet *pkt) { char filename[MAXFILENAMELENGTH]; snprintf(filename, MAXFILENAMELENGTH, "packets_%.4d_ts%d.tmp", my_rank, timestep); - printoutf("Reading %s...", filename); + printout("Reading %s...", filename); FILE *packets_file = fopen_required(filename, "rb"); assert_always(std::fread(pkt, sizeof(Packet), globals::npkts, packets_file) == static_cast(globals::npkts)); fclose(packets_file); - printoutf("done\n"); + printout("done\n"); } auto verify_temp_packetsfile(const int timestep, const int my_rank, const Packet *const pkt) -> bool { @@ -227,25 +227,25 @@ auto verify_temp_packetsfile(const int timestep, const int my_rank, const Packet char filename[MAXFILENAMELENGTH]; snprintf(filename, MAXFILENAMELENGTH, "packets_%.4d_ts%d.tmp", my_rank, timestep); - printoutf("Verifying file %s...", filename); + printout("Verifying file %s...", filename); FILE *packets_file = fopen_required(filename, "rb"); Packet pkt_in; bool readback_passed = true; for (int n = 0; n < globals::npkts; n++) { assert_always(std::fread(&pkt_in, sizeof(Packet), 1, packets_file) == 1); if (pkt_in != pkt[n]) { - printoutf("failed on packet %d\n", n); - printoutf(" compare number %d %d\n", pkt_in.number, pkt[n].number); - printoutf(" compare nu_cmf %lg %lg\n", pkt_in.nu_cmf, pkt[n].nu_cmf); - printoutf(" compare e_rf %lg %lg\n", pkt_in.e_rf, pkt[n].e_rf); + printout("failed on packet %d\n", n); + printout(" compare number %d %d\n", pkt_in.number, pkt[n].number); + printout(" compare nu_cmf %lg %lg\n", pkt_in.nu_cmf, pkt[n].nu_cmf); + printout(" compare e_rf %lg %lg\n", pkt_in.e_rf, pkt[n].e_rf); readback_passed = false; } } fclose(packets_file); if (readback_passed) { - printoutf(" verification passed\n"); + printout(" verification passed\n"); } else { - printoutf(" verification FAILED\n"); + printout(" verification FAILED\n"); } return readback_passed; } @@ -267,7 +267,7 @@ void read_packets(const char filename[], Packet *pkt) { const int i = packets_read - 1; if (i > globals::npkts - 1) { - printoutf( + printout( "ERROR: More data found beyond packet %d (expecting %d packets). Recompile exspec with the correct number " "of packets. Run (wc -l < packets00_0000.out) to count them.\n", packets_read, globals::npkts); @@ -324,7 +324,7 @@ void read_packets(const char filename[], Packet *pkt) { } if (packets_read < globals::npkts) { - printoutf( + printout( "ERROR: Read failed after packet %d (expecting %d packets). Recompile exspec with the correct number of " "packets. Run (wc -l < packets00_0000.out) to count them.\n", packets_read, globals::npkts); diff --git a/radfield.cc b/radfield.cc index 6059c51d0..08b62977b 100644 --- a/radfield.cc +++ b/radfield.cc @@ -145,7 +145,7 @@ constexpr auto select_bin(const double nu) -> int { void realloc_detailed_lines(const int new_size) { auto *newptr = static_cast(realloc(detailed_lineindicies, new_size * sizeof(int))); if (newptr == nullptr) { - printoutf("ERROR: Not enough memory to reallocate detailed Jblue estimator line list\n"); + printout("ERROR: Not enough memory to reallocate detailed Jblue estimator line list\n"); std::abort(); } assert_always(newptr != nullptr); @@ -160,8 +160,7 @@ void realloc_detailed_lines(const int new_size) { static_cast(realloc(Jb_lu_raw[modelgridindex], new_size * sizeof(Jb_lu_estimator))); if (prev_Jb_lu_normed[modelgridindex] == nullptr || Jb_lu_raw[modelgridindex] == nullptr) { - printoutf("ERROR: Not enough memory to reallocate detailed Jblue estimator list for cell %d.\n", - modelgridindex); + printout("ERROR: Not enough memory to reallocate detailed Jblue estimator list for cell %d.\n", modelgridindex); std::abort(); } } @@ -188,7 +187,7 @@ void add_detailed_line(const int lineindex) { } detailed_lineindicies[detailed_linecount] = lineindex; detailed_linecount++; - // printoutf("Added Jblue estimator for lineindex %d count %d\n", lineindex, detailed_linecount); + // printout("Added Jblue estimator for lineindex %d count %d\n", lineindex, detailed_linecount); } // get the normalised J_nu @@ -289,8 +288,8 @@ auto planck_integral(const double T_R, const double nu_lower, const double nu_up const int status = integrator(intparas, nu_lower, nu_upper, epsabs, epsrel, GSL_INTEG_GAUSS61, &integral, &error); if (status != 0) { - printoutf("planck_integral integrator status %d, GSL_FAILURE= %d. Integral value %g, setting to zero.\n", status, - GSL_FAILURE, integral); + printout("planck_integral integrator status %d, GSL_FAILURE= %d. Integral value %g, setting to zero.\n", status, + GSL_FAILURE, integral); integral = 0.; } gsl_set_error_handler(previous_handler); @@ -319,14 +318,14 @@ auto delta_nu_bar(const double T_R, void *const paras) -> double // double planck_integral_result = planck_integral_analytic(T_R, nu_lower, nu_upper, false); // double nu_bar_planck = nu_times_planck_integral / planck_integral_result; - // // printoutf("nu_bar %g nu_bar_planck(T=%g) %g\n",nu_bar,T_R,nu_bar_planck); + // // printout("nu_bar %g nu_bar_planck(T=%g) %g\n",nu_bar,T_R,nu_bar_planck); // if (!std::isfinite(nu_bar_planck)) { // double nu_times_planck_numerical = planck_integral(T_R, nu_lower, nu_upper, true); // double planck_integral_numerical = planck_integral(T_R, nu_lower, nu_upper, false); // double nu_bar_planck_numerical = nu_times_planck_numerical / planck_integral_numerical; - // printoutf("planck_integral_analytic is %g. Replacing with numerical result of %g.\n", nu_bar_planck, + // printout("planck_integral_analytic is %g. Replacing with numerical result of %g.\n", nu_bar_planck, // nu_bar_planck_numerical); // nu_bar_planck = nu_bar_planck_numerical; // } @@ -334,7 +333,7 @@ auto delta_nu_bar(const double T_R, void *const paras) -> double const double delta_nu_bar = nu_bar_planck_T_R - nu_bar_estimator; if (!std::isfinite(delta_nu_bar)) { - printoutf( + printout( "delta_nu_bar is %g. nu_bar_planck_T_R %g nu_times_planck_numerical %g planck_integral_numerical %g " "nu_bar_estimator %g\n", delta_nu_bar, nu_bar_planck_T_R, nu_times_planck_numerical, planck_integral_numerical, nu_bar_estimator); @@ -354,7 +353,7 @@ auto find_T_R(const int modelgridindex, const int binindex) -> float { double delta_nu_bar_min = delta_nu_bar(T_R_min, ¶s); double delta_nu_bar_max = delta_nu_bar(T_R_max, ¶s); - // printoutf("find_T_R: bin %4d delta_nu_bar(T_R_min) %g, delta_nu_bar(T_R_max) %g\n", + // printout("find_T_R: bin %4d delta_nu_bar(T_R_min) %g, delta_nu_bar(T_R_max) %g\n", // binindex, delta_nu_bar_min,delta_nu_bar_max); if (!std::isfinite(delta_nu_bar_min) || !std::isfinite(delta_nu_bar_max)) { @@ -382,7 +381,7 @@ auto find_T_R(const int modelgridindex, const int binindex) -> float { const double T_R_upper = gsl_root_fsolver_x_upper(T_R_solver); status = gsl_root_test_interval(T_R_lower, T_R_upper, epsabs, epsrel); - // printoutf("find_T_R: bin %4d iter %d, T_R is between %7.1f and %7.1f, guess %7.1f, delta_nu_bar %g, status + // printout("find_T_R: bin %4d iter %d, T_R is between %7.1f and %7.1f, guess %7.1f, delta_nu_bar %g, status // %d\n", // binindex,iteration_num,T_R_lower,T_R_upper,T_R,delta_nu_bar(T_R,¶s),status); if (status != GSL_CONTINUE) { @@ -391,7 +390,7 @@ auto find_T_R(const int modelgridindex, const int binindex) -> float { } if (status == GSL_CONTINUE) { - printoutf("[warning] find_T_R: T_R did not converge within %d iterations\n", maxit); + printout("[warning] find_T_R: T_R did not converge within %d iterations\n", maxit); } gsl_root_fsolver_free(T_R_solver); @@ -399,12 +398,12 @@ auto find_T_R(const int modelgridindex, const int binindex) -> float { // Thermal balance equation always negative ===> T_R = T_min // Calculate the rates again at this T_e to print them to file T_R = T_R_max; - printoutf("find_T_R: cell %d bin %4d no solution in interval, clamping to T_R_max=%g\n", modelgridindex, binindex, - T_R_max); + printout("find_T_R: cell %d bin %4d no solution in interval, clamping to T_R_max=%g\n", modelgridindex, binindex, + T_R_max); } else { T_R = T_R_min; - printoutf("find_T_R: cell %d bin %4d no solution in interval, clamping to T_R_min=%g\n", modelgridindex, binindex, - T_R_min); + printout("find_T_R: cell %d bin %4d no solution in interval, clamping to T_R_min=%g\n", modelgridindex, binindex, + T_R_min); } return T_R; @@ -414,29 +413,29 @@ void set_params_fullspec(const int modelgridindex, const int timestep) { const int nonemptymgi = grid::get_modelcell_nonemptymgi(modelgridindex); const double nubar = nuJ[nonemptymgi] / J[nonemptymgi]; if (!std::isfinite(nubar) || nubar == 0.) { - printoutf("[warning] T_R estimator infinite in cell %d, keep T_R, T_J, W of last timestep. J = %g. nuJ = %g\n", - modelgridindex, J[nonemptymgi], nuJ[nonemptymgi]); + printout("[warning] T_R estimator infinite in cell %d, keep T_R, T_J, W of last timestep. J = %g. nuJ = %g\n", + modelgridindex, J[nonemptymgi], nuJ[nonemptymgi]); } else { float T_J = pow(J[nonemptymgi] * PI / STEBO, 1 / 4.); if (T_J > MAXTEMP) { - printoutf("[warning] temperature estimator T_J = %g exceeds T_max %g in cell %d. Setting T_J = T_max!\n", T_J, - MAXTEMP, modelgridindex); + printout("[warning] temperature estimator T_J = %g exceeds T_max %g in cell %d. Setting T_J = T_max!\n", T_J, + MAXTEMP, modelgridindex); T_J = MAXTEMP; } else if (T_J < MINTEMP) { - printoutf("[warning] temperature estimator T_J = %g below T_min %g in cell %d. Setting T_J = T_min!\n", T_J, - MINTEMP, modelgridindex); + printout("[warning] temperature estimator T_J = %g below T_min %g in cell %d. Setting T_J = T_min!\n", T_J, + MINTEMP, modelgridindex); T_J = MINTEMP; } grid::set_TJ(modelgridindex, T_J); float T_R = H * nubar / KB / 3.832229494; if (T_R > MAXTEMP) { - printoutf("[warning] temperature estimator T_R = %g exceeds T_max %g in cell %d. Setting T_R = T_max!\n", T_R, - MAXTEMP, modelgridindex); + printout("[warning] temperature estimator T_R = %g exceeds T_max %g in cell %d. Setting T_R = T_max!\n", T_R, + MAXTEMP, modelgridindex); T_R = MAXTEMP; } else if (T_R < MINTEMP) { - printoutf("[warning] temperature estimator T_R = %g below T_min %g in cell %d. Setting T_R = T_min!\n", T_R, - MINTEMP, modelgridindex); + printout("[warning] temperature estimator T_R = %g below T_min %g in cell %d. Setting T_R = T_min!\n", T_R, + MINTEMP, modelgridindex); T_R = MINTEMP; } grid::set_TR(modelgridindex, T_R); @@ -444,7 +443,7 @@ void set_params_fullspec(const int modelgridindex, const int timestep) { const float W = J[nonemptymgi] * PI / STEBO / pow(T_R, 4); grid::set_W(modelgridindex, W); - printoutf( + printout( "Full-spectrum fit radfield for cell %d at timestep %d: J %g, nubar %5.1f Angstrom, T_J %g, T_R %g, W %g\n", modelgridindex, timestep, J[nonemptymgi], 1e8 * CLIGHT / nubar, T_J, T_R, W); } @@ -526,7 +525,7 @@ void init(const int my_rank, const int ndo_nonempty) { } if (addline) { - // printoutf("Adding Jblue estimator for lineindex %d Z=%02d ionstage %d lower %d upper %d A_ul %g\n", + // printout("Adding Jblue estimator for lineindex %d Z=%02d ionstage %d lower %d upper %d A_ul %g\n", // i, Z, ionstage, lowerlevel, upperlevel, A_ul); add_detailed_line(i); } @@ -543,13 +542,13 @@ void init(const int my_rank, const int ndo_nonempty) { std::SORT_OR_STABLE_SORT(detailed_lineindicies, detailed_lineindicies + detailed_linecount); } - printoutf("There are %d lines with detailed Jblue_lu estimators.\n", detailed_linecount); + printout("There are %d lines with detailed Jblue_lu estimators.\n", detailed_linecount); - printoutf("DETAILED_BF_ESTIMATORS %s", DETAILED_BF_ESTIMATORS_ON ? "ON" : "OFF"); + printout("DETAILED_BF_ESTIMATORS %s", DETAILED_BF_ESTIMATORS_ON ? "ON" : "OFF"); if (DETAILED_BF_ESTIMATORS_ON) { - printoutf(" from timestep %d\n", DETAILED_BF_ESTIMATORS_USEFROMTIMESTEP); + printout(" from timestep %d\n", DETAILED_BF_ESTIMATORS_USEFROMTIMESTEP); } else { - printoutf("\n"); + printout("\n"); } #ifdef MPI_ON const auto [_, noderank_nonemptycellcount] = @@ -557,11 +556,11 @@ void init(const int my_rank, const int ndo_nonempty) { #endif if (MULTIBIN_RADFIELD_MODEL_ON) { - printoutf("The multibin radiation field is being used from timestep %d onwards.\n", FIRST_NLTE_RADFIELD_TIMESTEP); + printout("The multibin radiation field is being used from timestep %d onwards.\n", FIRST_NLTE_RADFIELD_TIMESTEP); - printoutf("Initialising multibin radiation field with %d bins from (%.2f eV, %6.1f A) to (%.2f eV, %6.1f A)\n", - RADFIELDBINCOUNT, H * nu_lower_first_initial / EV, 1e8 * CLIGHT / nu_lower_first_initial, - H * nu_upper_last_initial / EV, 1e8 * CLIGHT / nu_upper_last_initial); + printout("Initialising multibin radiation field with %d bins from (%.2f eV, %6.1f A) to (%.2f eV, %6.1f A)\n", + RADFIELDBINCOUNT, H * nu_lower_first_initial / EV, 1e8 * CLIGHT / nu_lower_first_initial, + H * nu_upper_last_initial / EV, 1e8 * CLIGHT / nu_upper_last_initial); if (ndo_nonempty > 0) { char filename[MAXFILENAMELENGTH]; snprintf(filename, MAXFILENAMELENGTH, "radfield_%.4d.out", my_rank); @@ -592,13 +591,13 @@ void init(const int my_rank, const int ndo_nonempty) { } #endif - printoutf("[info] mem_usage: radiation field bin accumulators for non-empty cells occupy %.3f MB\n", - mem_usage_bins / 1024. / 1024.); - printoutf( + printout("[info] mem_usage: radiation field bin accumulators for non-empty cells occupy %.3f MB\n", + mem_usage_bins / 1024. / 1024.); + printout( "[info] mem_usage: radiation field bin solutions for non-empty cells occupy %.3f MB (node shared memory)\n", mem_usage_bin_solutions / 1024. / 1024.); } else { - printoutf("The radiation field model is a full-spectrum fit to a single dilute blackbody TR & W.\n"); + printout("The radiation field model is a full-spectrum fit to a single dilute blackbody TR & W.\n"); } if constexpr (DETAILED_BF_ESTIMATORS_ON) { @@ -613,13 +612,13 @@ void init(const int my_rank, const int ndo_nonempty) { prev_bfrate_normed = static_cast(malloc(nonempty_npts_model * globals::bfestimcount * sizeof(float))); #endif } - printoutf("[info] mem_usage: detailed bf estimators for non-empty cells occupy %.3f MB (node shared memory)\n", - nonempty_npts_model * globals::bfestimcount * sizeof(float) / 1024. / 1024.); + printout("[info] mem_usage: detailed bf estimators for non-empty cells occupy %.3f MB (node shared memory)\n", + nonempty_npts_model * globals::bfestimcount * sizeof(float) / 1024. / 1024.); bfrate_raw.resize(nonempty_npts_model * globals::bfestimcount); - printoutf("[info] mem_usage: detailed bf estimator acculumators for non-empty cells occupy %.3f MB\n", - nonempty_npts_model * globals::bfestimcount * sizeof(double) / 1024. / 1024.); + printout("[info] mem_usage: detailed bf estimator acculumators for non-empty cells occupy %.3f MB\n", + nonempty_npts_model * globals::bfestimcount * sizeof(double) / 1024. / 1024.); } zero_estimators(); @@ -693,7 +692,7 @@ auto get_Jblueindex(const int lineindex) -> int { // const int ion = linelist[lineindex].ionindex; // const int lower = linelist[lineindex].lowerlevelindex; // const int upper = linelist[lineindex].upperlevelindex; - // printoutf("Could not find lineindex %d among %d items (Z=%02d ionstage %d lower %d upper %d)\n", + // printout("Could not find lineindex %d among %d items (Z=%02d ionstage %d lower %d upper %d)\n", // lineindex, detailed_linecount, get_atomicnumber(element), get_ionstage(element, ion), lower, upper); return -1; @@ -936,7 +935,7 @@ auto planck_integral_analytic(const double T_R, const double nu_lower, const dou // + 6 * polylog(4,lowerexp) / pow(HOVERKB,4); // double integral2 = TWOHOVERCLIGHTSQUARED * (upperint - lowerint); - // printoutf("planck_integral_analytic is zero. debye_upper %g debye_lower %g. Test alternative %g\n", + // printout("planck_integral_analytic is zero. debye_upper %g debye_lower %g. Test alternative %g\n", // debye_upper,debye_lower,integral2); } } @@ -952,8 +951,8 @@ void fit_parameters(const int modelgridindex, const int timestep) { if constexpr (MULTIBIN_RADFIELD_MODEL_ON) { if (J_normfactor[nonemptymgi] <= 0) { - printoutf("radfield: FATAL J_normfactor = %g in cell %d at call to fit_parameters", J_normfactor[nonemptymgi], - modelgridindex); + printout("radfield: FATAL J_normfactor = %g in cell %d at call to fit_parameters", J_normfactor[nonemptymgi], + modelgridindex); std::abort(); } @@ -962,8 +961,8 @@ void fit_parameters(const int modelgridindex, const int timestep) { J_bin_sum += get_bin_J(modelgridindex, binindex); } - printoutf("radfield bins sum to J of %g (%.1f%% of total J).\n", J_bin_sum, 100. * J_bin_sum / J[nonemptymgi]); - printoutf("radfield: Finding parameters for %d bins...\n", RADFIELDBINCOUNT); + printout("radfield bins sum to J of %g (%.1f%% of total J).\n", J_bin_sum, 100. * J_bin_sum / J[nonemptymgi]); + printout("radfield: Finding parameters for %d bins...\n", RADFIELDBINCOUNT); double J_bin_max = 0.; for (int binindex = 0; binindex < RADFIELDBINCOUNT; binindex++) { @@ -985,29 +984,29 @@ void fit_parameters(const int modelgridindex, const int timestep) { if (binindex == RADFIELDBINCOUNT - 1) { const auto T_e = grid::get_Te(modelgridindex); - printoutf(" replacing bin %d T_R %7.1f with cell T_e = %7.1f\n", binindex, - get_bin_T_R(modelgridindex, binindex), T_e); + printout(" replacing bin %d T_R %7.1f with cell T_e = %7.1f\n", binindex, + get_bin_T_R(modelgridindex, binindex), T_e); T_R_bin = T_e; } double planck_integral_result = planck_integral(T_R_bin, nu_lower, nu_upper, false); - // printoutf("planck_integral(T_R=%g, nu_lower=%g, nu_upper=%g) = %g\n", T_R_bin, nu_lower, + // printout("planck_integral(T_R=%g, nu_lower=%g, nu_upper=%g) = %g\n", T_R_bin, nu_lower, // nu_upper, planck_integral_result); W_bin = J_bin / planck_integral_result; if (W_bin > 1e4) { - // printoutf("T_R_bin %g, nu_lower %g, nu_upper %g\n", T_R_bin, nu_lower, nu_upper); - printoutf("W %g too high, trying setting T_R of bin %d to %g. J_bin %g planck_integral %g\n", W_bin, - binindex, T_R_max, J_bin, planck_integral_result); + // printout("T_R_bin %g, nu_lower %g, nu_upper %g\n", T_R_bin, nu_lower, nu_upper); + printout("W %g too high, trying setting T_R of bin %d to %g. J_bin %g planck_integral %g\n", W_bin, + binindex, T_R_max, J_bin, planck_integral_result); planck_integral_result = planck_integral(T_R_max, nu_lower, nu_upper, false); W_bin = J_bin / planck_integral_result; if (W_bin > 1e4) { - printoutf("W still very high, W=%g. Zeroing bin...\n", W_bin); + printout("W still very high, W=%g. Zeroing bin...\n", W_bin); T_R_bin = -99.; W_bin = 0.; } else { - printoutf("new W is %g. Continuing with this value\n", W_bin); + printout("new W is %g. Continuing with this value\n", W_bin); T_R_bin = T_R_max; } } @@ -1092,17 +1091,17 @@ auto get_T_J_from_J(const int modelgridindex) -> double { const double T_J = pow(J[nonemptymgi] * PI / STEBO, 1. / 4.); if (!std::isfinite(T_J)) { // keep old value of T_J - printoutf("[warning] get_T_J_from_J: T_J estimator infinite in cell %d, use value of last timestep\n", - modelgridindex); + printout("[warning] get_T_J_from_J: T_J estimator infinite in cell %d, use value of last timestep\n", + modelgridindex); return grid::get_TR(modelgridindex); } // Make sure that T is in the allowed temperature range. if (T_J > MAXTEMP) { - printoutf("[warning] get_T_J_from_J: T_J would be %.1f > MAXTEMP. Clamping to MAXTEMP = %.0f K\n", T_J, MAXTEMP); + printout("[warning] get_T_J_from_J: T_J would be %.1f > MAXTEMP. Clamping to MAXTEMP = %.0f K\n", T_J, MAXTEMP); return MAXTEMP; } if (T_J < MINTEMP) { - printoutf("[warning] get_T_J_from_J: T_J would be %.1f < MINTEMP. Clamping to MINTEMP = %.0f K\n", T_J, MINTEMP); + printout("[warning] get_T_J_from_J: T_J would be %.1f < MINTEMP. Clamping to MINTEMP = %.0f K\n", T_J, MINTEMP); return MINTEMP; } return T_J; @@ -1150,7 +1149,7 @@ void reduce_estimators() if constexpr (MULTIBIN_RADFIELD_MODEL_ON) { const auto sys_time_start_reduction = std::time(nullptr); - printoutf("Reducing binned radiation field estimators"); + printout("Reducing binned radiation field estimators"); assert_always(radfieldbins != nullptr); for (ptrdiff_t nonemptymgi = 0; nonemptymgi < nonempty_npts_model; nonemptymgi++) { @@ -1162,12 +1161,12 @@ void reduce_estimators() } } const int duration_reduction = std::time(nullptr) - sys_time_start_reduction; - printoutf(" (took %d s)\n", duration_reduction); + printout(" (took %d s)\n", duration_reduction); } if constexpr (DETAILED_LINE_ESTIMATORS_ON) { const auto sys_time_start_reduction = std::time(nullptr); - printoutf("Reducing detailed line estimators"); + printout("Reducing detailed line estimators"); for (int modelgridindex = 0; modelgridindex < grid::get_npts_model(); modelgridindex++) { if (grid::get_numassociatedcells(modelgridindex) > 0) { @@ -1180,7 +1179,7 @@ void reduce_estimators() } } const int duration_reduction = std::time(nullptr) - sys_time_start_reduction; - printoutf(" (took %d s)\n", duration_reduction); + printout(" (took %d s)\n", duration_reduction); } MPI_Barrier(MPI_COMM_WORLD); } @@ -1217,7 +1216,7 @@ void do_MPI_Bcast(const int modelgridindex, const int root, const int root_node_ #endif void write_restart_data(FILE *gridsave_file) { - printoutf("binned radiation field and detailed lines, "); + printout("binned radiation field and detailed lines, "); fprintf(gridsave_file, "%d\n", 30490824); // special number marking the beginning of radfield data @@ -1283,12 +1282,12 @@ void write_restart_data(FILE *gridsave_file) { } void read_restart_data(FILE *gridsave_file) { - printoutf("Reading restart data for radiation field\n"); + printout("Reading restart data for radiation field\n"); int code_check = 0; assert_always(fscanf(gridsave_file, "%d\n", &code_check) == 1); if (code_check != 30490824) { - printoutf("ERROR: Beginning of radfield restart data not found! Found %d instead of 30490824\n", code_check); + printout("ERROR: Beginning of radfield restart data not found! Found %d instead of 30490824\n", code_check); std::abort(); } @@ -1313,12 +1312,12 @@ void read_restart_data(FILE *gridsave_file) { if (bincount_in != RADFIELDBINCOUNT || T_R_min_in != T_R_min || T_R_max_in != T_R_max || nu_lower_first_ratio < 0.999 || nu_upper_last_ratio < 0.999) { - printoutf( + printout( "ERROR: gridsave file specifies %d bins, nu_lower_first_initial %lg nu_upper_last_initial %lg T_R_min %lg " "T_R_max %lg\n", bincount_in, nu_lower_first_initial_in, nu_upper_last_initial_in, T_R_min_in, T_R_max_in); - printoutf("require %d bins, nu_lower_first_initial %lg nu_upper_last_initial %lg T_R_min %lg T_R_max %lg\n", - RADFIELDBINCOUNT, nu_lower_first_initial, nu_upper_last_initial, T_R_min, T_R_max); + printout("require %d bins, nu_lower_first_initial %lg nu_upper_last_initial %lg T_R_min %lg T_R_max %lg\n", + RADFIELDBINCOUNT, nu_lower_first_initial, nu_upper_last_initial, T_R_min, T_R_max); std::abort(); } @@ -1363,8 +1362,8 @@ void read_restart_data(FILE *gridsave_file) { assert_always(fscanf(gridsave_file, "%d\n", &detailed_linecount_in) == 1); if (detailed_linecount_in != detailed_linecount) { - printoutf("ERROR: gridsave file specifies %d detailed lines but this simulation has %d.\n", detailed_linecount_in, - detailed_linecount); + printout("ERROR: gridsave file specifies %d detailed lines but this simulation has %d.\n", detailed_linecount_in, + detailed_linecount); std::abort(); } @@ -1379,7 +1378,7 @@ void read_restart_data(FILE *gridsave_file) { int mgi_in = 0; assert_always(fscanf(gridsave_file, "%d %la\n", &mgi_in, &J_normfactor[nonemptymgi]) == 2); if (mgi_in != modelgridindex) { - printoutf("ERROR: expected data for cell %d but found cell %d\n", modelgridindex, mgi_in); + printout("ERROR: expected data for cell %d but found cell %d\n", modelgridindex, mgi_in); std::abort(); } @@ -1411,7 +1410,7 @@ void read_restart_data(FILE *gridsave_file) { } assert_always(fscanf(gridsave_file, "%d\n", &code_check) == 1); if (code_check != 42809403) { - printoutf("ERROR: End of radfield restart data not found! Found %d instead of 42809403\n", code_check); + printout("ERROR: End of radfield restart data not found! Found %d instead of 42809403\n", code_check); std::abort(); } } diff --git a/ratecoeff.cc b/ratecoeff.cc index ae397a166..f6715a1cd 100644 --- a/ratecoeff.cc +++ b/ratecoeff.cc @@ -63,11 +63,11 @@ auto read_ratecoeff_dat(FILE *ratecoeff_file) -> bool if (fscanf(ratecoeff_file, "%32s\n", adatafile_hash_in) != 1) { return false; } - printoutf("ratecoeff.dat: MD5 adata.txt = %s ", adatafile_hash_in); + printout("ratecoeff.dat: MD5 adata.txt = %s ", adatafile_hash_in); if (strcmp(adatafile_hash, adatafile_hash_in) == 0) { - printoutf("(pass)\n"); + printout("(pass)\n"); } else { - printoutf("MISMATCH: MD5 adata.txt = %s\n", adatafile_hash); + printout("MISMATCH: MD5 adata.txt = %s\n", adatafile_hash); return false; } @@ -75,11 +75,11 @@ auto read_ratecoeff_dat(FILE *ratecoeff_file) -> bool if (fscanf(ratecoeff_file, "%32s\n", compositionfile_hash_in) != 1) { return false; } - printoutf("ratecoeff.dat: MD5 compositiondata.txt %s ", compositionfile_hash_in); + printout("ratecoeff.dat: MD5 compositiondata.txt %s ", compositionfile_hash_in); if (strcmp(compositionfile_hash, compositionfile_hash_in) == 0) { - printoutf("(pass)\n"); + printout("(pass)\n"); } else { - printoutf("\nMISMATCH: MD5 compositiondata.txt = %s\n", compositionfile_hash); + printout("\nMISMATCH: MD5 compositiondata.txt = %s\n", compositionfile_hash); return false; } @@ -89,11 +89,11 @@ auto read_ratecoeff_dat(FILE *ratecoeff_file) -> bool if (fscanf(ratecoeff_file, "%32s\n", phixsfile_hash_in) != 1) { return false; } - printoutf("ratecoeff.dat: MD5 %s = %s ", phixsdata_filenames[phixsver], phixsfile_hash_in); + printout("ratecoeff.dat: MD5 %s = %s ", phixsdata_filenames[phixsver], phixsfile_hash_in); if (strcmp(phixsfile_hash[phixsver], phixsfile_hash_in) == 0) { - printoutf("(pass)\n"); + printout("(pass)\n"); } else { - printoutf("\nMISMATCH: MD5 %s = %s\n", phixsdata_filenames[phixsver], phixsfile_hash[phixsver]); + printout("\nMISMATCH: MD5 %s = %s\n", phixsdata_filenames[phixsver], phixsfile_hash[phixsver]); return false; } } @@ -108,37 +108,37 @@ auto read_ratecoeff_dat(FILE *ratecoeff_file) -> bool const int items_read = fscanf(ratecoeff_file, "%la %la %d %d %d %la\n", &in_T_min, &in_T_max, &in_tablesize, &in_nlines, &in_nbfcontinua, &in_ratecoeff_integral_accuracy); if (items_read != 6) { - printoutf("\nMISMATCH: error reading header line\n"); + printout("\nMISMATCH: error reading header line\n"); return false; } - printoutf("ratecoeff.dat: Tmin %g Tmax %g TABLESIZE %d nlines %d nbfcontinua %d in_ratecoeff_integral_accuracy %g ", - in_T_min, in_T_max, in_tablesize, in_nlines, in_nbfcontinua, in_ratecoeff_integral_accuracy); + printout("ratecoeff.dat: Tmin %g Tmax %g TABLESIZE %d nlines %d nbfcontinua %d in_ratecoeff_integral_accuracy %g ", + in_T_min, in_T_max, in_tablesize, in_nlines, in_nbfcontinua, in_ratecoeff_integral_accuracy); if (in_T_min != MINTEMP) { - printoutf("\nMISMATCH: this simulation has MINTEMP %g\n", MINTEMP); + printout("\nMISMATCH: this simulation has MINTEMP %g\n", MINTEMP); return false; } if (in_T_max != MAXTEMP) { - printoutf("\nMISMATCH: this simulation has MAXTEMP %g\n", MAXTEMP); + printout("\nMISMATCH: this simulation has MAXTEMP %g\n", MAXTEMP); return false; } if (in_tablesize != TABLESIZE) { - printoutf("\nMISMATCH: this simulation has TABLESIZE %d\n", TABLESIZE); + printout("\nMISMATCH: this simulation has TABLESIZE %d\n", TABLESIZE); return false; } if (in_nlines != globals::nlines) { - printoutf("\nMISMATCH: this simulation has nlines %d\n", globals::nlines); + printout("\nMISMATCH: this simulation has nlines %d\n", globals::nlines); return false; } if (in_nbfcontinua != globals::nbfcontinua) { - printoutf("\nMISMATCH: this simulation has nbfcontinua %d\n", globals::nbfcontinua); + printout("\nMISMATCH: this simulation has nbfcontinua %d\n", globals::nbfcontinua); return false; } if (in_ratecoeff_integral_accuracy != RATECOEFF_INTEGRAL_ACCURACY) { - printoutf("\nMISMATCH: this simulation has RATECOEFF_INTEGRAL_ACCURACY %g\n", RATECOEFF_INTEGRAL_ACCURACY); + printout("\nMISMATCH: this simulation has RATECOEFF_INTEGRAL_ACCURACY %g\n", RATECOEFF_INTEGRAL_ACCURACY); return false; } - printoutf("(pass)\n"); + printout("(pass)\n"); // this is redundant if the adata and composition data matches, consider removing for (int element = 0; element < get_nelements(); element++) { @@ -154,7 +154,7 @@ auto read_ratecoeff_dat(FILE *ratecoeff_file) -> bool const int ionisinglevels = get_ionisinglevels(element, ion); if (get_atomicnumber(element) != in_element || get_ionstage(element, ion) != in_ionstage || nlevels != in_levels || ionisinglevels != in_ionisinglevels) { - printoutf( + printout( "Levels or ionising levels count mismatch! element %d %d ionstage %d %d nlevels %d %d ionisinglevels " "%d %d\n", get_atomicnumber(element), in_element, get_ionstage(element, ion), in_ionstage, nlevels, in_levels, @@ -164,7 +164,7 @@ auto read_ratecoeff_dat(FILE *ratecoeff_file) -> bool } } - printoutf("Existing ratecoeff.dat is valid. Reading this file...\n"); + printout("Existing ratecoeff.dat is valid. Reading this file...\n"); for (int element = 0; element < get_nelements(); element++) { const int nions = get_nions(element) - 1; for (int ion = 0; ion < nions; ion++) { @@ -195,7 +195,7 @@ auto read_ratecoeff_dat(FILE *ratecoeff_file) -> bool if (in_corrphotoioncoeff >= 0) { corrphotoioncoeffs[get_bflutindex(iter, element, ion, level, phixstargetindex)] = in_corrphotoioncoeff; } else { - printoutf( + printout( "ERROR: USE_LUT_PHOTOION is on, but there are no corrphotoioncoeff values in ratecoeff file\n"); std::abort(); } @@ -205,7 +205,7 @@ auto read_ratecoeff_dat(FILE *ratecoeff_file) -> bool globals::bfheating_coeff[get_bflutindex(iter, element, ion, level, phixstargetindex)] = in_bfheating_coeff; } else { - printoutf( + printout( "ERROR: USE_LUT_BFHEATING is on, but there are no bfheating_coeff values in the ratecoeff " "file\n"); std::abort(); @@ -354,13 +354,13 @@ void precalculate_rate_coefficient_integrals() { const int atomic_number = get_atomicnumber(element); const int ionstage = get_ionstage(element, ion); const int nlevels = get_ionisinglevels(element, ion); - printoutf("Performing rate integrals for Z = %d, ionstage %d...\n", atomic_number, ionstage); + printout("Performing rate integrals for Z = %d, ionstage %d...\n", atomic_number, ionstage); gsl_error_handler_t *previous_handler = gsl_set_error_handler(gsl_error_handler_printout); for (int level = 0; level < nlevels; level++) { if ((level > 0) && (level % 50 == 0)) { - printoutf(" completed up to level %d of %d\n", level, nlevels); + printout(" completed up to level %d of %d\n", level, nlevels); } // coefficients are stored in node shared memory, so divide up the work on the node @@ -399,12 +399,12 @@ void precalculate_rate_coefficient_integrals() { integrator(intparas, nu_threshold, nu_max_phixs, 0, RATECOEFF_INTEGRAL_ACCURACY, GSL_INTEG_GAUSS61, &alpha_sp, &error); if (status != 0 && (status != 18 || (error / alpha_sp) > epsrelwarning)) { - printoutf("alpha_sp integrator status %d. Integral value %9.3e +/- %9.3e\n", status, alpha_sp, error); + printout("alpha_sp integrator status %d. Integral value %9.3e +/- %9.3e\n", status, alpha_sp, error); } alpha_sp *= FOURPI * sfac * phixstargetprobability; if (!std::isfinite(alpha_sp) || alpha_sp < 0) { - printoutf( + printout( "WARNING: alpha_sp was negative or non-finite for level %d Te %g. alpha_sp %g sfac %g " "phixstargetindex %d phixstargetprobability %g\n", level, T_e, alpha_sp, sfac, phixstargetindex, phixstargetprobability); @@ -419,12 +419,12 @@ void precalculate_rate_coefficient_integrals() { RATECOEFF_INTEGRAL_ACCURACY, GSL_INTEG_GAUSS61, &gammacorr, &error); if (status != 0 && (status != 18 || (error / gammacorr) > epsrelwarning)) { - printoutf("gammacorr integrator status %d. Integral value %9.3e +/- %9.3e\n", status, gammacorr, error); + printout("gammacorr integrator status %d. Integral value %9.3e +/- %9.3e\n", status, gammacorr, error); } gammacorr *= FOURPI * phixstargetprobability; assert_always(gammacorr >= 0); if (gammacorr < 0) { - printoutf("WARNING: gammacorr was negative for level %d\n", level); + printout("WARNING: gammacorr was negative for level %d\n", level); gammacorr = 0; } corrphotoioncoeffs[bflutindex] = gammacorr; @@ -438,12 +438,12 @@ void precalculate_rate_coefficient_integrals() { &this_bfheating_coeff, &error); if (status != 0 && (status != 18 || (error / this_bfheating_coeff) > epsrelwarning)) { - printoutf("bfheating_coeff integrator status %d. Integral value %9.3e +/- %9.3e\n", status, - this_bfheating_coeff, error); + printout("bfheating_coeff integrator status %d. Integral value %9.3e +/- %9.3e\n", status, + this_bfheating_coeff, error); } this_bfheating_coeff *= FOURPI * phixstargetprobability; if (this_bfheating_coeff < 0) { - printoutf("WARNING: bfheating_coeff was negative for level %d\n", level); + printout("WARNING: bfheating_coeff was negative for level %d\n", level); this_bfheating_coeff = 0; } globals::bfheating_coeff[bflutindex] = this_bfheating_coeff; @@ -455,12 +455,12 @@ void precalculate_rate_coefficient_integrals() { RATECOEFF_INTEGRAL_ACCURACY, GSL_INTEG_GAUSS61, &this_bfcooling_coeff, &error); if (status != 0 && (status != 18 || (error / this_bfcooling_coeff) > epsrelwarning)) { - printoutf("bfcooling_coeff integrator status %d. Integral value %9.3e +/- %9.3e\n", status, - this_bfcooling_coeff, error); + printout("bfcooling_coeff integrator status %d. Integral value %9.3e +/- %9.3e\n", status, + this_bfcooling_coeff, error); } this_bfcooling_coeff *= FOURPI * sfac * phixstargetprobability; if (!std::isfinite(this_bfcooling_coeff) || this_bfcooling_coeff < 0) { - printoutf( + printout( "WARNING: bfcooling_coeff was negative or non-finite for level %d Te %g. bfcooling_coeff %g sfac %g " "phixstargetindex %d phixstargetprobability %g\n", level, T_e, this_bfcooling_coeff, sfac, phixstargetindex, phixstargetprobability); @@ -514,16 +514,16 @@ void read_recombrate_file() { use_cellcache = false; FILE *recombrate_file = fopen("recombrates.txt", "r"); if (recombrate_file == nullptr) { - printoutf("No recombrates.txt file found. Skipping recombination rate scaling...\n"); + printout("No recombrates.txt file found. Skipping recombination rate scaling...\n"); return; } - printoutf("Reading recombination rate file (recombrates.txt)...\n"); + printout("Reading recombination rate file (recombrates.txt)...\n"); const double Te_estimate = RECOMBCALIBRATION_T_ELEC; const double log_Te_estimate = log10(Te_estimate); - printoutf("Calibrating recombination rates for a temperature of %.1f K\n", Te_estimate); + printout("Calibrating recombination rates for a temperature of %.1f K\n", Te_estimate); struct RRCRow { double log_Te; @@ -536,7 +536,7 @@ void read_recombrate_file() { int tablerows = 0; while (fscanf(recombrate_file, "%d %d %d\n", &atomicnumber, &upperionstage, &tablerows) > 0) { - // printoutf("%d %d %d\n", atomicnumber, upperionstage, tablerows); + // printout("%d %d %d\n", atomicnumber, upperionstage, tablerows); RRCRow T_highestbelow = {.log_Te = 0, .rrc_low_n = 0, .rrc_total = 0}; RRCRow T_lowestabove = {.log_Te = 0, .rrc_low_n = 0, .rrc_total = 0}; @@ -561,7 +561,7 @@ void read_recombrate_file() { if (element >= 0) { const int ion = upperionstage - get_ionstage(element, 0); // the index of the upper ion if (ion > 0 && ion < get_nions(element)) { - printoutf("Z=%d ionstage %d->%d\n", atomicnumber, upperionstage, upperionstage - 1); + printout("Z=%d ionstage %d->%d\n", atomicnumber, upperionstage, upperionstage - 1); assert_always(T_highestbelow.log_Te > 0); assert_always(T_lowestabove.log_Te > 0); @@ -577,17 +577,17 @@ void read_recombrate_file() { double rrc = calculate_ionrecombcoeff(-1, Te_estimate, element, ion, assume_lte, false, printdebug, false, per_groundmultipletpop, false); - printoutf(" rrc: %10.3e\n", rrc); + printout(" rrc: %10.3e\n", rrc); if (input_rrc_low_n >= 0) // if it's < 0, ignore it { - printoutf(" input_rrc_low_n: %10.3e\n", input_rrc_low_n); + printout(" input_rrc_low_n: %10.3e\n", input_rrc_low_n); const double phixs_multiplier = input_rrc_low_n / rrc; if (phixs_multiplier < 0.05 || phixs_multiplier >= 2.0) { - printoutf(" Not scaling phixs of all levels by %.3f (because < 0.05 or >= 2.0)\n", phixs_multiplier); + printout(" Not scaling phixs of all levels by %.3f (because < 0.05 or >= 2.0)\n", phixs_multiplier); } else { - printoutf(" scaling phixs of all levels by %.3f\n", phixs_multiplier); + printout(" scaling phixs of all levels by %.3f\n", phixs_multiplier); for (int level = 0; level < nlevels; level++) { scale_level_phixs(element, ion - 1, level, phixs_multiplier); @@ -595,23 +595,23 @@ void read_recombrate_file() { rrc = calculate_ionrecombcoeff(-1, Te_estimate, element, ion, assume_lte, false, printdebug, false, per_groundmultipletpop, false); - printoutf(" rrc: %10.3e\n", rrc); + printout(" rrc: %10.3e\n", rrc); } } // hopefully the RRC now matches the low_n value well, if it was defined // Next, use the superlevel recombination rates to make up the excess needed to reach the total RRC - printoutf(" input_rrc_total: %10.3e\n", input_rrc_total); + printout(" input_rrc_total: %10.3e\n", input_rrc_total); if (rrc < input_rrc_total) { const double rrc_superlevel = calculate_ionrecombcoeff(-1, Te_estimate, element, ion, assume_lte, false, printdebug, true, per_groundmultipletpop, false); - printoutf(" rrc(superlevel): %10.3e\n", rrc_superlevel); + printout(" rrc(superlevel): %10.3e\n", rrc_superlevel); if (rrc_superlevel > 0) { const double phixs_multiplier_superlevel = 1.0 + ((input_rrc_total - rrc) / rrc_superlevel); - printoutf(" scaling phixs of levels in the superlevel by %.3f\n", phixs_multiplier_superlevel); + printout(" scaling phixs of levels in the superlevel by %.3f\n", phixs_multiplier_superlevel); assert_always(phixs_multiplier_superlevel >= 0); const int first_superlevel_level = get_nlevels_nlte(element, ion - 1) + 1; @@ -619,9 +619,9 @@ void read_recombrate_file() { scale_level_phixs(element, ion - 1, level, phixs_multiplier_superlevel); } } else { - printoutf("There is no superlevel recombination, so multiplying all levels instead\n"); + printout("There is no superlevel recombination, so multiplying all levels instead\n"); const double phixs_multiplier = input_rrc_total / rrc; - printoutf(" scaling phixs of all levels by %.3f\n", phixs_multiplier); + printout(" scaling phixs of all levels by %.3f\n", phixs_multiplier); assert_always(phixs_multiplier >= 0); for (int level = 0; level < nlevels; level++) { @@ -629,9 +629,9 @@ void read_recombrate_file() { } } } else { - printoutf("rrc >= input_rrc_total!\n"); + printout("rrc >= input_rrc_total!\n"); const double phixs_multiplier = input_rrc_total / rrc; - printoutf(" scaling phixs of all levels by %.3f\n", phixs_multiplier); + printout(" scaling phixs of all levels by %.3f\n", phixs_multiplier); assert_always(phixs_multiplier >= 0); for (int level = 0; level < nlevels; level++) { @@ -641,7 +641,7 @@ void read_recombrate_file() { rrc = calculate_ionrecombcoeff(-1, Te_estimate, element, ion, assume_lte, false, printdebug, false, per_groundmultipletpop, false); - printoutf(" rrc: %10.3e\n", rrc); + printout(" rrc: %10.3e\n", rrc); } } } @@ -720,7 +720,7 @@ auto calculate_stimrecombcoeff_integral(const int element, const int lowerion, c // if (status != 0) // { // error *= FOURPI * get_phixsprobability(element, ion, level, phixstargetindex); - // printoutf("stimrecombcoeff gsl integrator warning %d. modelgridindex %d Z=%d ionstage %d lower %d + // printout("stimrecombcoeff gsl integrator warning %d. modelgridindex %d Z=%d ionstage %d lower %d // phixstargetindex %d gamma %g error %g\n", // status, modelgridindex, get_atomicnumber(element), get_ionstage(element, ion), level, // phixstargetindex, gammacorr, error); @@ -799,7 +799,7 @@ auto calculate_corrphotoioncoeff_integral(int element, const int ion, const int gsl_set_error_handler(previous_handler); if (status != 0 && (status != 18 || (error / gammacorr) > epsrelwarning)) { - printoutf( + printout( "corrphotoioncoeff gsl integrator warning %d. modelgridindex %d Z=%d ionstage %d lower %d phixstargetindex %d " "integral %g error %g\n", status, modelgridindex, get_atomicnumber(element), get_ionstage(element, ion), level, phixstargetindex, @@ -909,7 +909,7 @@ void setup_photoion_luts() { #endif assert_always(bfcooling_coeffs != nullptr); - printoutf( + printout( "[info] mem_usage: lookup tables derived from photoionisation (spontrecombcoeff, bfcooling and " "corrphotoioncoeff/bfheating if enabled) occupy %.3f MB\n", mem_usage_photoionluts / 1024. / 1024.); @@ -984,7 +984,7 @@ __host__ __device__ auto get_spontrecombcoeff(int element, const int ion, const const double f_upper = spontrecombcoeffs[get_bflutindex(upperindex, element, ion, level, phixstargetindex)]; const double f_lower = spontrecombcoeffs[get_bflutindex(lowerindex, element, ion, level, phixstargetindex)]; - // printoutf("interpolate_spontrecombcoeff element %d, ion %d, level %d, upper %g, lower %g\n", + // printout("interpolate_spontrecombcoeff element %d, ion %d, level %d, upper %g, lower %g\n", // element,ion,level,f_upper,f_lower); Alpha_sp = (f_lower + (f_upper - f_lower) / (T_upper - T_lower) * (T_e - T_lower)); } else { @@ -1076,7 +1076,7 @@ auto calculate_ionrecombcoeff(const int modelgridindex, const float T_e, const i const double alpha_ion_contrib = alpha_level * nnupperlevel / nnupperion; alpha += alpha_ion_contrib; if (printdebug && alpha_ion_contrib > 0. && lower < 50) { - printoutf( + printout( "recomb: Z=%d ionstage %d->%d upper+1 %5d lower+1 %5d alpha_level %7.2e alpha_ion_contrib %7.2e sum " "%7.2e nnlevel %7.2e nnionfrac %7.2e\n", get_atomicnumber(element), get_ionstage(element, lowerion + 1), get_ionstage(element, lowerion), @@ -1087,8 +1087,8 @@ auto calculate_ionrecombcoeff(const int modelgridindex, const float T_e, const i } } if (printdebug) { - printoutf("recomb: Z=%2d ionstage %d->%d upper+1 [all] lower+1 [all] Alpha %g\n\n", get_atomicnumber(element), - get_ionstage(element, lowerion + 1), get_ionstage(element, lowerion), alpha); + printout("recomb: Z=%2d ionstage %d->%d upper+1 [all] lower+1 [all] Alpha %g\n\n", get_atomicnumber(element), + get_ionstage(element, lowerion + 1), get_ionstage(element, lowerion), alpha); } return alpha; } @@ -1100,7 +1100,7 @@ auto calculate_ionrecombcoeff(const int modelgridindex, const float T_e, const i // W is easily factored out. For stimulated recombination we must assume // T_e = T_R for this precalculation. void ratecoefficients_init() { - printoutf("time before tabulation of rate coefficients %ld\n", std::time(nullptr)); + printout("time before tabulation of rate coefficients %ld\n", std::time(nullptr)); // Determine the temperature grids gridsize T_step_log = (log(MAXTEMP) - log(MINTEMP)) / (TABLESIZE - 1.); @@ -1119,11 +1119,11 @@ void ratecoefficients_init() { if (ratecoeff_file != nullptr) { ratecoeff_match = read_ratecoeff_dat(ratecoeff_file); if (!ratecoeff_match) { - printoutf("[info] ratecoefficients_init: ratecoeff.dat does not match current simulation. Recalculating...\n"); + printout("[info] ratecoefficients_init: ratecoeff.dat does not match current simulation. Recalculating...\n"); } fclose(ratecoeff_file); } else { - printoutf("[info] ratecoefficients_init: ratecoeff.dat file not found. Creating a new one...\n"); + printout("[info] ratecoefficients_init: ratecoeff.dat file not found. Creating a new one...\n"); } } #ifdef MPI_ON @@ -1149,7 +1149,7 @@ void ratecoefficients_init() { precalculate_ion_alpha_sp(); - printoutf("time after tabulation of rate coefficients %ld\n", std::time(nullptr)); + printout("time after tabulation of rate coefficients %ld\n", std::time(nullptr)); } auto interpolate_corrphotoioncoeff(const int element, const int ion, const int level, const int phixstargetindex, @@ -1310,7 +1310,7 @@ auto iongamma_is_zero(const int nonemptymgi, const int element, const int ion) - } const double epsilon_trans = epsilon(element, ion + 1, upperlevel) - epsilon(element, ion, level); - // printoutf("%g %g %g\n", get_levelpop(n,element,ion,level),col_ionization(n,0,epsilon_trans),epsilon_trans); + // printout("%g %g %g\n", get_levelpop(n,element,ion,level),col_ionization(n,0,epsilon_trans),epsilon_trans); if (nnlevel * col_ionization_ratecoeff(T_e, nne, element, ion, level, phixstargetindex, epsilon_trans) > 0) { return false; @@ -1348,7 +1348,7 @@ auto calculate_iongamma_per_gspop(const int modelgridindex, const int element, c Col_ion += nnlevel * col_ionization_ratecoeff(T_e, nne, element, ion, level, phixstargetindex, epsilon_trans); } } - // printoutf("element %d ion %d: col/gamma %g Te %g ne %g\n", element, ion, Col_ion/Gamma, grid::get_Te(n), + // printout("element %d ion %d: col/gamma %g Te %g ne %g\n", element, ion, Col_ion/Gamma, grid::get_Te(n), // grid::get_nne(n)); Gamma += Col_ion; Gamma /= get_groundlevelpop(modelgridindex, element, ion); @@ -1441,7 +1441,7 @@ auto calculate_iongamma_per_ionpop(const int modelgridindex, const float T_e, co if (printdebug && (gamma_ion_contribution_integral > 0. || gamma_ion_contribution_used > 0.) && lower < 20) { const double threshold_angstroms = 1e8 * CLIGHT / (get_phixs_threshold(element, lowerion, lower, phixstargetindex) / H); - printoutf( + printout( "Gamma_R: Z=%d ionstage %d->%d lower+1 %5d upper+1 %5d lambda_threshold %7.1f Gamma_integral %7.2e " "Gamma_bfest %7.2e Gamma_used %7.2e Gamma_used_sum %7.2e\n", get_atomicnumber(element), get_ionstage(element, lowerion), get_ionstage(element, lowerion + 1), lower + 1, @@ -1451,9 +1451,9 @@ auto calculate_iongamma_per_ionpop(const int modelgridindex, const float T_e, co } } if (printdebug) { - printoutf("Gamma_R: Z=%d ionstage %d->%d lower+1 [all] upper+1 [all] Gamma_used_ion %7.2e\n", - get_atomicnumber(element), get_ionstage(element, lowerion), get_ionstage(element, lowerion + 1), - gamma_ion_used); + printout("Gamma_R: Z=%d ionstage %d->%d lower+1 [all] upper+1 [all] Gamma_used_ion %7.2e\n", + get_atomicnumber(element), get_ionstage(element, lowerion), get_ionstage(element, lowerion + 1), + gamma_ion_used); } return gamma_ion; diff --git a/rpkt.cc b/rpkt.cc index 5b6378b10..584a34b14 100644 --- a/rpkt.cc +++ b/rpkt.cc @@ -138,13 +138,13 @@ auto get_event(const int modelgridindex, const Packet &pkt, const Rpkt_continuum const double tau_line = std::max(0., (B_lu * n_l - B_ul * n_u) * HCLIGHTOVERFOURPI * prop_time); - // printoutf("[debug] get_event: tau_line %g\n", tau_line); - // printoutf("[debug] get_event: tau_rnd - tau > tau_cont\n"); + // printout("[debug] get_event: tau_line %g\n", tau_line); + // printout("[debug] get_event: tau_rnd - tau > tau_cont\n"); if (tau_rnd - tau > tau_cont + tau_line) { // total optical depth still below tau_rnd: propagate to the line and continue - // printoutf( + // printout( // "[debug] get_event: tau_rnd - tau > tau_cont + tau_line ... proceed this packets " // "propagation\n"); @@ -168,7 +168,7 @@ auto get_event(const int modelgridindex, const Packet &pkt, const Rpkt_continuum } else { // bound-bound process occurs - // printoutf("[debug] get_event: tau_rnd - tau <= tau_cont + tau_line: bb-process occurs\n"); + // printout("[debug] get_event: tau_rnd - tau <= tau_cont + tau_line: bb-process occurs\n"); mastate = {.element = element, .ion = ion, .level = upper, .activatingline = lineindex}; @@ -178,7 +178,7 @@ auto get_event(const int modelgridindex, const Packet &pkt, const Rpkt_continuum } // the line and its parameters were already selected by closest_transition! - // printoutf("[debug] get_event: edist %g, abort_dist %g, edist-abort_dist %g, endloop + // printout("[debug] get_event: edist %g, abort_dist %g, edist-abort_dist %g, endloop // %d\n",edist,abort_dist,edist-abort_dist,endloop); return {dist + ldist, next_trans, true}; @@ -431,8 +431,8 @@ void rpkt_event_continuum(Packet &pkt, const Rpkt_continuum_absorptioncoeffs &ch // continuum process happens. select due to its probabilities sigma/chi_cont, chi_ff/chi_cont, // chi_bf/chi_cont - // printoutf("[debug] rpkt_event: r-pkt undergoes a continuum transition\n"); - // printoutf("[debug] rpkt_event: zrand*chi_cont %g, sigma %g, chi_ff %g, chi_bf %g\n", zrand * chi_cont, + // printout("[debug] rpkt_event: r-pkt undergoes a continuum transition\n"); + // printout("[debug] rpkt_event: zrand*chi_cont %g, sigma %g, chi_ff %g, chi_bf %g\n", zrand * chi_cont, // sigma, chi_ff, chi_bf); const auto chi_rnd = rng_uniform() * chi_cont; @@ -441,7 +441,7 @@ void rpkt_event_continuum(Packet &pkt, const Rpkt_continuum_absorptioncoeffs &ch // electron scattering occurs // in this case the packet stays a R_PKT of same nu_cmf as before (coherent scattering) // but with different direction - // printoutf("[debug] rpkt_event: electron scattering\n"); + // printout("[debug] rpkt_event: electron scattering\n"); stats::increment(stats::COUNTER_INTERACTIONS); pkt.nscatterings += 1; pkt.last_event = LASTEVENT_ELECTRONSCATTERING; @@ -462,7 +462,7 @@ void rpkt_event_continuum(Packet &pkt, const Rpkt_continuum_absorptioncoeffs &ch } else if (chi_rnd < chi_escatter + chi_ff) { // ff: transform to k-pkt - // printoutf("[debug] rpkt_event: free-free transition\n"); + // printout("[debug] rpkt_event: free-free transition\n"); stats::increment(stats::COUNTER_K_STAT_FROM_FF); stats::increment(stats::COUNTER_INTERACTIONS); pkt.last_event = 5; @@ -470,7 +470,7 @@ void rpkt_event_continuum(Packet &pkt, const Rpkt_continuum_absorptioncoeffs &ch pkt.absorptiontype = -1; } else if (chi_rnd < chi_escatter + chi_ff + chi_bf) { // bf: transform to k-pkt or activate macroatom corresponding to probabilities - // printoutf("[debug] rpkt_event: bound-free transition\n"); + // printout("[debug] rpkt_event: bound-free transition\n"); const auto &phixslist = *chi_rpkt_cont.phixslist; @@ -494,8 +494,8 @@ void rpkt_event_continuum(Packet &pkt, const Rpkt_continuum_absorptioncoeffs &ch const int level = globals::allcont[allcontindex].level; const int phixstargetindex = globals::allcont[allcontindex].phixstargetindex; - // printoutf("[debug] rpkt_event: bound-free: element %d, ion+1 %d, upper %d, ion %d, lower %d\n", element, ion + - // 1, 0, ion, level); printoutf("[debug] rpkt_event: bound-free: nu_edge %g, nu %g\n", nu_edge, nu); + // printout("[debug] rpkt_event: bound-free: element %d, ion+1 %d, upper %d, ion %d, lower %d\n", element, ion + + // 1, 0, ion, level); printout("[debug] rpkt_event: bound-free: nu_edge %g, nu %g\n", nu_edge, nu); if constexpr (TRACK_ION_STATS) { stats::increment_ion_stats_contabsorption(pkt, modelgridindex, element, ion); @@ -519,7 +519,7 @@ void rpkt_event_continuum(Packet &pkt, const Rpkt_continuum_absorptioncoeffs &ch // or to the thermal pool else { // transform to k-pkt - // printoutf("[debug] rpkt_event: bound-free: transform to k-pkt\n"); + // printout("[debug] rpkt_event: bound-free: transform to k-pkt\n"); stats::increment(stats::COUNTER_K_STAT_FROM_BF); stats::increment(stats::COUNTER_INTERACTIONS); pkt.last_event = 4; @@ -565,7 +565,7 @@ void rpkt_event_boundbound(Packet &pkt, const MacroAtomState &pktmastate, const // Handle r-packet interaction in thick cell (grey opacity). // The packet stays an RPKT of same nu_cmf as before (coherent scattering) but with a different direction. void rpkt_event_thickcell(Packet &pkt) { - // printoutf("[debug] rpkt_event_thickcell: electron scattering\n"); + // printout("[debug] rpkt_event_thickcell: electron scattering\n"); stats::increment(stats::COUNTER_INTERACTIONS); pkt.nscatterings += 1; pkt.last_event = LASTEVENT_ELECTRONSCATTERING; @@ -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) { - printoutf("[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); + 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); std::abort(); } if (sdist < 0) { const int cellindexnew = pkt.where; - printoutf("[warning] r_pkt: Negative distance (sdist = %g). Abort.\n", sdist); - printoutf("[warning] r_pkt: cell %d snext %d\n", cellindexnew, snext); - printoutf("[warning] r_pkt: pos %g %g %g\n", pkt.pos[0], pkt.pos[1], pkt.pos[2]); - printoutf("[warning] r_pkt: dir %g %g %g\n", pkt.dir[0], pkt.dir[1], pkt.dir[2]); - printoutf("[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); - printoutf("[warning] r_pkt: cell width %g\n", grid::wid_init(cellindexnew, 0) * pkt.prop_time / globals::tmin); + 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); assert_always(false); } if (((snext != -99) && (snext < 0)) || (snext >= grid::ngrid)) { - printoutf("[fatal] r_pkt: Heading for inappropriate grid cell. Abort.\n"); - printoutf("[fatal] r_pkt: Current cell %d, target cell %d.\n", pkt.where, snext); + 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); std::abort(); } @@ -812,9 +812,9 @@ auto do_rpkt_step(Packet &pkt, const double t2) -> bool { return false; } - printoutf("[fatal] do_rpkt: Failed to identify event . Rpkt. edist %g, sdist %g, tdist %g Abort.\n", edist, sdist, - tdist); - printoutf("[fatal] do_rpkt: Trouble was due to packet number %d.\n", pkt.number); + 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); std::abort(); } @@ -1066,7 +1066,7 @@ __host__ __device__ void emit_rpkt(Packet &pkt) { // negative time since we want the backwards transformation here pkt.dir = angle_ab(dir_cmf, vel_vec); - // printoutf("[debug] pkt.dir in RF: %g %g %g\n",pkt.dir[0],pkt.dir[1],pkt.dir[2]); + // printout("[debug] pkt.dir in RF: %g %g %g\n",pkt.dir[0],pkt.dir[1],pkt.dir[2]); // Finally we want to put in the rest frame energy and frequency. And record // that it's now a r-pkt. @@ -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)) { - printoutf("[fatal] calculate_chi_rpkt_cont: resulted in non-finite chi_rpkt_cont.total ... abort\n"); - printoutf("[fatal] es %g, ff %g, bf %g\n", chi_rpkt_cont.ffescat, chi_rpkt_cont.ffheat, chi_rpkt_cont.bf); - printoutf("[fatal] nbfcontinua %d\n", globals::nbfcontinua); - printoutf("[fatal] in cell %d with density %g\n", modelgridindex, grid::get_rho(modelgridindex)); - printoutf("[fatal] pkt.nu_cmf %g\n", nu_cmf); + 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); if (std::isfinite(chi_rpkt_cont.ffescat)) { chi_rpkt_cont.ffheat = 0.; chi_rpkt_cont.bf = 0.; @@ -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); - printoutf("calculating expansion opacities for cell %d...", modelgridindex); + printout("calculating expansion opacities for cell %d...", modelgridindex); const auto t_mid = globals::timesteps[globals::timestep].mid; @@ -1222,5 +1222,5 @@ void calculate_expansion_opacities(const int modelgridindex) { expansionopacity_planck_cumulative[(nonemptymgi * expopac_nbins) + binindex] = kappa_planck_cumulative; } } - printoutf("took %ld seconds\n", std::time(nullptr) - sys_time_start_calc); + printout("took %ld seconds\n", std::time(nullptr) - sys_time_start_calc); } diff --git a/sn3d.cc b/sn3d.cc index 214df5918..ae4364298 100644 --- a/sn3d.cc +++ b/sn3d.cc @@ -4,7 +4,7 @@ Comments are marked by // Deactivated code by // */ /* 2007-01-17 -- MK Several minor modifications (some marked in the code with //MK), these include - - global printoutf() routine (located in sn3d.c) + - global printout() routine (located in sn3d.c) - opacity_cases 2 and 3 added (changes in grid_init.c and update_grid.c, original opacity stuff was moved there from input.c) */ /* This is a code copied from Lucy 2004 paper on t-dependent supernova @@ -114,7 +114,7 @@ void initialise_linestat_file() { } void write_deposition_file(const int nts, const int my_rank, const int nstart, const int ndo) { - printoutf("Calculating deposition rates...\n"); + printout("Calculating deposition rates...\n"); auto const time_write_deposition_file_start = std::time(nullptr); double mtot = 0.; @@ -215,8 +215,8 @@ void write_deposition_file(const int nts, const int my_rank, const int nstart, c std::rename("deposition.out.tmp", "deposition.out"); } - printoutf("calculating and writing deposition.out took %ld seconds\n", - std::time(nullptr) - time_write_deposition_file_start); + printout("calculating and writing deposition.out took %ld seconds\n", + std::time(nullptr) - time_write_deposition_file_start); } #ifdef MPI_ON @@ -307,8 +307,8 @@ void mpi_communicate_grid_properties(const int my_rank, const int nprocs, const mpi_grid_buffer_size, &position, MPI_COMM_WORLD); } } - printoutf("[info] mem_usage: MPI_BUFFER: used %d of %zu bytes allocated to mpi_grid_buffer\n", position, - mpi_grid_buffer_size); + printout("[info] mem_usage: MPI_BUFFER: used %d of %zu bytes allocated to mpi_grid_buffer\n", position, + mpi_grid_buffer_size); assert_always(static_cast(position) <= mpi_grid_buffer_size); } MPI_Barrier(MPI_COMM_WORLD); @@ -453,23 +453,23 @@ void write_temp_packetsfile(const int timestep, const int my_rank, const Packet bool write_success = false; while (!write_success) { - printoutf("Writing %s...", filename); + printout("Writing %s...", filename); FILE *packets_file = fopen(filename, "wb"); if (packets_file == nullptr) { - printoutf("ERROR: Could not open file '%s' for mode 'wb'.\n", filename); + printout("ERROR: Could not open file '%s' for mode 'wb'.\n", filename); write_success = false; } else { write_success = (std::fwrite(pkt, sizeof(Packet), globals::npkts, packets_file) == static_cast(globals::npkts)); if (!write_success) { - printoutf("fwrite() FAILED! will retry...\n"); + printout("fwrite() FAILED! will retry...\n"); } fclose(packets_file); } if (write_success) { - printoutf("done\n"); + printout("done\n"); } } } @@ -480,7 +480,7 @@ void remove_temp_packetsfile(const int timestep, const int my_rank) { if (std::filesystem::exists(filename)) { std::remove(filename); - printoutf("Deleted %s\n", filename); + printout("Deleted %s\n", filename); } } @@ -490,7 +490,7 @@ void remove_grid_restart_data(const int timestep) { if (std::filesystem::exists(prevfilename)) { std::remove(prevfilename); - printoutf("Deleted %s\n", prevfilename); + printout("Deleted %s\n", prevfilename); } } @@ -501,14 +501,14 @@ auto walltime_sufficient_to_continue(const int nts, const int nts_prev, const in // time is measured from just before packet propagation from one timestep to the next const int estimated_time_per_timestep = std::time(nullptr) - time_timestep_start; - printoutf("TIME: time between timesteps is %d seconds (measured packet prop of ts %d and update grid of ts %d)\n", - estimated_time_per_timestep, nts_prev, nts); + printout("TIME: time between timesteps is %d seconds (measured packet prop of ts %d and update grid of ts %d)\n", + estimated_time_per_timestep, nts_prev, nts); bool do_this_full_loop = true; if (walltimelimitseconds > 0) { const int wallclock_used_seconds = std::time(nullptr) - real_time_start; const int wallclock_remaining_seconds = walltimelimitseconds - wallclock_used_seconds; - printoutf("TIMED_RESTARTS: Used %d of %d seconds of wall time.\n", wallclock_used_seconds, walltimelimitseconds); + printout("TIMED_RESTARTS: Used %d of %d seconds of wall time.\n", wallclock_used_seconds, walltimelimitseconds); // This flag being false will make it update_grid, and then exit do_this_full_loop = (wallclock_remaining_seconds >= (1.5 * estimated_time_per_timestep)); @@ -518,11 +518,11 @@ auto walltime_sufficient_to_continue(const int nts, const int nts_prev, const in MPI_Bcast(&do_this_full_loop, 1, MPI_C_BOOL, 0, MPI_COMM_WORLD); #endif if (do_this_full_loop) { - printoutf("TIMED_RESTARTS: Going to continue since remaining time %d s >= 1.5 * time_per_timestep\n", - wallclock_remaining_seconds); + printout("TIMED_RESTARTS: Going to continue since remaining time %d s >= 1.5 * time_per_timestep\n", + wallclock_remaining_seconds); } else { - printoutf("TIMED_RESTARTS: Going to terminate since remaining time %d s < 1.5 * time_per_timestep\n", - wallclock_remaining_seconds); + printout("TIMED_RESTARTS: Going to terminate since remaining time %d s < 1.5 * time_per_timestep\n", + wallclock_remaining_seconds); } } return do_this_full_loop; @@ -536,7 +536,7 @@ void save_grid_and_packets(const int nts, const int my_rank, const Packet *packe bool write_successful = false; while (!write_successful) { const auto time_write_packets_file_start = std::time(nullptr); - printoutf("time before write temporary packets file %ld\n", time_write_packets_file_start); + printout("time before write temporary packets file %ld\n", time_write_packets_file_start); // save packet state at start of current timestep (before propagation) write_temp_packetsfile(nts, my_rank, packets); @@ -550,9 +550,9 @@ void save_grid_and_packets(const int nts, const int my_rank, const Packet *packe #endif const auto timenow = std::time(nullptr); - printoutf("time after write temporary packets file %ld (took %lds, waited %lds, total %lds)\n", timenow, - time_write_packets_finished_thisrank - time_write_packets_file_start, - timenow - time_write_packets_finished_thisrank, timenow - time_write_packets_file_start); + printout("time after write temporary packets file %ld (took %lds, waited %lds, total %lds)\n", timenow, + time_write_packets_finished_thisrank - time_write_packets_file_start, + timenow - time_write_packets_finished_thisrank, timenow - time_write_packets_file_start); if constexpr (VERIFY_WRITTEN_PACKETS_FILES) { #ifdef MPI_ON @@ -561,7 +561,7 @@ void save_grid_and_packets(const int nts, const int my_rank, const Packet *packe const auto time_readback_packets_start = std::time(nullptr); - printoutf("reading back temporary packets file to check validity...\n"); + printout("reading back temporary packets file to check validity...\n"); // read packets file back to check that the disk write didn't fail write_successful = verify_temp_packetsfile(nts, my_rank, packets); @@ -570,8 +570,8 @@ void save_grid_and_packets(const int nts, const int my_rank, const Packet *packe MPI_Barrier(MPI_COMM_WORLD); #endif - printoutf("Verifying packets files for all ranks took %ld seconds.\n", - std::time(nullptr) - time_readback_packets_start); + printout("Verifying packets files for all ranks took %ld seconds.\n", + std::time(nullptr) - time_readback_packets_start); } else { write_successful = true; } @@ -704,8 +704,8 @@ auto do_timestep(const int nts, const int titer, const int my_rank, const int ns mpi_communicate_grid_properties(my_rank, globals::nprocs, nstart, ndo); #endif - printoutf("timestep %d: time after grid properties have been communicated %ld (took %ld seconds)\n", nts, - std::time(nullptr), std::time(nullptr) - sys_time_start_communicate_grid); + printout("timestep %d: time after grid properties have been communicated %ld (took %ld seconds)\n", nts, + std::time(nullptr), std::time(nullptr) - sys_time_start_communicate_grid); // If this is not the 0th time step of the current job step, // write out a snapshot of the grid properties for further restarts @@ -739,8 +739,8 @@ auto do_timestep(const int nts, const int titer, const int my_rank, const int ns #endif #ifdef MPI_ON - printoutf("timestep %d: time after estimators have been communicated %ld (took %ld seconds)\n", nts, - std::time(nullptr), std::time(nullptr) - time_communicate_estimators_start); + printout("timestep %d: time after estimators have been communicated %ld (took %ld seconds)\n", nts, + std::time(nullptr), std::time(nullptr) - time_communicate_estimators_start); #endif // The estimators have been summed across all processes and distributed. @@ -752,13 +752,13 @@ auto do_timestep(const int nts, const int titer, const int my_rank, const int ns write_partial_lightcurve_spectra(my_rank, nts, packets); - printoutf("During timestep %d on MPI process %d, %d pellets decayed and %d packets escaped. (t=%gd)\n", nts, - my_rank, globals::timesteps[nts].pellet_decays, globals::nesc, globals::timesteps[nts].mid / DAY); + printout("During timestep %d on MPI process %d, %d pellets decayed and %d packets escaped. (t=%gd)\n", nts, my_rank, + globals::timesteps[nts].pellet_decays, globals::nesc, globals::timesteps[nts].mid / DAY); if (VPKT_ON) { - printoutf("During timestep %d on MPI process %d, %d virtual packets were generated and %d escaped.\n", nts, - my_rank, nvpkt, nvpkt_esc1 + nvpkt_esc2 + nvpkt_esc3); - printoutf( + printout("During timestep %d on MPI process %d, %d virtual packets were generated and %d escaped.\n", nts, + my_rank, nvpkt, nvpkt_esc1 + nvpkt_esc2 + nvpkt_esc3); + printout( "%d virtual packets came from an electron scattering event, %d from a kpkt deactivation and %d from a " "macroatom deactivation.\n", nvpkt_esc1, nvpkt_esc2, nvpkt_esc3); @@ -794,7 +794,7 @@ auto do_timestep(const int nts, const int titer, const int my_rank, const int ns vpkt_write_timestep(nts, my_rank, true); - printoutf("time after write final packets file %ld\n", std::time(nullptr)); + printout("time after write final packets file %ld\n", std::time(nullptr)); // final packets*.out have been written, so remove the temporary packets files // commented out because you might still want to resume the simulation @@ -845,24 +845,24 @@ auto main(int argc, char *argv[]) -> int { assert_always(output_file.is_open()); #ifdef _OPENMP - printoutf("OpenMP parallelisation is active with %d threads (max %d)\n", omp_get_num_threads(), get_max_threads()); + printout("OpenMP parallelisation is active with %d threads (max %d)\n", omp_get_num_threads(), get_max_threads()); #else - printoutf("OpenMP parallelisation is not enabled in this build (this is normal)\n"); + printout("OpenMP parallelisation is not enabled in this build (this is normal)\n"); #endif } #ifdef STDPAR_ON - printoutf("C++ standard parallelism (stdpar) is enabled with %d hardware threads\n", - std::thread::hardware_concurrency()); + printout("C++ standard parallelism (stdpar) is enabled with %d hardware threads\n", + std::thread::hardware_concurrency()); #endif #ifdef GPU_ON - printoutf("GPU_ON is enabled\n"); + printout("GPU_ON is enabled\n"); #endif - printoutf("time at start %d\n", real_time_start); + printout("time at start %d\n", real_time_start); - printoutf("integration method is %s\n", USE_SIMPSON_INTEGRATOR ? "Simpson rule" : "GSL qag"); + printout("integration method is %s\n", USE_SIMPSON_INTEGRATOR ? "Simpson rule" : "GSL qag"); #ifdef WALLTIMELIMITSECONDS int walltimelimitseconds = WALLTIMELIMITSECONDS; @@ -873,10 +873,10 @@ auto main(int argc, char *argv[]) -> int { int opt = 0; while ((opt = getopt(argc, argv, "w:")) != -1) { // NOLINT(concurrency-mt-unsafe) if (opt == 'w') { - printoutf("Command line argument specifies wall time hours '%s', setting ", optarg); + printout("Command line argument specifies wall time hours '%s', setting ", optarg); const float walltimehours = strtof(optarg, nullptr); walltimelimitseconds = static_cast(walltimehours * 3600); - printoutf("walltimelimitseconds = %d\n", walltimelimitseconds); + printout("walltimelimitseconds = %d\n", walltimelimitseconds); } else { fprintf(stderr, "Usage: %s [-w WALLTIMELIMITHOURS]\n", argv[0]); std::abort(); @@ -887,32 +887,32 @@ auto main(int argc, char *argv[]) -> int { assert_always(packets != nullptr); - printoutf("git branch %s\n", GIT_BRANCH); + printout("git branch %s\n", GIT_BRANCH); - printoutf("git version: %s\n", GIT_VERSION); + printout("git version: %s\n", GIT_VERSION); - printoutf("git status %s\n", GIT_STATUS); + printout("git status %s\n", GIT_STATUS); - printoutf("sn3d compiled at %s on %s\n", __TIME__, __DATE__); + printout("sn3d compiled at %s on %s\n", __TIME__, __DATE__); #if defined TESTMODE && TESTMODE - printoutf("TESTMODE is ON\n"); + printout("TESTMODE is ON\n"); #endif #ifdef MPI_ON - printoutf("process id (pid): %d\n", getpid()); - printoutf("MPI enabled:\n"); - printoutf(" rank %d of [0..%d] in MPI_COMM_WORLD\n", globals::rank_global, globals::nprocs - 1); - printoutf(" rank %d of [0..%d] in node %d of [0..%d]\n", globals::rank_in_node, globals::node_nprocs - 1, - globals::node_id, globals::node_count - 1); + printout("process id (pid): %d\n", getpid()); + printout("MPI enabled:\n"); + printout(" rank %d of [0..%d] in MPI_COMM_WORLD\n", globals::rank_global, globals::nprocs - 1); + printout(" rank %d of [0..%d] in node %d of [0..%d]\n", globals::rank_in_node, globals::node_nprocs - 1, + globals::node_id, globals::node_count - 1); #ifdef MAX_NODE_SIZE - printoutf( + printout( "WARNING: Compiled with MAX_NODE_SIZE %d, which may mean mean that there are more nodes reported than physically " "present\n", MAX_NODE_SIZE); #endif #else - printoutf("MPI is disabled in this build\n"); + printout("MPI is disabled in this build\n"); #endif input(my_rank); @@ -926,8 +926,8 @@ auto main(int argc, char *argv[]) -> int { initialise_linestat_file(); } - printoutf("time after input %ld\n", std::time(nullptr)); - printoutf("timesteps %d\n", globals::ntimesteps); + printout("time after input %ld\n", std::time(nullptr)); + printout("timesteps %d\n", globals::ntimesteps); // Precalculate the rate coefficients for spontaneous and stimulated recombination // and for photoionisation. With the nebular approximation they only depend on T_e @@ -937,9 +937,9 @@ auto main(int argc, char *argv[]) -> int { ratecoefficients_init(); #ifdef MPI_ON - printoutf("barrier after tabulation of rate coefficients: time before barrier %ld, ", std::time(nullptr)); + printout("barrier after tabulation of rate coefficients: time before barrier %ld, ", std::time(nullptr)); MPI_Barrier(MPI_COMM_WORLD); - printoutf("time after barrier %ld\n", std::time(nullptr)); + printout("time after barrier %ld\n", std::time(nullptr)); #endif stats::init(); @@ -948,7 +948,7 @@ auto main(int argc, char *argv[]) -> int { FILE *syn_file = fopen_required("syn_dir.txt", "w"); fprintf(syn_file, "%g %g %g", globals::syn_dir[0], globals::syn_dir[1], globals::syn_dir[2]); fclose(syn_file); - printoutf("time write syn_dir.txt file %ld\n", std::time(nullptr)); + printout("time write syn_dir.txt file %ld\n", std::time(nullptr)); bool terminate_early = false; @@ -959,13 +959,13 @@ auto main(int argc, char *argv[]) -> int { } // Initialise the grid. Set up the initial positions and sizes of the grid cells. - printoutf("time grid_init %ld\n", std::time(nullptr)); + printout("time grid_init %ld\n", std::time(nullptr)); grid::grid_init(my_rank); - printoutf("Simulation propagates %g packets per process (total %g with nprocs %d)\n", 1. * globals::npkts, - 1. * globals::npkts * globals::nprocs, globals::nprocs); + printout("Simulation propagates %g packets per process (total %g with nprocs %d)\n", 1. * globals::npkts, + 1. * globals::npkts * globals::nprocs, globals::nprocs); - printoutf("[info] mem_usage: packets occupy %.3f MB\n", globals::npkts * sizeof(Packet) / 1024. / 1024.); + printout("[info] mem_usage: packets occupy %.3f MB\n", MPKTS * sizeof(Packet) / 1024. / 1024.); if (!globals::simulation_continued_from_saved) { std::remove("deposition.out"); @@ -983,12 +983,12 @@ auto main(int argc, char *argv[]) -> int { const int nstart = grid::get_nstart(my_rank); const int ndo = grid::get_ndo(my_rank); const int ndo_nonempty = grid::get_ndo_nonempty(my_rank); - printoutf("process rank %d (global max rank %d) assigned %d modelgrid cells (%d nonempty)", my_rank, - globals::nprocs - 1, ndo, ndo_nonempty); + printout("process rank %d (global max rank %d) assigned %d modelgrid cells (%d nonempty)", my_rank, + globals::nprocs - 1, ndo, ndo_nonempty); if (ndo > 0) { - printoutf(": cells [%d..%d] (model has max mgi %d)\n", nstart, nstart + ndo - 1, grid::get_npts_model() - 1); + printout(": cells [%d..%d] (model has max mgi %d)\n", nstart, nstart + ndo - 1, grid::get_npts_model() - 1); } else { - printoutf("\n"); + printout("\n"); } #ifdef MPI_ON @@ -998,7 +998,7 @@ auto main(int argc, char *argv[]) -> int { // The factor 4 comes from the fact that our buffer should contain elements of 4 byte // instead of 1 byte chars. But the MPI routines don't care about the buffers datatype mpi_grid_buffer_size = 4 * ((12 + 4 * get_includedions() + get_nelements()) * (maxndo) + 1); - printoutf("reserve mpi_grid_buffer_size %zu space for MPI communication buffer\n", mpi_grid_buffer_size); + printout("reserve mpi_grid_buffer_size %zu space for MPI communication buffer\n", mpi_grid_buffer_size); mpi_grid_buffer = static_cast(malloc(mpi_grid_buffer_size * sizeof(char))); assert_always(mpi_grid_buffer != nullptr); MPI_Barrier(MPI_COMM_WORLD); @@ -1026,7 +1026,7 @@ auto main(int argc, char *argv[]) -> int { // const auto time_before_barrier = std::time(nullptr); MPI_Barrier(MPI_COMM_WORLD); // const auto time_after_barrier = std::time(nullptr); - // printoutf("timestep %d: time before barrier %d, time after barrier %d\n", nts, time_before_barrier, + // printout("timestep %d: time before barrier %d, time after barrier %d\n", nts, time_before_barrier, // time_after_barrier); #endif @@ -1063,9 +1063,9 @@ auto main(int argc, char *argv[]) -> int { } if ((globals::ntimesteps != globals::timestep_finish) || (terminate_early)) { - printoutf("RESTART_NEEDED to continue model\n"); + printout("RESTART_NEEDED to continue model\n"); } else { - printoutf("No need for restart\n"); + printout("No need for restart\n"); } #ifdef MPI_ON @@ -1073,9 +1073,9 @@ auto main(int argc, char *argv[]) -> int { #endif const auto real_time_end = std::time(nullptr); - printoutf("sn3d finished at %ld (this job wallclock hours %.2f * %d processes * %d threads = %.1f core hours)\n", - real_time_end, (real_time_end - real_time_start) / 3600., globals::nprocs, get_max_threads(), - (real_time_end - real_time_start) / 3600. * globals::nprocs * get_max_threads()); + printout("sn3d finished at %ld (this job wallclock hours %.2f * %d processes * %d threads = %.1f core hours)\n", + real_time_end, (real_time_end - real_time_start) / 3600., globals::nprocs, get_max_threads(), + (real_time_end - real_time_start) / 3600. * globals::nprocs * get_max_threads()); if (estimators_file != nullptr) { fclose(estimators_file); diff --git a/sn3d.h b/sn3d.h index a86279d43..701803ad5 100644 --- a/sn3d.h +++ b/sn3d.h @@ -97,7 +97,6 @@ inline thread_local auto gslworkspace = #ifdef __NVCOMPILER_CUDA_ARCH__ #define printout(...) printf(__VA_ARGS__) -#define printoutf(...) printf(__VA_ARGS__) #define __artis_assert(e) \ { \ @@ -114,7 +113,7 @@ inline void print_line_start() { } } -__attribute__((__format__(__printf__, 1, 2))) inline auto printoutf(const char *format, ...) -> void { +__attribute__((__format__(__printf__, 1, 2))) inline auto printout(const char *format, ...) -> void { print_line_start(); va_list args{}; va_start(args, format); @@ -184,7 +183,7 @@ inline void atomicadd(T &var, const T &val) { inline void gsl_error_handler_printout(const char *reason, const char *file, int line, int gsl_errno) { if (gsl_errno != 18) // roundoff error { - printoutf("WARNING: gsl (%s:%d): %s (Error code %d)\n", file, line, reason, gsl_errno); + printout("WARNING: gsl (%s:%d): %s (Error code %d)\n", file, line, reason, gsl_errno); // abort(); } } @@ -198,7 +197,7 @@ inline void gsl_error_handler_printout(const char *reason, const char *file, int FILE *file = std::fopen(filename.c_str(), mode); if (file == nullptr) { - printoutf("ERROR: Could not open file '%s' for mode '%s'.\n", filename.c_str(), mode); + printout("ERROR: Could not open file '%s' for mode '%s'.\n", filename.c_str(), mode); std::abort(); } @@ -212,7 +211,7 @@ inline void gsl_error_handler_printout(const char *reason, const char *file, int } auto file = std::fstream(filename, mode); if (!file.is_open()) { - printoutf("ERROR: Could not open file '%s'\n", filename.c_str()); + printout("ERROR: Could not open file '%s'\n", filename.c_str()); std::abort(); } return file; diff --git a/spectrum_lightcurve.cc b/spectrum_lightcurve.cc index d437149c8..755073176 100644 --- a/spectrum_lightcurve.cc +++ b/spectrum_lightcurve.cc @@ -55,18 +55,18 @@ void printout_tracemission_stats() { if (mode == 0) { std::ranges::SORT_OR_STABLE_SORT(traceemissionabsorption, [](const auto &a, const auto &b) { return a.energyemitted > b.energyemitted; }); - printoutf("lambda [%5.1f, %5.1f] nu %g %g\n", traceemissabs_lambdamin, traceemissabs_lambdamax, - traceemissabs_nulower, traceemissabs_nuupper); + printout("lambda [%5.1f, %5.1f] nu %g %g\n", traceemissabs_lambdamin, traceemissabs_lambdamax, + traceemissabs_nulower, traceemissabs_nuupper); - printoutf("Top line emission contributions in the range lambda [%5.1f, %5.1f] time [%5.1fd, %5.1fd] (%g erg)\n", - traceemissabs_lambdamin, traceemissabs_lambdamax, traceemissabs_timemin / DAY, - traceemissabs_timemax / DAY, traceemission_totalenergy); + printout("Top line emission contributions in the range lambda [%5.1f, %5.1f] time [%5.1fd, %5.1fd] (%g erg)\n", + traceemissabs_lambdamin, traceemissabs_lambdamax, traceemissabs_timemin / DAY, + traceemissabs_timemax / DAY, traceemission_totalenergy); } else { std::ranges::SORT_OR_STABLE_SORT(traceemissionabsorption, std::ranges::greater{}, &emissionabsorptioncontrib::energyabsorbed); - printoutf("Top line absorption contributions in the range lambda [%5.1f, %5.1f] time [%5.1fd, %5.1fd] (%g erg)\n", - traceemissabs_lambdamin, traceemissabs_lambdamax, traceemissabs_timemin / DAY, - traceemissabs_timemax / DAY, traceabsorption_totalenergy); + printout("Top line absorption contributions in the range lambda [%5.1f, %5.1f] time [%5.1fd, %5.1fd] (%g erg)\n", + traceemissabs_lambdamin, traceemissabs_lambdamax, traceemissabs_timemin / DAY, + traceemissabs_timemax / DAY, traceabsorption_totalenergy); } // display the top entries of the sorted list @@ -74,8 +74,8 @@ void printout_tracemission_stats() { if (globals::nlines > maxlinesprinted) { nlines_limited = maxlinesprinted; } - printoutf("%17s %4s %9s %5s %5s %8s %8s %4s %7s %7s %7s %7s\n", "energy", "Z", "ionstage", "upper", "lower", - "coll_str", "A", "forb", "lambda", "", "B_lu", "B_ul"); + printout("%17s %4s %9s %5s %5s %8s %8s %4s %7s %7s %7s %7s\n", "energy", "Z", "ionstage", "upper", "lower", + "coll_str", "A", "forb", "lambda", "", "B_lu", "B_ul"); for (int i = 0; i < nlines_limited; i++) { double encontrib{NAN}; double totalenergy{NAN}; @@ -119,16 +119,16 @@ void printout_tracemission_stats() { [=](const auto &downtr) { return downtr.targetlevelindex == lower; }); assert_always(downtransition != (downtranslist + nupperdowntrans)); - printoutf("%7.2e (%5.1f%%) %4d %9d %5d %5d %8.1f %8.2e %4d %7.1f %7.1f %7.1e %7.1e\n", encontrib, - 100 * encontrib / totalenergy, get_atomicnumber(element), get_ionstage(element, ion), - globals::linelist[lineindex].upperlevelindex, globals::linelist[lineindex].lowerlevelindex, - downtransition->coll_str, globals::linelist[lineindex].einstein_A, - static_cast(downtransition->forbidden), linelambda, v_rad, B_lu, B_ul); + printout("%7.2e (%5.1f%%) %4d %9d %5d %5d %8.1f %8.2e %4d %7.1f %7.1f %7.1e %7.1e\n", encontrib, + 100 * encontrib / totalenergy, get_atomicnumber(element), get_ionstage(element, ion), + globals::linelist[lineindex].upperlevelindex, globals::linelist[lineindex].lowerlevelindex, + downtransition->coll_str, globals::linelist[lineindex].einstein_A, + static_cast(downtransition->forbidden), linelambda, v_rad, B_lu, B_ul); } else { break; } } - printoutf("\n"); + printout("\n"); } traceemissionabsorption.clear(); @@ -333,10 +333,10 @@ void write_spectrum(const std::string &spec_filename, const std::string &emissio assert_always(trueemission_file != nullptr); absorption_file = fopen_required(absorption_filename, "w"); assert_always(absorption_file != nullptr); - printoutf("Writing %s, %s, %s, and %s\n", spec_filename.c_str(), emission_filename.c_str(), - trueemission_filename.c_str(), absorption_filename.c_str()); + printout("Writing %s, %s, %s, and %s\n", spec_filename.c_str(), emission_filename.c_str(), + trueemission_filename.c_str(), absorption_filename.c_str()); } else { - printoutf("Writing %s\n", spec_filename.c_str()); + printout("Writing %s\n", spec_filename.c_str()); } if (TRACE_EMISSION_ABSORPTION_REGION_ON && do_emission_res && !traceemissionabsorption.empty()) { @@ -398,10 +398,10 @@ void write_specpol(const std::string &specpol_filename, const std::string &emiss if (do_emission_res) { emissionpol_file = fopen_required(emission_filename, "w"); absorptionpol_file = fopen_required(absorption_filename, "w"); - printoutf("Writing %s, %s, and %s\n", specpol_filename.c_str(), emission_filename.c_str(), - absorption_filename.c_str()); + printout("Writing %s, %s, and %s\n", specpol_filename.c_str(), emission_filename.c_str(), + absorption_filename.c_str()); } else { - printoutf("Writing %s\n", specpol_filename.c_str()); + printout("Writing %s\n", specpol_filename.c_str()); } fprintf(specpol_file, "%g ", 0.0); @@ -551,8 +551,8 @@ void init_spectra(Spectra &spectra, const double nu_min, const double nu_max, co spectra.timesteps[nts].trueemission = &spectra.trueemissionalltimesteps[nts * MNUBINS * proccount]; } if (print_memusage) { - printoutf("[info] mem_usage: set of emission/absorption spectra occupy %.3f MB (nnubins %d)\n", - mem_usage / 1024. / 1024., MNUBINS); + printout("[info] mem_usage: set of emission/absorption spectra occupy %.3f MB (nnubins %d)\n", + mem_usage / 1024. / 1024., MNUBINS); } } else { @@ -567,7 +567,7 @@ void init_spectra(Spectra &spectra, const double nu_min, const double nu_max, co spectra.trueemissionalltimesteps.clear(); if (print_memusage) { - printoutf("[info] mem_usage: set of spectra occupy %.3f MB (nnubins %d)\n", mem_usage / 1024. / 1024., MNUBINS); + printout("[info] mem_usage: set of spectra occupy %.3f MB (nnubins %d)\n", mem_usage / 1024. / 1024., MNUBINS); } } } @@ -648,9 +648,9 @@ void write_partial_lightcurve_spectra(const int my_rank, const int nts, const Pa MPI_Barrier(MPI_COMM_WORLD); #endif - printoutf("timestep %d: Saving partial light curves and %sspectra took %lds (%lds for MPI reduction)\n", nts, - do_emission_res ? "emission/absorption " : "", std::time(nullptr) - time_func_start, - time_mpireduction_end - time_mpireduction_start); + printout("timestep %d: Saving partial light curves and %sspectra took %lds (%lds for MPI reduction)\n", nts, + do_emission_res ? "emission/absorption " : "", std::time(nullptr) - time_func_start, + time_mpireduction_end - time_mpireduction_start); } // Routine to make a MC light curve from the r-packets. @@ -662,7 +662,7 @@ void write_light_curve(const std::string &lc_filename, const int current_abin, auto lc_file = fstream_required(lc_filename, std::ios::out | std::ios::trunc); - printoutf("Writing %s\n", lc_filename.c_str()); + printout("Writing %s\n", lc_filename.c_str()); char linebuffer[1024]; diff --git a/stats.cc b/stats.cc index 5fa91e01e..4784986aa 100644 --- a/stats.cc +++ b/stats.cc @@ -182,7 +182,7 @@ auto get_counter(enum eventcounters i) -> ptrdiff_t { void pkt_action_counters_printout(const int nts) { const double meaninteractions = static_cast(get_counter(COUNTER_INTERACTIONS)) / globals::npkts; - printoutf("timestep %d: mean number of interactions per packet = %g\n", nts, meaninteractions); + printout("timestep %d: mean number of interactions per packet = %g\n", nts, meaninteractions); const double deltat = globals::timesteps[nts].width; double modelvolume = 0.; @@ -191,47 +191,45 @@ void pkt_action_counters_printout(const int nts) { } // Printout packet statistics - printoutf("timestep %d: ma_stat_activation_collexc = %td\n", nts, get_counter(COUNTER_MA_STAT_ACTIVATION_COLLEXC)); - printoutf("timestep %d: ma_stat_activation_collion = %td\n", nts, get_counter(COUNTER_MA_STAT_ACTIVATION_COLLION)); - printoutf("timestep %d: ma_stat_activation_ntcollexc = %td\n", nts, - get_counter(COUNTER_MA_STAT_ACTIVATION_NTCOLLEXC)); - printoutf("timestep %d: ma_stat_activation_ntcollion = %td\n", nts, - get_counter(COUNTER_MA_STAT_ACTIVATION_NTCOLLION)); - printoutf("timestep %d: ma_stat_activation_bb = %td\n", nts, get_counter(COUNTER_MA_STAT_ACTIVATION_BB)); - printoutf("timestep %d: ma_stat_activation_bf = %td\n", nts, get_counter(COUNTER_MA_STAT_ACTIVATION_BF)); - printoutf("timestep %d: ma_stat_activation_fb = %td\n", nts, get_counter(COUNTER_MA_STAT_ACTIVATION_FB)); - printoutf("timestep %d: ma_stat_deactivation_colldeexc = %td\n", nts, - get_counter(COUNTER_MA_STAT_DEACTIVATION_COLLDEEXC)); - printoutf("timestep %d: ma_stat_deactivation_collrecomb = %td\n", nts, - get_counter(COUNTER_MA_STAT_DEACTIVATION_COLLRECOMB)); - printoutf("timestep %d: ma_stat_deactivation_bb = %td\n", nts, get_counter(COUNTER_MA_STAT_DEACTIVATION_BB)); - printoutf("timestep %d: ma_stat_deactivation_fb = %td\n", nts, get_counter(COUNTER_MA_STAT_DEACTIVATION_FB)); - printoutf("timestep %d: ma_stat_internaluphigher = %td\n", nts, get_counter(COUNTER_MA_STAT_INTERNALUPHIGHER)); - printoutf("timestep %d: ma_stat_internaluphighernt = %td\n", nts, get_counter(COUNTER_MA_STAT_INTERNALUPHIGHERNT)); - printoutf("timestep %d: ma_stat_internaldownlower = %td\n", nts, get_counter(COUNTER_MA_STAT_INTERNALDOWNLOWER)); - - printoutf("timestep %d: k_stat_to_ma_collexc = %td\n", nts, get_counter(COUNTER_K_STAT_TO_MA_COLLEXC)); - printoutf("timestep %d: k_stat_to_ma_collion = %td\n", nts, get_counter(COUNTER_K_STAT_TO_MA_COLLION)); - printoutf("timestep %d: k_stat_to_r_ff = %td\n", nts, get_counter(COUNTER_K_STAT_TO_R_FF)); - printoutf("timestep %d: k_stat_to_r_fb = %td\n", nts, get_counter(COUNTER_K_STAT_TO_R_FB)); - printoutf("timestep %d: k_stat_to_r_bb = %td\n", nts, get_counter(COUNTER_K_STAT_TO_R_BB)); - printoutf("timestep %d: k_stat_from_ff = %td\n", nts, get_counter(COUNTER_K_STAT_FROM_FF)); - printoutf("timestep %d: k_stat_from_bf = %td\n", nts, get_counter(COUNTER_K_STAT_FROM_BF)); - printoutf("timestep %d: k_stat_from_earlierdecay = %td\n", nts, get_counter(COUNTER_K_STAT_FROM_EARLIERDECAY)); - - printoutf("timestep %d: nt_stat_from_gamma = %td\n", nts, get_counter(COUNTER_NT_STAT_FROM_GAMMA)); - printoutf("timestep %d: nt_stat_to_ionization = %td\n", nts, get_counter(COUNTER_NT_STAT_TO_IONIZATION)); - printoutf("timestep %d: nt_stat_to_excitation = %td\n", nts, get_counter(COUNTER_NT_STAT_TO_EXCITATION)); - printoutf("timestep %d: nt_stat_to_kpkt = %td\n", nts, get_counter(COUNTER_NT_STAT_TO_KPKT)); + printout("timestep %d: ma_stat_activation_collexc = %td\n", nts, get_counter(COUNTER_MA_STAT_ACTIVATION_COLLEXC)); + printout("timestep %d: ma_stat_activation_collion = %td\n", nts, get_counter(COUNTER_MA_STAT_ACTIVATION_COLLION)); + printout("timestep %d: ma_stat_activation_ntcollexc = %td\n", nts, get_counter(COUNTER_MA_STAT_ACTIVATION_NTCOLLEXC)); + printout("timestep %d: ma_stat_activation_ntcollion = %td\n", nts, get_counter(COUNTER_MA_STAT_ACTIVATION_NTCOLLION)); + printout("timestep %d: ma_stat_activation_bb = %td\n", nts, get_counter(COUNTER_MA_STAT_ACTIVATION_BB)); + printout("timestep %d: ma_stat_activation_bf = %td\n", nts, get_counter(COUNTER_MA_STAT_ACTIVATION_BF)); + printout("timestep %d: ma_stat_activation_fb = %td\n", nts, get_counter(COUNTER_MA_STAT_ACTIVATION_FB)); + printout("timestep %d: ma_stat_deactivation_colldeexc = %td\n", nts, + get_counter(COUNTER_MA_STAT_DEACTIVATION_COLLDEEXC)); + printout("timestep %d: ma_stat_deactivation_collrecomb = %td\n", nts, + get_counter(COUNTER_MA_STAT_DEACTIVATION_COLLRECOMB)); + printout("timestep %d: ma_stat_deactivation_bb = %td\n", nts, get_counter(COUNTER_MA_STAT_DEACTIVATION_BB)); + printout("timestep %d: ma_stat_deactivation_fb = %td\n", nts, get_counter(COUNTER_MA_STAT_DEACTIVATION_FB)); + printout("timestep %d: ma_stat_internaluphigher = %td\n", nts, get_counter(COUNTER_MA_STAT_INTERNALUPHIGHER)); + printout("timestep %d: ma_stat_internaluphighernt = %td\n", nts, get_counter(COUNTER_MA_STAT_INTERNALUPHIGHERNT)); + printout("timestep %d: ma_stat_internaldownlower = %td\n", nts, get_counter(COUNTER_MA_STAT_INTERNALDOWNLOWER)); + + printout("timestep %d: k_stat_to_ma_collexc = %td\n", nts, get_counter(COUNTER_K_STAT_TO_MA_COLLEXC)); + printout("timestep %d: k_stat_to_ma_collion = %td\n", nts, get_counter(COUNTER_K_STAT_TO_MA_COLLION)); + printout("timestep %d: k_stat_to_r_ff = %td\n", nts, get_counter(COUNTER_K_STAT_TO_R_FF)); + printout("timestep %d: k_stat_to_r_fb = %td\n", nts, get_counter(COUNTER_K_STAT_TO_R_FB)); + printout("timestep %d: k_stat_to_r_bb = %td\n", nts, get_counter(COUNTER_K_STAT_TO_R_BB)); + printout("timestep %d: k_stat_from_ff = %td\n", nts, get_counter(COUNTER_K_STAT_FROM_FF)); + printout("timestep %d: k_stat_from_bf = %td\n", nts, get_counter(COUNTER_K_STAT_FROM_BF)); + printout("timestep %d: k_stat_from_earlierdecay = %td\n", nts, get_counter(COUNTER_K_STAT_FROM_EARLIERDECAY)); + + printout("timestep %d: nt_stat_from_gamma = %td\n", nts, get_counter(COUNTER_NT_STAT_FROM_GAMMA)); + printout("timestep %d: nt_stat_to_ionization = %td\n", nts, get_counter(COUNTER_NT_STAT_TO_IONIZATION)); + printout("timestep %d: nt_stat_to_excitation = %td\n", nts, get_counter(COUNTER_NT_STAT_TO_EXCITATION)); + printout("timestep %d: nt_stat_to_kpkt = %td\n", nts, get_counter(COUNTER_NT_STAT_TO_KPKT)); nonthermal::nt_print_stats(modelvolume, deltat); - printoutf("timestep %d: escounter = %td\n", nts, get_counter(COUNTER_ESCOUNTER)); - printoutf("timestep %d: cellcrossing = %td\n", nts, get_counter(COUNTER_CELLCROSSINGS)); - printoutf("timestep %d: updatecellcounter = %td\n", nts, get_counter(COUNTER_UPDATECELL)); - printoutf("timestep %d: resonancescatterings = %td\n", nts, get_counter(COUNTER_RESONANCESCATTERINGS)); + printout("timestep %d: escounter = %td\n", nts, get_counter(COUNTER_ESCOUNTER)); + printout("timestep %d: cellcrossing = %td\n", nts, get_counter(COUNTER_CELLCROSSINGS)); + printout("timestep %d: updatecellcounter = %td\n", nts, get_counter(COUNTER_UPDATECELL)); + printout("timestep %d: resonancescatterings = %td\n", nts, get_counter(COUNTER_RESONANCESCATTERINGS)); - printoutf("timestep %d: upscatterings = %td\n", nts, get_counter(COUNTER_UPSCATTER)); - printoutf("timestep %d: downscatterings = %td\n", nts, get_counter(COUNTER_DOWNSCATTER)); + printout("timestep %d: upscatterings = %td\n", nts, get_counter(COUNTER_UPSCATTER)); + printout("timestep %d: downscatterings = %td\n", nts, get_counter(COUNTER_DOWNSCATTER)); } void reduce_estimators() { diff --git a/thermalbalance.cc b/thermalbalance.cc index 31df125da..ce94a8e2b 100644 --- a/thermalbalance.cc +++ b/thermalbalance.cc @@ -91,7 +91,7 @@ auto calculate_bfheatingcoeff(const int element, const int ion, const int level, intparas, nu_threshold, nu_max_phixs, epsabs, epsrel, GSL_INTEG_GAUSS61, &bfheating, &error); if (status != 0 && (status != 18 || (error / bfheating) > epsrelwarning)) { - printoutf( + printout( "bf_heating integrator gsl warning %d. modelgridindex %d Z=%d ionstage %d lower %d phixstargetindex %d " "integral %g error %g\n", status, modelgridindex, get_atomicnumber(element), get_ionstage(element, ion), level, phixstargetindex, @@ -127,7 +127,7 @@ auto get_heating_ion_coll_deexc(const int modelgridindex, const int element, con } } // const double nnion = get_nnion(modelgridindex, element, ion); - // printoutf("ion_col_deexc_heating: T_e %g nne %g Z=%d ionstage %d nnion %g heating_contrib %g contrib/nnion %g\n", + // printout("ion_col_deexc_heating: T_e %g nne %g Z=%d ionstage %d nnion %g heating_contrib %g contrib/nnion %g\n", // T_e, nne, get_atomicnumber(element), get_ionstage(element, ion), nnion, C_deexc, C_deexc / nnion); return C_deexc; } @@ -218,7 +218,7 @@ auto T_e_eqn_heating_minus_cooling(const double T_e, void *paras) -> double { const double volumetmin = grid::get_modelcell_assocvolume_tmin(modelgridindex); const double dV = 3 * volumetmin / pow(globals::tmin, 3) * pow(t_current, 2); // really dV/dt const double V = volumetmin * pow(t_current / globals::tmin, 3); - // printoutf("nntot %g, p %g, dV %g, V %g\n",nntot,p,dV,V); + // printout("nntot %g, p %g, dV %g, V %g\n",nntot,p,dV,V); heatingcoolingrates->cooling_adiabatic = p * dV / V; const double total_heating_rate = heatingcoolingrates->heating_ff + heatingcoolingrates->heating_bf + @@ -263,7 +263,7 @@ void calculate_bfheatingcoeffs(int modelgridindex, std::vector &bfheatin const double minelfrac = 0.01; for (int element = 0; element < get_nelements(); element++) { if (grid::get_elem_abundance(modelgridindex, element) <= minelfrac && !USE_LUT_BFHEATING) { - printoutf("skipping Z=%d X=%g, ", get_atomicnumber(element), grid::get_elem_abundance(modelgridindex, element)); + printout("skipping Z=%d X=%g, ", get_atomicnumber(element), grid::get_elem_abundance(modelgridindex, element)); } const int nions = get_nions(element); @@ -306,7 +306,7 @@ void call_T_e_finder(const int modelgridindex, const int timestep, const double const double T_max, HeatingCoolingRates *heatingcoolingrates, const std::vector &bfheatingcoeffs) { const double T_e_old = grid::get_Te(modelgridindex); - printoutf("Finding T_e in cell %d at timestep %d...", modelgridindex, timestep); + printout("Finding T_e in cell %d at timestep %d...", modelgridindex, timestep); Te_solution_paras paras = {.t_current = t_current, .modelgridindex = modelgridindex, @@ -319,7 +319,7 @@ void call_T_e_finder(const int modelgridindex, const int timestep, const double double thermalmax = T_e_eqn_heating_minus_cooling(T_max, find_T_e_f.params); if (!std::isfinite(thermalmin) || !std::isfinite(thermalmax)) { - printoutf( + printout( "[abort request] call_T_e_finder: non-finite results in modelcell %d (T_R=%g, W=%g). T_e forced to be " "MINTEMP\n", modelgridindex, grid::get_TR(modelgridindex), grid::get_W(modelgridindex)); @@ -343,15 +343,15 @@ void call_T_e_finder(const int modelgridindex, const int timestep, const double const double T_e_min = gsl_root_fsolver_x_lower(T_e_solver); const double T_e_max = gsl_root_fsolver_x_upper(T_e_solver); status = gsl_root_test_interval(T_e_min, T_e_max, 0, TEMPERATURE_SOLVER_ACCURACY); - // printoutf("iter %d, T_e interval [%g, %g], guess %g, status %d\n", iternum, T_e_min, T_e_max, T_e, status); + // printout("iter %d, T_e interval [%g, %g], guess %g, status %d\n", iternum, T_e_min, T_e_max, T_e, status); if (status != GSL_CONTINUE) { - printoutf("after %d iterations, T_e = %g K, interval [%g, %g]\n", iternum + 1, T_e, T_e_min, T_e_max); + printout("after %d iterations, T_e = %g K, interval [%g, %g]\n", iternum + 1, T_e, T_e_min, T_e_max); break; } } if (status == GSL_CONTINUE) { - printoutf("[warning] call_T_e_finder: T_e did not converge within %d iterations\n", maxit); + printout("[warning] call_T_e_finder: T_e did not converge within %d iterations\n", maxit); } gsl_root_fsolver_free(T_e_solver); @@ -361,14 +361,14 @@ void call_T_e_finder(const int modelgridindex, const int timestep, const double else if (thermalmax < 0) { // Thermal balance equation always negative ===> T_e = T_min T_e = MINTEMP; - printoutf( + printout( "[warning] call_T_e_finder: cooling bigger than heating at lower T_e boundary %g in modelcell %d " "(T_R=%g,W=%g). T_e forced to be MINTEMP\n", MINTEMP, modelgridindex, grid::get_TR(modelgridindex), grid::get_W(modelgridindex)); } else { // Thermal balance equation always negative ===> T_e = T_max T_e = MAXTEMP; - printoutf( + printout( "[warning] call_T_e_finder: heating bigger than cooling over the whole T_e range [%g,%g] in modelcell %d " "(T_R=%g,W=%g). T_e forced to be MAXTEMP\n", MINTEMP, MAXTEMP, modelgridindex, grid::get_TR(modelgridindex), grid::get_W(modelgridindex)); @@ -376,11 +376,11 @@ void call_T_e_finder(const int modelgridindex, const int timestep, const double if (T_e > 2 * T_e_old) { T_e = 2 * T_e_old; - printoutf("use T_e damping in cell %d\n", modelgridindex); + printout("use T_e damping in cell %d\n", modelgridindex); T_e = std::min(T_e, MAXTEMP); } else if (T_e < 0.5 * T_e_old) { T_e = 0.5 * T_e_old; - printoutf("use T_e damping in cell %d\n", modelgridindex); + printout("use T_e damping in cell %d\n", modelgridindex); T_e = std::max(T_e, MINTEMP); } diff --git a/update_grid.cc b/update_grid.cc index abbbb5549..502eca330 100644 --- a/update_grid.cc +++ b/update_grid.cc @@ -46,7 +46,7 @@ void write_to_estimators_file(FILE *estimators_file, const int mgi, const int ti const auto sys_time_start_write_estimators = std::time(nullptr); - printoutf("writing to estimators file timestep %d cell %d...\n", timestep, mgi); + printout("writing to estimators file timestep %d cell %d...\n", timestep, mgi); const auto T_e = grid::get_Te(mgi); const auto nne = grid::get_nne(mgi); @@ -671,7 +671,7 @@ void write_to_estimators_file(FILE *estimators_file, const int mgi, const int ti const auto write_estim_duration = std::time(nullptr) - sys_time_start_write_estimators; if (write_estim_duration >= 1) { - printoutf("writing estimators for timestep %d cell %d took %ld seconds\n", timestep, mgi, write_estim_duration); + printout("writing estimators for timestep %d cell %d took %ld seconds\n", timestep, mgi, write_estim_duration); } } @@ -681,12 +681,12 @@ void solve_Te_nltepops(const int mgi, const int nonemptymgi, const int nts, cons { // bfheating coefficients are needed for the T_e solver, but // they only depend on the radiation field, which is fixed during the iterations below - printoutf("calculate_bfheatingcoeffs for timestep %d cell %d...", nts, mgi); + printout("calculate_bfheatingcoeffs for timestep %d cell %d...", nts, mgi); const auto sys_time_start_calculate_bfheatingcoeffs = std::time(nullptr); thread_local static auto bfheatingcoeffs = std::vector(get_includedlevels()); calculate_bfheatingcoeffs(mgi, bfheatingcoeffs); - printoutf("took %ld seconds\n", std::time(nullptr) - sys_time_start_calculate_bfheatingcoeffs); + printout("took %ld seconds\n", std::time(nullptr) - sys_time_start_calculate_bfheatingcoeffs); const double convergence_tolerance = 0.04; for (int nlte_iter = 0; nlte_iter <= NLTEITER; nlte_iter++) { @@ -727,7 +727,7 @@ void solve_Te_nltepops(const int mgi, const int nonemptymgi, const int nts, cons calculate_ion_balance_nne(mgi); const int duration_solve_pops = std::time(nullptr) - sys_time_start_pops; - printoutf( + printout( "Grid solver cell %d timestep %d: time spent on: Spencer-Fano %ds, partfuncs/gamma " "%ds, T_e %ds, populations %ds\n", mgi, nts, duration_solve_spencerfano, duration_solve_partfuncs_or_gamma, duration_solve_T_e, @@ -751,24 +751,24 @@ void solve_Te_nltepops(const int mgi, const int nonemptymgi, const int nts, cons const double nne_prev = grid::get_nne(mgi); calculate_ion_balance_nne(mgi); // sets nne fracdiff_nne = fabs((grid::get_nne(mgi) / nne_prev) - 1); - printoutf( + printout( "NLTE solver cell %d timestep %d iteration %d: time spent on: Spencer-Fano %ds, T_e " "%ds, NLTE populations %ds\n", mgi, nts, nlte_iter, duration_solve_spencerfano, duration_solve_T_e, duration_solve_nltepops); - printoutf( + printout( "NLTE (Spencer-Fano/Te/pops) solver cell %d timestep %d iteration %d: prev_iter nne " "%g, new nne is %g, fracdiff %g, prev T_e %g new T_e %g fracdiff %g\n", mgi, nts, nlte_iter, nne_prev, grid::get_nne(mgi), fracdiff_nne, prev_T_e, grid::get_Te(mgi), fracdiff_T_e); if (fracdiff_nne <= convergence_tolerance && fracdiff_T_e <= convergence_tolerance) { - printoutf( + printout( "NLTE (Spencer-Fano/Te/pops) solver nne converged to tolerance %g <= %g and T_e to " "tolerance %g <= %g after %d iterations.\n", fracdiff_nne, convergence_tolerance, fracdiff_T_e, convergence_tolerance, nlte_iter + 1); break; } if (nlte_iter == NLTEITER) { - printoutf( + printout( "WARNING: NLTE solver failed to converge after %d iterations. Keeping solution from " "last iteration\n", nlte_iter + 1); @@ -802,7 +802,7 @@ void update_gamma_corrphotoionrenorm_bfheating_estimators(const int mgi, const d globals::gammaestimator[ionestimindex] / get_corrphotoioncoeff_ana(element, ion, 0, 0, mgi); if (!std::isfinite(globals::corrphotoionrenorm[ionestimindex])) { - printoutf( + printout( "[fatal] about to set corrphotoionrenorm = NaN = gammaestimator / " "get_corrphotoioncoeff_ana(%d,%d,%d,%d,%d)=%g/%g", element, ion, 0, 0, mgi, globals::gammaestimator[ionestimindex], @@ -853,7 +853,7 @@ void update_gamma_corrphotoionrenorm_bfheating_estimators(const int mgi, const d globals::bfheatingestimator[ionestimindex] = globals::bfheatingestimator[ionestimindex] / bfheatingcoeff_ana; if (!std::isfinite(globals::bfheatingestimator[ionestimindex])) { - printoutf( + printout( "[fatal] about to set bfheatingestimator = NaN = bfheatingestimator / " "get_bfheatingcoeff_ana(%d,%d,%d,%d,%d)=%g/%g", element, ion, 0, 0, mgi, globals::bfheatingestimator[ionestimindex], bfheatingcoeff_ana); @@ -899,7 +899,7 @@ void update_grid_cell(const int mgi, const int nts, const int nts_prev, const in grid::get_modelcell_assocvolume_tmin(mgi) * pow(globals::timesteps[nts_prev].mid / globals::tmin, 3); const auto sys_time_start_update_cell = std::time(nullptr); - printoutf("update_grid_cell: working on cell %d before timestep %d titeration %d...\n", mgi, nts, titer); + printout("update_grid_cell: working on cell %d before timestep %d titeration %d...\n", mgi, nts, titer); // Update current mass density of cell grid::set_rho(mgi, grid::get_rho_tmin(mgi) / pow(tratmid, 3)); @@ -920,7 +920,7 @@ void update_grid_cell(const int mgi, const int nts, const int nts_prev, const in grid::modelgrid[mgi].thick = 1; if (globals::opacity_case == 3) { - // printoutf("update_grid: opacity_case 3 ... updating globals::cell[n].chi_grey"); //MK + // printout("update_grid: opacity_case 3 ... updating globals::cell[n].chi_grey"); //MK if (grid::get_rho(mgi) > globals::rho_crit) { grid::set_kappagrey(mgi, globals::opcase3_normal * (0.9 * grid::get_ffegrp(mgi) + 0.1) * globals::rho_crit / grid::get_rho(mgi)); @@ -944,15 +944,15 @@ void update_grid_cell(const int mgi, const int nts, const int nts_prev, const in // last timestep. Therefore it has no valid Gamma estimators and must // be treated in LTE at restart. if (grid::modelgrid[mgi].thick != 1 && grid::get_W(mgi) == 1) { - printoutf( + printout( "force modelgrid cell %d to grey/LTE thick = 1 for update grid since existing W == 1. (will not have " "gamma estimators)\n", mgi); grid::modelgrid[mgi].thick = 1; } - printoutf("lte_iteration %d\n", globals::lte_iteration ? 1 : 0); - printoutf("mgi %d modelgrid.thick: %d (during grid update)\n", mgi, grid::modelgrid[mgi].thick); + printout("lte_iteration %d\n", globals::lte_iteration ? 1 : 0); + printout("mgi %d modelgrid.thick: %d (during grid update)\n", mgi, grid::modelgrid[mgi].thick); for (int element = 0; element < get_nelements(); element++) { calculate_cellpartfuncts(mgi, element); @@ -1026,8 +1026,8 @@ void update_grid_cell(const int mgi, const int nts, const int nts_prev, const in solve_Te_nltepops(mgi, nonemptymgi, nts, titer, heatingcoolingrates); } - printoutf("Temperature/NLTE solution for cell %d timestep %d took %ld seconds\n", mgi, nts, - std::time(nullptr) - sys_time_start_temperature_corrections); + printout("Temperature/NLTE solution for cell %d timestep %d took %ld seconds\n", mgi, nts, + std::time(nullptr) - sys_time_start_temperature_corrections); } const float nne = grid::get_nne(mgi); @@ -1038,19 +1038,19 @@ void update_grid_cell(const int mgi, const int nts, const int nts_prev, const in // cube corners will have radial pos > rmax, so clamp to 0. const double dist_to_obs = std::max(0., (globals::rmax * tratmid) - radial_pos); const double grey_optical_depth = grid::get_kappagrey(mgi) * grid::get_rho(mgi) * dist_to_obs; - printoutf( + printout( "modelgridcell %d, compton optical depth (/propgridcell) %g, grey optical depth " "(/propgridcell) %g\n", mgi, compton_optical_depth, grey_optical_deptha); - printoutf("radial_pos %g, distance_to_obs %g, tau_dist %g\n", radial_pos, dist_to_obs, grey_optical_depth); + printout("radial_pos %g, distance_to_obs %g, tau_dist %g\n", radial_pos, dist_to_obs, grey_optical_depth); grid::modelgrid[mgi].grey_depth = grey_optical_depth; // grey_optical_depth = compton_optical_depth; if ((grey_optical_depth >= globals::cell_is_optically_thick) && (nts < globals::num_grey_timesteps)) { - printoutf("timestep %d cell %d is treated in grey approximation (chi_grey %g [cm2/g], tau %g >= %g)\n", nts, mgi, - grid::get_kappagrey(mgi), grey_optical_depth, globals::cell_is_optically_thick); + printout("timestep %d cell %d is treated in grey approximation (chi_grey %g [cm2/g], tau %g >= %g)\n", nts, mgi, + grid::get_kappagrey(mgi), grey_optical_depth, globals::cell_is_optically_thick); grid::modelgrid[mgi].thick = 1; } else if (VPKT_ON && (grey_optical_depth > cell_is_optically_thick_vpkt)) { grid::modelgrid[mgi].thick = 2; @@ -1066,7 +1066,7 @@ void update_grid_cell(const int mgi, const int nts, const int nts_prev, const in } else if (globals::simulation_continued_from_saved && nts == globals::timestep_initial) { // cooling rates were read from the gridsave file for this timestep // make sure they are valid - printoutf("cooling rates read from gridsave file for timestep %d cell %d...", nts, mgi); + printout("cooling rates read from gridsave file for timestep %d cell %d...", nts, mgi); assert_always(grid::modelgrid[mgi].totalcooling >= 0.); assert_always(grid::modelgrid[mgi].ion_cooling_contribs[0] >= 0.); } else { @@ -1074,13 +1074,13 @@ void update_grid_cell(const int mgi, const int nts, const int nts_prev, const in // and ion contributions inside update grid and communicate between MPI tasks const auto sys_time_start_calc_kpkt_rates = std::time(nullptr); - printoutf("calculating cooling_rates for timestep %d cell %d...", nts, mgi); + printout("calculating cooling_rates for timestep %d cell %d...", nts, mgi); // don't pass pointer to heatingcoolingrates because current populations and rates weren't // used to determine T_e kpkt::calculate_cooling_rates(mgi, nullptr); - printoutf("took %ld seconds\n", std::time(nullptr) - sys_time_start_calc_kpkt_rates); + printout("took %ld seconds\n", std::time(nullptr) - sys_time_start_calc_kpkt_rates); } if constexpr (EXPANSIONOPACITIES_ON || RPKT_BOUNDBOUND_THERMALISATION_PROBABILITY > 0.) { @@ -1091,7 +1091,7 @@ void update_grid_cell(const int mgi, const int nts, const int nts_prev, const in const int update_grid_cell_seconds = std::time(nullptr) - sys_time_start_update_cell; if (update_grid_cell_seconds > 0) { - printoutf("update_grid_cell for cell %d timestep %d took %d seconds\n", mgi, nts, update_grid_cell_seconds); + printout("update_grid_cell for cell %d timestep %d took %d seconds\n", mgi, nts, update_grid_cell_seconds); } } @@ -1104,12 +1104,11 @@ void update_grid(FILE *estimators_file, const int nts, const int nts_prev, const // nts timestep { const auto sys_time_start_update_grid = std::time(nullptr); - printoutf("\n"); - printoutf("timestep %d: time before update grid %ld (tstart + %ld) simtime ts_mid %g days\n", nts, - sys_time_start_update_grid, sys_time_start_update_grid - real_time_start, - globals::timesteps[nts].mid / DAY); + printout("\n"); + printout("timestep %d: time before update grid %ld (tstart + %ld) simtime ts_mid %g days\n", nts, + sys_time_start_update_grid, sys_time_start_update_grid - real_time_start, globals::timesteps[nts].mid / DAY); - // printoutf("[debug] update_grid: starting update for timestep %d...\n",m); + // printout("[debug] update_grid: starting update for timestep %d...\n",m); const double tratmid = globals::timesteps[nts].mid / globals::tmin; // Calculate the critical opacity at which opacity_case 3 switches from a @@ -1119,14 +1118,14 @@ void update_grid(FILE *estimators_file, const int nts, const int nts_prev, const // globals::timesteps[m].mid; globals::rho_crit = ME * CLIGHT * decay::nucmass(28, 56) / (PI * QE * QE * globals::rho_crit_para * 3000e-8 * globals::timesteps[nts].mid); - printoutf("update_grid: rho_crit = %g\n", globals::rho_crit); + printout("update_grid: rho_crit = %g\n", globals::rho_crit); // These values will not be used if nts == 0, but set them anyway // nts_prev is the previous timestep, unless this is timestep zero const double deltat = globals::timesteps[nts_prev].width; - // printoutf("timestep %d, titer %d\n", nts, titer); - // printoutf("deltat %g\n", deltat); + // printout("timestep %d, titer %d\n", nts, titer); + // printout("deltat %g\n", deltat); cellcache_change_cell(-99); @@ -1175,15 +1174,15 @@ void update_grid(FILE *estimators_file, const int nts, const int nts_prev, const // #endif globals::max_path_step = std::min(1.e35, globals::rmax / 10.); - printoutf("max_path_step %g\n", globals::max_path_step); + printout("max_path_step %g\n", globals::max_path_step); const auto time_update_grid_end_thisrank = std::time(nullptr); - printoutf("finished update grid on this rank at time %ld\n", time_update_grid_end_thisrank); + printout("finished update grid on this rank at time %ld\n", time_update_grid_end_thisrank); #ifdef MPI_ON MPI_Barrier(MPI_COMM_WORLD); #endif - printoutf( + printout( "timestep %d: time after update grid for all processes %ld (rank %d took %lds, waited " "%lds, total %lds)\n", nts, std::time(nullptr), my_rank, time_update_grid_end_thisrank - sys_time_start_update_grid, diff --git a/update_packets.cc b/update_packets.cc index 1aa55b1de..5f893e748 100644 --- a/update_packets.cc +++ b/update_packets.cc @@ -176,8 +176,8 @@ void update_pellet(Packet &pkt, const int nts, const double t2) { atomicadd(globals::timesteps[nts].alpha_emission, pkt.e_cmf); pkt.type = TYPE_NONTHERMAL_PREDEPOSIT_ALPHA; } else if constexpr (TESTMODE) { - printoutf("ERROR: pellet marked as particle emission is for decaytype %d != any of (alpha, beta+, beta-)\n", - pkt.pellet_decaytype); + printout("ERROR: pellet marked as particle emission is for decaytype %d != any of (alpha, beta+, beta-)\n", + pkt.pellet_decaytype); std::abort(); } else { __builtin_unreachable(); @@ -203,7 +203,7 @@ void update_pellet(Packet &pkt, const int nts, const double t2) { pkt.prop_time = globals::tmin; } else if constexpr (TESTMODE) { - printoutf("ERROR: Something wrong with decaying pellets. tdecay %g ts %g (ts + tw) %g\n", tdecay, ts, t2); + printout("ERROR: Something wrong with decaying pellets. tdecay %g ts %g (ts + tw) %g\n", tdecay, ts, t2); assert_testmodeonly(false); } else { __builtin_unreachable(); @@ -267,7 +267,7 @@ void do_packet(Packet &pkt, const double t2, const int nts) default: { if constexpr (TESTMODE) { - printoutf("ERROR: Unknown packet type %d\n", pkt.type); + printout("ERROR: Unknown packet type %d\n", pkt.type); assert_testmodeonly(false); } else { __builtin_unreachable(); @@ -366,7 +366,7 @@ void update_packets(const int my_rank, const int nts, std::span packets) const double ts_end = ts + tw; const auto time_update_packets_start = std::time(nullptr); - printoutf("timestep %d: start update_packets at time %ld\n", nts, time_update_packets_start); + printout("timestep %d: start update_packets at time %ld\n", nts, time_update_packets_start); bool timestepcomplete = false; int passnumber = 0; while (!timestepcomplete) { @@ -374,7 +374,7 @@ void update_packets(const int my_rank, const int nts, std::span packets) std::ranges::SORT_OR_STABLE_SORT(packets, std_compare_packets_bymodelgriddensity); - printoutf(" update_packets timestep %d pass %3d: started at %ld\n", nts, passnumber, sys_time_start_pass); + printout(" update_packets timestep %d pass %3d: started at %ld\n", nts, passnumber, sys_time_start_pass); const int count_pktupdates = static_cast(std::ranges::count_if( packets, [ts_end](const auto &pkt) { return pkt.prop_time < ts_end && pkt.type != TYPE_ESCAPE; })); @@ -413,7 +413,7 @@ void update_packets(const int my_rank, const int nts, std::span packets) packets, [ts_end](const auto &pkt) { return pkt.prop_time >= ts_end || pkt.type == TYPE_ESCAPE; }); const int cellcacheresets = stats::get_counter(stats::COUNTER_UPDATECELL) - updatecellcounter_beforepass; - printoutf( + printout( " update_packets timestep %d pass %3d: finished at %ld packetsupdated %7d cellcacheresets %7d (took %lds)\n", nts, passnumber, std::time(nullptr), count_pktupdates, cellcacheresets, std::time(nullptr) - sys_time_start_pass); @@ -424,12 +424,12 @@ void update_packets(const int my_rank, const int nts, std::span packets) stats::pkt_action_counters_printout(nts); const auto time_update_packets_end_thisrank = std::time(nullptr); - printoutf("timestep %d: end of update_packets for this rank at time %ld\n", nts, time_update_packets_end_thisrank); + printout("timestep %d: end of update_packets for this rank at time %ld\n", nts, time_update_packets_end_thisrank); #ifdef MPI_ON MPI_Barrier(MPI_COMM_WORLD); // hold all processes once the packets are updated #endif - printoutf( + printout( "timestep %d: time after update packets for all processes %ld (rank %d took %lds, waited %lds, total %lds)\n", nts, std::time(nullptr), my_rank, time_update_packets_end_thisrank - time_update_packets_start, std::time(nullptr) - time_update_packets_end_thisrank, std::time(nullptr) - time_update_packets_start); diff --git a/vpkt.cc b/vpkt.cc index 950d850a3..d05c418c2 100644 --- a/vpkt.cc +++ b/vpkt.cc @@ -313,7 +313,7 @@ auto rlc_emiss_vpkt(const Packet &pkt, const double t_current, const double t_ar // the excluded line vpkt.next_trans -= 1; - // printoutf("ldist > sdist : line in the next cell\n"); + // printout("ldist > sdist : line in the next cell\n"); break; } @@ -486,7 +486,7 @@ void read_vspecpol(const int my_rank, const int nts) { char filename[MAXFILENAMELENGTH]; snprintf(filename, MAXFILENAMELENGTH, "vspecpol_%.4d_ts%d.tmp", my_rank, nts); - printoutf("Reading %s\n", filename); + printout("Reading %s\n", filename); FILE *vspecpol_file = fopen_required(filename, "r"); @@ -573,7 +573,7 @@ void read_vpkt_grid(const int my_rank, const int nts) { char filename[MAXFILENAMELENGTH]; snprintf(filename, MAXFILENAMELENGTH, "vpkt_grid_%.4d_ts%d.tmp", my_rank, nts); - printoutf("Reading vpkt grid file %s\n", filename); + printout("Reading vpkt grid file %s\n", filename); FILE *vpkt_grid_file = fopen_required(filename, "r"); for (int obsdirindex = 0; obsdirindex < Nobs; obsdirindex++) { @@ -602,7 +602,7 @@ void vpkt_remove_temp_file(const int nts, const int my_rank) { for (const auto *filename : filenames) { if (std::filesystem::exists(filename)) { std::remove(filename); - printoutf("Deleted %s\n", filename); + printout("Deleted %s\n", filename); } } } @@ -613,7 +613,7 @@ void read_parameterfile_vpkt() { // Nobs assert_always(fscanf(input_file, "%d", &Nobs) == 1); - printoutf("vpkt.txt: Nobs %d directions\n", Nobs); + printout("vpkt.txt: Nobs %d directions\n", Nobs); // nz_obs_vpkt. Cos(theta) to the observer. A list in the case of many observers nz_obs_vpkt.resize(Nobs); @@ -621,7 +621,7 @@ void read_parameterfile_vpkt() { assert_always(fscanf(input_file, "%lg", &nz_obs_vpkt[i]) == 1); if (fabs(nz_obs_vpkt[i]) > 1) { - printoutf("Wrong observer direction\n"); + printout("Wrong observer direction\n"); std::abort(); } else if (nz_obs_vpkt[i] == 1) { nz_obs_vpkt[i] = 0.9999; @@ -638,8 +638,8 @@ void read_parameterfile_vpkt() { phiobs[i] = phi_degrees * PI / 180.; const double theta_degrees = std::acos(nz_obs_vpkt[i]) / PI * 180.; - printoutf("vpkt.txt: direction %d costheta %g (%.1f degrees) phi %g (%.1f degrees)\n", i, nz_obs_vpkt[i], - theta_degrees, phiobs[i], phi_degrees); + printout("vpkt.txt: direction %d costheta %g (%.1f degrees) phi %g (%.1f degrees)\n", i, nz_obs_vpkt[i], + theta_degrees, phiobs[i], phi_degrees); } // Nspectra opacity choices (i.e. Nspectra spectra for each observer) @@ -663,7 +663,7 @@ void read_parameterfile_vpkt() { } } - printoutf("vpkt.txt: Nspectra %d per observer\n", Nspectra); + printout("vpkt.txt: Nspectra %d per observer\n", Nspectra); tau_vpkt.resize(Nspectra, 0.); // time window. If dum4=1 it restrict vpkt to time windown (dum5,dum6) @@ -672,17 +672,17 @@ void read_parameterfile_vpkt() { double vspec_tmax_in_days = 0.; assert_always(fscanf(input_file, "%d %lg %lg \n", &override_tminmax, &vspec_tmin_in_days, &vspec_tmax_in_days) == 3); - printoutf("vpkt: compiled with VSPEC_TIMEMIN %.1fd VSPEC_TIMEMAX %1.fd VMTBINS %d\n", VSPEC_TIMEMIN / DAY, - VSPEC_TIMEMAX / DAY, VMTBINS); + printout("vpkt: compiled with VSPEC_TIMEMIN %.1fd VSPEC_TIMEMAX %1.fd VMTBINS %d\n", VSPEC_TIMEMIN / DAY, + VSPEC_TIMEMAX / DAY, VMTBINS); if (override_tminmax == 1) { VSPEC_TIMEMIN_input = vspec_tmin_in_days * DAY; VSPEC_TIMEMAX_input = vspec_tmax_in_days * DAY; - printoutf("vpkt.txt: VSPEC_TIMEMIN_input %.1fd, VSPEC_TIMEMAX_input %.1fd\n", VSPEC_TIMEMIN_input / DAY, - VSPEC_TIMEMAX_input / DAY); + printout("vpkt.txt: VSPEC_TIMEMIN_input %.1fd, VSPEC_TIMEMAX_input %.1fd\n", VSPEC_TIMEMIN_input / DAY, + VSPEC_TIMEMAX_input / DAY); } else { VSPEC_TIMEMIN_input = VSPEC_TIMEMIN; VSPEC_TIMEMAX_input = VSPEC_TIMEMAX; - printoutf( + printout( "vpkt.txt: VSPEC_TIMEMIN_input %.1fd, VSPEC_TIMEMAX_input %.1fd (inherited from VSPEC_TIMEMIN and " "VSPEC_TIMEMAX)\n", VSPEC_TIMEMIN_input / DAY, VSPEC_TIMEMAX_input / DAY); @@ -698,17 +698,17 @@ void read_parameterfile_vpkt() { int flag_custom_freq_ranges = 0; assert_always(fscanf(input_file, "%d ", &flag_custom_freq_ranges) == 1); - printoutf("vpkt: compiled with VMNUBINS %d\n", VMNUBINS); + printout("vpkt: compiled with VMNUBINS %d\n", VMNUBINS); assert_always(VSPEC_NUMAX > VSPEC_NUMIN); - printoutf("vpkt: compiled with VSPEC_NUMAX %g lambda_min %g Å\n", VSPEC_NUMAX, 1e8 * CLIGHT / VSPEC_NUMAX); - printoutf("vpkt: compiled with VSPEC_NUMIN %g lambda_max %g Å\n", VSPEC_NUMIN, 1e8 * CLIGHT / VSPEC_NUMIN); + printout("vpkt: compiled with VSPEC_NUMAX %g lambda_min %g Å\n", VSPEC_NUMAX, 1e8 * CLIGHT / VSPEC_NUMAX); + printout("vpkt: compiled with VSPEC_NUMIN %g lambda_max %g Å\n", VSPEC_NUMIN, 1e8 * CLIGHT / VSPEC_NUMIN); if (flag_custom_freq_ranges == 1) { assert_always(fscanf(input_file, "%d ", &Nrange) == 1); VSPEC_NUMIN_input.resize(Nrange, 0.); VSPEC_NUMAX_input.resize(Nrange, 0.); - printoutf("vpkt.txt: Nrange %d frequency intervals per spectrum per observer\n", Nrange); + printout("vpkt.txt: Nrange %d frequency intervals per spectrum per observer\n", Nrange); for (int i = 0; i < Nrange; i++) { double lmin_vspec_input = 0.; @@ -727,12 +727,12 @@ void read_parameterfile_vpkt() { VSPEC_NUMIN_input.push_back(VSPEC_NUMIN); VSPEC_NUMAX_input.push_back(VSPEC_NUMAX); - printoutf("vpkt.txt: Nrange 1 frequency interval (inherited from VSPEC_NUMIN and VSPEC_NUMAX)\n"); + printout("vpkt.txt: Nrange 1 frequency interval (inherited from VSPEC_NUMIN and VSPEC_NUMAX)\n"); } for (int i = 0; i < Nrange; i++) { - printoutf("vpkt.txt: range %d lambda [%g, %g] Angstroms\n", i, 1e8 * CLIGHT / VSPEC_NUMAX_input[i], - 1e8 * CLIGHT / VSPEC_NUMIN_input[i]); + printout("vpkt.txt: range %d lambda [%g, %g] Angstroms\n", i, 1e8 * CLIGHT / VSPEC_NUMAX_input[i], + 1e8 * CLIGHT / VSPEC_NUMIN_input[i]); } // if dum7=1, vpkt are not created when cell optical depth is larger than cell_is_optically_thick_vpkt @@ -740,22 +740,22 @@ void read_parameterfile_vpkt() { assert_always(fscanf(input_file, "%d %lg \n", &override_thickcell_tau, &cell_is_optically_thick_vpkt) == 2); if (override_thickcell_tau == 1) { - printoutf("vpkt.txt: cell_is_optically_thick_vpkt %lg\n", cell_is_optically_thick_vpkt); + printout("vpkt.txt: cell_is_optically_thick_vpkt %lg\n", cell_is_optically_thick_vpkt); } else { cell_is_optically_thick_vpkt = globals::cell_is_optically_thick; - printoutf("vpkt.txt: cell_is_optically_thick_vpkt %lg (inherited from cell_is_optically_thick)\n", - cell_is_optically_thick_vpkt); + printout("vpkt.txt: cell_is_optically_thick_vpkt %lg (inherited from cell_is_optically_thick)\n", + cell_is_optically_thick_vpkt); } // Maximum optical depth. If a vpkt reaches dum7 is thrown away assert_always(fscanf(input_file, "%lg \n", &tau_max_vpkt) == 1); - printoutf("vpkt.txt: tau_max_vpkt %g\n", tau_max_vpkt); + printout("vpkt.txt: tau_max_vpkt %g\n", tau_max_vpkt); // Produce velocity grid map if =1 int in_vgrid_on = 0; assert_always(fscanf(input_file, "%d \n", &in_vgrid_on) == 1); vgrid_on = in_vgrid_on != 0; - printoutf("vpkt.txt: velocity grid map %s\n", (vgrid_on) ? "ENABLED" : "DISABLED"); + printout("vpkt.txt: velocity grid map %s\n", (vgrid_on) ? "ENABLED" : "DISABLED"); if (vgrid_on) { double tmin_grid_in_days{NAN}; @@ -765,12 +765,12 @@ void read_parameterfile_vpkt() { tmin_grid = tmin_grid_in_days * DAY; tmax_grid = tmax_grid_in_days * DAY; - printoutf("vpkt.txt: velocity grid time range tmin_grid %gd tmax_grid %gd\n", tmin_grid / DAY, tmax_grid / DAY); + printout("vpkt.txt: velocity grid time range tmin_grid %gd tmax_grid %gd\n", tmin_grid / DAY, tmax_grid / DAY); // Specify wavelength range: number of intervals (dum9) and limits (dum10,dum11) assert_always(fscanf(input_file, "%d ", &Nrange_grid) == 1); - printoutf("vpkt.txt: velocity grid frequency intervals %d\n", Nrange_grid); + printout("vpkt.txt: velocity grid frequency intervals %d\n", Nrange_grid); nu_grid_max.resize(Nrange_grid, 0.); nu_grid_min.resize(Nrange_grid, 0.); @@ -782,8 +782,8 @@ void read_parameterfile_vpkt() { nu_grid_max[i] = CLIGHT / (range_lambda_min * 1e-8); nu_grid_min[i] = CLIGHT / (range_lambda_max * 1e-8); - printoutf("vpkt.txt: velgrid range %d lambda [%g, %g] Angstroms\n", i, 1e8 * CLIGHT / nu_grid_max[i], - 1e8 * CLIGHT / nu_grid_min[i]); + printout("vpkt.txt: velgrid range %d lambda [%g, %g] Angstroms\n", i, 1e8 * CLIGHT / nu_grid_max[i], + 1e8 * CLIGHT / nu_grid_min[i]); } } @@ -804,7 +804,7 @@ void vpkt_write_timestep(const int nts, const int my_rank, const bool is_final) snprintf(filename_vspecpol, MAXFILENAMELENGTH, "vspecpol_%.4d_ts%d.tmp", my_rank, nts); } - printoutf("Writing %s\n", filename_vspecpol); + printout("Writing %s\n", filename_vspecpol); FILE *vspecpol_file = fopen_required(filename_vspecpol, "w"); write_vspecpol(vspecpol_file); fclose(vspecpol_file); @@ -817,7 +817,7 @@ void vpkt_write_timestep(const int nts, const int my_rank, const bool is_final) snprintf(filename_vpktgrid, MAXFILENAMELENGTH, "vpkt_grid_%.4d_ts%d.tmp", my_rank, nts); } - printoutf("Writing vpkt grid file %s\n", filename_vpktgrid); + printout("Writing vpkt grid file %s\n", filename_vpktgrid); FILE *vpkt_grid_file = fopen_required(filename_vpktgrid, "w"); write_vpkt_grid(vpkt_grid_file); fclose(vpkt_grid_file); @@ -836,7 +836,7 @@ void vpkt_write_timestep(const int nts, const int my_rank, const bool is_final) } std::filesystem::copy_file(filename_prev, filename, std::filesystem::copy_options::overwrite_existing); - printoutf("Copying %s to %s\n", filename_prev, filename); + printout("Copying %s to %s\n", filename_prev, filename); if (!is_final) { vpkt_contrib_file = std::ofstream(filename, std::ios::app); @@ -862,7 +862,7 @@ void vpkt_init(const int nts, const int my_rank, const bool continued_from_saved char filename_prev[MAXFILENAMELENGTH]; snprintf(filename_prev, MAXFILENAMELENGTH, "vpackets_%.4d_ts%d.tmp", my_rank, nts); std::filesystem::copy_file(filename_prev, filename, std::filesystem::copy_options::overwrite_existing); - printoutf("Copying %s to %s\n", filename_prev, filename); + printout("Copying %s to %s\n", filename_prev, filename); } else { // Create new file with header line vpkt_contrib_file = std::ofstream(filename, std::ios::trunc);