Closed ladsantos closed 1 year ago
Thank you for taking a look at my email! I would like to add one more to the list that I discovered since I wrote you:
In the helium, oxygen and carbon code you incorporate a safeguard against numerical instabilities in the calculation of the population fractions, but this is absent from the hydrogen code. I discovered this because one of my solutions had the ionization fraction oscillate around 1. So probably add the lines
f_r[f_r < 0] = 1E-15 f_r[f_r > 1.0] = 1.0
after first finding f_r and in the relaxation loop. If I do this I get this plot:
Today I noticed two more things while looking through the oxygen and carbon codes again:
m_C = 6 * 1.67262192369e-27 # Carbon atomic mass in kg
and in carbon.py there are these lines:
k1 = h_fraction / (h_fraction + 4 * he_fraction + 6 * c_fraction) / m_h
k2 = he_fraction / (h_fraction + 4 * he_fraction + 6 * c_fraction) / m_h
k3 = c_fraction / (h_fraction + 4 * he_fraction + 6 * c_fraction) / m_h
where the number "6" is used. Now this is the atomic number, but shouldn't the mass number be used here? As it is for helium of course. So 12 for carbon and 16 for oxygen instead of 6 and 8 respectively.Thanks, Lars. Everything has been corrected in commit 8aa035c
. One item that did not require correction: the number densities are given in units of 1 / cm^{-3} (number of atoms per unit volume, and not mass per unit volume).
Hi Leonardo, I still think that line 40 in hydrogen.py should be “Density profile for the atmosphere, in units of g / cm 3.” instead of “Number density profile for the atmosphere, in units of 1 / cm 3.”. This density parameter is used in line 87 to find the number density:
n_tot = density / mu / m_h
And when the function radiative_processes_exact() is called later in the module, a density (g/cm3) is passed as the density parameter. So it is used correctly, just the documentation is incorrect.
Lars Klijn kindly sent a list of suggestions to apply in the code, which I list below from their email: