petitRADTRANS.radtrans_core.cloud_core#
Functions#
|
Calculates the turbulent settling speed of cloud particles. |
|
Calculates the mean radius of cloud particles for each layer and species. |
Calculates the 'a' parameter for the Hansen distribution for cloud particles. |
|
|
This function reimplements calc_cloud_opas from fortran_radiative_transfer_core.f90. |
Interpolate cloud opacities to actual radiative transfer wavelength grid. |
|
|
Finds the particle radius where its turbulent settling speed matches w_star, |
|
|
Performs one iteration of the bisection method for particle_radius. |
|
|
Core function for compute_cloud_particle_mean_radius, operating on single |
|
Core function for compute_cloud_particle_mean_radius_hansen, operating on single |
|
|
|
Shared integration backend for all cloud opacity methods. |
|
This function integrates the cloud opacity through the different layers of the atmosphere to get the total |
Args: |
Module Contents#
- petitRADTRANS.radtrans_core.cloud_core.compute_turbulent_settling_speed(x, reference_gravity, rho, clouds_particle_densities, temperatures, mean_molar_masses)#
Calculates the turbulent settling speed of cloud particles.
- Args:
x: Particle radius (cm). reference_gravity: Reference surface gravity (cm.s-2). rho: Atmospheric density at the particle’s location (g.cm-3). clouds_particle_densities: Density of the cloud particle material (g.cm-3). temperatures: Atmospheric temperature at the particle’s location (K). mean_molar_masses: Mean molar mass of the atmosphere at the particle’s location (g/mol).
Note: In Fortran, this was likely in amu, converted by cst_amu. Here, ensure it’s consistent or adjust cst_amu usage.
- Returns:
Turbulent settling speed (cm.s-1).
- petitRADTRANS.radtrans_core.cloud_core.compute_cloud_particle_mean_radius(reference_gravity, atmospheric_densities, clouds_particle_densities, temperatures, mean_molar_masses, f_seds, cloud_particle_radius_distribution_std, eddy_diffusion_coefficients)#
Calculates the mean radius of cloud particles for each layer and species. Translated from Fortran compute_cloud_particle_mean_radius.
- Args:
reference_gravity: Reference surface gravity (scalar float). atmospheric_densities: Atmospheric density (n_layers, float). clouds_particle_densities: Density of cloud particle material (n_clouds, float). temperatures: Atmospheric temperature (n_layers, float). mean_molar_masses: Mean molar mass of atmosphere (n_layers, float). f_seds: Sedimentation efficiency parameter (n_layers, n_clouds, float). cloud_particle_radius_distribution_std: Standard deviation of log-normal radius distribution (scalar float). eddy_diffusion_coefficients: Eddy diffusion coefficient (n_layers, float).
- Returns:
Mean particle radius (n_layers, n_clouds, float).
- petitRADTRANS.radtrans_core.cloud_core.compute_cloud_particle_mean_radius_hansen(reference_gravity, rho, clouds_particle_densities, temperatures, mean_molar_masses, f_seds, clouds_b_hansen, eddy_diffusion_coefficients)#
Calculates the ‘a’ parameter for the Hansen distribution for cloud particles. Translated from Fortran compute_cloud_particle_mean_radius_hansen.
- Args:
reference_gravity: Reference surface gravity (scalar float). rho: Atmospheric density (n_layers, float). clouds_particle_densities: Density of cloud particle material (n_clouds, float). temperatures: Atmospheric temperature (n_layers, float). mean_molar_masses: Mean molar mass of atmosphere (n_layers, float). f_seds: Sedimentation efficiency parameter (n_layers, n_clouds, float). clouds_b_hansen: ‘b’ parameter for the Hansen distribution (n_layers, n_clouds, float). eddy_diffusion_coefficients: Eddy diffusion coefficient (n_layers, float).
- Returns:
‘a’ parameter for the Hansen distribution (n_layers, n_clouds, float).
- petitRADTRANS.radtrans_core.cloud_core.compute_cloud_log_normal_particle_distribution_opacities(atmosphere_densities, clouds_particle_densities, clouds_mass_fractions, cloud_particle_mean_radii, cloud_particle_distribution_std, cloud_particle_radii_bins, cloud_particle_radii, clouds_absorption_opacities, clouds_scattering_opacities, clouds_particle_asymmetry_parameters)#
This function reimplements calc_cloud_opas from fortran_radiative_transfer_core.f90. This function integrates the cloud opacity through the different layers of the atmosphere to get the total optical depth, scattering and anisotropic fraction. # TODO optical depth or opacity?
Author: Francois Rozet
- Args:
- atmosphere_densities:
Density of the atmosphere at each of its layer
- clouds_particle_densities:
Density of each cloud particles
- clouds_mass_fractions:
Mass fractions of each cloud at each atmospheric layer
- cloud_particle_mean_radii:
Mean radius of each cloud particles at each atmospheric layer
- cloud_particle_distribution_std:
Standard deviation of the log-normal cloud particles distribution
- cloud_particle_radii_bins:
Bins of the particles cloud radii grid
- cloud_particle_radii:
Particles cloud radii grid
- clouds_absorption_opacities:
Cloud absorption opacities (radius grid, wavelength grid, clouds)
- clouds_scattering_opacities:
Cloud scattering opacities (radius grid, wavelength grid, clouds)
- clouds_particle_asymmetry_parameters:
Cloud particles asymmetry parameters (radius grid, wavelength grid, clouds)
Returns:
- petitRADTRANS.radtrans_core.cloud_core.interpolate_cloud_opacities(cloud_absorption_opacities, cloud_scattering_opacities, cloud_scattering_reduction_factor, cloud_wavelengths, frequencies_bin_edges)#
- petitRADTRANS.radtrans_core.cloud_core.interpolate_cloud_opacities_fortran(cloud_absorption_opacities, cloud_scattering_opacities, cloud_scattering_reduction_factor, cloud_wavelengths, frequencies_bin_edges)#
Interpolate cloud opacities to actual radiative transfer wavelength grid.
- petitRADTRANS.radtrans_core.cloud_core.particle_radius(x1, x2, reference_gravity, rho, clouds_particle_densities, temperatures, mean_molar_masses, w_star)#
Finds the particle radius where its turbulent settling speed matches w_star, using a bisection-like method.
- Args:
x1: Lower bound for particle radius search (cm). x2: Upper bound for particle radius search (cm). reference_gravity: Reference surface gravity (cm.s-2). rho: Atmospheric density (g.cm-3). clouds_particle_densities: Density of cloud particle material (g.cm-3). temperatures: Atmospheric temperature (K). mean_molar_masses: Mean molar mass of atmosphere (g/mol). w_star: Target settling speed (cm.s-1).
- Returns:
Particle radius (cm) or 1e-17 if root not bracketed or max iterations reached.
- petitRADTRANS.radtrans_core.cloud_core.particle_radius_midpoint(a, b)#
- petitRADTRANS.radtrans_core.cloud_core.particle_radius_bisection_iteration(val)#
Performs one iteration of the bisection method for particle_radius. Needed for the fixed-iteration root solve.
- petitRADTRANS.radtrans_core.cloud_core._compute_mean_radius_single(ref_g, rho_i, cloud_dens_j, temp_i, mean_molar_mass_i, f_sed_ij, std_dev, eddy_diff_i)#
Core function for compute_cloud_particle_mean_radius, operating on single layer and species values.
- petitRADTRANS.radtrans_core.cloud_core._compute_mean_radius_hansen_single(ref_g, rho_i, cloud_dens_j, temp_i, mean_molar_mass_i, f_sed_ij, b_hansen_ij, eddy_diff_i)#
Core function for compute_cloud_particle_mean_radius_hansen, operating on single layer and species values.
- petitRADTRANS.radtrans_core.cloud_core._run_fortran_cloud_hansen_opacities(atmospheric_densities, clouds_particle_densities, clouds_mass_fractions, cloud_particle_mean_radii, cloud_hansen_b, cloud_particle_radii_bins, cloud_particle_radii, clouds_absorption_opacities, clouds_scattering_opacities, clouds_particle_asymmetry_parameters)#
- petitRADTRANS.radtrans_core.cloud_core.compute_cloud_hansen_opacities(atmospheric_densities, clouds_particle_densities, clouds_mass_fractions, cloud_particle_mean_radii, cloud_hansen_b, cloud_particle_radii_bins, cloud_particle_radii, clouds_absorption_opacities, clouds_scattering_opacities, clouds_particle_asymmetry_parameters)#
- petitRADTRANS.radtrans_core.cloud_core._compute_cloud_scattering_reduction_factor(cloud_scattering_weighted_reduction, cloud_scattering_opacities)#
- petitRADTRANS.radtrans_core.cloud_core._integrate_cloud_opacities_from_dn_dr(dn_dr, atmosphere_densities, clouds_particle_densities, cloud_particle_radii_bins, cloud_particle_radii, clouds_absorption_opacities, clouds_scattering_opacities, clouds_particle_asymmetry_parameters, pressures, target_particle_radii, target_pressure)#
Shared integration backend for all cloud opacity methods. Operates purely on dn/dr and handles all integration logic.
If target_particle_radii and target_pressure are provided, the function will disable the radius bin closest to target_particle_radii and the pressure layer closest to target_pressure in the integration, effectively removing their contribution to the final opacities. This allows for selective exclusion of specific particle sizes or atmospheric layers from the cloud opacity calculation.
- Args:
- dn_dr:
Particle size distribution (radius grid, layers, clouds)
- atmosphere_densities:
Density of the atmosphere at each of its layer
- clouds_particle_densities:
Density of each cloud particles
- cloud_particle_radii_bins:
Bins of the particles cloud radii grid
- cloud_particle_radii:
Particles cloud radii grid
- clouds_absorption_opacities:
Cloud absorption opacities (radius grid, wavelength grid, clouds)
- clouds_scattering_opacities:
Cloud scattering opacities (radius grid, wavelength grid, clouds)
- clouds_particle_asymmetry_parameters:
Cloud particles asymmetry parameters (radius grid, wavelength grid, clouds)
- pressures:
Pressure grid of the atmosphere layers
- target_particle_radii (Optional[ArrayLike]:
Particle radius to target for selective bin disabling. Radius bin closest the input value will be disabled.
- target_pressure (Optional[ArrayLike]:
Pressure to target for selective bin disabling. Pressure bin closest to the input value will be disabled.
- petitRADTRANS.radtrans_core.cloud_core.compute_cloud_log_normal_particle_distribution_opacities_grid(atmosphere_densities, clouds_particle_densities, clouds_mass_fractions, cloud_particle_mean_radii, cloud_particle_distribution_std, cloud_particle_radii_bins, cloud_particle_radii, clouds_absorption_opacities, clouds_scattering_opacities, clouds_particle_asymmetry_parameters, pressures, target_particle_radii, target_pressure)#
This function integrates the cloud opacity through the different layers of the atmosphere to get the total optical depth, scattering and anisotropic fraction.
Author: Francois Rozet
- Args:
- atmosphere_densities:
Density of the atmosphere at each of its layer
- clouds_particle_densities:
Density of each cloud particles
- clouds_mass_fractions:
Mass fractions of each cloud at each atmospheric layer
- cloud_particle_mean_radii:
Mean radius of each cloud particles at each atmospheric layer
- cloud_particle_distribution_std:
Standard deviation of the log-normal cloud particles distribution
- cloud_particle_radii_bins:
Bins of the particles cloud radii grid
- cloud_particle_radii:
Particles cloud radii grid
- clouds_absorption_opacities:
Cloud absorption opacities (radius grid, wavelength grid, clouds)
- clouds_scattering_opacities:
Cloud scattering opacities (radius grid, wavelength grid, clouds)
- clouds_particle_asymmetry_parameters:
Cloud particles asymmetry parameters (radius grid, wavelength grid, clouds)
- pressures:
Pressure grid of the atmosphere layers
- target_particle_radii (Optional[ArrayLike]:
Particle radius to target for selective bin disabling. Radius bin closest the input value will be disabled.
- target_pressure (Optional[ArrayLike]:
Pressure to target for selective bin disabling. Pressure bin closest to the input value will be disabled.
Returns:
- petitRADTRANS.radtrans_core.cloud_core._compute_cloud_opacities_using_particle_size_grid(atmosphere_densities, clouds_mass_fractions, cloud_particle_number_density_grid, clouds_particle_densities, cloud_particle_radii_bins, cloud_particle_radii, clouds_absorption_opacities, clouds_scattering_opacities, clouds_particle_asymmetry_parameters, pressures, target_particle_radii, target_pressure)#
- Args:
- atmosphere_densities:
Density of the atmosphere at each of its layer
- clouds_mass_fractions:
Mass fractions of each cloud at each atmospheric layer
- cloud_particle_number_density_grid:
Output from cloud lognormal EXPERIMENTAL
- clouds_particle_densities:
Density of each cloud particles
- cloud_particle_radii_bins:
Bins of the particles cloud radii grid
- cloud_particle_radii:
Particles cloud radii grid
- clouds_absorption_opacities:
Cloud absorption opacities (radius grid, wavelength grid, clouds)
- clouds_scattering_opacities:
Cloud scattering opacities (radius grid, wavelength grid, clouds)
- clouds_particle_asymmetry_parameters:
Cloud particles asymmetry parameters (radius grid, wavelength grid, clouds)
- pressures:
Pressure grid of the atmosphere layers
- target_particle_radii (Optional[ArrayLike]:
Particle radius to target for selective bin disabling. Radius bin closest the input value will be disabled.
- target_pressure (Optional[ArrayLike]:
Pressure to target for selective bin disabling. Pressure bin closest to the input value will be disabled.
Returns: