sirocco-rt / sirocco

This is the repository for Sirocco, the radiative transfer code used to model winds in AGN and other systems
https://sirocco-rt.readthedocs.io/en/latest/
GNU General Public License v3.0
30 stars 24 forks source link

fix extract for bubble and lamp-post PL sources #1011

Closed jhmatthews closed 1 year ago

jhmatthews commented 1 year ago

In extract, a reweighting is applied which applies the Eddington approximation. The lines that do this are as follows:

    if (itype == PTYPE_STAR || itype == PTYPE_BL ||itype == PTYPE_AGN)
    {
      stuff_v (pp.x, x);
      renorm (x, 1.);
      zz = fabs (dot (x, pp.lmn));
      pp.w *= zz * (2.0 + 3.0 * zz);
    }

This is applied for all central sources of type AGN, BL or STAR, regardless of the "geometry" of the AGN (i.e. whether geo.pl_geometry has been set to BUBBLE, LAMPPOST or SPHERE). This should only really be applied when the SPHERE source is being used (since all the others used random isotropic directions and no weighting factor here is applied.

This bug will lead to a factor ~2 flux difference (because zz averages to 1/2) at low inclinations, but only for BUBBLE or LAMPPOST, which are "beta" modes that haven't been used in anger. The fix is simply to make the if statement if (itype == PTYPE_STAR || itype == PTYPE_BL || (itype == PTYPE_AGN && geo.pl_geometry == PL_GEOMETRY_SPHERE))

jhmatthews commented 1 year ago

I'm merging this @kslong