-
-
Notifications
You must be signed in to change notification settings - Fork 431
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updates to He NLTE treatment. #542
Changes from all commits
d072360
1333591
47681b8
6a1e5e9
aeabd1f
0b07991
3e72bd7
6ac63b6
fe9e209
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
|
||
from tardis.plasma.properties.base import (PreviousIterationProperty, | ||
ProcessingPlasmaProperty) | ||
from tardis.plasma.properties import PhiSahaNebular, PhiSahaLTE | ||
from tardis.plasma.properties.ion_population import PhiSahaNebular | ||
|
||
__all__ = ['PreviousElectronDensities', 'PreviousBetaSobolev', | ||
'HeliumNLTE', 'HeliumNumericalNLTE'] | ||
|
@@ -45,20 +45,18 @@ def set_initial_value(self, kwargs): | |
class HeliumNLTE(ProcessingPlasmaProperty): | ||
outputs = ('helium_population',) | ||
|
||
def calculate(self, level_boltzmann_factor, electron_densities, | ||
@staticmethod | ||
def calculate(level_boltzmann_factor, | ||
ionization_data, beta_rad, g, g_electron, w, t_rad, t_electrons, | ||
delta, zeta_data, number_density, partition_function): | ||
""" | ||
Updates all of the helium level populations according to the helium NLTE recomb approximation. | ||
""" | ||
helium_population = level_boltzmann_factor.ix[2].copy() | ||
# He I excited states | ||
he_one_population = self.calculate_helium_one(g_electron, beta_rad, | ||
ionization_data, level_boltzmann_factor, electron_densities, g, w) | ||
he_one_population = HeliumNLTE.calculate_helium_one(g_electron, beta_rad, | ||
ionization_data, level_boltzmann_factor, g, w) | ||
helium_population.ix[0].update(he_one_population) | ||
#He I metastable states | ||
helium_population.ix[0,1] *= (1 / w) | ||
helium_population.ix[0,2] *= (1 / w) | ||
#He I ground state | ||
helium_population.ix[0,0] = 0.0 | ||
#He II excited states | ||
|
@@ -68,38 +66,38 @@ def calculate(self, level_boltzmann_factor, electron_densities, | |
#He II ground state | ||
helium_population.ix[1,0] = 1.0 | ||
#He III states | ||
helium_population.ix[2,0] = self.calculate_helium_three(t_rad, w, | ||
helium_population.ix[2,0] = HeliumNLTE.calculate_helium_three(t_rad, w, | ||
zeta_data, t_electrons, delta, g_electron, beta_rad, | ||
ionization_data, electron_densities, g) | ||
unnormalised = helium_population.sum() | ||
normalised = helium_population.mul(number_density.ix[2] / unnormalised) | ||
helium_population.update(normalised) | ||
ionization_data, g) | ||
# unnormalised = helium_population.sum() | ||
# normalised = helium_population.mul(number_density.ix[2] / | ||
# unnormalised) | ||
# helium_population.update(normalised) | ||
return helium_population | ||
|
||
@staticmethod | ||
def calculate_helium_one(g_electron, beta_rad, ionization_data, | ||
level_boltzmann_factor, electron_densities, g, w): | ||
level_boltzmann_factor, g, w): | ||
""" | ||
Calculates the He I level population values, in equilibrium with the He II ground state. | ||
""" | ||
return level_boltzmann_factor.ix[2,0].mul( | ||
g.ix[2,0], axis=0) * (1./(2*g.ix[2,1,0])) * \ | ||
(1/g_electron) * (1/(w**2)) * np.exp( | ||
ionization_data.ionization_energy.ix[2,1] * beta_rad) * \ | ||
electron_densities | ||
return level_boltzmann_factor.ix[2,0] * (1./(2*g.ix[2,1,0])) * \ | ||
(1/g_electron) * (1/(w**2.)) * np.exp( | ||
ionization_data.ionization_energy.ix[2,1] * beta_rad) | ||
|
||
@staticmethod | ||
def calculate_helium_three(t_rad, w, zeta_data, t_electrons, delta, | ||
g_electron, beta_rad, ionization_data, electron_densities, g): | ||
g_electron, beta_rad, ionization_data, g): | ||
""" | ||
Calculates the He III level population values. | ||
""" | ||
zeta = PhiSahaNebular.get_zeta_values(zeta_data, 2, t_rad)[1] | ||
he_three_population = (2 / electron_densities) * \ | ||
he_three_population = 2 * \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can wrap the whole equation in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, sure. What's the difference? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To me |
||
(float(g.ix[2,2,0])/g.ix[2,1,0]) * g_electron * \ | ||
np.exp(-ionization_data.ionization_energy.ix[2,2] * beta_rad) \ | ||
* w * (delta.ix[2,2] * zeta + w * (1. - zeta)) * \ | ||
(t_electrons / t_rad) ** 0.5 | ||
return he_three_population | ||
|
||
class HeliumNumericalNLTE(ProcessingPlasmaProperty): | ||
''' | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are all these methods staticmethods?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remnant from the original method I tried to get this to work before I thought of a different way. I can change it.