Photochemistry
Module related to loading in photodisocciation data.
CrossSection
¶
Loads cross-section data for molecule.
Source code in src/freckll/reactions/photo.py
__add__(other)
¶
Add two cross sections together.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
other
|
CrossSection
|
The other cross section to add. |
required |
Returns:
Name | Type | Description |
---|---|---|
CrossSection |
CrossSection
|
A new CrossSection object with the summed values. |
Source code in src/freckll/reactions/photo.py
__init__(molecule, wavelength, cross_section)
¶
Initialize and load the cross-section data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
molecule
|
SpeciesFormula
|
The molecule for which the cross-section is loaded. |
required |
wavelength
|
Quantity
|
The wavelength at which the cross-section is measured. |
required |
cross_section
|
Quantity
|
The cross-section value at the given wavelength. |
required |
Source code in src/freckll/reactions/photo.py
interp_to(wavelength, temperature, pressure)
¶
Interpolate the cross section to the given wavelength, temperature and pressure
Parameters:
Name | Type | Description | Default |
---|---|---|---|
wavelength
|
Quantity
|
The wavelength to which the cross section is interpolated. |
required |
temperature
|
Quantity
|
The temperature at which the cross section is measured. |
required |
pressure
|
Quantity
|
The pressure at which the cross section is measured. |
required |
Returns:
Name | Type | Description |
---|---|---|
CrossSection |
CrossSection
|
A new CrossSection object with the interpolated values. |
Source code in src/freckll/reactions/photo.py
PhotoMolecule
¶
Represents a molecule used in photodissociation reactions.
This class contains the cross-section data and quantum yields for the molecule.
Source code in src/freckll/reactions/photo.py
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 |
|
__init__(molecule, cross_section)
¶
Initialize the PhotoMolecule with a molecule and its cross-section.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
molecule
|
SpeciesFormula
|
The molecule for which the cross-section is loaded. |
required |
cross_section
|
CrossSection
|
The cross-section data for the molecule. |
required |
Source code in src/freckll/reactions/photo.py
add_quantum_yield(branch_id, quantum_yield)
¶
Add a quantum yield to the molecule.
Will interpolate the quantum yield to the cross-section wavelength.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
branch_id
|
int | str
|
The ID of the branching ratio. |
required |
quantum_yield
|
QuantumYield
|
The quantum yield data to be added. |
required |
Source code in src/freckll/reactions/photo.py
get_quantum_yield(branch_id)
¶
Get the quantum yield for a given branch.
If the quantum yield is not found, a default quantum yield of 1.0 is returned.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
branch_id
|
int | str
|
The ID of the branching ratio. |
required |
Returns: QuantumYield: The quantum yield data for the given branch.
Source code in src/freckll/reactions/photo.py
interp_to(wavelength, temperature, pressure)
¶
Interpolate the cross section and quantum yields to the given wavelength.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
wavelength
|
Quantity
|
The wavelength to which the cross section and quantum yields are interpolated. |
required |
Returns:
Name | Type | Description |
---|---|---|
PhotoMolecule |
PhotoMolecule
|
A new PhotoMolecule object with the interpolated values. |
Source code in src/freckll/reactions/photo.py
reaction_rate(branch_id, flux)
¶
Compute the reaction rate for a given branch.
Calculates the integral:
where: - \(R\) is the reaction rate - \(\sigma(\lambda)\) is the cross-section - \(QY(\lambda)\) is the quantum yield - \(F(\lambda)\) is the flux The integral is computed over the wavelength range of the cross-section.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
branch_id
|
int | str
|
The ID of the branching ratio. |
required |
flux
|
Quantity
|
The flux at which the reaction rate is computed. |
required |
Returns:
Type | Description |
---|---|
list[FreckllArray]
|
u.Quantity: The reaction rate for the given branch. |
Source code in src/freckll/reactions/photo.py
PhotoReactionCall
¶
Source code in src/freckll/reactions/photo.py
263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 |
|
cross_section
property
¶
Return the cross-section of the reactant.
molecule
property
¶
Return the molecule of the reactant.
__call__(flux, number_density)
¶
Call the reaction.
This method computes the reaction rate and creates a Reaction object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
flux
|
Quantity
|
The flux at which the reaction is computed. |
required |
number_density
|
FreckllArray
|
The number density of the reactant. |
required |
Returns:
Name | Type | Description |
---|---|---|
Reaction |
Reaction
|
The reaction object representing the photodissociation reaction. |
Source code in src/freckll/reactions/photo.py
__init__(reactant, products, branch_id, species_list=None, reactant_index=None, product_indices=None, tags=None)
¶
Initialize the photodissociation reaction call.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
reactant
|
PhotoMolecule
|
The reactant of the reaction. |
required |
products
|
list[SpeciesFormula]
|
The products of the reaction. |
required |
branch_id
|
int | str
|
The ID of the branching ratio. |
required |
species_list
|
Optional[list[SpeciesFormula]]
|
The list of species in the network. |
None
|
reactant_index
|
Optional[int]
|
The index of the reactant in the species list. |
None
|
product_indices
|
Optional[NDArray[integer]]
|
The indices of the products in the species list. |
None
|
tags
|
Optional[list[str]]
|
The tags associated with the reaction. |
None
|
Source code in src/freckll/reactions/photo.py
interpolate_to(wavelength, temperature=None, pressure=None)
¶
Interpolate the reaction call to the given wavelength.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
wavelength
|
Quantity
|
The wavelength to which the reaction call is interpolated. |
required |
Returns:
Name | Type | Description |
---|---|---|
PhotoReactionCall |
PhotoReactionCall
|
A new PhotoReactionCall object with the interpolated values. |
Source code in src/freckll/reactions/photo.py
QuantumYield
¶
Loads quantum yield data for molecule.
This represents the branching ratio of the photodissociation process.
This is generic and it is up to the chemical network to determine how branching ratios are organised
Source code in src/freckll/reactions/photo.py
__init__(molecule, branch_id, wavelength, qy)
¶
Initialize and load the quantum yield data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
molecule
|
SpeciesFormula
|
The molecule for which the quantum yield is loaded. |
required |
branch_id
|
int | str
|
The ID of the branching ratio. |
required |
wavelength
|
Quantity
|
The wavelength at which the quantum yield is measured. |
required |
qy
|
NDArray[float64]
|
The quantum yield value at the given wavelength. |
required |
Source code in src/freckll/reactions/photo.py
interp_to(wavelength)
¶
Interpolate the quantum yield to the given wavelength.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
wavelength
|
Quantity
|
The wavelength to which the quantum yield is interpolated. |
required |
Returns:
Name | Type | Description |
---|---|---|
QuantumYield |
QuantumYield
|
A new QuantumYield object with the interpolated values. |
Source code in src/freckll/reactions/photo.py
StarSpectra
¶
Source code in src/freckll/reactions/photo.py
__init__(wavelength, flux, reference_distance)
¶
Initialize the star spectrum with wavelength and flux data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
wavelength
|
Quantity
|
The wavelength of the star spectrum. |
required |
flux
|
Quantity
|
The flux of the star spectrum. |
required |
reference_distance
|
Quantity
|
The reference distance for the flux. |
required |
Source code in src/freckll/reactions/photo.py
incident_flux(distance)
¶
Calculate the flux density at the reference distance.
The flux density is calculated using the formula: $$ F = F_0(\frac{D_0}{d})^2$$ where: - \(F\) is the flux density at distance \(d\) - \(F_0\) is the flux density at reference distance \(D_0\) - \(d\) is the distance from the star - \(D_0\) is the reference distance
Returns:
Type | Description |
---|---|
Quantity
|
u.Quantity: The flux density at the reference distance. |
Source code in src/freckll/reactions/photo.py
optical_depth(altitude, number_density, cross_sections, cross_section_indices)
¶
Compute the optical depth of the atmosphere.
The optical depth is computed using the formula:
where:
- \(\tau\) is the optical depth
- \(n(z)\) is the number density of the species at altitude \(z\)
- \(\sigma(z)\) is the cross-section of the species at altitude \(z\)
The integral is computed using the trapezoidal rule.
Source code in src/freckll/reactions/photo.py
radiative_transfer(flux_top, optical_depth, incident_angle, albedo=0.0)
¶
Computes the radiative transfer equation.
Computes the radiative transfer equation for a given flux and optical depth.
The flux is then propagated upwards and downwards through the atmosphere. The albedo is taken into account for the upward flux.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
flux_top
|
Quantity
|
The flux at the top of the atmosphere. |
required |
optical_depth
|
FreckllArray
|
The optical depth of the atmosphere. |
required |
incident_angle
|
Quantity
|
The angle of incidence. |
required |
albedo
|
float | NDArray[float64]
|
The albedo of the surface. |
0.0
|
Returns: u.Quantity: The total flux at each layer.
Source code in src/freckll/reactions/photo.py
rayleigh(spectral_grid, alpha, depolar_factor)
¶
Calculate the Rayleigh scattering cross-section.
The Rayleigh scattering cross-section is given by the formula: $$ \sigma_R = \frac{8 \pi^3}{3} \left(\frac{\alpha}{\lambda}\right)^4 (1 + \delta^2)$$
where:
- \(\sigma_R\) is the Rayleigh scattering cross-section
- \(\alpha\) is the polarizability of the molecule
Parameters:
Name | Type | Description | Default |
---|---|---|---|
spectral_grid
|
Quantity
|
The wavelength grid. |
required |
alpha
|
Quantity
|
The polarizability of the molecule. |
required |
depolar_factor
|
float
|
The depolarization factor. |
required |
Returns: u.Quantity: The Rayleigh scattering cross-section.