tardis.plasma.equilibrium.ion_populations module

class tardis.plasma.equilibrium.ion_populations.FixedElectronDensityIonPopulationSolver(rate_matrix_solver: AnalyticIonRateMatrix | EstimatedIonRateMatrix, max_solver_iterations: int = 100)[source]

Bases: IonPopulationSolver

Solve ion populations for a fixed electron density.

Solve the normalized ion population values from the rate matrices.

Parameters:
rate_matrix_solverAnalyticIonRateMatrix | EstimatedIonRateMatrix

Solver that builds ionization rate matrices.

max_solver_iterationsint, optional

Maximum iterations for lagged population-dependent corrections.

solve(radiation_field: DilutePlanckianRadiationField | PlanckianRadiationField, thermal_electron_energy_distribution: ThermalElectronEnergyDistribution, elemental_number_density: DataFrame, lte_level_population: DataFrame, estimated_level_population: DataFrame, lte_ion_population: DataFrame, estimated_ion_population: DataFrame, partition_function: DataFrame, boltzmann_factor: DataFrame, tolerance: float = 1e-14, lte_ionization_factor: DataFrame | None = None) tuple[DataFrame, Series][source]

Solve ion populations without imposing charge conservation.

class tardis.plasma.equilibrium.ion_populations.IonPopulationSolver(rate_matrix_solver: AnalyticIonRateMatrix | EstimatedIonRateMatrix, max_solver_iterations: int = 100)[source]

Bases: object

Solve ion populations from elemental ionization rate matrices.

Solve the normalized ion population values from the rate matrices.

Parameters:
rate_matrix_solverAnalyticIonRateMatrix | EstimatedIonRateMatrix

Solver that builds ionization rate matrices.

max_solver_iterationsint, optional

Maximum iterations for lagged population-dependent corrections.

solve(radiation_field: DilutePlanckianRadiationField | PlanckianRadiationField, thermal_electron_energy_distribution: ThermalElectronEnergyDistribution, elemental_number_density: DataFrame, lte_level_population: DataFrame, estimated_level_population: DataFrame, lte_ion_population: DataFrame, estimated_ion_population: DataFrame, partition_function: DataFrame | float, boltzmann_factor: DataFrame, tolerance: float = 1e-14, level_to_continuum_saha_factor: DataFrame | None = None, lte_ionization_factor: DataFrame | None = None) tuple[DataFrame, Series][source]

Solve ion populations while enforcing charge conservation.

solve_charge_balance(electron_density: ndarray[tuple[Any, ...], dtype[float64]], radiation_field: DilutePlanckianRadiationField | PlanckianRadiationField, thermal_electron_energy_distribution: ThermalElectronEnergyDistribution, lte_level_population: DataFrame, estimated_level_population: DataFrame, lte_ion_population: DataFrame, estimated_ion_population: DataFrame, partition_function: DataFrame, boltzmann_factor: DataFrame, level_to_continuum_saha_factor: DataFrame, elemental_number_density: DataFrame, maximum_electron_density: ndarray[tuple[Any, ...], dtype[float64]], lte_ionization_factor: DataFrame | None = None) tuple[ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]]][source]

Solve ion populations and calculate the normalized charge residual.

Parameters:
electron_densitynpt.NDArray[np.float64]

Trial electron number densities for each shell.

radiation_fieldDilutePlanckianRadiationField | PlanckianRadiationField

Radiation field used to calculate ionization rates.

thermal_electron_energy_distributionThermalElectronEnergyDistribution

Electron energy distribution used by the rate-matrix solver.

lte_level_populationpd.DataFrame

LTE level populations used by the rate-matrix solver.

estimated_level_populationpd.DataFrame

Estimated level populations used for lagged rate corrections.

lte_ion_populationpd.DataFrame

LTE ion populations used by the rate-matrix solver.

estimated_ion_populationpd.DataFrame

Estimated ion populations used for lagged rate corrections.

partition_functionpd.DataFrame

Partition functions used by the rate-matrix solver.

boltzmann_factorpd.DataFrame

Boltzmann factors used by the rate-matrix solver.

level_to_continuum_saha_factorpd.DataFrame

Density-independent Lucy level-to-continuum Saha factor.

elemental_number_densitypd.DataFrame

Elemental number densities indexed by atomic number and shell.

