agnwinds / python

This is the repository for Python, the radiative transfer code used to winds in AGN and other syatems
GNU General Public License v3.0
24 stars 25 forks source link

sigma_phot is very slow in macro atom models with lots of photionization x-sections #1038

Closed kslong closed 3 months ago

kslong commented 7 months ago

macro atom runs with cno included are very slow, and these runs seem to be slow in part because the routine sigma_phot can take up roughly half of the total time. This is split between photon transfer and setup routines. We need a faster version of this, if we are going to regularly run CNO models with macro atoms. (Note that we have long known that that sigma phot was a bottleneck, even in non-macro atom models but with large numbers of macro atoms the problem is apparently much worse.

kslong commented 7 months ago

I have modified the upsilon branch of python to use the stored logarithmic values for photon x-sections in sigma_phot, and removed log_sigma_phot as it is redundant. Using the stored values speeds up that portion of the code by 20-30%. The next step in this effort might well be to work on alpha_sp_integrand (or rather the code that calls this) so that it does not use a general purpose integration routine, but rather calculates the integral from the stored values of the photoionization x-sections. Alternatively as @ssim has suggested, we might want to explore ways to reduce the number of calls from kappa_bf (or to kappa_bf). Currently in the simple model I have been trying these two routines contribute about equally to the total number of calls to sigma_phot.

kslong commented 3 months ago

This issue should be resolved, by 83d46174dfc32ec0f0943825edc362d44a51ee28