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
26 stars 25 forks source link

Python cannot handle non-standard temperature profile and stellar atmospheres models #874

Closed kslong closed 3 years ago

kslong commented 3 years ago

Keith Inight would like run a model with a non-standard temperature profile with Kurucz model atmospheres, but this use case fails in Python with this error

error: disk_init: Integration on setting r boundaries got 1 nrings instead of 3000

Simply adding a gravity to the non-standard temperature profile file does not help. This seems to be a use case we have not considered.

There would seem to be a couple of possibilities, depending on how general a solution we want.

(Note @jhmatthews that we have had various thoughts about how to deal with reading in models over the years, so if we are going to look at this now, it might be good to comment on this issue to see if they can be taken into account at this time.)

kslong commented 3 years ago

The problem, not surprisingly, is in disk_init (which is where the error comes from). For a readin temperature distribution, mdot_disk is not required, and mdot_disk is used to establish a reference gravity, which is scaled to get the gravity at a given radius. The amount of emission from a ring is established by the call to

      emit = emittance_continuum (spectype, freqmin, freqmax, t, log_g);

and log_g is NaN. Interestingly this does not trigger an error, directly, but emit the returns NaN. I'm leaning toward a solution where if one reads in a temperature distribution, one must also read in a gravity, if one wants to use Kurucz models.

(Note however some of this relates to the question I was referring to above. Our approach for reading in model grids assumes generally that this model grids will be two parameter dataset, whereas in some cases we prefer that it be a one parameter set.)

kslong commented 3 years ago

I have made changes on the bug874_readin branch that address this issue, if anyone wants to check. It allows one to read in a non-standard temperature file with a 3rd column that represents a second parameter in a "stellar" grid.

The performance if you read in a non-standard temperature profile and want to use BB spectra should be unchanged.

I still have to clean this up, and figure out what happens if have a one parameter set of model spectra that you want to use.

kslong commented 3 years ago

Changes have been merged into dev so that one can add a gravity to a read in temperature profile. This enables using stellar atmospheres and similar models with a read-in disk temperature profile.