Equilibrate¶
Functions for equilibrating the initial droplet spectrum and assembling the
state vector. Used internally by ParcelModel at construction time, and exposed
for users building custom pipelines with the low-level integrator API.
equilibrate_initial_state ¶
equilibrate_initial_state(
T0: float,
S0: float,
P0: float,
r_drys: ArrayLike,
kappas: ArrayLike,
Nis: ArrayLike,
**kwargs: Any,
) -> Array
Assemble the equilibrated initial state vector y0.
Faithful to ParcelModel._setup_run: water-vapor mixing ratio from the
ambient RH, equilibrium wet radii, and the droplet liquid-water content they
imply (normalized by the dry-air density).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
T0
|
float
|
Initial temperature, K. |
required |
S0
|
float
|
Initial supersaturation (0 == 100% RH); typically sub-critical (< 0). |
required |
P0
|
float
|
Initial pressure, Pa. |
required |
r_drys
|
array, shape ``(nr,)``
|
Dry radii, m. |
required |
kappas
|
array, shape ``(nr,)``
|
Hygroscopicities. |
required |
Nis
|
array, shape ``(nr,)``
|
Number concentrations, m^-3. |
required |
**kwargs
|
Any
|
Forwarded to equilibrate_radii ( |
{}
|
Returns:
| Type | Description |
|---|---|
array, shape ``(7 + nr,)``
|
|
Source code in pyrcel/equilibrate.py
equilibrate_radii ¶
equilibrate_radii(
T0: float,
S0: float,
r_drys: ArrayLike,
kappas: ArrayLike,
*,
rtol: float = _RTOL,
atol: float = _ATOL,
max_steps: int = _MAX_STEPS,
) -> Array
Equilibrium wet radii for every aerosol bin (vectorized over bins).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
T0
|
float
|
Initial temperature, K. |
required |
S0
|
float
|
Initial supersaturation (0 == 100% RH); sub-critical (typically < 0). |
required |
r_drys
|
array, shape ``(nr,)``
|
Dry radii (m) and hygroscopicities. |
required |
kappas
|
array, shape ``(nr,)``
|
Dry radii (m) and hygroscopicities. |
required |
Returns:
| Type | Description |
|---|---|
array, shape ``(nr,)``
|
Equilibrium wet radii |
Source code in pyrcel/equilibrate.py
kohler_crit ¶
kohler_crit(
T: ArrayLike,
r_dry: ArrayLike,
kappa: ArrayLike,
*,
rtol: float = _RTOL,
atol: float = _ATOL,
max_steps: int = _MAX_STEPS,
) -> Array
Exact Köhler critical (peak) radius via a root-find on dSeq/dr = 0.
The JAX analog of pyrcel.legacy.thermo.kohler_crit (which uses
scipy.optimize.fminbound on -Seq). Seq is unimodal for kappa > 0,
so its derivative -- obtained analytically with jax.grad -- has a single
zero (the peak) on [r_dry, r_dry * 1e4]. Always returns r_crit > r_dry,
making it a valid upper bracket for the equilibrium solve at any particle size.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
T
|
float
|
Ambient temperature, K. |
required |
r_dry
|
float
|
Dry particle radius, m. |
required |
kappa
|
float
|
Particle hygroscopicity parameter. |
required |
rtol
|
float
|
Root-find tolerances. |
_RTOL
|
atol
|
float
|
Root-find tolerances. |
_RTOL
|
max_steps
|
int
|
Maximum bisection iterations. |
_MAX_STEPS
|
Returns:
| Type | Description |
|---|---|
float
|
Critical wet radius, m. Always satisfies |
See Also
kohler_crit_approx : Analytic approximation.
pyrcel.legacy.thermo.kohler_crit : NumPy equivalent using scipy.optimize.fminbound.
Source code in pyrcel/equilibrate.py
kohler_crit_approx ¶
Analytic approximate Köhler critical radius and supersaturation.
Mirrors pyrcel.legacy.thermo.kohler_crit with approx=True. This
approximation can return r_crit < r_dry for very small, low-κ particles,
so it is not used to bracket the equilibrium root — kohler_crit
is. Kept for reference and the analytic s_crit.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
T
|
float
|
Ambient temperature, K. |
required |
r_dry
|
float
|
Dry particle radius, m. |
required |
kappa
|
float
|
Particle hygroscopicity parameter. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
r_crit |
float
|
Approximate critical wet radius, m. |
s_crit |
float
|
Approximate critical supersaturation. |
See Also
kohler_crit : Exact numerical Köhler critical radius.
pyrcel.legacy.thermo.kohler_crit : NumPy equivalent with approx=True.