– if aggregates = False, this is the spherical particle radius
– if aggregates = True, this is the radius of a sphere of equivalent volume to the fractal aggregate
bin_min (array) – minimum radius in each particle bin
bin_max (array) – maximum radius in each particle bin
gas (string) – particle species to condense
optool_dir (string) –
directory location of compiled OPTOOL code. Assumes that .lnk files (the optool equivalent to .refrind) are stored in
a subdirectory within this folder.
– NOTE: these .lnk files must be in ascending wavelength order to correctly compute Mie coefficients!
– However, we will flip the arrays once calculated, so that .mieff files are consistently saved in order of descending wavelength.
Df (float) – the fractal dimension, if aggregrates = True
N_mon (int) – the number of monomers. If None, must set r_mon directly.
r_mon (float) – monomer particle radius (cm), used if aggregates = True. Can set directly or calculate from N_mon.
k0 (float) – the fractal prefactor, either prescribed by user or calculated using Tazaki (2021) Eq 2
Returns:
qext (array) – extinction effiencies for all particle radii/wavelengths
qsca (array) – scattering effiencies for all particle radii/wavelengths
cos_qscat (array) – average asymmetry parameter x Q_sca for all particle radii/wavelengths
Given the refractive indices at a certain wavelength this module
calculates the Mie scattering by a stratified sphere.The basic code used
was that described in the report: “ Subroutines for computing the parameters of
the electromagnetic radiation scattered by a sphere “ J.V. Dave,
I B M Scientific Center, Palo Alto , California.
Report NO. 320 - 3236 .. MAY 1968 .
Parameters:
RO (float) – Outer Shell Radius (cm)
RFR (float) – Real refractive index of shell layer (in the form n= RFR-i*RFI)
RFI (float) – Imaginary refractive index of shell layer (in the form n= RFR-i*RFI)
THET (ndarray) – Angle in degrees between the directions of the incident and the scattered radiation.
JX (integer) – Total number of THET for which calculations are required
R (float) – Radius of core (cm)`
RE2 (float) – Real refractive index of core (in the form n= RE2-i*TMAG2)
TMAG2 (float) – Imaginary refractive index of core (in the form n= RE2-i*TMAG2)
WVNO (float) – Wave-number corresponding to the wavelength. (cm^-1)
Returns:
QEXT (float) – Efficiency factor for extinction,VAN DE HULST,P.14 ‘ 127
QSCAT (float) – Efficiency factor for scattering,VAN DE HULST,P.14 ‘ 127
CTBQRS (float) – Average(cos(theta))*QSCAT,VAN DE HULST,P.14 ‘ 127
ISTATUS (integer) – Convergence indicator, 0 if converged, -1 if otherwise.
Defines all the atmospheric parameters needed for the calculation
Note: Some of this is repeated in the layer() function.
This is done on purpose because layer is used to get a “virtual”
layer off the user input’s grid. These parameters are also
needed, though, to get the initial mixing parameters from the user.
Therefore, we put them in both places.
Computes kz profile and mixing length given user input. In brief the options are:
Input Kz
Input constant kz
3) Input convective heat flux (supply chf in df)
3a) Input convective heat flux, correct for latent heat (supply chf in df and set latent_heat=True)
and/or 3b) Input convective heat flux, correct for convective overshoot (supply chf, convective_overshoot=1/3)
4) Set kz_min to prevent kz from going too low (any of the above and set kz_min~1e5)
Parameters:
df (dataframe or dict) – Dataframe from input with “pressure”(bars),”temperature”(K). MUST have at least two
columns with names “pressure” and “temperature”.
Optional columns include the eddy diffusion “kz” in cm^2/s CGS units, and
the convective heat flux ‘chf’ also in cgs (e.g. sigma_csg T^4)
constant_kz (float) – Constant value for kz, if kz is supplied in df or filename,
it will inheret that value and not use this constant_value
Default = None
latent_heat (bool) – optional, Default = False. The latent heat factors into the mixing length.
When False, the mixing length goes as the scale height
When True, the mixing length is scaled by the latent heat
convective_overshoot (float) – Optional, Default is None. But the default value used in
Ackerman & Marley 2001 is 1./3. If you are unsure of what to pick, start
there. This is only used when the
This is ONLY used when a chf (convective heat flux) is supplied
kz_min (float) – Minimum Kz value. This will reset everything below kz_min to kz_min.
Default = 1e5 cm2/s
Define Kz in CGS. Should be on same grid as pressure. This overwrites whatever was
defined in get_pt ! Users can define kz by:
Defining a DataFrame with keys ‘pressure’ (in bars), and ‘kz’
Defining constant kz
Supplying a convective heat flux and prescription for latent_heat
Parameters:
df (pandas.DataFrame, dict) – Dataframe or dictionary with ‘kz’ as one of the fields.
constant_kz (float) – Constant value for kz in units of cm^2/s
chf (ndarray) – Convective heat flux in cgs units (e.g. sigma T^4). This will be used to compute
the kzz using the methodology of Gierasch and Conrath (1985)
latent_heat (bool) – optional, Default = False. The latent heat factors into the mixing length.
When False, the mixing length goes as the scale height
When True, the mixing length is scaled by the latent heat
This is ONLY used when a chf (convective heat flux) is supplied
df (dataframe or dict) – Dataframe with “pressure”(bars),”temperature”(K). MUST have at least two
columns with names “pressure” and “temperature”.
Optional columns include the eddy diffusion “kz” in cm^2/s CGS units, and
the convective heat flux ‘chf’ also in cgs (e.g. sigma_csg T^4)
filename (str) – Filename read in. Will be read in with pd.read_csv and should
result in two named headers “pressure”(bars),”temperature”(K).
Optional columns include the eddy diffusion “kz” in cm^2/s CGS units, and
the convective heat flux ‘chf’ also in cgs (e.g. sigma_csg T^4)
Use pd_kwargs to ensure file is read in properly.
kz_min (float, optional) – Minimum Kz value. This will reset everything below kz_min to kz_min.
Default = 1e5 cm2/s
constant_kz (float, optional) – Constant value for kz, if kz is supplied in df or filename,
it will inheret that value and not use this constant_value
Default = None
latent_heat (bool) – optional, Default = False. The latent heat factors into the mixing length.
When False, the mixing length goes as the scale height
When True, the mixing length is scaled by the latent heat
convective_overshoot (float) – Optional, Default is None. But the default value used in
Ackerman & Marley 2001 is 1./3. If you are unsure of what to pick, start
there. This is only used when the
This is ONLY used when a chf (convective heat flux) is supplied
Teff (float, optional) – Effective temperature. If None (default), Teff set to temperature at 1 bar
alpha_pressure (float) – Pressure at which we want fsed=alpha for variable fsed calculation
pd_kwargs (kwargs) – Pandas key words for file read in.
If reading old style eddysed files, you would need:
skiprows=3, sep=r’s+’, header=None, names=[“ind”,”pressure”,”temperature”,”kz”]
Function that calculations new Mie database using MiePython (for spherical particles) or OPTOOL (for aggregates)
:param gas_name: List of names of gasses. Or a single gas name.
See pyeddy.available() to see which ones are currently available.
Parameters:
virga_dir (str) – Directory where you store the VIRGA refractive index files (.refind format).
dir_out (str) – Directory where you want to store Mie parameter files. Will be stored as gas_name.Mieff.
BEWARE FILE OVERWRITES.
optool_dir (str) – Directory where you store optool refractive index files (.lnk format).
rmin (float) – (Default=1e-8) Units of cm. The minimum radius to compute Mie parameters for.
Usually 0.001 microns is small enough. However, if you notice your mean particle radius
is on the low end, you may compute your grid to even lower particle sizes.
rmax (float) – (Default=5.4239131e-2) Units of cm. The maximum radius to compute Mie parameters for.
If your .mieff files take a long time to create, reduce this number. If you get a warning
that your particles are “off the grid” (larger than your maximum grid value), increase this number.
nradii (int, optional) – (Default=60) number of radii points to compute grid on. 40 grid points for exoplanets/BDs
logspace (boolean, optional) – (Default = True)
Spaces the radii logarithmically (which they generally tend to be in the clouds) if True. Spaces them linearly if False.
aggregates (boolean, optional) – (Default = True)
Sets whether particles are aggregates or spheres. If true, we will calculate optical properties using OPTOOL instead of MiePython.
Df (If aggregates = True, the fractal dimension of the aggegrate particle. a number between 1 and 3. (3 would be equal to solid spheres with radii of the outer effective radius))
N_mon (If aggregates = True, the number of monomers that make up an aggregate. Can set directly or calculate from r_mon.)
r_mon (If aggregates = True, the monomer radius that makes up an aggregate particle (in cm). Can either set or calculate from N_mon.)
k0 (only used if aggregate = True.) – Default = 0, where it will then be calculated in the vfall equation using Tazaki (2021) Eq 2. k0 can also be prescribed by user,
but with a warning that when r_mon is fixed, unless d_f = 1 at r= r_mon, the dynamics may not be consistent between the boundary
when spheres grow large enough to become aggregates (this applies only when r_mon is fixed. If N_mon is fixed instead, any value of k0 is fine).
Calculate spectrally-resolved profiles of optical depth, single-scattering
albedo, and asymmetry parameter for a user-input particle radius distribution
Parameters:
wave_in (ndarray) – your wavelength grid in microns
ndz (float) –
Column density of total particle concentration (#/cm^2)
Note: set to whatever, it’s your free knob
—- this does not directly translate to something physical because it’s for all particles in your slab
May have to use values of 1e8 or so
radius (ndarray) – Radius bin values - the range of particle sizes of interest. Maybe measured in the lab,
Ensure radius_unit is specified
radius_unit (astropy.unit.Units) – Astropy compatible unit
Calculate condensate number density and effective radius for a layer,
assuming geometric scatterers.
gas_namestr
Name of condensate
supsatfloat
Super saturation factor
t_layerfloat
Temperature of layer mid-pt (K)
p_layerfloat
Pressure of layer mid-pt (dyne/cm^2)
r_atmosfloat
specific gas constant for atmosphere (erg/K/g)
r_cloudfloat
specific gas constant for cloud species (erg/K/g)
q_belowfloat
total mixing ratio (vapor+condensate) below layer (g/g)
mxlfloat
convective mixing length scale (cm): no less than 1/10 scale height
dz_layerfloat
Thickness of layer cm
gravityfloat
Gravity of planet cgs
mw_atmosfloat
Molecular weight of the atmosphere
mfpfloat
atmospheric mean free path (cm)
viscfloat
atmospheric viscosity (dyne s/cm^2)
rho_pfloat
density of condensed vapor (g/cm^3)
w_convectfloat
convective velocity scale (cm/s)
fsedfloat
Sedimentation efficiency coefficient (unitless)
bfloat
Denominator of exponential in sedimentation efficiency (if param is ‘exp’)
eps: float
Minimum value of fsed function (if param=exp)
z_botfloat
Altitude at bottom of layer
z_layerfloat
Altitude of midpoint of layer (cm)
z_alphafloat
Altitude at which fsed=alpha for variable fsed calculation
paramstr
fsed parameterisation
‘const’ (constant), ‘exp’ (exponential density derivation)
sigfloat
Width of the log normal particle distrubtion
mhfloat
Metallicity NON log solar (1 = 1x solar)
rminfloat
Minium radius on grid (cm)
nradint
Number of radii on Mie grid
radiusndarray
Particle radius bin centers from the grid (cm)
aggregatesbool, optional
set to ‘True’ if you want fractal aggregates, keep at default ‘False’ for spherical cloud particles
Dffloat, optional
only used if aggregate = True.
The fractal dimension of an aggregate particle.
Low Df are highly fractal long, lacy chains; large Df are more compact. Df = 3 is a perfect compact sphere.
N_monfloat, optional
only used if aggregate = True.
The number of monomers that make up the aggregate. Either this OR r_mon should be provided (but not both).
r_monfloat, optional (units: cm)
only used if aggregate = True.
The size of the monomer radii (sub-particles) that make up the aggregate. Either this OR N_mon should be
provided (but not both).
k0float, optional (units: None)
only used if aggregate = True.
Default = 0, where it will then be calculated in the vfall equation using Tazaki (2021) Eq 2. k0 can also be prescribed by user,
but with a warning that when r_mon is fixed, unless d_f = 1 at r= r_mon, the dynamics may not be consistent between the boundary
when spheres grow large enough to become aggregates (this applies only when r_mon is fixed. If N_mon is fixed instead, any value of k0 is fine).
og_vfallbool , optional
optional, default = True. True does the original fall velocity calculation.
False does the updated one which runs a tad slower but is more consistent.
The main effect of turning on False is particle sizes in the upper atmosphere
that are slightly bigger.
Returns:
qt_top (float) – gas + condensate mixing ratio at top of layer(g/g)
qc_layer (float) – condenstate mixing ratio (g/g)
qt_layer (float) – gas + condensate mixing ratio (g/g)
rg_layer (float) – geometric mean radius of condensate cm
reff_layer (float) – droplet effective radius (second moment of size distrib, cm)
ndz_layer (float) – number column density of condensate (cm^-3)
Top level program to run eddysed. Requires running Atmosphere class
before running this.
Parameters:
atmo (class) – Atmosphere class
directory (str, optional) – Directory string that describes where refrind files are
as_dict (bool, optional) – Default = False. Option to view full output as dictionary
og_solver (bool, optional) –
Default=True. BETA. Contact developers before changing to False.
Option to change mmr solver (True = original eddysed, False = new direct solver)
direct_tol (float , optional) – Only used if og_solver =False. Default = True.
Tolerance for direct solver
refine_TP (bool, optional) – Only used if og_solver =False.
Option to refine temperature-pressure profile for direct solver
og_vfall (bool, optional) – Option to use original A&M or new Khan-Richardson method for finding vfall
analytical_rg (bool, optional) – Only used if og_solver =False.
Option to use analytical expression for rg, or alternatively deduce rg from calculation
Calculation option will be most useful for future
inclusions of alternative particle size distributions
do_virtual (bool) – If the user adds an upper bound pressure that is too low. There are cases where a cloud wants to
form off the grid towards higher pressures. This enables that.
Returns:
opd, w0, g0 – Extinction per layer, single scattering abledo, asymmetry parameter,
All are ndarrays that are nlayer by nwave
dict – Dictionary output that contains full output. See tutorials for explanation of all output.
Converts VIRGA’s .refrind files into OPTOOL .lnk files. The differences in file format are below:
VIRGA: [index, wavelength, n, k] No header, and in order of descending wavelength
OPTOOL: [wavelength, n, k] Header (num wavelengths and density, can also include comments), and in order of ascending wavelength
This function converts the XX.refrind file and saves it in the OPTOOL folder as XX_VIRGA.lnk in the optool directory, ready for optool to
use in MMF calculations (see “calc_mie_db”).
Parameters:
aggregate_list (list, str) – List of names of gasses. Or a single gas name.
See pyeddy.available() to see which ones are currently available.
virga_dir (str) – Directory where you store the VIRGA refractive index files (.refind format).
optool_dir (str) – Directory where you store optool refractive index files (.lnk format).
mh (float) – Atmospheric metallicity in NON log units (e.g. 1 for 1x solar)
sig (float) – Width of the log normal particle distribution
rmin (float) – Minium radius on grid (cm)
nrad (int) – Number of radii on Mie grid
radius (ndarray) – Particle radius bin centers from the grid (cm)
d_molecule (float) – diameter of atmospheric molecule (cm) (Rosner, 2000)
(3.711e-8 for air, 3.798e-8 for N2, 2.827e-8 for H2)
Set in Atmosphere constants
eps_k (float) – Depth of the Lennard-Jones potential well for the atmosphere
Used in the viscocity calculation (units are K) (Rosner, 2000)
c_p_factor (float) – specific heat of atmosphere (erg/K/g) . Usually 7/2 for ideal gas
diatomic molecules (e.g. H2, N2). Technically does slowly rise with
increasing temperature
aggregates (bool, optional) – set to ‘True’ if you want fractal aggregates, keep at default ‘False’ for spherical cloud particles
Df (float, optional) – only used if aggregate = True.
The fractal dimension of an aggregate particle.
Low Df are highly fractal long, lacy chains; large Df are more compact. Df = 3 is a perfect compact sphere.
N_mon (float, optional) – only used if aggregate = True.
The number of monomers that make up the aggregate. Either this OR r_mon should be provided (but not both).
r_mon (float, optional (units: cm)) – only used if aggregate = True.
The size of the monomer radii (sub-particles) that make up the aggregate. Either this OR N_mon should be
provided (but not both).
k0 (float, optional (units: None)) – only used if aggregate = True.
Default = 0, where it will then be calculated in the vfall equation using Tazaki (2021) Eq 2. k0 can also be prescribed by user,
but with a warning that when r_mon is fixed, unless d_f = 1 at r= r_mon, the dynamics may not be consistent between the boundary
when spheres grow large enough to become aggregates (this applies only when r_mon is fixed. If N_mon is fixed instead, any value of k0 is fine).
og_vfall (bool , optional) – optional, default = True. True does the original fall velocity calculation.
False does the updated one which runs a tad slower but is more consistent.
The main effect of turning on False is particle sizes in the upper atmosphere
that are slightly bigger.
do_virtual (bool,optional) – optional, Default = True which adds a virtual layer if the
species condenses below the model domain.
Get pre-calculated radius-wavelength grid of optical properties, considering the particles as either spheres (gas_name.mieff)
or aggregates (gas_name_aggregates_Df_XXXX.mieff), if aggregates=true and this aggregates file has been created using calc_mie_db function).
New version of grid generator - creates lin-spaced or log-spaced radii grids. Updated by MGL 07/01/25.
ALGORITHM DESCRIPTION:
First, VIRGA makes grid of particle sizes and calculates the optical properties for them. Then, when we find the average particle
size in a particular layer of cloud, it creates a lognormal distribution of particles (one that has the calculated mean radius),
and then finds how many particles fall into each of the ‘bins’ of the radius ‘grid’ that we have created. Finally, it weights the
contribution from each bin by the number of particles to calculate the total opacity of that layer. Therefore, the same grid needs
to be used for making the .mieff files (optical properties) and running VIRGA.
This new version simplifies the arrays to represent the mean, minimum and maximum values of radius in each bin. It also uses a consistent
function to calculate the radius values and bin widths, as well as correcting an error for the first bin mean.
Parameters:
r_min (float) – minimum radius in grid (in cm). Default is 10^-8 cm (0.0001 um) to match databases in v0.0.
r_max (float) – maximum radius in grid (in cm). Default is 5.4239131 x 10^-2 cm (542 um), to match databases in v0.0.
n_radii (int) – number of increments (note that each of these increments will be further divided into 6 sub-bins to smooth out any resonance features that occur due to specific particle sizes). Default is 60 to match databases in v0.0.
logspace (boolean) – Default = True. Spaces the radii logarithmically if True (tends to be the case in the clouds). Spaces them linearly if False.
Returns:
radius (array) – the mean radii for each set of 6 sub-bins
bin_min (array) – minimum value of each bin
bin_max – maximum value of each bin
dr (array) – the difference between the start and end of each bin (width of the radius bin)
Reads reference files with wavelength, and refractory indicies. The file formats
are different for VIRGA and OPTOOL. OPTOOL formats should be created by the user
and stored in /lnk_data using the “convert_refrind_to_lnk function before running
“calc_mie_db” function
VIRGA FILE FORMAT:
Input files are structured as a 4 column file with columns:
index, wavelength (micron), nn, kk
OPTOOL FILE FORMAT:
Input files are structured as a 3 column file with columns:
wavelength (micron), nn, kk
Parameters:
igas (str) – Gas name
directory (str) – Directory were reference files are located.
Calculate layer condensate properties by iterating on optical depth
in one model layer (converging on optical depth over sublayers)
gas_namestr
Name of condenstante
rho_pfloat
density of condensed vapor (g/cm^3)
t_layerfloat
Temperature of layer mid-pt (K)
p_layerfloat
Pressure of layer mid-pt (dyne/cm^2)
t_topfloat
Temperature at top of layer (K)
t_botfloat
Temperature at botton of layer (K)
p_topfloat
Pressure at top of layer (dyne/cm2)
p_botfloat
Pressure at botton of layer
kzfloat
eddy diffusion coefficient (cm^2/s)
mixlfloat
Mixing length (cm)
gravityfloat
Gravity of planet cgs
mw_atmosfloat
Molecular weight of the atmosphere
gas_mwfloat
Gas molecular weight
q_belowfloat
total mixing ratio (vapor+condensate) below layer (g/g)
supsatfloat
Super saturation factor
fsedfloat
Sedimentation efficiency coefficient (unitless)
bfloat
Denominator of exponential in sedimentation efficiency (if param is ‘exp’)
eps: float
Minimum value of fsed function (if param=exp)
z_topfloat
Altitude at top of layer
z_botfloat
Altitude at bottom of layer
z_alphafloat
Altitude at which fsed=alpha for variable fsed calculation
paramstr
fsed parameterisation
‘const’ (constant), ‘exp’ (exponential density derivation)
sigfloat
Width of the log normal particle distribution
mhfloat
Metallicity NON log soar (1=1xSolar)
rminfloat
Minium radius on grid (cm)
nradint
Number of radii on Mie grid
radiusndarray
Particle radius bin centers from the grid (cm)
d_moleculefloat
diameter of atmospheric molecule (cm) (Rosner, 2000)
(3.711e-8 for air, 3.798e-8 for N2, 2.827e-8 for H2)
Set in Atmosphere constants
eps_kfloat
Depth of the Lennard-Jones potential well for the atmosphere
Used in the viscocity calculation (units are K) (Rosner, 2000)
c_p_factorfloat
specific heat of atmosphere (erg/K/g) . Usually 7/2 for ideal gas
diatomic molecules (e.g. H2, N2). Technically does slowly rise with
increasing temperature
og_vfallbool
Use original or new vfall calculation
aggregatesbool, optional
set to ‘True’ if you want fractal aggregates, keep at default ‘False’ for spherical cloud particles
Dffloat, optional
only used if aggregate = True.
The fractal dimension of an aggregate particle.
Low Df are highly fractal long, lacy chains; large Df are more compact. Df = 3 is a perfect compact sphere.
N_monfloat, optional
only used if aggregate = True.
The number of monomers that make up the aggregate. Either this OR r_mon should be provided (but not both).
k0float, optional (units: None)
only used if aggregate = True.
Default = 0, where it will then be calculated in the vfall equation using Tazaki (2021) Eq 2. k0 can also be prescribed by user,
but with a warning that when r_mon is fixed, unless d_f = 1 at r= r_mon, the dynamics may not be consistent between the boundary
when spheres grow large enough to become aggregates (this applies only when r_mon is fixed. If N_mon is fixed instead, any value of k0 is fine).
r_monfloat, optional (units: cm)
only used if aggregate = True.
The size of the monomer radii (sub-particles) that make up the aggregate. Either this OR N_mon should be
provided (but not both).
Returns:
qc_layer (ndarray) – condenstate mixing ratio (g/g)
qt_layer (ndarray) – gas + condensate mixing ratio (g/g)
rg_layer (ndarray) – geometric mean radius of condensate cm
reff_layer (ndarray) – droplet effective radius (second moment of size distrib, cm)
ndz_layer (ndarray) – number column density of condensate (cm^-3)
q_below (ndarray) – total mixing ratio (vapor+condensate) below layer (g/g)
Sets up a PICASO-readable dataframe that inserts a wavelength dependent aerosol layer at the user’s
given pressure bounds, i.e., a wavelength-dependent slab of clouds or haze.
Parameters:
p_bottom (float) – the cloud/haze base pressure
the upper bound of pressure (i.e., lower altitude bound) to set the aerosol layer. (Bars)
opd (ndarray) – wavelength-dependent optical depth of the aerosol
w0 (ndarray) – wavelength-dependent single scattering albedo of the aerosol
wavenumber_grid (ndarray) – wavenumber grid in (cm^-1)
pressure_grid (ndarray) – bars, user-defined pressure grid for the model atmosphere
p_top (float) – bars, the cloud/haze-top pressure
This cuts off the upper cloud region as a step function.
You must specify either p_top or p_decay.
p_decay (ndarray) – noramlized to 1, unitless
array the same size as pressure_grid which specifies a
height dependent optical depth. The usual format of p_decay is
a fsed like exponential decay ~np.exp(-fsed*z/H)
Return type:
Dataframe of aerosol layer with pressure (in levels - non-physical units!), wavenumber, opd, w0, and g0 to be read by PICASO
Code to plot the particle densities at each radius and at each pressure layer for aggregates of each fractal dimension.
This basically allows you to see the relative numbers and radii of the particles that form in each layer, for each fractal dimension.
Parameters:
clouds_from_virga_spheres (dict) – output from virga (spherical model)
clouds_from_virga_fractals (dict) – array of dicts with output from virga (all of the virga models for each fractal dimension)
d_f_list (array) – list of fractal dimensions analysed
colors (array (optional)) – list of colors to use (in order: spheres, 1.2, 1.6, 2.0, 2.4, 2.8)
min_pressure (float (optional)) – minimum pressure (bars) to plot on y-axis
max_pressure (float (optional)) – maximum pressure (bars) to plot on y-axis
Return type:
Figure with the particle densities at each radius and at each pressure layer for aggregates of each fractal dimension
Code to plot the particle radius at each pressure layer for aggregates of each fractal dimension.
Designed originally for diagnostic tests as part for VIRGA development by MGL.
Parameters:
clouds_from_virga_spheres (dict) – output from virga (spherical model)
clouds_from_virga_fractals (dict) – array of dicts with output from virga (all of the virga models for each fractal dimension)
d_f_list (array) – list of fractal dimensions analysed
colors (array (optional)) – list of colors to use (in order: spheres, 1.2, 1.6, 2.0, 2.4, 2.8)
width (float (optional)) – width of lines in plot (default = 3)
min_pressure (float (optional)) – minimum pressure (bars) to plot on y-axis
max_pressure (float (optional)) – maximum pressure (bars) to plot on y-axis
Return type:
Figure plotting the particle radius at each pressure layer for aggregates of each fractal dimension.
Code to plot the wavelength-radius grid that was used the create the .mieff files, and then overplot the actual radii
for each pressure layer for each fractal dimension, so that we can check that the radii we are using actually have
unique optical properties that were calculated at a reasonable resolution.
Parameters:
clouds_from_virga_spheres (dict) – output from virga (spherical model)
clouds_from_virga_fractals (dict) – array of dicts with output from virga (all of the virga models for each fractal dimension)
aggregate (string) – chemical species used in model
d_f_list (array) – list of fractal dimensions analysed
mieff_dir (string) – filepath to directory where .mieff files are stored
colors (array (optional)) – list of colors to use (in order: spheres, 1.2, 1.6, 2.0, 2.4, 2.8)
Return type:
Wavelength-radius grid from .mieff files, overplotted with radii for each pressure layer for each fractal dimension.
Plot PT profiles with condensation curves.
Thick lines in this pt plot signify those gases that
were turned on in the run, NOT those that were recommended.
Parameters:
out (dict) – Dictionary output from pyeddy run
with_condensation (bool) – Plots condensation curves of gases. Also plots those that were turned on in the
calculation with line_width=5. All others are set to 1.
return_condensation (bool) – If true, it returns list of condenation temps for each gas, pressure grid,
and a list of the gas names
**kwargs (kwargs) – Kwargs for bokeh.figure()
Returns:
if return_condensation (fig, cond temperature curves, ,cond pressure grid , name of all available gases)
Find the following variables for a given radius. One value should be prescribed by the user, but both
can change according to the growth model in Figure 2 of Moran & Lodge (2025):
N_mon: Number of monomers
r_mon: monomer radius
Parameters:
N_mon_prescribed (int) – Value of 1 if the user prescribed N_mon, 0 if they prescribed r_mon instead
radius (float) – compact radius of aggregate (units:cm)
original_N_mon (int) – original number of monomers prescribed by user
”
Define force balance for spherical particles falling in atmosphere, namely equate
gravitational and viscous drag forces.
Viscous drag assumed to be quadratic (Benchaita et al. 1983) and is a function of
the Reynolds number dependent drag coefficient.
Drag coefficient taken from Khan-Richardson model (Richardson et al. 2002) and
is valid for 1e-2 < Re < 1e5.
Calculates the pressure of saturation mixing ratio for a gas
that is extrapolated below the model domain.
This is specifically used if the gas has saturated
below the model grid
New vfall function written by SEM and MGL, based on the methods of:
“Aggregate Cloud Particle Effects in Exoplanet Atmospheres”, Vahidinia et al. (2024)
“A Condensation–coalescence Cloud Model for Exoplanetary Atmospheres: Formulation and Test Applications to Terrestrial and Jovian Clouds”, Ohno and Okuzumi (2017)
“Theoretical modeling of mineral cloud formation on super-Earths”, K. Ohno (2024)
We adapt the above to include a broad range of aggregates and atmospheric conditions. The general outline of the code is:
Find the characteristic radius (R_c) of the particle:
SPHERES: R_c = radius of the sphere
AGGREGATES: R_c = radius of gyration
Determine the Knudsen number:
If Kn > 10 we are in the Free molecular regime (if the mean free path of the gas is large compared to the particle size).
Here, use equation 46 of Vahidinia et al. (2024) to adapt the fall velocity of spheres for aggregates of fractal dimension d_f
If Kn < 10 we are in the Continuum regime (the gas can be treated a a continuous fluid)
Here, use equation 23 of Ohno and Okuzumi (2017) to calculate vfall for aggregates of any type, with the addition of the Beta slip correction
factor (Eq 3.11 of Ohno, 2024). This equation (Eq. 23) is valid for all three of the stokes, slip and turbulent regimes, so there is no need to calculate
Reynolds number. It is not strictly designed to work for really low fractal dimensions (e.g. DCLA aggregates with d_f = 1.2), so consider the effects
an upper bound for these if used (though aggregates in high atmospheres are not usually in the continuum regime anyway, they are in the Free molecular
regime. The use of mobility radius for linear DCLA aggregates was explored, but R_gyr was chosen to remain consistent and continuous as d_f changes.
DEPRECATED, SEE CURRENT IMPLEMENTATION IN ‘VFALL’ FUNCTION
Calculate fallspeed for a particle at one layer in an
atmosphere, assuming low Reynolds number and in the molecular regime (Epstein drag),
i.e., where Knudsen number (mfp/r) is high (>>1).
User chooses whether particle is spherical or an aggregate.
If aggregrate, the monomer size is given by r and the outer effective radius of the aggregrate is Ragg.
Calculates fallspeed for a fractal aggegrate particle as performed
by Ohno et al., 2020, with an outer
effective radius of R_agg made up of monomers of size r, at one layer in an
atmosphere. ***Requires characteristic radius ragg to have D > or equal 2, i.e., not very fluffy aggregrates.
Essentially a more explicit version of the regular “vfall_aggregates” function,
and is not dependent on being in free molecular (Esptein) regime
all units are cgs
Parameters:
r (float) – monomer particle radius (cm)
grav (float) – acceleration of gravity (cm/s^2)
rhop (float) – density of monomer particle (g/cm^3)
This is used to find F(X)-y=0 where F(X) is the fall speed for
a spherical particle and y is the convective velocity scale.
When the two are balanced we arrive at our correct particle radius.
Therefore, it is the same as the vfall function but with the
subtraction of the convective velocity scale (cm/s) w_convect.