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

Adiabatic heating in macro-atom mode #929

Open Higginbottom opened 2 years ago

Higginbottom commented 2 years ago

Negative values of adiabatic cooling - i.e. heating is often a problem in python simulations. It is usually only seen in imported hydro models - and this is one. The problem is that in macro atom mode, two errors are produced:

100001 -- kpkt: Photon %d. Adiabatic cooling negative! Major problem if inwind (%d) == 0 100000 -- kpkt: Photon %d. Setting adiabatic kpkt destruction probability to zero for this matom.

which are causing the run to stop due to too many errors. We should either remove this as an error if we think the code is dealing with the situation properly, or fix it!

It takes a long time to get to the error - but here are the files to run it..

input.pf.txt 00000578.pluto.txt

jhmatthews commented 2 years ago

So, the reason this happens is because all energy is initially created as r-packets in a macro-atom simulation (although there was an attempt to put in extra heating, it's never really been fully working or tested). Thus, in a normal run, there's no way to account for nonradiative heating as in this case - whereas in the non-macro atom case the temperature would increase and so would the thermal wind radiation, there's no way to create the extra packets in the non-macro atom mode.

The actual error is occurring when the code decides how to eliminate k-packets by k->r transitions. Normally it would have a nonzero probability of destroying the packet via adiabatic cooling, but if adiabatic cooling is -ve then it sets this probability to zero.

It's possible it wouldn't be that much work to implement given I already had a bit of a go at it, but I'd need to think about it and I'm wary of introducing new schemes we don't have time to fully test given recent history.