maximum_electron_densitynpt.NDArray[np.float64]

Maximum possible electron number density for each shell, used to normalize the charge residual.

Returns:
tuple[npt.NDArray[np.float64], npt.NDArray[np.float64]]

Absolute ion populations and normalized charge residuals for each shell.

solve_element_populations_at_electron_density(electron_density: ndarray[tuple[Any, ...], dtype[float64]], radiation_field: DilutePlanckianRadiationField | PlanckianRadiationField, thermal_electron_energy_distribution: ThermalElectronEnergyDistribution, lte_level_population: DataFrame, estimated_level_population: DataFrame, lte_ion_population: DataFrame, estimated_ion_population: DataFrame, partition_function: DataFrame, boltzmann_factor: DataFrame, level_to_continuum_saha_factor: DataFrame, elemental_number_density: DataFrame, lte_ionization_factor: DataFrame | None = None) ndarray[tuple[Any, ...], dtype[float64]][source]

Solve elemental ion populations at supplied electron densities.

Parameters:
electron_densitynumpy.ndarray

Electron number densities in cm^-3 ordered like the output columns.

radiation_fieldRadiationField

Fixed radiation field.

thermal_electron_energy_distributiontardis.plasma.electron_energy_distribution.ThermalElectronEnergyDistribution

Fixed electron energy and temperature inputs.

lte_level_populationpandas.DataFrame

LTE level number density. Columns are cells.

estimated_level_populationpandas.DataFrame

Previous estimated level number density. Columns are cells.

lte_ion_populationpandas.DataFrame

LTE ion number density. Columns are cells.

estimated_ion_populationpandas.DataFrame

Previous estimated ion number density. Columns are cells.

level_to_continuum_saha_factorpandas.DataFrame

Density-independent Lucy level-to-continuum Saha factor.

elemental_number_densitypandas.DataFrame

Elemental number density. Index is atomic number, columns are cells.

Returns:
numpy.ndarray

Absolute ion populations ordered like ion_population_index and the elemental-density columns.

solve_shell_charge(shell_idx: int, maximum_electron_density: float, base_electron_density: ndarray[tuple[Any, ...], dtype[float64]], radiation_field: DilutePlanckianRadiationField | PlanckianRadiationField, thermal_electron_energy_distribution: ThermalElectronEnergyDistribution, lte_level_population: DataFrame, estimated_level_population: DataFrame, lte_ion_population: DataFrame, estimated_ion_population: DataFrame, partition_function: DataFrame, boltzmann_factor: DataFrame, level_to_continuum_saha_factor: DataFrame, elemental_number_density: DataFrame, maximum_electron_densities: ndarray[tuple[Any, ...], dtype[float64]], lte_ionization_factor: DataFrame | None = None) float[source]

Solve the charge balance for one shell.

Parameters:
shell_idxint

Index of the shell whose electron density is being solved.

maximum_electron_densityfloat

Maximum possible electron number density in the shell.

base_electron_densitynpt.NDArray[np.float64]

Electron number densities used for all shells before updating the selected shell.

radiation_fieldDilutePlanckianRadiationField | PlanckianRadiationField

Radiation field used to calculate ionization rates.

thermal_electron_energy_distributionThermalElectronEnergyDistribution

Electron energy distribution used by the rate-matrix solver.

lte_level_populationpd.DataFrame

LTE level populations used by the rate-matrix solver.

estimated_level_populationpd.DataFrame

Estimated level populations used for lagged rate corrections.

lte_ion_populationpd.DataFrame

LTE ion populations used by the rate-matrix solver.

estimated_ion_populationpd.DataFrame

Estimated ion populations used for lagged rate corrections.

partition_functionpd.DataFrame

Partition functions used by the rate-matrix solver.

boltzmann_factorpd.DataFrame

Boltzmann factors used by the rate-matrix solver.

level_to_continuum_saha_factorpd.DataFrame

Density-independent Lucy level-to-continuum Saha factor.

elemental_number_densitypd.DataFrame

Elemental number densities indexed by atomic number and shell.

maximum_electron_densitiesnpt.NDArray[np.float64]

Maximum possible electron number density for each shell, used to normalize the charge residual.

Returns:
float

Charge-balanced electron number density for the selected shell.

Raises:
PlasmaIonizationError

If the charge residual is not bracketed over the allowed electron density interval.