Skip to content

Commit

Permalink
Correctly integrate spontaneous recombination rate coeff
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewfullard committed Jan 13, 2025
1 parent cf1c261 commit 7311b73
Showing 1 changed file with 23 additions and 12 deletions.
35 changes: 23 additions & 12 deletions tardis/plasma/equilibrium/rates/photoionization_strengths.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,17 @@ def __init__(
self.photoionization_cross_sections = photoionization_cross_sections
self.nu = self.photoionization_cross_sections.nu.values

self.photoionization_block_references = np.pad(
self.photoionization_cross_sections.nu.groupby(level=[0, 1, 2])
.count()
.values.cumsum(),
[1, 0],
)

self.photoionization_index = (
self.photoionization_cross_sections.index.unique()
)

@property
def common_prefactor(self):
return (
Expand Down Expand Up @@ -64,7 +75,18 @@ def solve(self, electron_temperature):
axis=0,
)
)
return spontaneous_recombination_rate_coeff
spontaneous_recombination_rate_coeff_integrated = (
integrate_array_by_blocks(
spontaneous_recombination_rate_coeff.to_numpy(),
self.nu,
self.photoionization_block_references,
)
)

return pd.DataFrame(
spontaneous_recombination_rate_coeff_integrated,
index=self.photoionization_index,
)


class AnalyticPhotoionizationCoeffSolver(SpontaneousRecombinationCoeffSolver):
Expand All @@ -74,17 +96,6 @@ def __init__(
):
super().__init__(photoionization_cross_sections)

self.photoionization_block_references = np.pad(
self.photoionization_cross_sections.nu.groupby(level=[0, 1, 2])
.count()
.values.cumsum(),
[1, 0],
)

self.photoionization_index = (
self.photoionization_cross_sections.index.unique()
)

def calculate_mean_intensity_photoionization_df(
self,
dilute_blackbody_radiationfield_state,
Expand Down

0 comments on commit 7311b73

Please sign in to comment.