Skip to content

Commit

Permalink
Small format changes relevant to #653 having to do with star and agn
Browse files Browse the repository at this point in the history
treatment
  • Loading branch information
kslong committed Dec 19, 2019
1 parent 5bc5dac commit 30289ef
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 17 deletions.
30 changes: 18 additions & 12 deletions source/photon_gen.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
5 changes: 2 additions & 3 deletions source/python.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 */


Expand Down
36 changes: 36 additions & 0 deletions source/recipes.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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)
{
Expand All @@ -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;j<npoints+1;j++)
{
printf ("OUTPUT %e %e\n",a+j*dx,func(a+j*dx,test));
}
for (j=0;j<w->size;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
Expand Down
4 changes: 2 additions & 2 deletions source/run.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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 ();
Expand Down

0 comments on commit 30289ef

Please sign in to comment.