Skip to content

Make ionization and recombination components functions, optionally return level-resolved rates - #444

Draft
wtbarnes wants to merge 7 commits into
mainfrom
density-dependent-rates
Draft

Make ionization and recombination components functions, optionally return level-resolved rates#444
wtbarnes wants to merge 7 commits into
mainfrom
density-dependent-rates

Conversation

@wtbarnes

@wtbarnes wtbarnes commented May 5, 2026

Copy link
Copy Markdown
Owner

Fixes #384
Fixes #385
Fixes #415
Fixes #416

Remaining TODOs

  • Return level-resolved ionization rates
  • Decide where to return the density-dependent advanced model rates
  • Add function for selecting a model atmosphere
  • Add methods for calculating CT ionization and recombination rates
  • Allow Element.ionization_equilibrium to accept a density and atmosphere model.

@wtbarnes
wtbarnes force-pushed the density-dependent-rates branch from ee238fc to 50bc8a3 Compare May 7, 2026 22:07
@wtbarnes

wtbarnes commented May 7, 2026

Copy link
Copy Markdown
Owner Author

Some working notes for myself

  • Should have separate methods for charge transfer ionization/recombination
  • These can be added into total for ionization/recombination if model atmosphere is considered
  • Should ionization/recombination rate methods be able to return the advanced model rates?
  • These have the downside of needing to repeatedly calculate the level populations...
  • If not, then are they just all calculated in Element.ionization_equilibrium?

@wtbarnes

wtbarnes commented Jul 12, 2026

Copy link
Copy Markdown
Owner Author

There are properties related to the older treatment of the level-resolved ionization and recombination rate data (cilvl and reclvl files, respectively) that I've called _level_resolved_ionization_rate and _level_resolved_recombination_rate that have an unfortunate namespace clash with the functionality I'm adding here.

fiasco/fiasco/ions.py

Lines 997 to 1019 in 43ad865

@cached_property
@needs_dataset('cilvl')
@u.quantity_input
def _level_resolved_ionization_rate(self):
ionization_rates = self._level_resolved_rates_interpolation(
self._cilvl['temperature'],
self._cilvl['ionization_rate'],
fill_below='extrapolate',
fill_above=0.0,
)
return self._cilvl['upper_level'], ionization_rates
@cached_property
@needs_dataset('reclvl')
@u.quantity_input
def _level_resolved_recombination_rate(self):
recombination_rates = self._level_resolved_rates_interpolation(
self._reclvl['temperature'],
self._reclvl['recombination_rate'],
fill_below=0.0,
fill_above='extrapolate',
)
return self._reclvl['upper_level'], recombination_rates

These should just be folded into the _population_correction method as that is the only place they are used anyway.

def _population_correction(self, population, density, rate_matrix):

These are not meant to be used on their own and should not be confused with the new advanced model data.

@wtbarnes
wtbarnes force-pushed the density-dependent-rates branch from 50bc8a3 to 80ac468 Compare July 31, 2026 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant