From 30289efda3ec2acd53a7d85f12fb40b39549e5c5 Mon Sep 17 00:00:00 2001 From: "Knox S. Long" Date: Thu, 19 Dec 2019 16:20:57 -0600 Subject: [PATCH] Small format changes relevant to #653 having to do with star and agn treatment --- source/photon_gen.c | 30 ++++++++++++++++++------------ source/python.h | 5 ++--- source/recipes.c | 36 ++++++++++++++++++++++++++++++++++++ source/run.c | 4 ++-- 4 files changed, 58 insertions(+), 17 deletions(-) diff --git a/source/photon_gen.c b/source/photon_gen.c index bcd8a4478..2d944d02a 100644 --- a/source/photon_gen.c +++ b/source/photon_gen.c @@ -455,26 +455,32 @@ iwind = -1 Don't generate any wind photons at all int phot_status () { - if (geo.adiabatic) - Log ("!! xdefine_phot: heating & cooling due to adiabatic processes: %8.2e %8.2e \n", geo.heat_adiabatic, geo.cool_adiabatic); Log - ("!! xdefine_phot: lum_tot %8.2e lum_star %8.2e lum_disk %8.2e lum_bl %8.2e lum_agn %8.2e lum_wind %8.2e\n", - geo.lum_tot, geo.lum_star, geo.lum_disk, geo.lum_bl, geo.lum_agn, geo.lum_wind); + ("!! xdefine_phot: lum_tot %8.2e lum_star %8.2e lum_bl %8.2e lum_bh %8.2e lum_disk %8.2e lum_wind %8.2e\n", + geo.lum_tot, geo.lum_star, geo.lum_bl, geo.lum_agn, geo.lum_disk, geo.lum_wind); Log - ("!! xdefine_phot: f_tot %8.2e f_star %8.2e f_disk %8.2e f_bl %8.2e f_agn %8.2e f_wind %8.2e f_matom %8.2e f_kpkt %8.2e \n", - geo.f_tot, geo.f_star, geo.f_disk, geo.f_bl, geo.f_agn, geo.f_wind, geo.f_matom, geo.f_kpkt); + ("!! xdefine_phot: f_tot %8.2e f_star %8.2e f_bl %8.2e f_bh %8.2e f_disk %8.2e f_wind %8.2e f_matom %8.2e f_kpkt %8.2e \n", + geo.f_tot, geo.f_star, geo.f_bl, geo.f_agn, geo.f_disk, geo.f_wind, geo.f_matom, geo.f_kpkt); Log ("!! xdefine_phot: wind ff %8.2e fb %8.2e lines %8.2e for freq %8.2e %8.2e\n", geo.lum_ff, geo.lum_rr, geo.lum_lines, geo.f1, geo.f2); - Log - ("!! xdefine_phot: star tstar %8.2e %8.2e lum_star %8.2e %8.2e %8.2e \n", - geo.tstar, geo.tstar_init, geo.lum_star, geo.lum_star_init, geo.lum_star_back); - Log - ("!! xdefine_phot: disk lum_disk %8.2e %8.2e %8.2e \n", - geo.lum_disk, geo.lum_disk_init, geo.lum_disk_back); + if (geo.lum_star > 0) + { + Log + ("!! xdefine_phot: star tstar %8.2e %8.2e lum_star %8.2e %8.2e %8.2e \n", + geo.tstar, geo.tstar_init, geo.lum_star, geo.lum_star_init, geo.lum_star_back); + } + if (geo.lum_disk > 0) + { + Log + ("!! xdefine_phot: disk lum_disk %8.2e %8.2e %8.2e \n", + geo.lum_disk, geo.lum_disk_init, geo.lum_disk_back); + } + if (geo.adiabatic) + Log ("!! xdefine_phot: heating & cooling due to adiabatic processes: %8.2e %8.2e \n", geo.heat_adiabatic, geo.cool_adiabatic); return (0); } diff --git a/source/python.h b/source/python.h index 0c9ef71d8..766f55198 100755 --- a/source/python.h +++ b/source/python.h @@ -363,7 +363,7 @@ struct geometry double swavemin, swavemax, sfmin, sfmax; // The minimum and maximum wavelengths/freqs for detailed spectra int select_extract, select_spectype; -/* Begin description of the actual geometery */ +/* Begin description of the actual geometry */ /* The next variables refere to the entire space in which pbotons sill be tracked. Photons * outside these regions are assumed to have hit something or be freely moving through space. @@ -394,7 +394,7 @@ struct geometry the temperature of the disk for future ionization cycles */ - int absorb_reflect; /*Controls what happens when a photong hits the disk or star + int absorb_reflect; /*Controls what happens when a photon hits the disk or star */ #define DISK_TPROFILE_STANDARD 0 // This is a standard Shakura-Sunyaev disk. The profile depends on mstar and mdot_disk @@ -581,7 +581,6 @@ struct geometry of the agn is elsewhere in the structure */ double const_agn; /*The constant for the Power law, there are lots of ways of defining the PL which is best? */ -//OLD double r_agn; /* radius of the "photosphere" of the BH in the AGN. */ double d_agn; /* the distance to the agn - only used in balance to calculate the ionization fraction */ diff --git a/source/recipes.c b/source/recipes.c index 2dd9a53e4..a1c80f6b4 100755 --- a/source/recipes.c +++ b/source/recipes.c @@ -91,7 +91,12 @@ num_int (func, a, b, eps) int status = 0; int status2 = 0; +<<<<<<< Updated upstream int npoints; +======= + int npoints, j; + double dx; +>>>>>>> Stashed changes size_t neval; gsl_function F; F.function = func; @@ -112,7 +117,13 @@ num_int (func, a, b, eps) { gsl_set_error_handler_off (); //We need to be able to catch and handle gsl errors +<<<<<<< Updated upstream gsl_integration_workspace *w = gsl_integration_workspace_alloc (1000); +======= +// gsl_integration_romberg_workspace *w = gsl_integration_romberg_alloc (10); + gsl_integration_workspace *w = gsl_integration_workspace_alloc (1000); +// gsl_integration_romberg (&F, a, b, 0, eps, &result, &neval, w); +>>>>>>> Stashed changes status = gsl_integration_qags (&F, a, b, 0, eps, 1000, w, &result, &error); if (status) { @@ -122,10 +133,35 @@ num_int (func, a, b, eps) gsl_integration_romberg_workspace *w = gsl_integration_romberg_alloc (30); status2 = gsl_integration_romberg (&F, a, b, 0, eps, &result2, &neval, w); gsl_integration_romberg_free (w); +<<<<<<< Updated upstream +======= + printf ("Errored %e %e %e %e\n", a, b, result, result2); +>>>>>>> Stashed changes if (status2) { Error ("num_init: some kind of error in romberg and qags integration\n"); } +<<<<<<< Updated upstream +======= +/* dx=(b-a)/npoints; + for (j=0;jsize;j++) + { + printf ("INTEG %i %e %e %e %e\n",j,w->alist[j],w->blist[j],w->rlist[j],w->elist[j]); + } + if (error*100. < result) + { + Error ("num_int: cannot reach tolerance because of roundoff - returning best guess\n"); + } + else + { + Error ("BLAH num_int: cannot reach tolerance because of roundoff, and guess has error of more than 1pc %e %e\n",error,result); +// exit(0); + }*/ +>>>>>>> Stashed changes } } else diff --git a/source/run.c b/source/run.c index 1c1850c2e..4b41865c2 100644 --- a/source/run.c +++ b/source/run.c @@ -276,7 +276,7 @@ calculate_ionization (restart_stat) } Log ("!!python: luminosity lost by being completely absorbed %18.12e \n", zz_abs); Log ("!!python: luminosity lost by too many scatters %18.12e \n", zz_scat); - Log ("!!python: luminosity lost by hitting the star %18.12e \n", zz_star); + Log ("!!python: luminosity lost by hitting the central object %18.12e \n", zz_star); Log ("!!python: luminosity lost by hitting the disk %18.12e \n", zz_disk); Log ("!!python: luminosity lost by errors %18.12e \n", zz_err); Log ("!!python: luminosity lost by the unknown %18.12e \n", zz_else); @@ -683,7 +683,7 @@ make_spectra (restart_stat) xsignal (files.root, "%-20s %s\n", "COMPLETE", files.root); - Log ("\nBrief Run Summary\nAt program comppletion, the elapsed TIME was %f\n", timer ()); + Log ("\nBrief Run Summary\nAt program completion, the elapsed TIME was %f\n", timer ()); Log ("There were %d of %d ionization cycles and %d of %d spectral cycles run\n", geo.wcycle, geo.wcycles, geo.pcycle, geo.pcycles); Log ("Convergence statistics for the wind after the ionization calculation:\n"); check_convergence ();