API Documentation

Public API

Breeze.BreezeModule

Julia package for finite-volume GPU and CPU large eddy simulations (LES) of atmospheric flows. The abstractions, design, and finite-volume engine are based on Oceananigans.

source

Advection

AnelasticEquations

Breeze.AnelasticEquationsModule
AnelasticEquations

Module implementing anelastic dynamics for atmosphere models.

The anelastic approximation filters acoustic waves by assuming density and pressure are small perturbations from a dry, hydrostatic, adiabatic reference state. The key constraint is that mass flux divergence vanishes:

\[\boldsymbol{\nabla} ⋅ (ρᵣ \boldsymbol{u}) = 0\]

source

AtmosphereModels

Breeze.AtmosphereModels.AbstractMicrophysicalStateType
AbstractMicrophysicalState{FT}

Abstract supertype for microphysical state structs.

Microphysical states encapsulate the local microphysical variables (e.g., cloud liquid, rain, droplet number) needed to compute tendencies. This abstraction enables the same tendency functions to work for both grid-based LES and Lagrangian parcel models.

Concrete subtypes should be immutable structs containing the relevant mixing ratios and number concentrations for a given microphysics scheme.

For example, a warm-phase one-moment scheme might define a state with cloud liquid and rain mixing ratios (qᶜˡ, ).

See also microphysical_state, microphysical_tendency.

source
Breeze.AtmosphereModels.AbstractSolarPositionType
abstract type AbstractSolarPosition

Abstract supertype for solar-position specifications passed to RadiativeTransferModel. Concrete subtypes determine how cos(θ_z) is computed on each radiation update:

  • ApparentSolarPosition — real-Earth time-varying, computed from the model clock and grid (or explicit) longitude/latitude.
  • DiurnalSolarPosition — idealized diurnal cycle at a fixed latitude and declination, no calendar dependence.
  • FixedCosineZenith — constant cos(θ_z), clock-independent.
source
Breeze.AtmosphereModels.AdiabaticBalancerType
struct AdiabaticBalancer{T, S}

Configuration for adiabatic (FV3 na_init) initialization, applied with balance_adiabatically!(model, balancer) or set!(model; balancer = AdiabaticBalancer(...)). Works for both CompressibleDynamics and AnelasticDynamics.

Keyword arguments

  • time_stepping: the time discretization used for the balance excursion (the sponge is always stripped — it is irreversible). CompressibleDynamics only; ignored for AnelasticDynamics (which has a single projection-based scheme). Options:
    • default (DefaultTimeStepping()) — fully-explicit stepping. Memory-minimal (no acoustic substepper; only the aliased Gⁿ/U⁰ tendency storage) and cleanly reversible, but Δt is bounded by the vertical acoustic CFL.
    • nothing — reuse the model's native scheme (e.g. split-explicit), at the cost of rebuilding the acoustic substepper's scratch fields.
    • any time-discretization object — swapped in as-is.
  • Δt: forward/backward step size. nothing (default) auto-derives the vertical-acoustic-CFL step acoustic_cfl_safety · Δz_min / c from the grid and analysis sound speed; pass a number to override.
  • cycles: number of balance cycles (default 1).
  • weight: nudging weight toward the analysis snapshot (default 2 → ⅓ dynamics + ⅔ analysis).
  • with_moisture: if true (default) the moisture density ρqᵉ relaxes with the other prognostics. If false, ρqᵉ is snapshotted before the balance and restored after, so it is preserved exactly — reproducing a graft that returns only (ρ, ρu, ρv, ρw, ρθ).
source
Breeze.AtmosphereModels.AllSkyOpticsType
struct AllSkyOptics <: Breeze.AtmosphereModels.AbstractOptics

Type representing full-spectrum all-sky (cloudy) radiation using RRTMGP gas and cloud optics, can be used as optics argument in RadiativeTransferModel.

All-sky radiation includes scattering by cloud liquid and ice particles, requiring cloud water path, cloud fraction, and effective radius inputs from the microphysics scheme.

source
Breeze.AtmosphereModels.ApparentSolarPositionType
struct ApparentSolarPosition{C, E} <: AbstractSolarPosition

Time-varying apparent solar position. The cosine of the solar zenith angle is recomputed on each radiation update from the model clock and either the grid's $(λ, φ)$ coordinates (when coordinate === nothing, the default) or an explicit (longitude, latitude) tuple stored in coordinate.

When the model clock holds a floating-point time (in seconds), epoch::DateTime provides the absolute reference against which clock.time is resolved. With a DateTime clock, epoch is ignored.

Fields

  • coordinate::Any: Observer longitude/latitude. Either nothing (use grid coordinates) or a (longitude, latitude) tuple in degrees.

  • epoch::Any: DateTime anchor for floating-point clocks. Either nothing (requires a DateTime clock) or a DateTime.

source
Breeze.AtmosphereModels.ApparentSolarPositionMethod
ApparentSolarPosition(
;
    coordinate,
    epoch
) -> ApparentSolarPosition{Nothing, Nothing}

Construct an ApparentSolarPosition with optional coordinate and epoch.

julia> using Breeze, Datesjulia> ApparentSolarPosition()ApparentSolarPosition(coordinate=<from grid>, epoch=<from clock>)julia> ApparentSolarPosition(coordinate = (-70.9, 42.5))ApparentSolarPosition(coordinate=(-70.9, 42.5), epoch=<from clock>)julia> ApparentSolarPosition(epoch = DateTime(2024, 1, 1))ApparentSolarPosition(coordinate=<from grid>, epoch=2024-01-01T00:00:00)
source
Breeze.AtmosphereModels.AtmosphereModelMethod
AtmosphereModel(
    grid;
    clock,
    thermodynamic_constants,
    formulation,
    dynamics,
    velocities,
    moisture_density,
    tracers,
    coriolis,
    boundary_conditions,
    forcing,
    advection,
    momentum_advection,
    scalar_advection,
    closure,
    microphysics,
    timestepper,
    timestepper_kwargs,
    radiation
) -> AtmosphereModel{Dyn, Frm, Arc, Tst, Grd, Clk, Thm, Mom, Moi, Nothing, Tmp, Sol, Vel, Trc, Adv, Nothing, Frc, Nothing, Cnd, Nothing, Nothing, Nothing} where {Dyn, Frm, Arc, Tst, Grd, Clk, Thm, Mom, Moi, Tmp, Sol, Vel, Trc, Adv, Frc, Cnd}

Return an AtmosphereModel that uses the anelastic approximation following Pauluis (2008).

Arguments

  • The default dynamics is AnelasticDynamics.

  • The default formulation is :LiquidIcePotentialTemperature.

  • The default advection scheme is Centered(order=2) for both momentum and scalars. If a single advection is provided, it is used for both momentum and scalars.

  • Alternatively, specific momentum_advection and scalar_advection schemes may be provided. scalar_advection may be a NamedTuple with a different scheme for each respective scalar, identified by name.

Example

julia> using Breezejulia> grid = RectilinearGrid(size=(8, 8, 8), extent=(1, 2, 3));julia> model = AtmosphereModel(grid)AtmosphereModel{CPU, RectilinearGrid}(time = 0 seconds, iteration = 0)├── grid: 8×8×8 RectilinearGrid{Float64, Periodic, Periodic, Bounded} on CPU with 3×3×3 halo├── dynamics: AnelasticDynamics(p₀=101325.0, θ₀=288.0)├── formulation: LiquidIcePotentialTemperatureFormulation├── thermodynamic_constants: ThermodynamicConstants{Float64}├── timestepper: SSPRungeKutta3├── advection scheme:│   ├── momentum: Centered(order=2)│   ├── ρθ: Centered(order=2)│   └── ρqᵛ: Centered(order=2)├── forcing: @NamedTuple{ρu::Returns{Float64}, ρv::Returns{Float64}, ρw::Returns{Float64}, ρθ::Returns{Float64}, ρqᵛ::Returns{Float64}, ρe::Returns{Float64}}├── tracers: ()├── coriolis: Nothing└── microphysics: Nothing

References

Pauluis, O. (2008). Thermodynamic consistency of the anelastic approximation for a moist atmosphere. Journal of the Atmospheric Sciences 65, 2719–2729.

source
Breeze.AtmosphereModels.BackgroundAtmosphereType
struct BackgroundAtmosphere{N2, O2, CO2, CH4, N2O, CO, NO2, O3, CFC11, CFC12, CFC22, CCL4, CF4, HFC125, HFC134A, HFC143A, HFC23, HFC32}

Volume mixing ratios (VMR) for radiatively active gases. All values are dimensionless molar fractions.

RRTMGP supports spatially-varying VMR only for H₂O (computed from model moisture) and O₃. All other gases use global mean values.

Fields

  • Constant gases (global mean only): N₂, O₂, CO₂, CH₄, N₂O, CO, NO₂
  • Halocarbons: CFC₁₁, CFC₁₂, CFC₂₂, CCl₄, CF₄
  • Hydrofluorocarbons: HFC₁₂₅, HFC₁₃₄ₐ, HFC₁₄₃ₐ, HFC₂₃, HFC₃₂
  • Spatially-varying: O₃ - can be a constant or a function for height-dependent profiles

Defaults are approximate modern atmospheric values for major gases; halocarbons default to zero.

Note: H₂O is computed from the model's prognostic moisture field, not specified here.

The BackgroundAtmosphere constructor does not require a grid. When passed to RadiativeTransferModel, the O₃ field is materialized using the grid. This allows users to seamlessly switch between constant and function-based concentrations.

source
Breeze.AtmosphereModels.BackgroundAtmosphereMethod
BackgroundAtmosphere(
;
    N₂,
    O₂,
    CO₂,
    CH₄,
    N₂O,
    CO,
    NO₂,
    O₃,
    CFC₁₁,
    CFC₁₂,
    CFC₂₂,
    CCl₄,
    CF₄,
    HFC₁₂₅,
    HFC₁₃₄ₐ,
    HFC₁₄₃ₐ,
    HFC₂₃,
    HFC₃₂
) -> BackgroundAtmosphere{Float64, Float64, Float64, Float64, Float64, Float64, Float64, typeof(standard_ozone_profile), Float64, Float64, Float64, Float64, Float64, Float64, Float64, Float64, Float64, Float64}

Construct a BackgroundAtmosphere with volume mixing ratios for radiatively active gases. All values are dimensionless molar fractions.

RRTMGP supports spatially-varying VMR only for H₂O and O₃. Other gases use global means.

  • Constant gases: Specify as numbers
  • O₃: Can be a Number or Function for height-dependent profiles

Keyword Arguments

  • Constant gases: N₂, O₂, CO₂, CH₄, N₂O, CO, NO₂
  • Halocarbons: CFC₁₁, CFC₁₂, CFC₂₂, CCl₄, CF₄
  • Hydrofluorocarbons: HFC₁₂₅, HFC₁₃₄ₐ, HFC₁₄₃ₐ, HFC₂₃, HFC₃₂
  • Spatially-varying: O₃ (can be Number or Function)

Defaults are approximate modern atmospheric values; halocarbons default to zero, and ozone defaults to standard_ozone_profile (pass O₃ = 0 for an ozone-free atmosphere). Note: H₂O is computed from the model's prognostic moisture field.

Example

julia> using Breezejulia> background = BackgroundAtmosphere(CO₂ = 400e-6)BackgroundAtmosphere with 6 active gases:  N₂ = 0.78084  O₂ = 0.20946  CO₂ = 400.0 ppm  CH₄ = 1.8 ppm  N₂O = 330.0 ppb  O₃ = standard_ozone_profile (generic function with 1 method)julia> tropical_ozone(z) = 30e-9 * (1 + z / 10000);julia> background = BackgroundAtmosphere(CO₂ = 400e-6, O₃ = tropical_ozone)BackgroundAtmosphere with 6 active gases:  N₂ = 0.78084  O₂ = 0.20946  CO₂ = 400.0 ppm  CH₄ = 1.8 ppm  N₂O = 330.0 ppb  O₃ = tropical_ozone (generic function with 1 method)
source
Breeze.AtmosphereModels.CellAdvectionTimescaleType

A callable that returns the advective timescale of a model restricted to the directions of formulation: HorizontalFormulation() counts only the horizontal advective CFL (dropping the vertical term), ThreeDimensionalFormulation() counts all three directions. Pass it to the cell_advection_timescale keyword of TimeStepWizard / conjure_time_step_wizard!, or as the timescale argument of CFL (CFL(Δt, CellAdvectionTimescale(...))), to control or monitor which directions bind the time step.

source
Breeze.AtmosphereModels.DiurnalSolarPositionType
DiurnalSolarPosition(; ...)
DiurnalSolarPosition(
    FT::DataType;
    latitude,
    declination,
    day_length,
    noon_offset
)

Construct a DiurnalSolarPosition with sensible defaults: perpetual equinox (declination = 0), 24-hour day (day_length = 86400 s), and noon at the start of the simulation (noon_offset = 0).

The positional argument FT controls the precision of the stored fields and defaults to Oceananigans.defaults.FloatType. Pass FT = Float32 (or set Oceananigans.defaults.FloatType = Float32) to run in Float32:

DiurnalSolarPosition(Float32, latitude = 30)
source
Breeze.AtmosphereModels.DiurnalSolarPositionType
struct DiurnalSolarPosition{FT} <: AbstractSolarPosition

Idealized diurnal cycle with no annual variation and no calendar dependence. cos(θ_z) is computed analytically on each radiation update from the model clock (which must be numeric — seconds since the start of the run) as

\[\cos(θ_z) = \sin(φ) \sin(δ) + \cos(φ) \cos(δ) \cos(ω), \qquad ω = \frac{2π}{T_d} (t - t_{\text{noon}})\]

where $φ$ is the (fixed) observer latitude, $δ$ is the (fixed) solar declination, $T_d$ is the day length, and $t_{\text{noon}}$ is the simulation time at which local noon occurs. $ω = 0$ at noon and $ω = ±π$ at local midnight. The result is clamped to be non-negative.

Fields

  • latitude::Any: Observer latitude (degrees).

  • declination::Any: Solar declination (degrees). Zero is perpetual equinox; ±23.5 is perpetual solstice.

  • day_length::Any: Rotation period (seconds). Default 86400 is the Earth day.

  • noon_offset::Any: Simulation time (seconds) at which local noon occurs. Default 0.

Examples

Perpetual equinox at 30°N (default: 24-hour day, noon at $t = 0$):

julia> using Breezejulia> DiurnalSolarPosition(latitude = 30)DiurnalSolarPosition(latitude = 30.0°, declination = 0.0°, day_length = 86400.0 s, noon_offset = 0.0 s)

Perpetual June solstice at 45°N:

julia> using Breezejulia> DiurnalSolarPosition(latitude = 45, declination = 23.5)DiurnalSolarPosition(latitude = 45.0°, declination = 23.5°, day_length = 86400.0 s, noon_offset = 0.0 s)

Fast rotator with a 10-hour day, sun overhead, starting at sunrise:

julia> using Breezejulia> DiurnalSolarPosition(latitude = 0, day_length = 10 * 3600, noon_offset = 5 * 3600)DiurnalSolarPosition(latitude = 0.0°, declination = 0.0°, day_length = 36000.0 s, noon_offset = 18000.0 s)
source
Breeze.AtmosphereModels.FixedCosineZenithType
struct FixedCosineZenith{FT} <: AbstractSolarPosition

Constant cosine of the solar zenith angle. The model clock has no effect on the sun position; the shortwave path length is fixed at $1 / \cos(θ_z)$ and the top-of-atmosphere downward shortwave flux is solar_constant * cos_zenith.

This is the appropriate choice for idealized studies (radiative-convective equilibrium, RCE intercomparisons) where a diurnal or annual mean is desired. Common values: $\cos(θ_z) = 0.5$ for diurnal mean at mid-latitudes, $\cos(θ_z) ≈ 0.41$ for the global annual mean.

Fields

  • cos_zenith::Any: Cosine of the solar zenith angle. Should satisfy $0 ≤ \cos(θ_z) ≤ 1$ for the sun above the horizon.

Example

julia> using Breezejulia> FixedCosineZenith(0.5)FixedCosineZenith(cos_zenith = 0.5)
source
Breeze.AtmosphereModels.HorizontalSlowModeType
struct HorizontalSlowMode{D}

Wrapper type indicating that vertical "fast" terms should be excluded from tendencies.

When computing momentum tendencies with a HorizontalSlowMode-wrapped dynamics, the horizontal pressure gradient is computed normally, but the vertical pressure gradient and buoyancy return zero. These vertical fast terms are handled by the acoustic substep loop through perturbation variables $-ψ ∂ρ''/∂z - g ρ''$.

Including the full vertical PG and buoyancy in the slow tendency introduces a hydrostatic truncation error $O(Δz^2)$ that drives spurious acoustic modes. The horizontal PG does not suffer from this issue and can safely be included.

source
Breeze.AtmosphereModels.HydrostaticallyBalancedDensityType
HydrostaticallyBalancedDensity(; surface_pressure = nothing)

Marker passed as the ρ value to set! to set the density in discrete moist hydrostatic balance with the just-set θˡⁱ/qᵛ, by per-column integration of the hydrostatic equation upward from surface_pressure (a scalar; defaults to the dynamics' mean surface pressure). For CompressibleDynamics.

Unlike supplying a density field, this guarantees the initial column satisfies the discrete hydrostatic balance (pᵏ − pᵏ⁻¹)/Δz + g(ρᵏ + ρᵏ⁻¹)/2 = 0, so the cold start carries no spurious vertical pressure-gradient force. Combine with compute_reference_state = true (perturbation-form base state) and balancer (nonhydrostatic ρw spin-up) for a full one-call initialization.

source
Breeze.AtmosphereModels.NothingMicrophysicalStateType
NothingMicrophysicalState{FT}

A microphysical state with no prognostic variables.

Used for Nothing microphysics and SaturationAdjustment schemes where cloud condensate is diagnosed from the thermodynamic state rather than being prognostic.

source
Breeze.AtmosphereModels.RadiativeTransferModelMethod
RadiativeTransferModel(
    grid::Oceananigans.Grids.AbstractGrid,
    optics,
    args...;
    kw...
)

Construct a RadiativeTransferModel on grid using the specified optics.

Valid optics types are:

The constants argument provides physical constants for the radiative transfer solver.

Solar position

The solar_position keyword controls how the cosine of the solar zenith angle is obtained on each radiation update. See AbstractSolarPosition and its subtypes:

  • ApparentSolarPosition (default) — time-varying, computed from the model clock and grid (or explicit) longitude/latitude. Supports DateTime clocks and floating-point clocks resolved against an epoch.
  • FixedCosineZenith — constant cos(θ_z), clock-independent. Appropriate for idealized radiative-convective equilibrium studies.

Example

julia> using Breeze, Oceananigans.Units, RRTMGP, NCDatasetsjulia> grid = RectilinearGrid(; size=16, x=0, y=45, z=(0, 10kilometers),                              topology=(Flat, Flat, Bounded));julia> RadiativeTransferModel(grid, GrayOptics(), ThermodynamicConstants();                              surface_temperature = 300,                              surface_albedo = 0.1)RadiativeTransferModel├── solar_constant: 1361.0 W m⁻²├── solar_position: ApparentSolarPosition(coordinate=(0.0, 45.0), epoch=<from clock>)├── surface_temperature: ConstantField(300.0) K├── surface_emissivity: ConstantField(0.98)├── direct_surface_albedo: ConstantField(0.1)└── diffuse_surface_albedo: ConstantField(0.1)julia> RadiativeTransferModel(grid, GrayOptics(), ThermodynamicConstants();                              surface_temperature = 300,                              surface_albedo = 0.1,                              solar_position = FixedCosineZenith(0.5))RadiativeTransferModel├── solar_constant: 1361.0 W m⁻²├── solar_position: FixedCosineZenith(cos_zenith = 0.5)├── surface_temperature: ConstantField(300.0) K├── surface_emissivity: ConstantField(0.98)├── direct_surface_albedo: ConstantField(0.1)└── diffuse_surface_albedo: ConstantField(0.1)julia> RadiativeTransferModel(grid, ClearSkyOptics(), ThermodynamicConstants();                              surface_temperature = 300,                              surface_albedo = 0.1,                              background_atmosphere = BackgroundAtmosphere(CO₂ = 400e-6))RadiativeTransferModel├── solar_constant: 1361.0 W m⁻²├── solar_position: ApparentSolarPosition(coordinate=(0.0, 45.0), epoch=<from clock>)├── surface_temperature: ConstantField(300.0) K├── surface_emissivity: ConstantField(0.98)├── direct_surface_albedo: ConstantField(0.1)└── diffuse_surface_albedo: ConstantField(0.1)

References

  • O'Gorman, P. A. and Schneider, T. (2008). The hydrological cycle over a wide range of climates simulated with an idealized GCM. Journal of Climate, 21, 3815–3832.
source
Breeze.AtmosphereModels.SlowTendencyModeType
struct SlowTendencyMode{D}

Wrapper type indicating that only "slow" tendencies should be computed.

When computing momentum tendencies with a SlowTendencyMode-wrapped dynamics, the "fast" terms (pressure gradient and buoyancy) return zero. This is used for split-explicit time-stepping where fast terms are handled separately in an acoustic substep loop.

See also SplitExplicitTimeDiscretization.

source
Breeze.AtmosphereModels.SpeciesBorrowingType
struct SpeciesBorrowing{VB} <: Breeze.AtmosphereModels.AbstractNegativeMoistureCorrection

Correct negative moisture produced by advection via same-level species borrowing.

At each grid cell, negative hydrometeors borrow from lighter species in the chain (e.g. rain <- cloud liquid <- vapor). Vertical redistribution of any remaining negative vapor is performed when vertical_borrowing is set to VerticalBorrowing.

For microphysics with number concentrations (categories that subtype AbstractNumberConcentrationCategories), orphaned number concentrations are zeroed and negative number concentrations are clamped after mass borrowing.

See fix_negative_moisture! for details.

Fields

  • vertical_borrowing: nothing (default) or VerticalBorrowing() to enable vertical redistribution
source
Breeze.AtmosphereModels.VerticalBorrowingType
struct VerticalBorrowing <: Breeze.AtmosphereModels.AbstractNegativeMoistureCorrection

Redistribute negative vapor vertically within each column via a top-to-bottom sweep that pushes deficits downward, followed by one bottom-to-top borrowing step if the bottom level is still negative.

This scheme can be used on its own to correct the moisture prognostic, or as the second phase of SpeciesBorrowing to clean up any vapor deficit that remains after same-level species borrowing.

Column-integrated moisture is conserved ($Δz$-weighted).

source
Breeze.AtmosphereModels.WarmRainStateType
WarmRainState{FT} <: AbstractMicrophysicalState{FT}

A simple microphysical state for warm-rain schemes with cloud liquid and rain.

Fields

  • qᶜˡ::Any: Specific cloud liquid water content [kg/kg]

  • qʳ::Any: Specific rain water content [kg/kg]

source
Breeze.AtmosphereModels.advecting_momentumMethod
advecting_momentum(
    model
) -> NamedTuple{(:ρu, :ρv, :ρw), <:Tuple{Any, Any, Any}}

Return the momentum tuple used for momentum advection transport and the continuity equation divergence.

For standard (non-terrain) models, this is model.momentum. For terrain-following coordinates, the vertical component ρw is replaced by the contravariant vertical momentum $\rho \tilde{w}$.

source
Breeze.AtmosphereModels.balance_adiabatically!Method
balance_adiabatically!(
    model::AtmosphereModel,
    balancer::AdiabaticBalancer
) -> AtmosphereModel

Run adiabatic (FV3 na_init) initialization on model in place: spin the nonhydrostatic state (ρw and the pressure balance) into balance with the analysis fields. balancer is an AdiabaticBalancer (or true for the defaults / false for a no-op). Builds a stripped, memory-sharing twin via adiabatic_balance_twin and runs the low-level balance_adiabatically!(model; Δt, cycles, weight) on it, so the balanced state lands directly in model — no graft, no second field set.

source
Breeze.AtmosphereModels.balance_adiabatically!Method
balance_adiabatically!(
    model::AtmosphereModel;
    Δt,
    cycles,
    weight
)

Spin up a balanced vertical momentum ρw (and the nonhydrostatic pressure balance) consistent with model's initial (analysis) state, via FV3 adiabatic initialization (na_init).

Analyses (ERA5, GFS, …) supply the density, momentum, and thermodynamic state but cold-start the vertical velocity w at zero (hydrostatic), so the nonhydrostatic state is out of balance with the rest. Each of cycles cycles entails two symmetric forward/backward dynamics excursions at the same Δt. After each excursion — which lets ρw develop — the initial fields (every prognostic except ρw) are nudged back toward their t = 0 snapshot by the weighted mean

x  (x + weight·x₀) / (1 + weight)

(default weight = 2 → ⅓ dynamics + ⅔ snapshot). ρw is never snapshotted or nudged, so the balance the excursion imprints on it is exactly what is kept. update_state! after each nudge rebuilds the diagnostics; the clock is reset to t = 0 on exit.

balance_adiabatically! performs adiabatic dynamics only. The caller must pass a model built without physics (microphysics = nothing), without an upper sponge, and without forcing — these run inside update_state!/time_step! and would corrupt the spin-up. Boundary conditions are not modified; pass a model whose boundaries are time-invariant so the symmetric excursion stays nearly reversible. The two-argument balance_adiabatically!(model, balancer) constructs such a model automatically.

source
Breeze.AtmosphereModels.buoyancy_forceᶜᶜᶜFunction
buoyancy_forceᶜᶜᶜ(i, j, k, grid, dynamics, temperature,
                  specific_prognostic_moisture, microphysics, microphysical_fields, constants)

Compute the buoyancy force density $ρ b$ at cell center (i, j, k).

This function is used in the vertical momentum equation to compute the gravitational forcing term.

source
Breeze.AtmosphereModels.compute_forcing!Method
compute_forcing!(forcing)

Compute any fields or quantities needed by a forcing before it is applied. This function is extended by the Forcings module for forcing types that require pre-computation (e.g., SubsidenceForcing which computes horizontal averages).

source
Breeze.AtmosphereModels.compute_microphysical_tendencies!Method
compute_microphysical_tendencies!(model) -> Any

Add microphysics tendency contributions to the model's Gⁿ fields.

This is the only entry point through which compute_tendencies! invokes microphysics. Concrete implementations add methods on the two-argument helper compute_microphysical_tendencies!(microphysics, model).

The default implementation launches a single fused kernel that builds the microphysical state and thermodynamic state 𝒰 once per cell, then +=s the result of microphysical_tendency for each prognostic name into the corresponding G field. Schemes whose tendencies factor naturally per-name only need to extend microphysical_tendency.

Schemes whose tendencies bundle many process rates feeding multiple prognostics (e.g. mixed-phase non-equilibrium 1M, where ~14 process rates feed 5 prognostic tendencies) override this method directly to compute the bundle once per cell.

source
Breeze.AtmosphereModels.default_temperature_solverMethod
default_temperature_solver(dynamics)

Return the default solver for a formulation's temperature inversion given dynamics.

The need for an iterative inversion is dictated by the intersection of the dynamics and the thermodynamic formulation: the fallback returns nothing (closed-form, no iteration), and dynamics whose prognostic closure makes the inversion implicit (e.g. CompressibleDynamics with LiquidIcePotentialTemperatureFormulation, where temperature solves T = (ρRᵐT/pˢᵗ)^κ θ + ΔL/cᵖᵐ) extend this function to return an iterative solver.

source
Breeze.AtmosphereModels.dynamics_densityFunction
dynamics_density(dynamics)

Return the coupling density — the density weighting the momentum (ρu = ρᵈ u) and the thermodynamic flux variable (ρθ = ρᵈ θ), and the divisor for diagnosing velocity (u = ρu/ρᵈ) and potential temperature (θ = ρθ/ρᵈ). It is the prognostic mass variable advanced by continuity.

  • AnelasticDynamics: the time-independent reference density ρᵣ.
  • CompressibleDynamics: the prognostic dry-air density ρᵈ.

The total air density ρ = ρᵈ + Σ ρˣ (dry air plus every water species) is a separate, diagnosed quantity — see total_density — used wherever total mass enters the physics: the moisture mass-fraction recovery (qˣ = ρˣ/ρ, so the thermodynamics stays in mass fractions), scalar and water advection, the equation of state, and buoyancy. The water densities (ρqᵛ, ρqˡ, …) are stored as partial densities (mass per volume), not coupling-weighted. On the anelastic core the two densities coincide (total_density === dynamics_density).

source
Breeze.AtmosphereModels.dynamics_pressureFunction
dynamics_pressure(dynamics)

Return the pressure field appropriate to the dynamical formulation, in Pa — the pressure entering the equation of state, buoyancy, and the thermodynamic tendencies.

For anelastic dynamics, this is the time-independent hydrostatic reference pressure $pᵣ(z)$. For compressible dynamics, this is the prognostic pressure field. The anomaly and total-pressure counterparts are pressure_anomaly and total_pressure.

source
Breeze.AtmosphereModels.grid_moisture_fractionsMethod
grid_moisture_fractions(
    i,
    j,
    k,
    grid,
    microphysics,
    ρ,
    qᵛ,
    μ_fields
) -> Breeze.Thermodynamics.MoistureMassFractions

Grid-indexed version of moisture_fractions.

This is the generic wrapper that:

  1. Extracts prognostic values from μ_fields via extract_microphysical_prognostics
  2. Builds the microphysical state via microphysical_state with 𝒰 = nothing
  3. Calls moisture_fractions

This works for non-equilibrium schemes where cloud condensate is prognostic. Non-equilibrium schemes don't need 𝒰 to build their state (they use prognostic fields).

Saturation adjustment schemes should override this to read from diagnostic fields.

source
Breeze.AtmosphereModels.initial_aerosol_numberMethod
initial_aerosol_number(microphysics) -> Any

Return the total initial aerosol number concentration [m⁻³] for a microphysics scheme.

This is used by initialize_model_microphysical_fields! and parcel model construction to set a physically meaningful default for the prognostic aerosol number density ρnᵃ. The value is derived from the aerosol size distribution stored in the microphysics scheme, so it stays consistent with the activation parameters.

Returns 0 by default; extensions override this for schemes with prognostic aerosol.

source
Breeze.AtmosphereModels.is_density_tendency_forcingMethod
is_density_tendency_forcing(_) -> Bool

Return true if forcing produces a density-weighted tendency F_{ρϕ} directly (i.e., already includes the multiplication by ρ).

Forcings that return density tendencies must be supplied under their density-weighted key (e.g., ρθ, ρu) rather than the corresponding specific key (θ, u), because the specific-key dispatch wraps user values in SpecificForcing, which would multiply by ρ a second time. This trait is used by atmosphere_model_forcing to reject such misuses with a clear error.

Defaults to false. Extended for SubsidenceForcing and GeostrophicForcing in the Forcings module.

source
Breeze.AtmosphereModels.materialize_atmosphere_model_boundary_conditionsFunction
materialize_atmosphere_model_boundary_conditions(boundary_conditions, grid, formulation,
                                                dynamics, microphysics, surface_pressure, thermodynamic_constants,
                                                microphysical_fields, specific_prognostic_moisture, temperature)

Regularize boundary conditions for an AtmosphereModel. This function is extended by the BoundaryConditions module to provide atmosphere-specific boundary condition handling.

If formulation is :LiquidIcePotentialTemperature and ρe boundary conditions are provided, they are automatically converted to ρθ boundary conditions by wrapping flux BCs in EnergyFluxBoundaryCondition, which divides by the local mixture heat capacity.

The dynamics argument provides access to the reference state for boundary conditions that require it, such as VirtualPotentialTemperature diagnostics.

The microphysics argument specifies the microphysics scheme used to compute moisture fractions for mixture heat capacity and virtual potential temperature calculations.

The microphysical_fields, specific_prognostic_moisture, and temperature arguments are pre-created fields used to construct the VirtualPotentialTemperature diagnostic for stability-dependent boundary conditions.

source
Breeze.AtmosphereModels.materialize_atmosphere_model_forcingFunction
materialize_atmosphere_model_forcing(forcing, field, name, model_field_names, context)

Materialize a forcing for an AtmosphereModel field. This function is extended by the Forcings module to handle atmosphere-specific forcing types like subsidence and geostrophic forcings.

The context argument provides additional information needed for materialization, such as grid, reference state, and thermodynamic constants.

source
Breeze.AtmosphereModels.materialize_surface_propertyMethod
materialize_surface_property(x, grid [, solar_position])

Convert a surface property (albedo, emissivity) to the form the radiative-transfer solver stores: a Number becomes a grid-eltype scalar and a Field passes through. Extend the three-argument form for property sources that must be resolved against the grid and the solar epoch (e.g. an observed-albedo dataset); it falls back to the two-argument form.

source
Breeze.AtmosphereModels.microphysical_stateMethod
microphysical_state(microphysics, ρ, μ, 𝒰, velocities)

Build an AbstractMicrophysicalState (ℳ) from density-weighted prognostic microphysical variables μ, density ρ, and thermodynamic state 𝒰.

This is the primary interface that microphysics schemes must implement. It converts density-weighted prognostics to the scheme-specific AbstractMicrophysicalState type.

For non-equilibrium schemes, cloud condensate comes from μ (prognostic fields). For saturation adjustment schemes, cloud condensate comes from 𝒰.moisture_mass_fractions, while precipitation (rain, snow) still comes from μ.

Arguments

  • microphysics: The microphysics scheme
  • ρ: Local density (scalar)
  • μ: NamedTuple of density-weighted prognostic variables (e.g., (ρqᶜˡ=..., ρqʳ=...))
  • 𝒰: Thermodynamic state
  • velocities: NamedTuple of velocity components (; u, v, w) [m/s].

Returns

An AbstractMicrophysicalState subtype containing the local specific microphysical variables.

See also microphysical_tendency, AbstractMicrophysicalState.

source
Breeze.AtmosphereModels.microphysical_tendencyMethod
microphysical_tendency(microphysics, name, ρ, ℳ, 𝒰, constants)

Compute the tendency for microphysical variable name from the microphysical state and thermodynamic state 𝒰.

This is the state-based tendency interface that operates on scalar states without grid indexing. It works identically for grid-based LES and parcel models.

Arguments

  • microphysics: The microphysics scheme
  • name: Variable name as Val(:name) (e.g., Val(:ρqᶜˡ))
  • ρ: Local density (scalar)
  • : Microphysical state (e.g., WarmPhaseOneMomentState)
  • 𝒰: Thermodynamic state
  • constants: Thermodynamic constants

Returns

The tendency value (scalar, units depend on variable).

See also microphysical_state, AbstractMicrophysicalState.

source
Breeze.AtmosphereModels.moisture_fractionsMethod
moisture_fractions(
    _::Nothing,
    ℳ,
    qᵛ
) -> Breeze.Thermodynamics.MoistureMassFractions

Compute MoistureMassFractions from a microphysical state and scheme-dependent specific moisture $qᵛᵉ$.

The input $qᵛᵉ$ is the scheme-dependent specific moisture: vapor for non-equilibrium schemes, or equilibrium moisture ($qᵉ = qᵛ + qᶜˡ$) for saturation adjustment schemes.

This is the state-based (gridless) interface for computing moisture fractions. Microphysics schemes should extend this method to partition moisture based on their prognostic variables.

The default implementation for Nothing microphysics assumes all moisture is vapor.

source
Breeze.AtmosphereModels.moisture_prognostic_nameMethod
moisture_prognostic_name(_::Nothing) -> Symbol

Return the prognostic moisture field name as a Symbol for the given microphysics scheme.

The physical meaning of the prognostic moisture field depends on the scheme:

  • Nothing / non-equilibrium: :ρqᵛ (true vapor density)
  • SaturationAdjustment: :ρqᵉ (equilibrium moisture density, diagnostically partitioned)
source
Breeze.AtmosphereModels.precipitation_rateFunction
precipitation_rate(model, phase=:liquid)

Return a KernelFunctionOperation representing the precipitation rate for the given phase.

The precipitation rate is the rate at which moisture is removed from the atmosphere by precipitation processes.

Arguments:

  • model: An AtmosphereModel with a microphysics scheme
  • phase: Either :liquid (rain) or :ice (snow). Default is :liquid.

Returns a Field or KernelFunctionOperation that can be computed and visualized. Specific microphysics schemes must extend this function.

source
Breeze.AtmosphereModels.set_to_mean!Method
set_to_mean!(ref::ExnerReferenceState, model)

Exner analogue of the ReferenceState method, for split-explicit CompressibleDynamics. Recompute the base exner_function/pressure/density by re-running the same discrete Exner column integration the constructor uses, with the horizontal-mean liquid-ice potential temperature and vapor mass fraction of the current model state. The recomputed reference is horizontally uniform (a single column). (Assumes a 1-D column reference, the form built from a constant or z-dependent θ₀.)

Unlike the anelastic ReferenceState method there is no rescale_densities option: the Exner reference is only the perturbation-form base state, not the prognostic density (ρᵈ), so changing it does not require rescaling the density-weighted prognostics.

source
Breeze.AtmosphereModels.set_to_mean!Method
set_to_mean!(reference_state, model; rescale_densities=false)

Recompute the reference pressure and density profiles from horizontally-averaged temperature and moisture mass fractions of the current model state.

When rescale_densities=true, density-weighted prognostic fields (ρe, ρqᵗ, ρu, etc.) are rescaled by ρᵣ_new / ρᵣ_old so that the specific quantities (e, qᵗ, u, etc.) are unchanged. When false (default), the density-weighted fields are left as-is and only diagnostics are recomputed.

source
Breeze.AtmosphereModels.specific_humidityMethod
specific_humidity(model) -> Any

Return the specific humidity (vapor mass fraction) field for the given model.

This always returns the actual vapor field $qᵛ$ from the microphysical fields, regardless of microphysics scheme.

source
Breeze.AtmosphereModels.specific_prognostic_moisture_from_totalMethod
specific_prognostic_moisture_from_total(
    _::Nothing,
    qᵗ,
    ℳ
) -> Any

Convert total specific moisture $qᵗ$ to the scheme-dependent specific moisture $qᵛᵉ$ by subtracting the appropriate condensate from the microphysical state $ℳ$.

For non-equilibrium schemes, $qᵛᵉ = qᵛ = qᵗ - qˡ$ (subtract all condensate). For saturation adjustment schemes, $qᵛᵉ = qᵉ = qᵗ - qʳ$ (subtract only precipitation). For Nothing microphysics, $qᵛᵉ = qᵗ$ (all moisture is vapor).

This is used by parcel models that store total moisture $qᵗ$ as the prognostic variable, to produce the correct input for moisture_fractions.

source
Breeze.AtmosphereModels.standard_ozone_profileMethod
standard_ozone_profile(z) -> Any

An idealized climatological ozone volume mixing ratio (mol/mol) as a function of height z (m): a weak tropospheric background increasing toward the tropopause, blended into a Gaussian stratospheric layer peaking near 25 km. Keeps the stratospheric column near radiative balance in deep-column simulations — without ozone the upper column is far from radiative equilibrium and destabilizes when the spectral fluxes recompute. Not a substitute for an observed or model ozone climatology.

source
Breeze.AtmosphereModels.static_energy_densityFunction
static_energy_density(model)

Return the static energy density field for the given model.

For LiquidIcePotentialTemperatureFormulation, returns a Field with boundary conditions that convert potential temperature fluxes to energy fluxes. This allows users to use BoundaryConditionOperation to extract energy flux values from the model.

For StaticEnergyFormulation, returns the prognostic energy density field directly.

source
Breeze.AtmosphereModels.surface_precipitation_fluxMethod
surface_precipitation_flux(model) -> Any

Return a 2D Field representing the flux of precipitating moisture at the bottom boundary.

The surface precipitation flux is $wʳ ρqʳ$ at the bottom face (k = 1), representing the rate at which rain mass leaves the domain through the bottom boundary.

Units: kg/m²/s (positive = downward flux out of domain)

Arguments:

Returns a 2D Field that can be computed and visualized. Specific microphysics schemes must extend this function.

source
Breeze.AtmosphereModels.thermodynamic_densityFunction
thermodynamic_density(formulation)

Return the thermodynamic density field for the given formulation — the prognostic thermodynamic variable in coupling-density-weighted ("flux") form (ρθ, ρe, ρE).

The weighting density is the dynamics' coupling density (see dynamics_density): the reference density ρᵣ on the anelastic core and the prognostic dry-air density ρᵈ on the compressible core. The generic name (ρθ) is therefore ρᵈθ on CompressibleDynamics; the intensive variable is recovered as θ = ρθ / dynamics_density(dynamics).

source
Breeze.AtmosphereModels.transport_velocitiesMethod
transport_velocities(
    model
) -> NamedTuple{(:u, :v, :w), <:Tuple{Any, Any, Any}}

Return the velocity tuple used for scalar advection transport.

For standard (non-terrain) models, this is model.velocities. For terrain-following coordinates, the vertical component is replaced by the contravariant vertical velocity $\tilde{w}$.

source
Breeze.AtmosphereModels.update_microphysical_auxiliaries!Function

Update auxiliary microphysical fields at grid point (i, j, k).

This is the single interface function for updating all auxiliary (non-prognostic) microphysical fields. Microphysics schemes should extend this function.

The function receives:

  • μ: NamedTuple of microphysical fields (mutated)
  • i, j, k: Grid indices (after μ since this is a mutating function)
  • microphysics: The microphysics scheme
  • : The microphysical state at this point
  • ρ: Local density
  • 𝒰: Thermodynamic state
  • constants: Thermodynamic constants

Why i, j, k is needed

Grid indices cannot be eliminated because:

  1. Fields must be written at specific grid points
  2. Some schemes need grid-dependent logic (e.g., k == 1 for bottom boundary conditions in sedimentation schemes)

What to implement

Schemes should write all auxiliary fields in one function. This includes:

  • Specific moisture fractions (qᶜˡ, , etc.) from the microphysical state
  • Derived quantities (qˡ = qᶜˡ + qʳ, qⁱ = qᶜⁱ + qˢ)
  • Vapor mass fraction qᵛ from the thermodynamic state
  • Terminal velocities for sedimentation

See WarmRainState implementation below for an example.

source

AtmosphereModels.Diagnostics

Breeze.AtmosphereModels.Diagnostics.DewpointTemperatureMethod
DewpointTemperature(
    model;
    solver
) -> KernelFunctionOperation{_A, _B, _C, _D, T, K, D} where {_A, _B, _C, _D, T, K<:Breeze.AtmosphereModels.Diagnostics.DewpointTemperatureKernelFunction, D<:Tuple}

Return a KernelFunctionOperation representing the dewpoint temperature $T⁺$.

The dewpoint temperature is the temperature at which the air would become saturated at its current vapor pressure. It is computed by solving the implicit equation:

\[pᵛ⁺(T⁺) = pᵛ\]

using secant iteration, where $pᵛ$ is the actual vapor pressure and $pᵛ⁺$ is the saturation vapor pressure.

For saturated air, the dewpoint temperature equals the actual temperature.

The solver keyword argument (default SecantSolver(reltol=1e-4, abstol=0, maxiter=10)) controls the secant iteration; its convergence criterion compares the vapor pressure residual against the actual vapor pressure $pᵛ$.

Example

using Breezegrid = RectilinearGrid(size=(1, 1, 8), extent=(1, 1, 1e3))model = AtmosphereModel(grid; microphysics=SaturationAdjustment())set!(model, θ=300, qᵗ=0.01)T⁺ = DewpointTemperature(model)# outputKernelFunctionOperation at (Center, Center, Center)├── grid: 1×1×8 RectilinearGrid{Float64, Periodic, Periodic, Bounded} on CPU with 1×1×3 halo├── kernel_function: DewpointTemperatureKernelFunction└── arguments: ()

The result may be wrapped in a Field to store the computed values:

T⁺_field = Field(T⁺)# output1×1×8 Field{Center, Center, Center} on RectilinearGrid on CPU├── grid: 1×1×8 RectilinearGrid{Float64, Periodic, Periodic, Bounded} on CPU with 1×1×3 halo├── boundary conditions: FieldBoundaryConditions│   └── west: Periodic, east: Periodic, south: Periodic, north: Periodic, bottom: ZeroFlux, top: ZeroFlux, immersed: Nothing├── operand: KernelFunctionOperation at (Center, Center, Center)├── status: time=0.0└── data: 3×3×14 OffsetArray(::Array{Float64, 3}, 0:2, 0:2, -2:11) with eltype Float64 with indices 0:2×0:2×-2:11    └── max=289.056, min=287.474, mean=288.266
source
Breeze.AtmosphereModels.Diagnostics.EquivalentPotentialTemperatureType
EquivalentPotentialTemperature(model, flavor=:specific)

Return a KernelFunctionOperation representing equivalent potential temperature $θᵉ$.

Equivalent potential temperature is conserved during moist adiabatic processes (including condensation and evaporation) and is useful for identifying air masses and tracking convective processes. Following Emanuel1994 equation 4.5.11:

\[θᵉ = T \left(\frac{p₀}{p}\right)^{Rᵈ/cᵖᵐ} \exp\left(\frac{ℒˡ qᵛ}{cᵖᵐ T}\right) ℋ^γ\]

where $ℒˡ$ is the latent heat of vaporization, $qᵛ$ is the vapor mass fraction, $ℋ$ is the relative humidity, and $γ = -Rᵛ qᵛ / cᵖᵐ$.

Arguments

  • model: An AtmosphereModel instance.
  • flavor: Either :specific (default) to return $θᵉ$, or :density to return $ρ θᵉ$.

Examples

using Breezegrid = RectilinearGrid(size=(1, 1, 8), extent=(1, 1, 1e3))model = AtmosphereModel(grid)set!(model, θ=300, qᵗ=0.01)θᵉ = EquivalentPotentialTemperature(model)Field(θᵉ)# output1×1×8 Field{Center, Center, Center} on RectilinearGrid on CPU├── grid: 1×1×8 RectilinearGrid{Float64, Periodic, Periodic, Bounded} on CPU with 1×1×3 halo├── boundary conditions: FieldBoundaryConditions│   └── west: Periodic, east: Periodic, south: Periodic, north: Periodic, bottom: ZeroFlux, top: ZeroFlux, immersed: Nothing├── operand: KernelFunctionOperation at (Center, Center, Center)├── status: time=0.0└── data: 3×3×14 OffsetArray(::Array{Float64, 3}, 0:2, 0:2, -2:11) with eltype Float64 with indices 0:2×0:2×-2:11    └── max=326.162, min=325.851, mean=326.006

References

  • Emanuel, K. A. (1994). Atmospheric Convection. Oxford University Press.
source
Breeze.AtmosphereModels.Diagnostics.LiquidIcePotentialTemperatureType
LiquidIcePotentialTemperature(model, flavor=:specific)

Return a KernelFunctionOperation representing liquid-ice potential temperature $θˡⁱ$.

Liquid-ice potential temperature is a conserved quantity under moist adiabatic processes that accounts for the latent heat associated with liquid water and ice:

\[θˡⁱ = θ \left(1 - \frac{ℒˡᵣ qˡ + ℒⁱᵣ qⁱ}{cᵖᵐ T}\right)\]

where $θ$ is the mixture potential temperature, $ℒˡᵣ$ and $ℒⁱᵣ$ are the reference latent heats for liquid and ice, and $qˡ$, $qⁱ$ are the liquid and ice mass fractions.

Arguments

  • model: An AtmosphereModel instance.
  • flavor: Either :specific (default) to return $θˡⁱ$, or :density to return $ρ θˡⁱ$.

Examples

using Breezegrid = RectilinearGrid(size=(1, 1, 8), extent=(1, 1, 1e3))model = AtmosphereModel(grid)set!(model, θ=300, qᵗ=0.01)θˡⁱ = LiquidIcePotentialTemperature(model)Field(θˡⁱ)# output1×1×8 Field{Center, Center, Center} on RectilinearGrid on CPU├── grid: 1×1×8 RectilinearGrid{Float64, Periodic, Periodic, Bounded} on CPU with 1×1×3 halo├── boundary conditions: FieldBoundaryConditions│   └── west: Periodic, east: Periodic, south: Periodic, north: Periodic, bottom: ZeroFlux, top: ZeroFlux, immersed: Nothing├── operand: KernelFunctionOperation at (Center, Center, Center)├── status: time=0.0└── data: 3×3×14 OffsetArray(::Array{Float64, 3}, 0:2, 0:2, -2:11) with eltype Float64 with indices 0:2×0:2×-2:11    └── max=300.0, min=300.0, mean=300.0
source
Breeze.AtmosphereModels.Diagnostics.PotentialTemperatureType
PotentialTemperature(model, flavor=:specific)

Return a KernelFunctionOperation representing the (mixture) potential temperature $θ$.

The potential temperature is defined as the temperature a parcel would have if adiabatically brought to a reference pressure $p₀$:

\[θ = \frac{T}{Π}\]

where $T$ is temperature and $Π = (p/p₀)^{Rᵐ/cᵖᵐ}$ is the mixture Exner function, computed using the moist air gas constant $Rᵐ$ and heat capacity $cᵖᵐ$.

Arguments

  • model: An AtmosphereModel instance.
  • flavor: Either :specific (default) to return $θ$, or :density to return $ρ θ$.

Examples

using Breezegrid = RectilinearGrid(size=(1, 1, 8), extent=(1, 1, 1e3))model = AtmosphereModel(grid)set!(model, θ=300, qᵗ=0.01)θ = PotentialTemperature(model)Field(θ)# output1×1×8 Field{Center, Center, Center} on RectilinearGrid on CPU├── grid: 1×1×8 RectilinearGrid{Float64, Periodic, Periodic, Bounded} on CPU with 1×1×3 halo├── boundary conditions: FieldBoundaryConditions│   └── west: Periodic, east: Periodic, south: Periodic, north: Periodic, bottom: ZeroFlux, top: ZeroFlux, immersed: Nothing├── operand: KernelFunctionOperation at (Center, Center, Center)├── status: time=0.0└── data: 3×3×14 OffsetArray(::Array{Float64, 3}, 0:2, 0:2, -2:11) with eltype Float64 with indices 0:2×0:2×-2:11    └── max=300.0, min=300.0, mean=300.0
source
Breeze.AtmosphereModels.Diagnostics.SaturationSpecificHumidityType
SaturationSpecificHumidity(
    model
) -> KernelFunctionOperation{_A, _B, _C, _D, T, K, D} where {_A, _B, _C, _D, T, K<:Breeze.AtmosphereModels.Diagnostics.SaturationSpecificHumidityKernelFunction, D<:Tuple}
SaturationSpecificHumidity(
    model,
    flavor_symbol
) -> KernelFunctionOperation{_A, _B, _C, _D, T, K, D} where {_A, _B, _C, _D, T, K<:Breeze.AtmosphereModels.Diagnostics.SaturationSpecificHumidityKernelFunction, D<:Tuple}

Return a KernelFunctionOperation representing the specified flavor of saturation specific humidity $qᵛ⁺$.

Flavor options

  • :prognostic

    Return the saturation specific humidity corresponding to the model's prognostic state. This is the same as the equilibrium saturation specific humidity for saturated conditions and a model that uses saturation adjustment microphysics.

  • :equilibrium

    Return the saturation specific humidity in potentially-saturated conditions, using the model's specific moisture field. This is equivalent to the :total_moisture flavor under saturated conditions with no condensate; or in other words, if the specific moisture happens to be equal to the saturation specific humidity.

  • :total_moisture

    Return saturation specific humidity in the case that the total specific moisture is equal to the saturation specific humidity and there is no condensate. This is useful for manufacturing perfectly saturated initial conditions.

source
Breeze.AtmosphereModels.Diagnostics.StabilityEquivalentPotentialTemperatureType
StabilityEquivalentPotentialTemperature(model, flavor=:specific)

Return a KernelFunctionOperation representing stability-equivalent potential temperature $θᵇ$.

Stability-equivalent potential temperature is a moist-conservative variable suitable for computing the moist Brunt-Väisälä frequency. It follows from the derivation in the paper by Durran and Klemp (1982), who show that the moist Brunt-Väisälä frequency $Nᵐ$ is correctly expressed in terms of the vertical gradient of a moist-conservative variable.

The formulation is based on equation (17) by Durran and Klemp (1982):

\[θᵇ = θᵉ \left( \frac{T}{Tᵣ} \right)^{cˡ qˡ / cᵖᵐ}\]

where $θᵉ$ is the equivalent potential temperature, $T$ is temperature, $Tᵣ$ is the energy reference temperature, $cˡ$ is the heat capacity of liquid water, $qᵗ$ is the total moisture specific humidity, and $cᵖᵐ$ is the moist air heat capacity.

This quantity is conserved along moist adiabats and is appropriate for use in stability calculations in saturated atmospheres.

Arguments

  • model: An AtmosphereModel instance.
  • flavor: Either :specific (default) to return $θᵇ$, or :density to return $ρ θᵇ$.

Examples

using Breezegrid = RectilinearGrid(size=(1, 1, 8), extent=(1, 1, 1e3))model = AtmosphereModel(grid)set!(model, θ=300, qᵗ=0.01)θᵇ = StabilityEquivalentPotentialTemperature(model)Field(θᵇ)# output1×1×8 Field{Center, Center, Center} on RectilinearGrid on CPU├── grid: 1×1×8 RectilinearGrid{Float64, Periodic, Periodic, Bounded} on CPU with 1×1×3 halo├── boundary conditions: FieldBoundaryConditions│   └── west: Periodic, east: Periodic, south: Periodic, north: Periodic, bottom: ZeroFlux, top: ZeroFlux, immersed: Nothing├── operand: KernelFunctionOperation at (Center, Center, Center)├── status: time=0.0└── data: 3×3×14 OffsetArray(::Array{Float64, 3}, 0:2, 0:2, -2:11) with eltype Float64 with indices 0:2×0:2×-2:11    └── max=326.162, min=325.851, mean=326.006

References

  • Durran, D. R. and Klemp, J. B. (1982). On the effects of moisture on the Brunt-Väisälä frequency. Journal of the Atmospheric Sciences 39, 2152–2158.
source
Breeze.AtmosphereModels.Diagnostics.StaticEnergyType
StaticEnergy(model, flavor=:specific)

Return a KernelFunctionOperation representing moist static energy $e$.

Moist static energy is a conserved quantity in adiabatic, frictionless flow that combines sensible heat, gravitational potential energy, and latent heat:

\[e = cᵖᵐ T + g z - ℒˡᵣ qˡ - ℒⁱᵣ qⁱ\]

where $cᵖᵐ$ is the moist air heat capacity, $T$ is temperature, $g$ is gravitational acceleration, $z$ is height, and $ℒˡᵣ qˡ + ℒⁱᵣ qⁱ$ is the latent heat content of condensate.

This is the prognostic thermodynamic variable used in StaticEnergyThermodynamics.

Arguments

  • model: An AtmosphereModel instance.
  • flavor: Either :specific (default) to return $e$, or :density to return $ρ e$.

Examples

using Breezegrid = RectilinearGrid(size=(1, 1, 8), extent=(1, 1, 1e3))model = AtmosphereModel(grid)set!(model, θ=300)e = StaticEnergy(model)Field(e)# output1×1×8 Field{Center, Center, Center} on RectilinearGrid on CPU├── grid: 1×1×8 RectilinearGrid{Float64, Periodic, Periodic, Bounded} on CPU with 1×1×3 halo├── boundary conditions: FieldBoundaryConditions│   └── west: Periodic, east: Periodic, south: Periodic, north: Periodic, bottom: ZeroFlux, top: ZeroFlux, immersed: Nothing├── operand: KernelFunctionOperation at (Center, Center, Center)├── status: time=0.0└── data: 3×3×14 OffsetArray(::Array{Float64, 3}, 0:2, 0:2, -2:11) with eltype Float64 with indices 0:2×0:2×-2:11    └── max=3.03019e5, min=302661.0, mean=3.0284e5
source
Breeze.AtmosphereModels.Diagnostics.VirtualPotentialTemperatureType
VirtualPotentialTemperature(model, flavor=:specific)

Return a KernelFunctionOperation representing virtual potential temperature $θᵛ$.

Virtual potential temperature is the temperature that dry air would need to have in order to have the same density as moist air at the same pressure. To define virtual potential temperature, we first note the definition of virtual temperature:

\[Tᵛ = T \left( 1 + δᵛ qᵛ - qˡ - qⁱ \right)\]

where $δᵛ ≡ Rᵛ / Rᵈ - 1$. This follows from the ideal gas law for a mixture, $p = ρ Rᵐ T$, the mixture gas constant $Rᵐ = qᵈ Rᵈ + qᵛ Rᵛ = Rᵈ \left( 1 + δᵛ qᵛ - qˡ - qⁱ \right)$, and the definition of virtual temperature, $p = ρ Rᵈ Tᵛ$, which leads to

\[Tᵛ = T \frac{Rᵐ}{Rᵈ} = T \left( 1 + δᵛ qᵛ - qˡ - qⁱ \right)\]

The virtual potential temperature is defined analogously,

\[θᵛ = T \left( \frac{pˢᵗ}{p} \right)^{Rᵈ/cᵖᵈ} \left( 1 + δᵛ qᵛ - qˡ - qⁱ \right) .\]

Note that $Rᵛ / Rᵈ ≈ 1.608$ for water vapor and a dry air mixture typical to Earth's atmosphere, and that $δᵛ ≈ 0.608$.

using Breezegrid = RectilinearGrid(size=(1, 1, 8), extent=(1, 1, 1e3))model = AtmosphereModel(grid)set!(model, θ=300, qᵗ=0.01)θᵛ = VirtualPotentialTemperature(model)Field(θᵛ)# output1×1×8 Field{Center, Center, Center} on RectilinearGrid on CPU├── grid: 1×1×8 RectilinearGrid{Float64, Periodic, Periodic, Bounded} on CPU with 1×1×3 halo├── boundary conditions: FieldBoundaryConditions│   └── west: Periodic, east: Periodic, south: Periodic, north: Periodic, bottom: ZeroFlux, top: ZeroFlux, immersed: Nothing├── operand: KernelFunctionOperation at (Center, Center, Center)├── status: time=0.0└── data: 3×3×14 OffsetArray(::Array{Float64, 3}, 0:2, 0:2, -2:11) with eltype Float64 with indices 0:2×0:2×-2:11    └── max=301.82, min=301.8, mean=301.81
source
Breeze.AtmosphereModels.Diagnostics.azimuthal_mean!Method
azimuthal_mean!(profile, field; center, m) -> Any

Remap field (on an $(x, y, z)$ grid) onto the radial rings of profile (on an $(r, z)$ grid) about center, in place, by area-weighted binning of m × m sub-cells per Cartesian cell. profile and field must share their vertical grid; the radial rings are profile's uniform x-cells.

source
Breeze.AtmosphereModels.Diagnostics.azimuthal_meanMethod
azimuthal_mean(field; radius, Nr, center, m)

Azimuthally average field into radial rings about center = (xc, yc), returning a Field on a one-dimensional-in-radius grid — Bounded in radius, Flat in azimuth, and Bounded in z — with Nr uniform rings spanning $[0, \texttt{radius}]$ and the same vertical grid as field.

Each Cartesian cell is split into an m × m block of sub-cells that are binned by radius, so a cell contributes to every ring it overlaps — uniform sub-sampling is area-weighting, which makes this a first-order conservative remap onto the radial rings (a pragmatic stand-in for a reduction on a true cylindrical grid). The kernel runs on the CPU and the GPU. Larger m resolves the rings more finely and keeps near-center rings populated; any ring that still catches nothing (only when $\texttt{radius}/N_r$ is finer than a sub-cell) is filled with NaN, not zero, so it reads as "no data" and doesn't bias a subsequent radial average.

using Oceananigans, Breezegrid = RectilinearGrid(size=(64, 64, 4), x=(-1, 1), y=(-1, 1), z=(0, 1),                       topology=(Periodic, Periodic, Bounded))c = CenterField(grid)set!(c, (x, y, z) -> 5)            # a constant field= azimuthal_mean(c; radius=1, Nr=8)maximum(c̄)                         # the azimuthal mean of a constant is that constant# output5.0
source

BoundaryConditions

Breeze.BoundaryConditions.BulkDragFunctionMethod
BulkDragFunction(; direction=nothing, coefficient=1e-3, gustiness=0,
                   surface_temperature=nothing, filtered_velocities=nothing)

Create a bulk drag function for computing surface momentum fluxes using bulk aerodynamic formulas. The momentum flux is computed in the same form as the scalar bulk fluxes,

\[Jᵘ = - ρ₀ Cᴰ |U| u\]

where Cᴰ is the drag coefficient, |U| = √(u² + v² + gustiness²) is the wind speed (with gustiness to prevent singularities at low wind), u is the velocity component at the first cell face, and ρ₀ is the surface density computed from the surface pressure and surface temperature. Monin–Obukhov similarity is a profile law for u (not ρu), so using u here keeps the formulation consistent with the similarity theory underlying Cᴰ.

When a FilteredSurfaceVelocities is supplied via filtered_velocities, every field entering the formula — the wind speed |U|, the velocity u, and the virtual potential temperature θᵥ used in stability — is read from the filtered state. The surface density ρ₀ is computed from the (slowly varying) surface temperature and pressure and is not filtered. Temporal filtering of the matching velocity is used to mitigate log-layer mismatch in wall-modeled large-eddy simulations, where the spurious correlation between the instantaneous friction velocity and matching-velocity fluctuations otherwise biases the surface stress (Nishizawa & Kitamura (2018); Shin, Yang & Howland (2025)).

Monin–Obukhov consistency

ρ₀ is computed from surface quantities (surface_pressure and surface_temperature) via the ideal gas law, so it is a true surface density — independent of the vertical grid resolution. Using the prognostic density at the first cell would introduce a grid-dependent ρ₀ (the first-cell height ½Δz shifts the value as the grid is refined), which is inconsistent with the bulk-flux closure derived from Monin–Obukhov similarity.

Default surface temperature

If the user does not supply surface_temperature, materialization calls default_drag_surface_temperature(dynamics, …). The default exists for AnelasticDynamics (recovered from the reference state via Exner) but raises for CompressibleDynamics, which has no equivalent reference profile — pass surface_temperature explicitly in that case.

Keyword Arguments

  • direction: The direction of the momentum component (XDirection() or YDirection()). If nothing, the direction is inferred from the field location during boundary condition regularization.
  • coefficient: The drag coefficient (default: 1e-3). Can be a constant or a PolynomialCoefficient for wind and stability-dependent transfer coefficients.
  • gustiness: Minimum wind speed to prevent singularities when winds are calm (default: 0)
  • surface_temperature: Surface temperature, used to compute ρ₀ and required when using PolynomialCoefficient with stability correction. Can be a Field, Function, or Number. (default: nothing)
  • filtered_velocities: A FilteredSurfaceVelocities for temporally filtered wind speed, near-surface velocity, and θᵥ in the bulk formula. If nothing (default), instantaneous fields are used.
source
Breeze.BoundaryConditions.BulkSensibleHeatFluxFunctionMethod
BulkSensibleHeatFluxFunction(
;
    coefficient,
    gustiness,
    surface_temperature,
    filtered_velocities
)

A bulk sensible heat flux function. The flux is computed as:

\[J = - ρ₀ Cᵀ |U| Δϕ\]

where $Cᵀ$ is the transfer coefficient, $|U|$ is the wind speed, and $Δϕ$ is the difference between the near-surface atmospheric value and the surface value of the thermodynamic variable appropriate to the formulation:

  • For LiquidIcePotentialTemperatureFormulation: $Δϕ = θ - θ₀$, where $θ₀ = T₀ / Π₀$ and $Π₀ = (p₀ / pˢᵗ)^{Rᵈ / cᵖᵈ}$ (potential temperature flux)
  • For StaticEnergyFormulation: $Δϕ = e - cᵖᵈ T₀$ (static energy flux)

Here $p₀$ is the actual surface pressure, while $pˢᵗ$ is the fixed reference pressure used to define potential temperature.

The formulation is set automatically during model construction based on the thermodynamic formulation.

Keyword Arguments

  • coefficient: The sensible heat transfer coefficient.
  • gustiness: Minimum wind speed to prevent singularities (default: 0).
  • surface_temperature: The surface temperature. Can be a Field, a Function, or a Number. Functions are converted to Fields during model construction.
  • filtered_velocities: Either nothing (default) or FilteredSurfaceVelocities. Note that when filtered_velocities is not nothing, then automatically there is filtering in the scalar fields via FilteredSurfaceScalar with the same parameters (e.g., height, timescale) as filtered_velocities.
source
Breeze.BoundaryConditions.BulkVaporFluxFunctionMethod
BulkVaporFluxFunction(; coefficient, gustiness=0, surface_temperature, filtered_velocities=nothing)

Create a bulk vapor flux function for computing surface moisture fluxes. The flux is computed as:

\[Jᵛ = - ρ₀ Cᵛ |U| (qᵗ - qᵛ₀)\]

where $Cᵛ$ is the transfer coefficient, $|U|$ is the wind speed, $qᵗ$ is the atmospheric specific humidity, and $qᵛ₀$ is the saturation specific humidity at the surface.

Keyword Arguments

  • coefficient: The vapor transfer coefficient.
  • gustiness: Minimum wind speed to prevent singularities (default: 0).
  • surface_temperature: The surface temperature. Can be a Field, a Function, or a Number. Used to compute saturation specific humidity at the surface.
  • filtered_velocities: Either nothing (default) or FilteredSurfaceVelocities. Note that when filtered_velocities is not nothing, then automatically there is filtering in the scalar fields via FilteredSurfaceScalar with the same parameters (e.g., height, timescale) as filtered_velocities.
source
Breeze.BoundaryConditions.EnergyFluxBoundaryConditionFunctionType
EnergyFluxBoundaryConditionFunction

A wrapper for boundary conditions that converts energy flux to potential temperature flux.

When using LiquidIcePotentialTemperatureFormulation, the prognostic thermodynamic variable is $ρθ$ (potential temperature density). This wrapper allows users to specify energy fluxes (e.g., sensible heat flux in W/m²) which are converted to potential temperature fluxes by dividing by the local mixture heat capacity $cᵖᵐ$.

The relationship is:

\[Jᶿ = 𝒬 / cᵖᵐ\]

where $𝒬$ is the energy flux and $Jᶿ$ is the potential temperature flux.

The mixture heat capacity is computed using moisture fractions from the microphysics scheme, which correctly accounts for liquid and ice condensate when present.

source
Breeze.BoundaryConditions.FilteredSurfaceScalarMethod
FilteredSurfaceScalar(grid; height=nothing, filter_timescale=Inf)

A two-dimensional field storing a temporally filtered near-surface scalar for use in bulk flux boundary conditions.

The filter update is the same exponential form as FilteredSurfaceVelocities.

Keyword Arguments

  • height: Reference height (m) for scalar evaluation. If nothing, the first grid cell center value is used.
  • filter_timescale: Filter time scale τ in seconds (default: Inf).
source
Breeze.BoundaryConditions.FilteredSurfaceVelocitiesMethod
FilteredSurfaceVelocities(grid; height=nothing, filter_timescale=Inf)

Two-dimensional fields storing temporally filtered near-surface velocities and virtual potential temperature for use in bulk flux boundary conditions. Filtering the matching velocity mitigates log-layer mismatch in wall-modeled large-eddy simulations by removing the spurious correlation between the instantaneous friction velocity and matching-velocity fluctuations (Nishizawa & Kitamura (2018); Shin, Yang & Howland (2025)).

The filtered velocities ū, (and θ̄ᵥ when a stability-dependent bulk coefficient is attached) are updated each time step via an exponential (first-order) filter:

ū + ϵ u_new) / (1 + ϵ),     ϵ = Δt / τ

where τ is the filter_timescale.

θ̄ᵥ is updated from the virtual-potential-temperature diagnostic owned by any attached PolynomialCoefficient; when the bulk coefficient is a plain Number (no stability correction) the θ̄ᵥ field is allocated but unused.

Keyword Arguments

  • height: Reference height (m) for velocity evaluation. If nothing (default), the first grid cell center value is used. If a number, velocity is linearly interpolated to that height. (θ̄ᵥ is always read at the first cell center, matching the height at which bulk_coefficient evaluates stability.)
  • filter_timescale: Filter time scale τ in seconds (default: Inf, no filtering).
source
Breeze.BoundaryConditions.FittedStabilityFunctionMethod
FittedStabilityFunction(scalar_roughness_length;
                        richardson_number_mapping = RichardsonNumberMapping(typeof(scalar_roughness_length)),
                        stability_function_parameters = StabilityFunctionParameters(typeof(scalar_roughness_length)))

Stability correction based on Monin-Obukhov similarity theory using the Li et al. (2010) analytical mapping from bulk Richardson number to the stability parameter $ζ = z/L$.

Uses Hogström (1996) integrated stability functions for unstable conditions and Beljaars & Holtslag (1991) for stable conditions.

Applies structurally correct (and different) corrections for momentum vs scalar transfer:

  • Momentum: $Cᴰ = Cᴰ_N [α / (α - Ψᴰ)]²$
  • Scalar: $Cᵀ = Cᵀ_N [α / (α - Ψᴰ)] [β_h / (β_h - Ψᵀ)]$

where $α = \ln(z/ℓ)$, $β_h = \ln(z/ℓ_h)$.

FittedStabilityFunction is callable: sf(Riᴮ, α, β) returns the momentum stability correction factor, and sf(Riᴮ, α, β, Val(:scalar)) returns the scalar correction factor.

Arguments

  • scalar_roughness_length: Roughness length for heat/moisture $ℓ_h$ (m).

Keyword Arguments

References

  • Beljaars, A. C. M., & Holtslag, A. A. M. (1991). Flux parameterization over land surfaces for atmospheric models. Journal of Applied Meteorology, 30, 327-341.
  • Hogström, U. L. F. (1996). Review of some basic characteristics of the atmospheric surface layer. Boundary-Layer Meteorology, 78, 215-246.
  • Li, Y., Gao, Z., Lenschow, D. H., & Chen, F. (2010). An improved approach for parameterizing surface-layer turbulent transfer coefficients in numerical models. Boundary-Layer Meteorology, 137, 153-165.
source
Breeze.BoundaryConditions.PolynomialCoefficientType
PolynomialCoefficient(
;
    ...
) -> PolynomialCoefficient{_A, Nothing, SF, PlanarLiquidSurface, Nothing, Nothing, Nothing, Nothing} where {_A, SF<:(FittedStabilityFunction{_A, RM, SP} where {_A, RM<:Breeze.BoundaryConditions.RichardsonNumberMapping, SP<:Breeze.BoundaryConditions.StabilityFunctionParameters})}
PolynomialCoefficient(
    FT;
    polynomial,
    roughness_length,
    minimum_wind_speed,
    stability_function,
    surface,
    transfer_type
) -> PolynomialCoefficient{_A, Nothing, SF, PlanarLiquidSurface, Nothing, Nothing, Nothing, Nothing} where {_A, SF<:(FittedStabilityFunction{_A, RM, SP} where {_A, RM<:Breeze.BoundaryConditions.RichardsonNumberMapping, SP<:Breeze.BoundaryConditions.StabilityFunctionParameters})}

A bulk transfer coefficient that depends on wind speed and atmospheric stability, following Large and Yeager (2009).

The neutral transfer coefficient at 10 m follows the Large and Yeager (2009) form:

\[C^N_{10}(U_h) = (a_0 + a_1 U_h + a_2 / U_h) × 10^{-3}\]

where $U_h$ is the wind speed at measurement height $h$.

The coefficient is adjusted for measurement height using logarithmic profile theory, and stability correction is applied based on the bulk Richardson number.

When polynomial is nothing, the appropriate Large and Yeager (2009) polynomial will be automatically selected based on the boundary condition type:

  • BulkDrag: default_neutral_drag_polynomial = (0.142, 0.076, 2.7) for momentum
  • BulkSensibleHeatFlux: default_neutral_sensible_heat_polynomial = (0.128, 0.068, 2.43) for sensible heat
  • BulkVaporFlux: default_neutral_latent_heat_polynomial = (0.120, 0.070, 2.55) for latent heat

Keyword Arguments

  • polynomial: Tuple (a₀, a₁, a₂) for the polynomial. If nothing, the polynomial is automatically selected by the boundary condition constructor.
  • roughness_length: Surface roughness in meters (default: 1.5e-4, typical for ocean)
  • minimum_wind_speed: Minimum wind speed to avoid singularity in a₂/U term (default: 0.1 m/s)
  • stability_function: Stability correction strategy. Default is FittedStabilityFunction using Li et al. (2010) $Riᴮ → ζ$ mapping with Hogström (1996) / Beljaars & Holtslag (1991) MOST stability functions. The scalar roughness length defaults to roughness_length / 7.3 (typical ocean value). Use nothing to disable stability correction.
  • surface: Surface type for computing saturation specific humidity in the stability correction. Default is PlanarLiquidSurface(). Use PlanarIceSurface() for ice surfaces.

The measurement height is automatically determined from the grid as the height of the first cell center above the surface.

Examples

using Breeze.BoundaryConditions: PolynomialCoefficient# Polynomial coefficient with default settingscoef = PolynomialCoefficient()# outputPolynomialCoefficient{Float64}├── polynomial: nothing├── roughness_length: 0.00015 m├── minimum_wind_speed: 0.1 m/s├── surface: PlanarLiquidSurface└── stability_function: FittedStabilityFunction (Li et al. 2010)
using Breeze.BoundaryConditions: PolynomialCoefficient# With explicit polynomialcoef = PolynomialCoefficient(polynomial = (0.142, 0.076, 2.7))# outputPolynomialCoefficient{Float64}├── polynomial: (0.142, 0.076, 2.7)├── roughness_length: 0.00015 m├── minimum_wind_speed: 0.1 m/s├── surface: PlanarLiquidSurface└── stability_function: FittedStabilityFunction (Li et al. 2010)
using Breeze.BoundaryConditions: PolynomialCoefficient# No stability correctioncoef = PolynomialCoefficient(stability_function = nothing)# outputPolynomialCoefficient{Float64}├── polynomial: nothing├── roughness_length: 0.00015 m├── minimum_wind_speed: 0.1 m/s├── surface: PlanarLiquidSurface└── stability_function: Nothing

References

  • Beljaars, A. C. M., & Holtslag, A. A. M. (1991). Flux parameterization over land surfaces for atmospheric models. Journal of Applied Meteorology, 30, 327-341.
  • Hogström, U. L. F. (1996). Review of some basic characteristics of the atmospheric surface layer. Boundary-Layer Meteorology, 78, 215-246.
  • Large, W., & Yeager, S. G. (2009). The global climatology of an interannually varying air–sea flux data set. Climate dynamics, 33(2), 341-364.
  • Li, Y., Gao, Z., Lenschow, D. H., & Chen, F. (2010). An improved approach for parameterizing surface-layer turbulent transfer coefficients in numerical models. Boundary-Layer Meteorology, 137, 153-165.
source
Breeze.BoundaryConditions.RichardsonNumberMappingType
RichardsonNumberMapping(FT = Oceananigans.defaults.FloatType;
                        stable_unstable_transition = 0,
                        strongly_stable_transition = 0.2,
                        aᵘ₁₁ =  0.0450, bᵘ₁₁ =  0.0030, bᵘ₁₂ =  0.0059,
                        aᵘ₂₁ = -0.0828, aᵘ₂₂ =  0.8845,
                        bᵘ₃₁ =  0.1739, bᵘ₃₂ = -0.9213, bᵘ₃₃ = -0.1057,
                        aʷ₁₁ =  0.5738, aʷ₁₂ = -0.4399,
                        aʷ₂₁ = -4.901,  aʷ₂₂ = 52.50,
                        bʷ₁₁ = -0.0539, bʷ₁₂ =  1.540,
                        bʷ₂₁ = -0.6690, bʷ₂₂ = -3.282,
                        aˢ₁₁ =  0.7529, aˢ₂₁ = 14.94,
                        bˢ₁₁ =  0.1569, bˢ₂₁ = -0.3091, bˢ₂₂ = -1.303)

Regression coefficients for the non-iterative mapping from bulk Richardson number $Riᴮ$ to the Monin-Obukhov stability parameter $ζ = z/L$, following Li et al. (2010).

The superscripts u, w, s denote unstable, weakly stable, and strongly stable regimes respectively. Subscript indices follow the original paper.

Three regimes:

  • Unstable ($Riᴮ <$ stable_unstable_transition): Eq. (12)
  • Weakly stable (stable_unstable_transition $≤ Riᴮ ≤$ strongly_stable_transition): Eq. (14)
  • Strongly stable ($Riᴮ >$ strongly_stable_transition): Eq. (16)

References

  • Li, Y., Gao, Z., Lenschow, D. H., & Chen, F. (2010). An improved approach for parameterizing surface-layer turbulent transfer coefficients in numerical models. Boundary-Layer Meteorology, 137, 153-165.
source
Breeze.BoundaryConditions.StabilityFunctionParametersType
StabilityFunctionParameters(FT = Oceananigans.defaults.FloatType;
                            γᴰ = 19.3,
                            γᵀ = 11.6,
                            a = 1,
                            b = 2/3,
                            c = 5,
                            d = 0.35)

Parameters for the integrated Monin-Obukhov stability functions $Ψ^D(ζ)$ and $Ψ^T(ζ)$.

Note: we use superscript D (drag/momentum) and T (temperature/scalar) to match the transfer coefficient notation $Cᴰ$, $Cᵀ$ established in notation.md. In the literature these are commonly written $Ψ_m$ and $Ψ_h$.

For unstable conditions ($ζ < 0$), uses Hogström (1996):

  • $φ^D = (1 - γ^D ζ)^{-1/4}$
  • $φ^T = 0.95(1 - γ^T ζ)^{-1/2}$

For stable conditions ($ζ ≥ 0$), uses Beljaars & Holtslag (1991):

  • $Ψ^D = -[a ζ + b (ζ - c/d) e^{-dζ} + bc/d]$
  • $Ψ^T = -[(1 + 2aζ/3)^{3/2} + b (ζ - c/d) e^{-dζ} + bc/d - 1]$

References

  • Beljaars, A. C. M., & Holtslag, A. A. M. (1991). Flux parameterization over land surfaces for atmospheric models. Journal of Applied Meteorology, 30, 327-341.
  • Hogström, U. L. F. (1996). Review of some basic characteristics of the atmospheric surface layer. Boundary-Layer Meteorology, 78, 215-246.
source
Breeze.BoundaryConditions.ThetaFluxBoundaryConditionFunctionType
ThetaFluxBoundaryConditionFunction

A wrapper for boundary conditions that converts potential temperature flux to energy flux.

When building a diagnostic energy_density field from a PotentialTemperatureFormulation, the boundary conditions on ρθ (potential temperature density) must be converted to energy flux boundary conditions by multiplying by the local mixture heat capacity $cᵖᵐ$.

The relationship is:

\[𝒬 = Jᶿ cᵖᵐ\]

where $𝒬$ is the energy flux and $Jᶿ$ is the potential temperature flux.

source
Breeze.BoundaryConditions.BulkDragMethod
BulkDrag(; direction=nothing, coefficient=1e-3, gustiness=0, surface_temperature=nothing)

Create a FluxBoundaryCondition for surface momentum drag.

See BulkDragFunction for details.

Examples

using Breezedrag = BulkDrag(coefficient=1e-3, gustiness=0.1)# outputFluxBoundaryCondition: BulkDragFunction(direction=Nothing, coefficient=0.001, gustiness=0.1)

Or with explicit direction, e.g., XDirection() for u:

using Oceananigans.Grids: XDirectionu_drag = BulkDrag(direction=XDirection(), coefficient=1e-3)ρu_bcs = FieldBoundaryConditions(bottom=u_drag)# outputOceananigans.FieldBoundaryConditions, with boundary conditions├── west: DefaultBoundaryCondition (FluxBoundaryCondition: Nothing)├── east: DefaultBoundaryCondition (FluxBoundaryCondition: Nothing)├── south: DefaultBoundaryCondition (FluxBoundaryCondition: Nothing)├── north: DefaultBoundaryCondition (FluxBoundaryCondition: Nothing)├── bottom: FluxBoundaryCondition: BulkDragFunction(direction=XDirection(), coefficient=0.001, gustiness=0)├── top: DefaultBoundaryCondition (FluxBoundaryCondition: Nothing)└── immersed: DefaultBoundaryCondition (FluxBoundaryCondition: Nothing)

and similarly for YDirection for v.

source
Breeze.BoundaryConditions.BulkSensibleHeatFluxMethod
BulkSensibleHeatFlux(; coefficient, gustiness=0, surface_temperature)

Create a FluxBoundaryCondition for surface sensible heat flux.

The bulk formula computes

\[J = -ρ₀ Cᵀ |U| Δϕ\]

where $Δϕ$ depends on the thermodynamic formulation: $Δθ$ for potential temperature or $Δe$ for static energy. The formulation is set automatically during model construction.

See BulkSensibleHeatFluxFunction for details.

Example

using BreezeT₀(x, y) = 290 + 2 * sign(cos(2π * x / 20e3))ρe_bc = BulkSensibleHeatFlux(coefficient = 1e-3,                             gustiness = 0.1,                             surface_temperature = T₀)# outputFluxBoundaryCondition: BulkSensibleHeatFluxFunction(coefficient=0.001, gustiness=0.1)
source
Breeze.BoundaryConditions.BulkVaporFluxMethod
BulkVaporFlux(; coefficient, surface_temperature, gustiness=0)

Create a FluxBoundaryCondition for surface moisture flux.

The saturation specific humidity at the surface is automatically computed from surface_temperature.

See BulkVaporFluxFunction for details.

Example

using BreezeT₀(x, y) = 290 + 2 * sign(cos(2π * x / 20e3))moisture_bc = BulkVaporFlux(coefficient = 1e-3,                            gustiness = 0.1,                            surface_temperature = T₀)# outputFluxBoundaryCondition: BulkVaporFluxFunction(coefficient=0.001, gustiness=0.1)
source
Breeze.BoundaryConditions.EnergyFluxBoundaryConditionMethod
EnergyFluxBoundaryCondition(flux)

Create a boundary condition that wraps an energy flux and converts it to a potential temperature flux for use with LiquidIcePotentialTemperatureFormulation.

The energy flux is divided by the local mixture heat capacity $cᵖᵐ$ to obtain the potential temperature flux: $Jᶿ = 𝒬 / cᵖᵐ$.

source
Breeze.BoundaryConditions.ThetaFluxBoundaryConditionMethod
ThetaFluxBoundaryCondition(flux)

Create a boundary condition that wraps a potential temperature flux and converts it to an energy flux for use with diagnostic energy density fields.

The potential temperature flux is multiplied by the local mixture heat capacity $cᵖᵐ$ to obtain the energy flux: $𝒬 = Jᶿ cᵖᵐ$.

source

CelestialMechanics

Breeze.CelestialMechanics.cos_solar_zenith_angleMethod
cos_solar_zenith_angle(
    i,
    j,
    grid::RectilinearGrid{<:Any, <:Flat, <:Flat, <:Bounded},
    datetime::Dates.DateTime
) -> Any

Compute the cosine of the solar zenith angle for the grid's location.

For single-column grids with Flat horizontal topology, extracts latitude from the y-coordinate and longitude from the x-coordinate.

source
Breeze.CelestialMechanics.cos_solar_zenith_angleMethod
cos_solar_zenith_angle(
    datetime::Dates.DateTime,
    longitude,
    latitude
) -> Any

Compute the cosine of the solar zenith angle for a given datetime and location.

The solar zenith angle $θ_z$ satisfies:

\[\cos(θ_z) = \sin(φ) \sin(δ) + \cos(φ) \cos(δ) \cos(ω)\]

where:

  • $φ$ is the latitude
  • $δ$ is the solar declination
  • $ω$ is the hour angle

Arguments

  • datetime: UTC datetime
  • latitude: latitude in degrees (positive North)
  • longitude: longitude in degrees (positive East)

Returns

A value between -1 and 1. Negative values indicate the sun is below the horizon.

source
Breeze.CelestialMechanics.equation_of_timeMethod
equation_of_time(day_of_year) -> Any

Compute the equation of time (in minutes) for a given day of year.

This accounts for the difference between mean solar time and apparent solar time due to the eccentricity of Earth's orbit and the obliquity of the ecliptic.

Uses the approximation by Spencer (1971); see solar_declination.

References

  • Spencer, J. W. (1971) Fourier series representation of the position of the sun. Search, 2, 162-172.
source
Breeze.CelestialMechanics.hour_angleMethod
hour_angle(datetime::Dates.DateTime, longitude) -> Any

Compute the hour angle (in radians) for a given datetime and longitude.

The hour angle $ω$ is zero at solar noon and increases by 15° per hour (Earth rotates 360°/24h = 15°/h).

Arguments

  • datetime: UTC datetime
  • longitude: longitude in degrees (positive East)
source
Breeze.CelestialMechanics.solar_declinationMethod
solar_declination(day_of_year) -> Any

Compute the solar declination angle (in radians) for a given day of year.

Uses the approximation by Spencer (1971):

\[δ = 0.006918 - 0.399912 \cos(γ) + 0.070257 \sin(γ) - 0.006758 \cos(2γ) + 0.000907 \sin(2γ) - 0.002697 \cos(3γ) + 0.00148 \sin(3γ)\]

where $γ = 2π (d - 1) / 365$ is the fractional year in radians and $d$ is the day of year.

References

  • Spencer, J. W. (1971) Fourier series representation of the position of the sun. Search, 2, 162-172.
source

CompressibleEquations

Breeze.CompressibleEquationsModule
CompressibleEquations

Module implementing fully compressible dynamics for atmosphere models.

The compressible formulation directly time-steps density as a prognostic variable and computes pressure from the ideal gas law. This formulation does not filter acoustic waves, so explicit time-stepping with small time steps (or acoustic substepping) is required.

The fully compressible Euler equations in conservation form are:

\[\begin{aligned} &\text{Mass:} && \partial_t \rho + \boldsymbol{\nabla \cdot} (\rho \boldsymbol{u}) = 0 \\ &\text{Momentum:} && \partial_t (\rho \boldsymbol{u}) + \boldsymbol{\nabla \cdot} (\rho \boldsymbol{u} \boldsymbol{u}) + \boldsymbol{\nabla} p = -\rho g \hat{\boldsymbol{z}} + \rho \boldsymbol{f} + \boldsymbol{\nabla \cdot \mathcal{T}} \end{aligned}\]

Pressure is computed from the ideal gas law:

\[p = \rho R^m T\]

where $R^m$ is the mixture gas constant.

source
Breeze.CompressibleEquations.AbstractRampType

Abstract supertype for upper-sponge ramp shapes. A concrete AbstractRamp is callable as (ramp)(z, sponge_top, depth) and returns a value in $[0, 1]$: zero below $z_{\rm sponge\_top} - \text{depth}$, rising to one at the lid $z = z_{\rm sponge\_top}$.

source
Breeze.CompressibleEquations.AcousticOuterSchemeType
abstract type AcousticOuterScheme

Abstract supertype for the outer Runge–Kutta scheme that drives the acoustic substep loop. The current implementation supports a single concrete subtype:

The interface exists to make the outer-scheme commitment explicit in the type system and to provide a clean extension point for a future Multirate Infinitesimal Step (MIS) outer scheme. A concrete subtype is expected to provide a stage_fractions method returning its stage-fraction tuple.

source
Breeze.CompressibleEquations.AcousticSubstepDistributionType
abstract type AcousticSubstepDistribution

Abstract supertype for the choice of how acoustic substeps are distributed across the three Wicker–Skamarock RK3 stages.

Concrete subtypes:

  • ProportionalSubsteps — each stage independently covers its own interval $β Δt$ with $Nτ = ⌈β N⌉$ substeps of size $Δτ = β Δt / Nτ$ (count proportional to the stage fraction; size fitted so the substeps exactly tile $β Δt$). This is the default.

  • ConstantSubstepSize — every stage uses the same substep size $Δτ = Δt/N$ ($N$ rounded up to a multiple of 6 so $β N$ is integral), with stage-dependent counts $Nτ = β N$.

  • MonolithicFirstStage — stage 1 collapses to a single substep of size $Δt/3$; stages 2 and 3 are the same as ConstantSubstepSize.

source
Breeze.CompressibleEquations.AcousticSubstepperType
struct AcousticSubstepper{N, FT, D, AD, US, CF, MP, TAV, GT, TS}

Storage and parameters for the split-explicit acoustic substepper (scheme described in the module header). Πᴸ=(pᴸ/pˢᵗ)^κ, θᴸ=ρθᴸ/ρᴸ, γᵐRᵐᴸ are cached once per stage (recomputing inline per call is much slower on H100); ρᴸ, ρθᴸ, pᴸ and the stage-entry momenta are read live from model.dynamics.* / model.momentum.* (untouched by the loop) and are the recovery base for _recover_full_state! — no snapshot fields. The vertical solve is a (possibly off-centered) Crank-Nicolson tridiagonal Schur system for (ρw)′.

Fields:

  • substeps: acoustic substeps N per Δt (nothing ⇒ adaptive via acoustic_cfl).
  • acoustic_cfl: target horizontal acoustic Courant number for the adaptive count (default 0.5).
  • forward_weight: CN off-centering ω (0.5 = centered; default 0.65).
  • damping, substep_distribution: divergence-damping strategy; substep allocation across WS-RK3 stages.
  • linearization_exner (Πᴸ), linearization_potential_temperature (θᴸ), linearization_gamma_R_mixture (γᵐRᵐᴸ, the moist PGF coefficient): per-stage caches.
  • density_perturbation (ρ′), density_potential_temperature_perturbation ((ρθ)′), momentum_perturbation ((ρu/v/w)′ as .u/.v/.w): perturbation prognostics advanced in the loop.
  • density_predictor, density_potential_temperature_predictor: explicit predictors before the vertical solve.
  • previous_density_potential_temperature_perturbation: prior-substep (ρθ)′, for Klemp 2018 damping.
  • time_averaged_velocities: acoustic-mean velocity for non-acoustic scalar transport (moisture/tracers/ chemistry/TKE); the slow ρθ tendency uses the current RK predictor velocity instead, not this cache.
  • slow_vertical_momentum_tendency (Gˢρw, z-faces): advection+Coriolis+closure+forcing (PGF/buoyancy excluded — those are in the fast operator).
  • vertical_solver: BatchedTridiagonalSolver for the implicit (ρw)′ update.
source
Breeze.CompressibleEquations.AcousticSubstepperMethod
AcousticSubstepper(
    grid,
    split_explicit::SplitExplicitTimeDiscretization;
    prognostic_momentum,
    substep_floattype
) -> AcousticSubstepper{_A, _B, _C, AD, _D, CF, MP, TAV, GT, TS} where {_A, _B, _C, AD<:AcousticSubstepDistribution, _D, CF<:(Field{Center, Center, Center, Nothing, G, I, D, T, B, Nothing} where {G, I, D, T, B}), MP<:(NamedTuple{(:u, :v, :w), <:Tuple{Field{Face, Center, Center, Nothing, G, I, D, T, B, Nothing} where {G, I, D, T, B}, Field{Center, Face, Center, Nothing, G, I, D, T, B, Nothing} where {G, I, D, T, B}, Field{Center, Center, Face, Nothing, G, I, D, T, B, Nothing} where {G, I, D, T, B}}}), TAV<:(NamedTuple{(:u, :v, :w), <:Tuple{Field{Face, Center, Center, Nothing, G, I, D, T, B, Nothing} where {G, I, D, T, B}, Field{Center, Face, Center, Nothing, G, I, D, T, B, Nothing} where {G, I, D, T, B}, Field{Center, Center, Face, Nothing, G, I, D, T, B, Nothing} where {G, I, D, T, B}}}), GT<:(Field{Center, Center, Face, Nothing, G, I, D, T, B, Nothing} where {G, I, D, T, B}), TS<:(Oceananigans.Solvers.BatchedTridiagonalSolver{Breeze.CompressibleEquations.AcousticTridiagLower, Breeze.CompressibleEquations.AcousticTridiagDiagonal, Breeze.CompressibleEquations.AcousticTridiagUpper, _A, G, Nothing, Oceananigans.Grids.ZDirection} where {_A, G<:Oceananigans.Grids.AbstractGrid})}

Construct an AcousticSubstepper. The perturbation face fields $(ρu)′, (ρv)′, (ρw)′$ and the scalar-transport velocities use topology-derived BCs (periodic wrap / impenetrability), not the prognostic momentum's BCs: inheriting them would imprint the full-state wall target onto the perturbation halo for a nonzero NormalFlowBoundaryCondition (issue #716) and apply momentum BCs to velocity fields. The wall target re-enters via the prognostic momentum's own BC after each substep's momentum update. The prognostic_momentum kwarg is retained for backwards compatibility but no longer consulted.

source
Breeze.CompressibleEquations.CompressibleDynamicsType
struct CompressibleDynamics{TD, D, DT, P, FT, RS, TM, CV, CM}

Fully compressible dynamics with prognostic density and diagnostic pressure.

Fields

  • dry_density: Prognostic dry-air density field ρᵈ
  • total_density: Diagnosed total air density ρ = ρᵈ + Σρˣ (used for thermodynamics, scalar advection, EOS, buoyancy)
  • pressure: Diagnostic pressure field p = ρ Rᵐ T
  • standard_pressure: Reference pressure pˢᵗ for potential temperature (default 10⁵ Pa)
  • surface_pressure: Mean pressure at the bottom of the atmosphere p₀
  • time_discretization: Time discretization scheme (SplitExplicitTimeDiscretization or ExplicitTimeStepping)
  • reference_state: The single fixed hydrostatically-balanced reference state for base-state pressure/buoyancy correction (perturbation-form PGF), or nothing when disabled. An ExnerReferenceState whose fields are grid-polymorphic: a 1D column on height-coordinate grids, and horizontally-varying 3D fields on terrain-following grids (where a single column is not hydrostatically consistent per terrain column).
  • terrain_metrics: TerrainMetrics for terrain-following coordinates (or nothing). This — not reference_state — is the sole "is this a terrain grid?" signal.
  • , ρw̃: contravariant vertical velocity / momentum diagnostic fields (or nothing when no terrain metrics)

The time_discretization determines how tendencies are computed and which time-stepper is used:

The moist equation-of-state θˡⁱ→T temperature inversion is controlled by the thermodynamic formulation, not the dynamics: see temperature_solver on LiquidIcePotentialTemperatureFormulation.

source
Breeze.CompressibleEquations.CompressibleDynamicsMethod
CompressibleDynamics(
;
    ...
) -> CompressibleDynamics{ExplicitTimeStepping, Nothing, Nothing, Nothing, Float64, Breeze.CompressibleEquations.AutoReference, SlopeOutsideInterpolation, Nothing, Nothing}
CompressibleDynamics(
    time_discretization;
    standard_pressure,
    surface_pressure,
    reference_potential_temperature,
    reference_temperature,
    reference_vapor_mass_fraction,
    slope_stencil,
    terrain_metrics,
    reference_state,
    temperature_tolerance,
    temperature_maxiter
) -> CompressibleDynamics{_A, Nothing, Nothing, Nothing, Float64, Breeze.CompressibleEquations.AutoReference, SlopeOutsideInterpolation, Nothing, Nothing} where _A

Construct CompressibleDynamics. The density and pressure fields are materialized later in the model constructor.

Positional Arguments

Keyword Arguments

  • standard_pressure: Reference pressure for potential temperature (default: 10⁵ Pa)

  • surface_pressure: Mean surface pressure (default: 101325.0 Pa)

  • reference_potential_temperature: Potential temperature for building a fixed hydrostatically-balanced reference state used in base-state subtraction. Can be a constant θ₀ or a function θ(z). Default: nothing, which uses the automatic θᵣ = 288 K profile when reference_state = :auto. When provided, this profile replaces the automatic profile when building the ExnerReferenceState.

  • reference_vapor_mass_fraction: Optional vapor mass fraction for building a moist compressible reference state. Can be a constant qᵛ, function qᵛ(z), or field, and is used with reference_potential_temperature.

  • slope_stencil: Pressure-gradient slope-interpolation stencil for terrain-following grids. Default: SlopeOutsideInterpolation. Ignored on non-terrain-following grids.

  • terrain_metrics: Escape hatch — pass a pre-built TerrainMetrics to bypass the automatic build. Default: nothing (auto-build from the grid using slope_stencil).

  • reference_state: Whether to carry the single hydrostatic reference state used for the perturbation-form pressure-gradient force and buoyancy. Default: :auto — on a bounded vertical grid, build a standard-atmosphere (θᵣ = 288 K) hydrostatic reference: a 1D column on height-coordinate grids, 3D fields on terrain-following grids. Periodic and flat vertical topologies carry no automatic reference because a nontrivial hydrostatic atmosphere is incompatible with periodicity and unnecessary without a vertical dimension. Pass reference_state = nothing to disable it entirely — the PGF and buoyancy then difference the full pressure, reproducing the un-corrected behavior (useful for testing). Disabling is mutually exclusive with an explicit reference profile. To replace the reference with one deduced from an initial state's horizontal mean, call set!(model; …, compute_reference_state=true).

    Deep near-isentropic reference profiles

    The reference integrates the hydrostatic equation up each column using θᵣ(z). A (nearly) constant-θ column is isentropic and its hydrostatic pressure reaches zero at a finite height (≈ cᵖ θ / g, about 29 km for the default θᵣ = 288 K); if the domain top exceeds that height the integration has no positive-pressure solution and the reference fills with NaN. Physical, stably-stratified profiles are unaffected. For such a deep, near-isentropic setup pass either a stratified reference_potential_temperature or reference_state = nothing (full-pressure form).

source
Breeze.CompressibleEquations.ConstantSubstepSizeType
struct ConstantSubstepSize <: AcousticSubstepDistribution

Acoustic substep distribution where every stage uses the same substep size $Δτ = Δt/N$. $N$ is rounded up to a multiple of 6 (= LCM of the WS-RK3 stage denominators 2 and 3) so the per-stage count $Nτ = β_\mathrm{stage} N$ is an exact integer and each stage covers exactly $β Δt$ — uniform Δτ, at the cost of over-resolving (substep count is the next multiple of 6 ≥ the CFL minimum).

source
Breeze.CompressibleEquations.CubicRampType
struct CubicRamp <: AbstractRamp

Hermite cubic "smoothstep" sponge ramp. $s² (3 − 2s)$ where $s = \text{clamp}((z − (H − \text{depth}))/\text{depth}, 0, 1)$.

Has zero derivative at both the layer base and the lid, so absorbs upgoing waves smoothly without the reflective kink of LinearRamp. Functionally equivalent to Sin2Ramp but ~5–10× cheaper inside the GPU kernel (no transcendental). Recommended default.

source
Breeze.CompressibleEquations.DirectDivergenceDampingType
struct DirectDivergenceDamping{FT} <: AcousticDampingStrategy

Acoustic divergence damping that forms the horizontal θ-flux divergence $δ = ∂ₓ(θᴸ(ρu)′) + ∂_y(θᴸ(ρv)′)$ directly from the perturbation momentum, rather than approximating it through the $(ρθ)′$ substep tendency the way ThermalDivergenceDamping does (Klemp, Skamarock & Ha 2018, their eq. 36). After each acoustic substep the horizontal perturbation momentum receives the correction

\[Δ(ρu)′ = α\, Δx²\, ∂ₓ δ / θᴸ, \qquad Δ(ρv)′ = α\, Δy²\, ∂_y δ / θᴸ,\]

with the single dimensionless coefficient α (MPAS config_smdiv, default 0.1; the Laplacian-diffusion stability bound is α ≲ 0.2). The divergence is horizontal only: the damped quantity must match the divergence in the $Θ = ρθ$ equation, and folding in the vertical θ-flux divergence damps the resolved vertical flux and destabilizes the flow. Differencing the velocity field directly (rather than the $(ρθ)′$ tendency) carries no $1/Δτ$ in the diffusivity, which also avoids the thermal proxy's cold-start $∝ α/Δτ$ spurious force (cf. PR #794).

source
Breeze.CompressibleEquations.ExplicitTimeSteppingType
struct ExplicitTimeStepping

Standard explicit time discretization for compressible dynamics.

All tendencies (including pressure gradient and acoustic modes) are computed together and time-stepped explicitly. This requires small time steps limited by the acoustic CFL condition (sound speed ~340 m/s).

Use SplitExplicitTimeDiscretization for more efficient time-stepping with larger Δt.

source
Breeze.CompressibleEquations.LinearRampType
struct LinearRamp <: AbstractRamp

Linear sponge ramp. Cheap but introduces a kink at the bottom of the sponge layer (nonzero slope at $z = H − \text{depth}$), which can cause small partial reflection of upgoing waves in idealised tests. WRF's older damp_opt = 2 form uses this.

source
Breeze.CompressibleEquations.ProportionalSubstepsType
struct ProportionalSubsteps <: AcousticSubstepDistribution

Acoustic substep distribution where each WS-RK3 stage independently covers its interval $β_\mathrm{stage} Δt$ with $Nτ = ⌈β_\mathrm{stage} N⌉$ substeps of size $Δτ = β_\mathrm{stage} Δt / Nτ$. The count is proportional to the stage fraction and the size is fitted so the substeps exactly tile each stage — exact coverage at the minimum substep count (no global quantization; Δτ may differ slightly by stage).

This is the default.

source
Breeze.CompressibleEquations.Sin2RampType
struct Sin2Ramp <: AbstractRamp

$\sin^2$ sponge ramp from Klemp, Dudhia & Hassiotis (2008). Same zero-derivative-at-both-ends behaviour as CubicRamp, but with a transcendental call. Provided for parity with WRF (damp_opt = 3) / MPAS-Atmosphere; prefer CubicRamp for performance in new code.

source
Breeze.CompressibleEquations.SplitExplicitTimeDiscretizationType
struct SplitExplicitTimeDiscretization{N, FT, D, US, AD<:AcousticSubstepDistribution}

Time discretization for fully compressible dynamics that integrates slow terms with a Wicker-Skamarock RK3 outer loop and acoustic terms with split-explicit inner substeps.

The constructor accepts substeps or an acoustic_cfl for choosing the number of acoustic substeps, a forward_weight for off-centering the acoustic solve, an acoustic damping strategy such as ThermalDivergenceDamping, an optional UpperSponge, and a substep_distribution such as ProportionalSubsteps.

Backward integration (time_step!(model, Δt) with Δt < 0) is supported for the linearized acoustic substep loop. See the field-documentation docstring for the A-stability argument, sign-handling of the adaptive substep count, and the irreversibility caveat for the optional UpperSponge.

source
Breeze.CompressibleEquations.ThermalDivergenceDampingType
struct ThermalDivergenceDamping{FT, LS} <: AcousticDampingStrategy

Acoustic divergence damping that uses the (ρθ)′ tendency as a discrete proxy for the momentum divergence. From the linearized ρθ-continuity equation $\partial_t (ρθ)' + \nabla\cdot(ρθ^L u') = 0$, the per-substep quantity

\[D \equiv \frac{(ρθ)' - (ρθ)'_\mathrm{old}}{θ^L} \approx -Δτ \, \nabla\cdot(ρu)'\]

is what would otherwise require an extra divergence operator and an extra kernel pass. Building the correction from D reuses the substep's already-resident (ρθ)′ snapshots — that's the algorithmic choice this damping is named for.

Used by Klemp, Skamarock & Ha (2018) / Skamarock & Klemp (1992) / Baldauf (2010). After each acoustic substep, the horizontal momentum perturbation components $(ρu)′$ and $(ρv)′$ pick up an explicit correction proportional to the horizontal gradient of $D$. If damp_vertical = true, the vertical component is folded implicitly into the column tridiag as a Laplacian on the acoustic vertical momentum perturbation: $(ρw)′$ for height-coordinate dynamics and $(ρ ilde{w})′$ for terrain-following dynamics. By default, damp_vertical = false and vertical acoustic damping comes from the off-centered implicit solve.

Per-substep momentum correction (Klemp, Skamarock & Ha 2018 eq. 36, MPAS form):

\[Δ(ρu)′ = -γ · ∂_x D , \quad Δ(ρv)′ = -γ · ∂_y D .\]

with local per-direction horizontal diffusivities. On a uniform square grid this is the finite-difference analogue of MPAS's coef_divdamp = 2·smdiv·config_len_disp/Δτ:

\[γ_x = α \, Δx^2 / Δτ , \qquad γ_y = α \, Δy^2 / Δτ .\]

On anisotropic or latitude-longitude grids, using the local per-direction spacing keeps the nondimensional explicit damping strength approximately uniform across the mesh. Pass length_scale = ℓ to override the automatic local scale with the fixed diffusivity $γ = α ℓ^2 / Δτ$ when a nominal mesh length is more appropriate. The optional vertical tridiag contribution uses $γ_z = α Δz² / Δτ$ when damp_vertical = true.

$α$ is the dimensionless Klemp 2018 coefficient (= MPAS config_smdiv, default 0.1). The combined 2-D horizontal explicit-time stability bound is $8α ≤ 2 → α ≤ 0.25$; the default sits well below it. Combined with the SplitExplicitTimeDiscretization default $\omega = 0.65$, this preserves the exact discrete rest atmosphere at Δt = 20 s and damps divergent acoustic noise in production runs. It should not be read as a guarantee that every grid-scale balanced-mode growth diagnostic is physically correct.

Fields

  • coefficient: Dimensionless damping coefficient $α$ (Klemp 2018 / MPAS config_smdiv). Default 0.1. The horizontal part is explicit and obeys the usual 8α ≤ 2 2-D combined CFL. When damp_vertical = true, the vertical contribution is implicit and is folded into the column tridiag.
  • length_scale: Optional override for the dispersion length $d$. Default nothing (auto: local $γ_x = α Δx^2 / Δτ$ and $γ_y = α Δy^2 / Δτ$). Setting length_scale = ℓ forces a fixed $γ = α \, ℓ² / Δτ$ in both horizontal directions.
  • damp_vertical: If true, the vertical part of the divergence damping is folded into the column tridiag (a Laplacian on (ρw)′ in height coordinates or (ρw̃)′ in terrain-following coordinates). If false (default), no extra vertical damping is applied — the vertical acoustic modes are damped solely by the off-centering of the implicit pressure-gradient solve ($\omega > 0.5$), which Klemp et al. 2018 eq. (32) shows is algebraically equivalent to a vertical divergence damping with diffusivity $γ_z = c² Δτ s/2$ where $s = 2\omega - 1$.
source
Breeze.CompressibleEquations.UpperSpongeType
struct UpperSponge{FT, R<:AbstractRamp}

Implicit upper Rayleigh sponge for the substepper inner loop. Damps the acoustic vertical momentum perturbation toward zero inside a layer of thickness depth below the model lid, with peak damping rate damping_rate (in 1/s) at the lid scaled by ramp(z). The damped variable is $(ρw)′$ for height-coordinate dynamics and $(ρ ilde{w})′$ for terrain-following dynamics.

The damping is applied inside the column tridiag as a CN-weighted contribution (paralleling the existing implicit divergence-damping treatment): $δτᵐ⁺ × \text{rate} × \text{ramp}(z)$ on the LHS diagonal, $δτˢ⁻ × \text{rate} × \text{ramp}(z)$ on the explicit-half RHS. This matches the Rayleigh-layer form of the Klemp, Dudhia & Hassiotis (2008) absorbing treatment used in WRF (damp_opt=3) and MPAS-Atmosphere. The profile shape is controlled by ramp; use Sin2Ramp for the classic $\sin^2$ profile.

Keyword arguments

  • damping_rate: peak damping rate at the lid, in 1/s. Default 0.2.

    Because the damping is fully implicit in the inner-loop tridiag, it is unconditionally stable for any positive value, so the choice is guided by physics rather than CFL. Typical guidance:

    • $\text{rate} ≳ N$ (Brunt–Väisälä frequency, ~0.01 /s in the stratosphere) is the lower bound at which gravity waves are absorbed rather than reflected within the layer crossing time.
    • WRF's dampcoef default and Klemp et al.'s recommendation is 0.2 (i.e. τ ≈ 5 s at the lid) — comfortably above $N$ and aggressive enough to absorb in one or two crossings.
    • Larger values are fine numerically but produce a sharper "cap" near the lid; if the application cares about resolved dynamics just below the sponge, prefer $\text{rate} ≈ 0.1$ and a deeper layer.
  • depth: sponge-layer thickness below the lid, in metres along the reference vertical coordinate. Default 5e3.

    Should span at least ~10 grid cells in the vertical to give the smooth profile room to absorb without aliasing; for $Δz ≈ 1\,\text{km}$ the default of 5 km gives 5 cells (marginal — bump to 10 km if w-spectrum has structure right below the lid).

  • ramp: an AbstractRamp controlling the profile shape. Default CubicRamp(). Other built-ins: Sin2Ramp(), LinearRamp(). Custom shapes are supported by subtyping AbstractRamp and defining (::MyRamp)(z, sponge_top, depth).

The ramp depends only on the reference vertical coordinate (no horizontal variation), so the sponge does not break zonal symmetry and remains uniform over terrain-following grids.

source
Breeze.CompressibleEquations.WickerSkamarock3Type
struct WickerSkamarock3 <: AcousticOuterScheme

Three-stage Wicker–Skamarock RK3 outer scheme (Wicker and Skamarock 2002) with canonical stage fractions $β = (1/3, 1/2, 1)$. Each stage resets the prognostic state to $U^n$ and applies a fraction $β_k Δt$ of the slow tendency evaluated at the previous-stage state, while the acoustic substep loop advances linearized perturbations about each RK stage-entry state.

source
Breeze.CompressibleEquations.acoustic_rk3_substep_loop!Method
acoustic_rk3_substep_loop!(
    model::AtmosphereModel,
    substepper,
    Δt,
    β_stage,
    Uᴸ
)

Execute one Wicker–Skamarock RK3 stage of the linearized acoustic substep loop. Number and size of substeps in this stage depend on substepper.substep_distribution.

source
Breeze.CompressibleEquations.freeze_linearization_state!Method
freeze_linearization_state!(
    substepper::AcousticSubstepper,
    model
)

Compute the background quantities used by the substepper as the first linearization point of an outer step. Subsequent RK stages call prepare_acoustic_cache!, which refreshes the same cached quantities to the stage-entry state.

After this call:

  • linearization_exner = Πᴸ = (pᴸ/pˢᵗ)^κ derived from model.dynamics.pressure
  • linearization_potential_temperature = θᴸ = ρθᴸ/ρᴸ derived from model.dynamics.dry_density + ρθ
source
Breeze.CompressibleEquations.prepare_acoustic_cache!Method
prepare_acoustic_cache!(
    substepper::AcousticSubstepper,
    model
)

Stage-start cache preparation. Refreshes the cached linearization quantities (Πᴸ, θᴸ, γᵐRᵐᴸ) to the stage-entry state $Uᴸ_\mathrm{stage}$ (per Skamarock & Klemp 2008 above eq. 16), recomputing them from the live model.dynamics.*. The rewind-perturbation initialization (initialize_stage_perturbations!, called next) handles the WS-RK3 invariant by setting $(ρ)′_\mathrm{init} = Uᴸ_\mathrm{outer} − Uᴸ_\mathrm{stage}$ (zero for stage 1; nonzero for stages 2 and 3).

source

Forcings

Breeze.Forcings.SpecificForcingMethod
SpecificForcing(
    forcing
) -> SpecificForcing{_A, Nothing, Nothing} where _A

Wrap a user-supplied forcing that produces a specific (per-unit-mass) tendency so that Breeze applies the density multiply $ρ$ at kernel time. After materialization, the kernel callable returns

\[ρ(i, j, k) \, F_ϕ(i, j, k, t)\]

interpolating $ρ$ to the appropriate cell face for fields whose target prognostic lives at Face in any direction (e.g. $ρ$ is interpolated to x-Face for u-forcings via $ℑxᶠᵃᵃ$, to z-Face for w via $ℑzᵃᵃᶠ$). ρ is ρᵣ(z) under AnelasticDynamics and the prognostic ρ(x, y, z, t) under CompressibleDynamics; the same wrapper handles both.

Users typically supply specific forcings directly through specific-named keys (u, v, w, θ, e, qᵉ, qᵛ, …) in the forcing NamedTuple passed to AtmosphereModel, and the dispatch wraps each entry in SpecificForcing automatically. The wrapper can also be constructed directly when finer control is needed.

The inner forcing can be anything accepted by Breeze's materialize_atmosphere_model_forcing: a function (x, y, z, t), a Returns callable, a Field, an Oceananigans.Forcing, a Breeze forcing such as SubsidenceForcing or one produced by geostrophic_forcings, or a tuple of these.

source
Breeze.Forcings.SubsidenceForcingMethod
SubsidenceForcing(
    wˢ
) -> SubsidenceForcing{_A, Nothing} where _A

Forcing that represents large-scale subsidence advecting horizontally-averaged fields downward. The kernel returns the specific tendency

\[F_ϕ = - w^s \, ∂_z \overline{ϕ}\]

where $w^s$ is the subsidence_vertical_velocity and $\overline{ϕ}$ is the horizontal average of the field being forced. Supply SubsidenceForcing under the specific prognostic name (e.g. θ, qᵉ, u); the AtmosphereModel dispatch wraps it in SpecificForcing so the density factor $ρ$ is applied automatically at kernel time.

Fields

  • : Either a function of z specifying the subsidence velocity profile, or a Field containing the subsidence velocity.

The horizontal average is computed automatically during update_state!.

Example

using Breezegrid = RectilinearGrid(size=(64, 64, 75), x=(0, 6400), y=(0, 6400), z=(0, 3000))(z) = z < 1500 ? -0.0065 * z / 1500 : -0.0065 * (1 - (z - 1500) / 600)subsidence = SubsidenceForcing(wˢ)forcing = (; θ=subsidence, qᵛ=subsidence)model = AtmosphereModel(grid; forcing)model.forcing.ρθ.forcing# outputSubsidenceForcing with wˢ: 1×1×76 Field{Nothing, Nothing, Face} reduced over dims = (1, 2) on RectilinearGrid on CPU└── averaged_field: 1×1×75 Field{Nothing, Nothing, Center} reduced over dims = (1, 2) on RectilinearGrid on CPU
source
Breeze.Forcings.geostrophic_forcingsMethod
geostrophic_forcings(
    uᵍ,
    vᵍ
) -> NamedTuple{(:u, :v), <:Tuple{Breeze.Forcings.GeostrophicForcing{Oceananigans.Grids.XDirection, _A, Nothing} where _A, Breeze.Forcings.GeostrophicForcing{Oceananigans.Grids.YDirection, _A, Nothing} where _A}}

Create a pair of geostrophic forcings for the x- and y-momentum equations, keyed under specific names u and v. Each GeostrophicForcing returns a specific tendency; the model's density factor ρ is applied automatically via SpecificForcing when the forcing is dispatched under a specific key, with the correct horizontal interpolation of ρ to the appropriate cell face.

The Coriolis parameter is extracted from the model's coriolis during model construction.

Arguments

  • uᵍ: Function of z specifying the x-component of the geostrophic velocity.
  • vᵍ: Function of z specifying the y-component of the geostrophic velocity.

Returns a NamedTuple with u and v forcing entries that can be merged into the model forcing.

Example

using Breezeuᵍ(z) = -10 + 0.001zvᵍ(z) = 0.0coriolis = FPlane(f=1e-4)forcing = geostrophic_forcings(uᵍ, vᵍ)# outputNamedTuple with 2 GeostrophicForcings:├── u: GeostrophicForcing{XDirection}│   └── geostrophic_velocity: vᵍ (generic function with 1 method)└── v: GeostrophicForcing{YDirection}    └── geostrophic_velocity: uᵍ (generic function with 1 method)
source

KinematicDriver

Breeze.KinematicDriverModule
KinematicDriver

Module implementing kinematic dynamics for atmosphere models.

Kinematic dynamics prescribes the velocity field rather than solving for it, enabling isolated testing of microphysics, thermodynamics, and other physics without the complexity of solving the momentum equations.

This is analogous to the kin1d driver in P3-microphysics.

source
Breeze.KinematicDriver.PrescribedDynamicsType
struct PrescribedDynamics{Div, D, P, FT}

Dynamics for kinematic atmosphere models where velocity is prescribed. The type parameter Div indicates whether divergence correction is applied.

source
Breeze.KinematicDriver.PrescribedDynamicsMethod
PrescribedDynamics(
    density;
    pressure,
    surface_pressure,
    standard_pressure,
    divergence_correction
) -> PrescribedDynamics{_A, D} where {_A, D<:PrescribedDensity}

Construct PrescribedDynamics from a density field or PrescribedDensity. If pressure=nothing, hydrostatic pressure is computed during materialization.

source
Breeze.KinematicDriver.PrescribedDynamicsMethod
PrescribedDynamics(
    reference_state::ReferenceState;
    divergence_correction
) -> PrescribedDynamics{_A, D} where {_A, D<:PrescribedDensity}

Construct PrescribedDynamics from a ReferenceState. Wraps density in PrescribedDensity (fixed in time).

If divergence_correction=true, scalar tendencies include +c∇·(ρU) to account for the non-divergent velocity field.

Example

using Oceananigansusing Breezegrid = RectilinearGrid(size=(4, 4, 8), extent=(1000, 1000, 2000))reference_state = ReferenceState(grid, ThermodynamicConstants())dynamics = PrescribedDynamics(reference_state)# outputPrescribedDynamics├── density: PrescribedDensity├── pressure: 1×1×8 Field{Nothing, Nothing, Center} reduced over dims = (1, 2) on RectilinearGrid on CPU├── surface_pressure: 101325.0└── standard_pressure: 100000.0
source

Microphysics

Breeze.Microphysics.BulkMicrophysicsType
BulkMicrophysics(
;
    ...
) -> BulkMicrophysics{N, Nothing, Nothing, Nothing} where N<:(SaturationAdjustment{E, S} where {E<:MixedPhaseEquilibrium, S<:SecantSolver})
BulkMicrophysics(
    FT::DataType;
    categories,
    cloud_formation,
    precipitation_boundary_condition,
    negative_moisture_correction
) -> BulkMicrophysics{N, Nothing, Nothing, Nothing} where N<:(SaturationAdjustment{E, S} where {E<:MixedPhaseEquilibrium, S<:SecantSolver})

Return a BulkMicrophysics microphysics scheme.

Keyword arguments

  • categories: Microphysical categories (e.g., cloud liquid, cloud ice, rain, snow) or nothing for non-precipitating
  • cloud_formation: Cloud formation scheme (default: SaturationAdjustment)
  • precipitation_boundary_condition: Bottom boundary condition for precipitation sedimentation.
    • nothing (default): Precipitation passes through the bottom
    • ImpenetrableBoundaryCondition(): Precipitation collects at the bottom
  • negative_moisture_correction: Correction scheme for negative moisture produced by advection.
    • nothing (default): No correction
      • VerticalBorrowing(): Vertical redistribution of the moisture prognostic only
    • SpeciesBorrowing(): Same-level species borrowing only
    • SpeciesBorrowing(vertical_borrowing=VerticalBorrowing()): Species borrowing with vertical redistribution
source
Breeze.Microphysics.BulkMicrophysicsType
struct BulkMicrophysics{N, C, B, NMC}

Bulk microphysics scheme with cloud formation and precipitation categories.

Fields

  • cloud_formation: Cloud formation scheme (saturation adjustment or non-equilibrium)
  • categories: Precipitation categories (e.g., rain, snow) or nothing
  • precipitation_boundary_condition: Bottom boundary condition for precipitation sedimentation.
    • nothing (default): Precipitation passes through the bottom (open boundary)
    • ImpenetrableBoundaryCondition(): Precipitation collects at the bottom (zero terminal velocity at surface)
  • negative_moisture_correction: Correction scheme for negative moisture produced by advection.
    • nothing (default): No correction
      • VerticalBorrowing(): Vertical redistribution of the moisture prognostic only
    • SpeciesBorrowing(): Same-level species borrowing only
    • SpeciesBorrowing(vertical_borrowing=VerticalBorrowing()): Species borrowing with vertical redistribution
source
Breeze.Microphysics.DCMIP2016KesslerMicrophysicsType
DCMIP2016KesslerMicrophysics(
;
    ...
) -> Breeze.Microphysics.DCMIP2016KesslerMicrophysics
DCMIP2016KesslerMicrophysics(
    FT;
    dcmip_temperature_scale,
    terminal_velocity_coefficient,
    density_scale,
    terminal_velocity_exponent,
    autoconversion_rate,
    autoconversion_threshold,
    accretion_rate,
    accretion_exponent,
    evaporation_ventilation_coefficient_1,
    evaporation_ventilation_coefficient_2,
    evaporation_ventilation_exponent_1,
    evaporation_ventilation_exponent_2,
    diffusivity_coefficient,
    thermal_conductivity_coefficient,
    substep_cfl
) -> Breeze.Microphysics.DCMIP2016KesslerMicrophysics

Construct a DCMIP2016 implementation of the Kessler (1969) warm-rain bulk microphysics scheme.

This implementation follows the DCMIP2016 test case specification, which is based on Klemp and Wilhelmson (1978).

Positional Arguments

  • FT: Floating-point type for all parameters (default: Oceananigans.defaults.FloatType).

References

  • Zarzycki, C. M., et al. (2019). DCMIP2016: the splitting supercell test case. Geoscientific Model Development, 12, 879–892.
  • Kessler, E. (1969). On the Distribution and Continuity of Water Substance in Atmospheric Circulations. Meteorological Monographs, 10(32).
  • Klemp, J. B., & Wilhelmson, R. B. (1978). The simulation of three-dimensional convective storm dynamics. Journal of the Atmospheric Sciences, 35(6), 1070-1096.
  • DCMIP2016 Fortran implementation (kessler.f90 in DOI: 10.5281/zenodo.1298671)

Moisture Categories

This scheme represents moisture in three categories:

  • Water vapor mixing ratio (rᵛ)
  • Cloud water mixing ratio (rᶜˡ)
  • Rain water mixing ratio ()

Breeze tracks moisture using mass fractions (q), whereas the Kessler scheme uses mixing ratios (r). Conversions between these representations are performed internally. In Breeze, water vapor is not a prognostic variable; instead, it is diagnosed from the total specific moisture qᵗ and the liquid condensates.

Physical Processes

  1. Autoconversion: Cloud water converts to rain water when the cloud water mixing ratio exceeds a threshold.
  2. Accretion: Rain water collects cloud water as it falls.
  3. Saturation Adjustment: Water vapor condenses to cloud water or cloud water evaporates to maintain saturation.
  4. Rain Evaporation: Rain water evaporates into subsaturated air.
  5. Rain Sedimentation: Rain water falls gravitationally.

Implementation Details

  • The microphysics update is applied via a GPU-compatible kernel launched from microphysics_model_update!.
  • Rain sedimentation uses subcycling to satisfy CFL constraints, following the Fortran implementation.
  • All microphysical updates are applied directly to the state variables in the kernel.

Keyword Arguments

Saturation (Tetens/Clausius-Clapeyron formula)

  • dcmip_temperature_scale (T_DCMIP2016): A parameter of uncertain provenance that appears in the DCMIP2016 implementation of the Kessler scheme (line 105 of kessler.f90 in DOI: 10.5281/zenodo.1298671)

The "saturation adjustment coefficient" f₅ is then computed as

\[f₅ = a T_DCMIP2016 ℒˡᵣ / cᵖᵈ\]

where a is the liquid_coefficient for Tetens' saturation vapor pressure formula, ℒˡᵣ is the latent heat of vaporization of liquid water, and cᵖᵈ is the heat capacity of dry air.

Rain Terminal Velocity (Klemp & Wilhelmson 1978, eq. 2.15)

Terminal velocity: 𝕎ʳ = a𝕎 × (ρ × rʳ × Cᵨ)^β𝕎 × √(ρ₀/ρ)

  • terminal_velocity_coefficient (a𝕎): Terminal velocity coefficient in m/s (default: 36.34)
  • density_scale (Cᵨ): Density scale factor for unit conversion (default: 0.001)
  • terminal_velocity_exponent (β𝕎): Terminal velocity exponent (default: 0.1364)
  • ρ: Density
  • ρ₀: Reference density at z=0

Autoconversion

  • autoconversion_rate (k₁): Autoconversion rate coefficient in s⁻¹ (default: 0.001)
  • autoconversion_threshold (rᶜˡ★): Critical cloud water mixing ratio threshold in kg/kg (default: 0.001)

Accretion

  • accretion_rate (k₂): Accretion rate coefficient in s⁻¹ (default: 2.2)
  • accretion_exponent (βᵃᶜᶜ): Accretion exponent for rain mixing ratio (default: 0.875)

Rain Evaporation (Klemp & Wilhelmson 1978, eq. 2.14)

Ventilation: (Cᵉᵛ₁ + Cᵉᵛ₂ × (ρ rʳ)^βᵉᵛ₁) × (ρ rʳ)^βᵉᵛ₂

  • evaporation_ventilation_coefficient_1 (Cᵉᵛ₁): Evaporation ventilation coefficient 1 (default: 1.6)
  • evaporation_ventilation_coefficient_2 (Cᵉᵛ₂): Evaporation ventilation coefficient 2 (default: 124.9)
  • evaporation_ventilation_exponent_1 (βᵉᵛ₁): Evaporation ventilation exponent 1 (default: 0.2046)
  • evaporation_ventilation_exponent_2 (βᵉᵛ₂): Evaporation ventilation exponent 2 (default: 0.525)
  • diffusivity_coefficient (Cᵈⁱᶠᶠ): Diffusivity-related denominator coefficient (default: 2.55e8)
  • thermal_conductivity_coefficient (Cᵗʰᵉʳᵐ): Thermal conductivity-related denominator coefficient (default: 5.4e5)

Numerical

  • substep_cfl: CFL safety factor for sedimentation subcycling (default: 0.8)
source
Breeze.Microphysics.InstantaneousPrecipitationType
InstantaneousPrecipitation(
;
    ...
) -> InstantaneousPrecipitation{S} where S<:(SaturationAdjustment{WarmPhaseEquilibrium, S} where S<:SecantSolver)
InstantaneousPrecipitation(
    FT::DataType;
    equilibrium,
    solver
) -> InstantaneousPrecipitation{S} where S<:(SaturationAdjustment{WarmPhaseEquilibrium, S} where S<:SecantSolver)

Construct an InstantaneousPrecipitation scheme. equilibrium selects the phase equilibrium used by the underlying saturation solve (default warm-phase), and solver controls its iteration (see SaturationAdjustment).

source
Breeze.Microphysics.InstantaneousPrecipitationType
struct InstantaneousPrecipitation{S}

Instantaneous-precipitation microphysics: an instantaneous, irreversible condensation with immediate rain-out and no re-evaporation (no cloud or rain stage). Excess water vapor above saturation condenses, releases its latent heat to the air, and is removed as precipitation in the same step. This is the "large-scale condensation" of the DCMIP2016 Reed–Jablonowski simple-physics suite.

The saturation/latent-heat solve is delegated to a SaturationAdjustment instance (saturation_adjustment), so the equilibrium thermodynamics are shared and validated. The distinction is irreversibility: the condensate is purged from the prognostic vapor every step and cannot re-evaporate.

The prognostic moisture is the vapor density ρqᵛ (no condensate is retained).

source
Breeze.Microphysics.NonEquilibriumCloudFormationType
NonEquilibriumCloudFormation(liquid, ice=nothing)

A cloud formation scheme where cloud liquid and ice are prognostic variables that evolve via condensation/evaporation and deposition/sublimation tendencies, rather than being diagnosed instantaneously via saturation adjustment.

The condensation/evaporation and deposition/sublimation tendencies are commonly modeled as relaxation toward saturation with timescale τ_relax, including a latent-heat (psychrometric/thermal) correction factor; see Morrison and Grabowski (2008), Appendix Eq. (A3), and standard cloud microphysics texts such as Pruppacher and Klett (2010) or Rogers and Yau (1989).

For some bulk schemes (e.g. the CloudMicrophysics 1M extension), liquid and ice may be set to nothing and used purely as phase indicators (warm-phase vs mixed-phase), with any relaxation timescales sourced from the scheme's precipitation/category parameters instead.

Fields

  • liquid: Parameters for cloud liquid (contains relaxation timescale τ_relax)
  • ice: Parameters for cloud ice (contains relaxation timescale τ_relax), or nothing for warm-phase only

References

  • Morrison, H. and Grabowski, W. W. (2008). A novel approach for representing ice microphysics in models: Description and tests using a kinematic framework. J. Atmos. Sci., 65, 1528–1548. https://doi.org/10.1175/2007JAS2491.1
  • Pruppacher, H. R. and Klett, J. D. (2010). Microphysics of Clouds and Precipitation (2nd ed.).
  • Rogers, R. R. and Yau, M. K. (1989). A Short Course in Cloud Physics (3rd ed.).
source
Breeze.Microphysics.SaturationAdjustmentType
SaturationAdjustment(
;
    ...
) -> SaturationAdjustment{E, S} where {E<:MixedPhaseEquilibrium, S<:SecantSolver}
SaturationAdjustment(
    FT::DataType;
    solver,
    equilibrium,
    tolerance,
    maxiter
) -> SaturationAdjustment{E, S} where {E<:MixedPhaseEquilibrium, S<:SecantSolver}

Return SaturationAdjustment microphysics representing an instantaneous adjustment to equilibrium between condensates and water vapor, computed by a secant iteration on the temperature residual controlled by solver.

The options for equilibrium are:

  • WarmPhaseEquilibrium() representing an equilibrium between water vapor and liquid water.

  • MixedPhaseEquilibrium() representing a temperature-dependent equilibrium between water vapor, possibly supercooled liquid water, and ice. The equilibrium state is modeled as a linear variation of the equilibrium liquid fraction with temperature, between the freezing temperature (e.g. 273.15 K) below which liquid water is supercooled, and the temperature of homogeneous ice nucleation temperature (e.g. 233.15 K) at which the supercooled liquid fraction vanishes.

The options for solver are SecantSolver (default: SecantSolver(abstol=1e-4, maxiter=20), an absolute tolerance on the temperature-like residual in Kelvin) and FixedIterations, which performs a fixed number of secant steps with no convergence test (the form required for Reactant tracing and cheap reverse-mode differentiation).

source
Breeze.Microphysics.RelativeHumidityMethod
RelativeHumidity(
    model
) -> KernelFunctionOperation{_A, _B, _C, _D, T, K, D} where {_A, _B, _C, _D, T, K<:Breeze.Microphysics.RelativeHumidityKernelFunction, D<:Tuple}

Return a KernelFunctionOperation representing the relative humidity $ℋ$, defined as the ratio of vapor pressure to saturation vapor pressure:

\[ℋ = \frac{pᵛ}{pᵛ⁺}\]

where $pᵛ$ is the vapor pressure (partial pressure of water vapor) computed from the ideal gas law

\[pᵛ = ρ qᵛ Rᵛ T\]

and $pᵛ⁺$ is the saturation vapor pressure.

For unsaturated conditions, $ℋ < 1$. For saturated conditions with saturation adjustment microphysics, $ℋ = 1$ (or very close to it due to numerical precision).

Examples

using Breezegrid = RectilinearGrid(size=(1, 1, 128), extent=(1e3, 1e3, 1e3))microphysics = SaturationAdjustment()model = AtmosphereModel(grid; microphysics)set!(model, θ=300, qᵗ=0.005)  # subsaturated= RelativeHumidity(model)# outputKernelFunctionOperation at (Center, Center, Center)├── grid: 1×1×128 RectilinearGrid{Float64, Periodic, Periodic, Bounded} on CPU with 1×1×3 halo├── kernel_function: RelativeHumidityKernelFunction└── arguments: ()

As with other diagnostics, RelativeHumidity may be wrapped in Field to store the result:

ℋ_field = RelativeHumidity(model) |> Field# output1×1×128 Field{Center, Center, Center} on RectilinearGrid on CPU├── grid: 1×1×128 RectilinearGrid{Float64, Periodic, Periodic, Bounded} on CPU with 1×1×3 halo├── boundary conditions: FieldBoundaryConditions│   └── west: Periodic, east: Periodic, south: Periodic, north: Periodic, bottom: ZeroFlux, top: ZeroFlux, immersed: Nothing├── operand: KernelFunctionOperation at (Center, Center, Center)├── status: time=0.0└── data: 3×3×134 OffsetArray(::Array{Float64, 3}, 0:2, 0:2, -2:131) with eltype Float64 with indices 0:2×0:2×-2:131    └── max=0.214949, min=0.137169, mean=0.172626

We also provide a convenience constructor for the Field:

ℋ_field = RelativeHumidityField(model)# output1×1×128 Field{Center, Center, Center} on RectilinearGrid on CPU├── grid: 1×1×128 RectilinearGrid{Float64, Periodic, Periodic, Bounded} on CPU with 1×1×3 halo├── boundary conditions: FieldBoundaryConditions│   └── west: Periodic, east: Periodic, south: Periodic, north: Periodic, bottom: ZeroFlux, top: ZeroFlux, immersed: Nothing├── operand: KernelFunctionOperation at (Center, Center, Center)├── status: time=0.0└── data: 3×3×134 OffsetArray(::Array{Float64, 3}, 0:2, 0:2, -2:131) with eltype Float64 with indices 0:2×0:2×-2:131    └── max=0.214949, min=0.137169, mean=0.172626
source
Breeze.Microphysics.adjust_thermodynamic_stateMethod
adjust_thermodynamic_state(
    𝒰₀::Breeze.Thermodynamics.AbstractThermodynamicState,
    microphysics::SaturationAdjustment,
    constants
) -> Breeze.Thermodynamics.LiquidIceDensityState

Return the saturation-adjusted thermodynamic state using a secant iteration.

source
Breeze.Microphysics.adjust_thermodynamic_stateMethod
adjust_thermodynamic_state(
    𝒰₀::Breeze.Thermodynamics.LiquidIceDensityState,
    microphysics::SaturationAdjustment,
    constants
) -> Breeze.Thermodynamics.LiquidIceDensityState

Saturation adjustment for the LiquidIceDensityState: a secant on the constant-density θˡⁱ-conservation residual, so qsat and the θˡⁱ inversion are evaluated at the state's actual density ρ (with true pressure p = ρRᵐT) rather than a fixed reference pressure. This is the density-consistent analogue of the generic (reference-pressure) adjust_state secant; like that one it holds θˡⁱ fixed (conserves it). See NumericalEarth/Breeze.jl#765.

source
Breeze.Microphysics.compute_temperatureMethod
compute_temperature(
    𝒰₀,
    adjustment::SaturationAdjustment,
    constants
) -> Any

Perform saturation adjustment and return the temperature associated with the adjusted state.

source
Breeze.Microphysics.kessler_terminal_velocityMethod
kessler_terminal_velocity(rʳ, ρ, ρ₁, microphysics) -> Any

Compute rain terminal velocity (m/s) following Klemp and Wilhelmson (1978) eq. 2.15.

The terminal velocity is computed as:

\[𝕎ʳ = a^𝕎 (ρ rʳ Cᵨ)^{β^𝕎} \sqrt{ρ₀/ρ}\]

where $a^𝕎$ is the terminal_velocity_coefficient, $Cᵨ$ is the density_scale, and $β^𝕎$ is the terminal_velocity_exponent.

source
Breeze.Microphysics.number_concentrationMethod
number_concentration(model, species::Symbol) -> Any

Lazy diagnostic returning the total number concentration $ρnˣ$ (m⁻³) for the requested species.

For OneMomentCloudMicrophysics, species ∈ (:rain, :snow) returns a KernelFunctionOperation that computes $n_0 \, λ^{-1}$ from the prognostic $ρqˣ$ and the scheme's size distribution. Snow's intercept $n_0$ depends on $(q, ρ)$ per Kaul et al. (2015) — so this diagnostic stays consistent with the scheme's actual DSD without re-encoding species-specific physics at every call site.

For TwoMomentCloudMicrophysics, returns the prognostic $ρnˣ$ field directly (e.g., :rainρnʳ, :cloud_liquidρnᶜˡ).

Returns nothing if the species is not carried by the model (e.g., :hail for a 1-mom scheme without hail). Errors for microphysics schemes that do not define a DSD-based number concentration (e.g., SaturationAdjustment).

The return shape is therefore polymorphic — a lazy KernelFunctionOperation for 1-mom and a stored Field for 2-mom — so the function is snake-cased rather than PascalCased. Use number_concentration_field when you want a uniformly Field-typed handle.

source
Breeze.Microphysics.number_concentration_fieldMethod
number_concentration_field(model, species::Symbol) -> Any

Field-typed handle for the number_concentration diagnostic. For 1-mom, allocates a Field shell around the lazy KernelFunctionOperation (use compute! to populate it). For 2-mom, returns the prognostic $ρnˣ$ field directly. Returns nothing when the requested species is not carried by the model.

source

MoistAirBuoyancies

Breeze.MoistAirBuoyancies.MoistAirBuoyancyMethod
MoistAirBuoyancy(
    grid;
    surface_pressure,
    reference_potential_temperature,
    standard_pressure,
    thermodynamic_constants
) -> MoistAirBuoyancy{RS, AT} where {RS<:(ReferenceState{_A, P, D, T, QV, QL, QI} where {_A, P<:(Field{Nothing, Nothing, Center, Nothing, G, I, D, T, B, Nothing} where {G, I, D, T, B}), D<:(Field{Nothing, Nothing, Center, Nothing, G, I, D, T, B, Nothing} where {G, I, D, T, B}), T<:(Field{Nothing, Nothing, Center, Nothing, G, I, D, T, B, Nothing} where {G, I, D, T, B}), QV<:(Oceananigans.Fields.ZeroField{_A, 3} where _A), QL<:(Oceananigans.Fields.ZeroField{_A, 3} where _A), QI<:(Oceananigans.Fields.ZeroField{_A, 3} where _A)}), AT<:ThermodynamicConstants}

Return a MoistAirBuoyancy formulation that can be provided as input to an Oceananigans.NonhydrostaticModel.

Required tracers

MoistAirBuoyancy requires tracers θ and qᵗ.

Example

using Breeze, Oceananigansgrid = RectilinearGrid(size=(1, 1, 8), extent=(1, 1, 3e3))buoyancy = MoistAirBuoyancy(grid)# outputMoistAirBuoyancy:├── reference_state: ReferenceState{Float64}(p₀=101325.0, θ₀=288.0, pˢᵗ=100000.0)└── thermodynamic_constants: ThermodynamicConstants{Float64}

To build a model with MoistAirBuoyancy, we include potential temperature and total specific humidity tracers θ and qᵗ to the model.

model = NonhydrostaticModel(grid; buoyancy, tracers = (:θ, :qᵗ))# outputNonhydrostaticModel{CPU, RectilinearGrid}(time = 0 seconds, iteration = 0)├── grid: 1×1×8 RectilinearGrid{Float64, Periodic, Periodic, Bounded} on CPU with 1×1×3 halo├── timestepper: RungeKutta3TimeStepper├── advection scheme: Centered(order=2)├── tracers: (θ, qᵗ)├── closure: Nothing├── buoyancy: MoistAirBuoyancy with ĝ = NegativeZDirection()└── coriolis: Nothing
source

ParcelModels

Breeze.ParcelModels.ParcelDynamicsType
ParcelDynamics(
;
    ...
) -> ParcelDynamics{Nothing, Nothing, Nothing, Nothing, PrescribedVerticalVelocity}
ParcelDynamics(
    FT::DataType;
    vertical_velocity_formulation,
    surface_pressure,
    standard_pressure
) -> ParcelDynamics{Nothing, Nothing, Nothing, Nothing, PrescribedVerticalVelocity}

Construct ParcelDynamics with default (uninitialized) state.

The environmental profiles and parcel state are set using set! after constructing the AtmosphereModel.

source
Breeze.ParcelModels.ParcelDynamicsType
struct ParcelDynamics{S, TS, D, P, U, FT}

Lagrangian parcel dynamics for AtmosphereModel.

Fields

  • state: parcel state (position, thermodynamics, microphysics)
  • timestepper: SSP RK3 timestepper with tendencies
  • density: environmental density field [kg/m³]
  • pressure: environmental pressure field [Pa]
  • surface_pressure: surface pressure [Pa]
  • standard_pressure: standard pressure for potential temperature [Pa]
source
Breeze.ParcelModels.ParcelInitialStateType
mutable struct ParcelInitialState{FT, MP}
  • x::Any

  • y::Any

  • z::Any

  • w::Any

  • qᵗ::Any

  • ℰ::Any

  • μ::Any

Storage for the initial parcel prognostic state at the beginning of a time step. Used by SSP RK3 to combine the initial state with intermediate states.

source
Breeze.ParcelModels.ParcelModelType
ParcelModel

Type alias for AtmosphereModel{<:ParcelDynamics}.

A ParcelModel represents a Lagrangian adiabatic parcel that rises through a prescribed environmental atmosphere. The parcel is characterized by its position (x, y, z), thermodynamic state, and moisture content. The environmental profiles (temperature, pressure, density, velocities) are defined on a 1D vertical grid.

The parcel's motion is determined by interpolating environmental velocities to the parcel position, and its thermodynamic evolution follows adiabatic processes with optional microphysical interactions.

See also ParcelDynamics, AtmosphereModel.

source
Breeze.ParcelModels.ParcelStateType
mutable struct ParcelState{FT, TH, MP}
  • x::Any

  • y::Any

  • z::Any

  • w::Any

  • ρ::Any

  • qᵗ::Any

  • ρqᵗ::Any

  • ℰ::Any

  • ρℰ::Any

  • 𝒰::Any

  • μ::Any

State of a Lagrangian air parcel with position, thermodynamic state, and microphysics.

The parcel model evolves specific quantities (qᵗ, ℰ) directly for exact conservation. Density-weighted forms (ρqᵗ, ρℰ) are also stored for consistency with the microphysics interface.

  • w: parcel vertical velocity [m/s], prognostic for PrognosticVerticalVelocity, zero for PrescribedVerticalVelocity
  • ρ: environmental density at parcel height [kg/m³], interpolated from background profile, not the parcel's own density. The parcel density is computed from density(𝒰, constants) using the ideal gas law applied to the parcel's thermodynamic state.
source
Breeze.ParcelModels.ParcelTimestepperType
struct ParcelTimestepper{GT, U0, FT}

SSP RK3 time-stepper for ParcelModel.

Stores tendencies, the initial state at the beginning of a time step, and the SSP RK3 stage coefficients.

Fields

  • G: tendencies for prognostic variables
  • U⁰: initial state storage (position, moisture, thermodynamics, microphysics)
  • α¹, α², α³: SSP RK3 stage coefficients (1, 1/4, 2/3)
source
Breeze.ParcelModels.ParcelTimestepperMethod
ParcelTimestepper(
    state::ParcelState{FT},
    Gμ
) -> Breeze.ParcelModels.ParcelTimestepper{GT, U0} where {GT<:Breeze.ParcelModels.ParcelTendencies, U0<:Breeze.ParcelModels.ParcelInitialState}

Construct a ParcelTimestepper for SSP RK3 time-stepping.

source
Breeze.ParcelModels.PrescribedVerticalVelocityType
PrescribedVerticalVelocity

Singleton type for prescribed vertical velocity dynamics. The parcel moves following the prescribed environmental vertical velocity field w(z).

This is the default vertical velocity formulation: dz/dt = w_env(z).

source
Breeze.ParcelModels.PrognosticVerticalVelocityType
PrognosticVerticalVelocity

Singleton type for prognostic vertical velocity dynamics. The parcel has a prognostic vertical velocity driven by buoyancy, i.e., dz/dt = w and dw/dt = b, where b = -g (ρᵖ - ρᵉ) / ρᵉ is the net buoyancy from the density difference, including both the virtual temperature effect and condensate loading.

source
Breeze.ParcelModels.compute_parcel_tendencies!Method
compute_parcel_tendencies!(
    model::AtmosphereModel{<:ParcelDynamics}
)

Compute tendencies for the parcel prognostic variables.

Position tendencies are interpolated from environmental velocity fields. Thermodynamic and moisture tendencies come from microphysical sources/sinks.

The parcel model evolves specific quantities (e, qᵗ) directly, not density-weighted quantities. For adiabatic ascent with no microphysics, specific static energy and moisture are exactly conserved (de/dt = dqᵗ/dt = 0). This is simpler and more accurate than stepping density-weighted quantities.

source
Breeze.ParcelModels.materialize_parcel_microphysics_prognosticsMethod
materialize_parcel_microphysics_prognostics(
    FT,
    microphysics
) -> Union{Nothing, NamedTuple}

Create the parcel microphysics prognostic variables for the given microphysics scheme.

Returns nothing for microphysics schemes without explicit prognostic variables (e.g., Nothing, SaturationAdjustment), or a NamedTuple containing the prognostic density-weighted scalars for schemes with prognostic microphysics.

The prognostic variables use the same ρ-weighted names as the grid-based model (e.g., :ρqᶜˡ, :ρqʳ) from prognostic_field_names(microphysics).

source
Breeze.ParcelModels.parcel_buoyancyMethod
parcel_buoyancy(state, dynamics, constants) -> Any

Compute the net buoyancy acceleration for a parcel.

The buoyancy is computed from the density difference between the parcel and environment:

\[B = -g (ρ_{parcel} - ρ_{env}) / ρ_{env}\]

Here, $ρ_{env}$ is the environmental density interpolated at the parcel height and $ρ_{parcel} = p / (Rᵐ T)$ is the total parcel density from the ideal gas law, where $Rᵐ = qᵈ Rᵈ + qᵛ Rᵛ$ with $qᵈ = 1 - qᵛ - qˡ - qⁱ$. This formulation captures both the virtual temperature effect (from vapor content) and the condensate loading effect (condensate reduces $qᵈ$, reducing $Rᵐ$, increasing $ρ_{parcel}$) in a single term without double-counting.

source
Breeze.ParcelModels.ssp_rk3_parcel_substep!Method
ssp_rk3_parcel_substep!(
    model::AtmosphereModel{<:ParcelDynamics},
    U⁰::Breeze.ParcelModels.ParcelInitialState,
    Δt,
    α
)

Apply an SSP RK3 substep with coefficient $α$:

\[u^{(m)} = (1 - α) u^{(0)} + α \left[u^{(m-1)} + Δt \, G^{(m-1)}\right]\]

where $u^{(0)}$ is the initial state, $u^{(m-1)}$ is the current state, and $G^{(m-1)}$ is the tendency at the current state.

The parcel model steps specific quantities (e, qᵗ) directly for exact conservation. For adiabatic ascent with no microphysics sources, de/dt = dqᵗ/dt = 0, so these quantities remain exactly constant throughout the simulation.

source
Breeze.ParcelModels.step_parcel_state!Method
step_parcel_state!(
    model::AtmosphereModel{<:ParcelDynamics},
    Δt
)

Step the parcel state forward using Forward Euler:

\[x^{n+1} = x^n + Δt \, G^n\]

Compute tendencies at the current state, then advance all prognostic variables. After updating position, the thermodynamic state is adjusted for the new height (adiabatic adjustment) and environmental conditions are updated from the profiles.

source

PotentialTemperatureFormulations

Breeze.PotentialTemperatureFormulationsModule
PotentialTemperatureFormulations

Submodule defining the liquid-ice potential temperature thermodynamic formulation for atmosphere models.

LiquidIcePotentialTemperatureFormulation uses liquid-ice potential temperature density ρθ as the prognostic thermodynamic variable.

source
Breeze.PotentialTemperatureFormulations.LiquidIcePotentialTemperatureFormulationType

LiquidIcePotentialTemperatureFormulation uses liquid-ice potential temperature density ρθ as the prognostic thermodynamic variable.

Liquid-ice potential temperature is a conserved quantity in moist adiabatic processes and is defined as:

\[θˡⁱ = T \left( \frac{p^{st}}{p} \right)^{Rᵐ/cᵖᵐ} \exp\left( -\frac{ℒˡᵣ qˡ + ℒⁱᵣ qⁱ}{cᵖᵐ T} \right)\]

Recovering temperature from θˡⁱ may require an iterative inversion, depending on the dynamics: with prognostic-density (compressible) dynamics, temperature solves the implicit relation T = (ρRᵐT/pˢᵗ)^κ θ + ΔL/cᵖᵐ. The inversion is controlled by temperature_solver:

  • DefaultTemperatureSolver() (default): resolved at materialization to default_temperature_solver(dynamics)nothing for anelastic dynamics (closed-form inversion) and NewtonSolver() for compressible dynamics.
  • NewtonSolver: tolerance-based Newton iteration.
  • FixedIterations: a fixed number of Newton steps with no convergence test, which unrolls to straight-line code (required for Reactant tracing and cheap reverse-mode differentiation).
  • nothing: the non-iterated closed-form inversion.
source
Breeze.PotentialTemperatureFormulations.LiquidIcePotentialTemperatureFormulationMethod
LiquidIcePotentialTemperatureFormulation(
;
    temperature_solver
) -> LiquidIcePotentialTemperatureFormulation{Nothing, Nothing, Breeze.AtmosphereModels.DefaultTemperatureSolver}

Return a LiquidIcePotentialTemperatureFormulation with the given temperature_solver. The prognostic and diagnostic fields are materialized later in the model constructor.

using BreezeLiquidIcePotentialTemperatureFormulation(temperature_solver = FixedIterations(2))# outputLiquidIcePotentialTemperatureFormulation└── temperature_solver: FixedIterations(2)
source

Solvers

Breeze.SolversModule
Solvers

Iterative solvers for the small nonlinear scalar problems that arise in Breeze's thermodynamics: equation-of-state temperature inversions, saturation adjustment, and dewpoint computation.

A "solver" is a lightweight, isbits description of an iteration's stopping rule that algorithms dispatch on:

  • NewtonSolver and SecantSolver iterate until a tolerance-based convergence criterion is met (or maxiter is reached).
  • FixedIterations performs an exact number of iterations with no convergence test at all. Because the trip count is fixed, the loop unrolls to straight-line code, which is required for Reactant tracing and cheap reverse-mode differentiation (a tolerance-based while loop traces to an XLA while op whose adjoint is pathological — see NumericalEarth/Breeze.jl#767).
  • nothing means "do not iterate": the algorithm returns its initial guess (typically a closed-form approximation).

The drivers newton_solve and secant_solve implement the iterations once, so every algorithm shares the same loop logic and the same solver vocabulary.

Tolerance conventions

The choice between reltol and abstol follows the natural scale of the residual:

  • Quantities bounded away from zero with a fixed precision target use an absolute tolerance. Every iteration on a temperature (the θˡⁱ→T inversion, saturation adjustment, the Boussinesq adjustment temperature) is solved to abstol = 1e-4 K — far below any physically or numerically meaningful temperature increment, yet reached in a handful of iterations by both Newton (quadratic) and secant (superlinear).
  • Quantities that range over orders of magnitude use a relative tolerance against an algorithm-supplied scale. The dewpoint solve iterates on a saturation-vapor-pressure residual (Pa), which spans roughly two decades over the atmospheric temperature range, so it uses reltol = 1e-4 against the vapor pressure; an absolute Pa tolerance would be meaningless across that range.

Iteration caps reflect each method's convergence order and role: the quadratically-convergent Newton inversion caps at maxiter = 8, the superlinear secant temperature solves cap at maxiter = 20, and the dewpoint diagnostic caps at maxiter = 10.

source
Breeze.Solvers.FixedIterationsType
struct FixedIterations

A solver that performs exactly iterations iterations with no convergence test.

The fixed trip count means the iteration unrolls to straight-line, branch-free code, making it the right choice for Reactant tracing and reverse-mode differentiation, where data-dependent while loops are pathological (NumericalEarth/Breeze.jl#767).

using BreezeFixedIterations(2)# outputFixedIterations(2)
source
Breeze.Solvers.NewtonSolverType
NewtonSolver(; ...) -> NewtonSolver
NewtonSolver(
    FT::DataType;
    reltol,
    abstol,
    maxiter
) -> NewtonSolver

Return a NewtonSolver with relative tolerance reltol, absolute tolerance abstol, and iteration cap maxiter.

using BreezeNewtonSolver(maxiter=4)# outputNewtonSolver(reltol=0.0, abstol=0.0001, maxiter=4)
source
Breeze.Solvers.NewtonSolverType
struct NewtonSolver{FT}

A Newton iteration that terminates when the step size Δx satisfies |Δx| ≤ max(abstol, reltol * |x|), or after maxiter iterations.

source
Breeze.Solvers.SecantSolverType
SecantSolver(; ...) -> SecantSolver
SecantSolver(
    FT::DataType;
    reltol,
    abstol,
    maxiter
) -> SecantSolver

Return a SecantSolver with relative tolerance reltol, absolute tolerance abstol, and iteration cap maxiter.

using BreezeSecantSolver(abstol=1e-4, maxiter=20)# outputSecantSolver(reltol=0.0, abstol=0.0001, maxiter=20)
source
Breeze.Solvers.SecantSolverType
struct SecantSolver{FT}

A secant iteration that terminates when the residual r satisfies |r| ≤ max(abstol, reltol * |scale|) — where scale is an algorithm-supplied magnitude for the residual — or after maxiter iterations.

source

StaticEnergyFormulations

Breeze.StaticEnergyFormulationsModule
StaticEnergyFormulations

Submodule defining the static energy thermodynamic formulation for atmosphere models.

StaticEnergyFormulation uses moist static energy density ρe as the prognostic thermodynamic variable. Moist static energy is a conserved quantity in adiabatic, frictionless flow that combines sensible heat, gravitational potential energy, and latent heat.

source
Breeze.StaticEnergyFormulations.StaticEnergyFormulationType

StaticEnergyFormulation uses moist static energy density ρe as the prognostic thermodynamic variable.

Moist static energy is a conserved quantity in adiabatic, frictionless flow that combines sensible heat, gravitational potential energy, and latent heat:

\[e = cᵖᵐ T + g z - ℒˡᵣ qˡ - ℒⁱᵣ qⁱ\]

The energy density equation includes a buoyancy flux term following Pauluis (2008).

source

TerrainFollowingDiscretization

Breeze.TerrainFollowingDiscretizationModule
TerrainFollowingDiscretization

Module implementing terrain-following vertical coordinates via the TerrainFollowingVerticalDiscretization (TFVD) grid type.

TFVD stores a uniform reference vertical coordinate $r$ and a formulation (e.g. LinearDecay or TwoLevelDecay) that defines the physical altitude

\[z(x, y, r) = r + h(x, y) \, b(r) ,\]

where $h(x, y)$ is the terrain and $b(r)$ is a decay basis satisfying $b(0) = 1$ and $b(z_\text{top}) = 0$.

Public API:

See docs/src/terrain_following_coordinates.md for the math, discrete operators, well-balancing reference state, and worked examples.

source
Breeze.TerrainFollowingDiscretization.LinearDecayType
struct LinearDecay{FT, H, SX, SY} <: Breeze.TerrainFollowingDiscretization.AbstractTerrainFormulation

Gal-Chen & Somerville (1975) terrain-following formulation: a single decay basis $b(r) = 1 - r/z_{top}$ that linearly attenuates the terrain from the surface to the model top.

source
Breeze.TerrainFollowingDiscretization.SlopeInsideInterpolationType
struct SlopeInsideInterpolation

Terrain pressure gradient stencil where the slope is multiplied inside the interpolation of $∂p'/∂r$:

\[\text{correction} = \overline{\overline{s \, \partial_r p'}^x}^z\]

The slope is evaluated at each (Center, Center, Face) stencil point before averaging to (Face, Center, Center).

source
Breeze.TerrainFollowingDiscretization.TerrainMetricsType
struct TerrainMetrics{H, SX, SY, FT, PG}

Pre-computed terrain derivative fields and model top height.

Fields

  • topography: 2D field storing $h(x, y)$ at (Center, Center)
  • ∂x_h: 2D field storing $\partial h / \partial x$ at (Face, Center)
  • ∂y_h: 2D field storing $\partial h / \partial y$ at (Center, Face)
  • z_top: Height of the model top (top of the reference coordinate)
  • pressure_gradient_stencil: Stencil type for the terrain-corrected horizontal pressure gradient (SlopeOutsideInterpolation or SlopeInsideInterpolation)
source
Breeze.TerrainFollowingDiscretization.TwoLevelDecayType
struct TwoLevelDecay{ZT, FT, H, SX, SY, B} <: Breeze.TerrainFollowingDiscretization.AbstractTerrainFormulation

Schär et al. (2002) "Smooth LEvel VErtical" (SLEVE) terrain-following formulation. Splits the terrain into a smoothed large-scale component $h_1$ (decay length large_scale_height) and the residual small-scale component $h_2$ (decay length small_scale_height). Each is attenuated with a hyperbolic-sine basis $b_n(r) = \sinh((z_{top}-r)/s_n) / \sinh(z_{top}/s_n)$, so the small-scale features decay quickly while the large-scale envelope is preserved aloft.

Constructed via the kwarg form TwoLevelDecay(; large_scale_height, small_scale_height).

source
Breeze.TerrainFollowingDiscretization.build_terrain_metricsMethod
build_terrain_metrics(grid, stencil) -> TerrainMetrics

Build a TerrainMetrics for a materialized TerrainFollowingVerticalDiscretization grid. On such grids the terrain slope used by the dynamics comes from the grid ∂z∂x operator (formulation decay), so this object only carries the pressure_gradient_stencil, z_top, and a representative terrain field.

source
Breeze.TerrainFollowingDiscretization.materialize_terrain!Method
materialize_terrain!(grid, topography) -> Any

Fill the terrain components of a TerrainFollowingVerticalDiscretization grid in place from topography(x, y). Must be called after the grid is built (the horizontal nodes are needed to evaluate the topography). For TwoLevelDecay, the terrain is split into large- and small-scale parts by horizontal smoothing.

The topography is evaluated at the horizontal cell-centre nodes. Its arguments follow the grid's horizontal coordinates with Flat dimensions dropped, matching every other set! initialiser: topography(x, y) on a RectilinearGrid, topography(λ, φ) on a LatitudeLongitudeGrid, and e.g. topography(x) when y is Flat.

source

Thermodynamics

Breeze.Thermodynamics.ClausiusClapeyronType
struct ClausiusClapeyron

A saturation vapor pressure formulation based on the Clausius-Clapeyron relation.

The Clausius-Clapeyron equation describes how saturation vapor pressure varies with temperature based on thermodynamic principles. This formulation uses thermodynamic constants (latent heats, heat capacities, triple point values) to compute saturation vapor pressure analytically.

See saturation_vapor_pressure for the implementation details.

source
Breeze.Thermodynamics.CondensedPhaseType
CondensedPhase(; ...)
CondensedPhase(FT; reference_latent_heat, heat_capacity)

Return CondensedPhase with specified parameters converted to FT.

Two examples of CondensedPhase are liquid and ice. When matter is converted from vapor to liquid, water molecules in the gas phase cluster together and slow down to form liquid with heat_capacity, The lost of molecular kinetic energy is called the reference_latent_heat.

Likewise, during deposition, water molecules in the gas phase cluster into ice crystals.

Arguments

  • FT: Float type to use (defaults to Oceananigans.defaults.FloatType)
  • reference_latent_heat: Difference between the internal energy of the gaseous phase at the energy_reference_temperature.
  • heat_capacity: Heat capacity of the phase of matter.
source
Breeze.Thermodynamics.ExnerReferenceStateType
ExnerReferenceState(
    grid;
    ...
) -> ExnerReferenceState{_A, FP, FD, FE} where {_A, FP<:(Field{Nothing, Nothing, Center, Nothing, G, I, D, T, B, Nothing} where {G, I, D, T, B}), FD<:(Field{Nothing, Nothing, Center, Nothing, G, I, D, T, B, Nothing} where {G, I, D, T, B}), FE<:(Field{Nothing, Nothing, Center, Nothing, G, I, D, T, B, Nothing} where {G, I, D, T, B})}
ExnerReferenceState(
    grid,
    constants;
    surface_pressure,
    potential_temperature,
    reference_temperature,
    standard_pressure,
    vapor_mass_fraction
) -> ExnerReferenceState{_A, FP, FD, FE} where {_A, FP<:(Field{Nothing, Nothing, Center, Nothing, G, I, D, T, B, Nothing} where {G, I, D, T, B}), FD<:(Field{Nothing, Nothing, Center, Nothing, G, I, D, T, B, Nothing} where {G, I, D, T, B}), FE<:(Field{Nothing, Nothing, Center, Nothing, G, I, D, T, B, Nothing} where {G, I, D, T, B})}

Construct an ExnerReferenceState by discrete Exner integration on grid.

Two modes are supported, controlled by which keyword is provided:

Isentropic (potential_temperature): Constant or horizontally-varying θ₀. Each column is built by Newton iteration on the discrete hydrostatic balance $(p_k - p_{k-1})/Δz_{face} + g(ρ_k + ρ_{k-1})/2 = 0$ so the substepper's slow vertical-momentum tendency vanishes to ulp on a rest atmosphere. The same column kernel handles both the 1D path (θ₀ constant or z-dependent) and the 3D path (θ₀(x, y, z)); vapor_mass_fraction is supported in both. When provided, the level-local moist gas constants $Rᵐ = (1-qᵛ)Rᵈ + qᵛRᵛ$, $cᵖᵐ = (1-qᵛ)cᵖᵈ + qᵛcᵖᵛ$ are used; the dry case is recovered exactly when $qᵛ ≡ 0$.

Isothermal (reference_temperature): Constant T₀ (MPAS baroclinic wave convention). Uses the analytic isothermal solution: $p₀(z) = pˢ \exp(-g z / (Rᵈ T₀))$, $Π₀ = (p₀/pˢᵗ)^κ$, $ρ₀ = p₀/(Rᵈ T₀)$, $θ₀ = T₀/Π₀$. This matches MPAS initatmcases.F lines 813-817 exactly.

Arguments

  • grid: The grid
  • constants: Thermodynamic constants (default: ThermodynamicConstants(eltype(grid)))

Keyword Arguments

  • surface_pressure: Pressure at z=0 (default: 101325 Pa)
  • potential_temperature: Constant value or function θᵣ(z) for isentropic reference (default: 288 K)
  • reference_temperature: Constant T₀ for isothermal reference (default: nothing). When provided, overrides potential_temperature.
  • standard_pressure: pˢᵗ for potential temperature definition (default: 1e5 Pa)
  • vapor_mass_fraction: Optional vapor mass fraction for a moist reference state. A number or function qᵛ(z) builds a 1D column; a multi-argument function qᵛ(x, y, z) (or qᵛ(φ, z) on a LatitudeLongitudeGrid) builds a 3D field.
source
Breeze.Thermodynamics.ExnerReferenceStateType
ExnerReferenceState

A dry reference state built in Exner coordinates, ensuring that the discrete Exner hydrostatic balance

\[cᵖᵈ θᵣ^{face} \frac{π₀[k] - π₀[k-1]}{Δz} = -g\]

holds exactly at every interior z-face. This is essential for the Exner pressure acoustic substepping formulation, where the vertical pressure gradient is computed as $cᵖᵈ θᵥ ∂π'/∂z$ and the hydrostatic part must cancel to machine precision.

Unlike ReferenceState which builds pressure first and derives Exner, this type builds the Exner function π₀ first by discrete integration and then derives pressure and density from it. This matches CM1's approach where pi0 is the fundamental reference variable.

Fields

  • surface_pressure: Reference pressure at z=0 (Pa)
  • surface_potential_temperature: Reference potential temperature at z=0 (K)
  • standard_pressure: pˢᵗ for potential temperature definition (Pa)
  • pressure: Reference pressure field $p₀ = pˢᵗ π₀^{cᵖᵈ/Rᵈ}$ (derived from π₀)
  • density: Reference density field $ρ₀ = p₀/(Rᵈ T₀)$ (derived from π₀ and θᵣ)
  • exner_function: Reference Exner function π₀ (built by discrete integration)
source
Breeze.Thermodynamics.FlatauPolynomialType
FlatauPolynomial(
;
    ...
) -> Breeze.Thermodynamics.FlatauPolynomial
FlatauPolynomial(
    FT;
    liquid_coefficients,
    ice_coefficients,
    reference_temperature,
    minimum_temperature_offset
) -> Breeze.Thermodynamics.FlatauPolynomial

Construct a FlatauPolynomial saturation vapor pressure formulation: the eighth-order polynomial fits of Flatau et al. (1992) to the saturation vapor pressure over planar liquid and ice surfaces,

\[pᵛ⁺(T) = \sum_{n=0}^{8} aₙ (T - Tᵣ)^n ,\]

with reference_temperature $Tᵣ = 273.16$ K and the relative-error-norm coefficient sets (their Tables 3 and 4), which are the fits in operational use in WRF-family microphysics. The temperature argument is clamped below at $Tᵣ -$ minimum_temperature_offset (80 K), the fits' stated range of validity.

Compared to the default integrated Clausius–Clapeyron formulation the polynomial agrees to within 0.2 % (liquid, 233–313 K) while replacing a ^ and an exp with a branch-free Horner chain — approximately 70× cheaper per call on CPU Float64 and free of the FP64 transcendental penalty on GPUs. See ClausiusClapeyron and TetensFormula for the alternative formulations.

Example

using Breeze.Thermodynamicsconstants = ThermodynamicConstants(; saturation_vapor_pressure = FlatauPolynomial())

References

  • Flatau, P. J., Walko, R. L. and Cotton, W. R. (1992). Polynomial fits to saturation vapor pressure. Journal of Applied Meteorology 31, 1507–1513.
source
Breeze.Thermodynamics.IdealGasType
struct IdealGas{FT}

A struct representing an ideal gas with molar mass and specific heat capacity.

Fields

  • molar_mass: Molar mass of the gas in kg/mol
  • heat_capacity: Specific heat capacity at constant pressure in J/(kg·K)

Examples

using Breezedry_air = IdealGas(molar_mass=0.02897, heat_capacity=1005)# outputIdealGas{Float64}(molar_mass=0.02897, heat_capacity=1005.0)
source
Breeze.Thermodynamics.MixedPhaseEquilibriumType
MixedPhaseEquilibrium(; freezing_temperature=273.15, homogeneous_ice_nucleation_temperature=233.15)

Represents a mixed-phase equilibrium where both liquid and ice condensates are considered. The liquid fraction varies linearly with temperature between the freezing temperature and the homogeneous ice nucleation temperature.

source
Breeze.Thermodynamics.MoistureMassFractionsType
struct MoistureMassFractions{FT}

A struct representing the moisture mass fractions of a moist air parcel.

Fields

  • vapor: the mass fraction of vapor
  • liquid: the mass fraction of liquid
  • ice: the mass fraction of ice
source
Breeze.Thermodynamics.MoistureMassFractionsMethod
MoistureMassFractions(
    r::Breeze.Thermodynamics.MoistureMixingRatio
) -> Breeze.Thermodynamics.MoistureMassFractions

Convert MoistureMixingRatio to MoistureMassFractions.

Mass fractions are defined as mass of constituent per total mass:

\[q = r / (1 + rᵗ)\]

where $rᵗ$ is the total mixing ratio.

source
Breeze.Thermodynamics.MoistureMixingRatioMethod
MoistureMixingRatio(
    q::Breeze.Thermodynamics.MoistureMassFractions
) -> Breeze.Thermodynamics.MoistureMixingRatio

Convert MoistureMassFractions to MoistureMixingRatio.

Mixing ratios are defined as mass of constituent per mass of dry air:

\[r = q / (1 - qᵗ) = q / qᵈ\]

where $qᵗ$ is the total specific moisture and $qᵈ = 1 - qᵗ$ is the dry air mass fraction.

source
Breeze.Thermodynamics.ReferenceStateType
ReferenceState(
    grid;
    ...
) -> ReferenceState{_A, P, D, T, QV, QL, QI} where {_A, P<:(Field{Nothing, Nothing, Center, Nothing, G, I, D, T, B, Nothing} where {G, I, D, T, B}), D<:(Field{Nothing, Nothing, Center, Nothing, G, I, D, T, B, Nothing} where {G, I, D, T, B}), T<:(Field{Nothing, Nothing, Center, Nothing, G, I, D, T, B, Nothing} where {G, I, D, T, B}), QV<:(Oceananigans.Fields.ZeroField{_A, 3} where _A), QL<:(Oceananigans.Fields.ZeroField{_A, 3} where _A), QI<:(Oceananigans.Fields.ZeroField{_A, 3} where _A)}
ReferenceState(
    grid,
    constants;
    surface_pressure,
    potential_temperature,
    standard_pressure,
    discrete_hydrostatic_balance,
    vapor_mass_fraction,
    liquid_mass_fraction,
    ice_mass_fraction
) -> ReferenceState{_A, P, D, T, QV, QL, QI} where {_A, P<:(Field{Nothing, Nothing, Center, Nothing, G, I, D, T, B, Nothing} where {G, I, D, T, B}), D<:(Field{Nothing, Nothing, Center, Nothing, G, I, D, T, B, Nothing} where {G, I, D, T, B}), T<:(Field{Nothing, Nothing, Center, Nothing, G, I, D, T, B, Nothing} where {G, I, D, T, B}), QV<:(Oceananigans.Fields.ZeroField{_A, 3} where _A), QL<:(Oceananigans.Fields.ZeroField{_A, 3} where _A), QI<:(Oceananigans.Fields.ZeroField{_A, 3} where _A)}

Return a ReferenceState on grid, with ThermodynamicConstants constants that includes the hydrostatic reference pressure and reference density.

The reference state is initialized with a dry adiabatic temperature profile and the given moisture profiles (zero by default). The pressure and density are then computed by hydrostatic integration using the mixture gas constant $Rᵐ = qᵈ Rᵈ + qᵛ Rᵛ$ and the ideal gas law $ρ = p / (Rᵐ T)$.

Arguments

  • grid: The grid.
  • constants :: ThermodynamicConstants: By default, ThermodynamicConstants(eltype(grid)).

Keyword arguments

  • surface_pressure: By default, 101325.

  • potential_temperature: A constant value (default 288) or a function $θ(z)$ giving the potential temperature profile. When a constant is provided, closed-form adiabatic hydrostatic profiles are used. When a function is provided, the hydrostatic profiles are computed by numerical integration of $∂p/∂z = -g ρ$.

  • standard_pressure: Reference pressure for potential temperature ($pˢᵗ$). By default, 1e5.

  • discrete_hydrostatic_balance: If true, recompute the reference pressure from the reference density using discrete integration, so that ∂z(p_ref) + g * ℑz(ρ_ref) = 0 exactly at the discrete level. By default, false.

    Discrete vs continuous hydrostatic balance

    With discrete balance, reference subtraction becomes a no-op (the subtracted terms cancel to machine precision). For split-explicit compressible dynamics, continuous balance (default) is preferred: both the actual and reference states share similar $O(Δz^2)$ truncation errors that cancel in the perturbation PG, leaving only the tiny truncation error of the physical perturbation $∂(p - p_{ref})/∂z$.

  • vapor_mass_fraction: Initial qᵛ profile. Can be a Number, Function(z), or Field. Default: nothing (ZeroField).

  • liquid_mass_fraction: Initial qˡ profile. Default: nothing (ZeroField).

  • ice_mass_fraction: Initial qⁱ profile. Default: nothing (ZeroField).

Pass =0 to allocate an actual Field initialized to zero — required for later use with compute_reference_state! or set_to_mean!.

source
Breeze.Thermodynamics.TetensFormulaType
TetensFormula(; ...) -> Breeze.Thermodynamics.TetensFormula
TetensFormula(
    FT;
    reference_saturation_vapor_pressure,
    reference_temperature,
    liquid_coefficient,
    liquid_temperature_offset,
    ice_coefficient,
    ice_temperature_offset
) -> Breeze.Thermodynamics.TetensFormula

Construct a TetensFormula saturation vapor pressure formulation. Tetens's (1930) formula is an empirical relationship for the saturation vapor pressure,

\[pᵛ⁺(T) = pᵛ⁺ᵣ \exp \left( a \frac{T - Tᵣ}{T - δT} \right) ,\]

where $pᵛ⁺ᵣ$ is reference_saturation_vapor_pressure, $Tᵣ$ is reference_temperature, $a$ is an empirical coefficient, and $δT$ is a temperature offset.

See also the wikipedia article on "Tetens equation". Different coefficients are used for liquid water and ice surfaces. Default values for the liquid formula are from Monteith and Unsworth (2014), and default values for the ice formula are from Murray (1967):

Liquid water (T > 0°C):

  • liquid_coefficient: 17.27
  • liquid_temperature_offset: 35.85 K (corresponding to 237.3 K offset from 0°C)

Ice (T < 0°C):

  • ice_coefficient: 21.875
  • ice_temperature_offset: 7.65 K (corresponding to 265.5 K offset from 0°C)

References

  • Monteith, J. L. and Unsworth, M. H. (2014). Principles of Environmental Physics. 4th Edition (Academic Press).
  • Murray, F. W. (1967). On the computation of saturation vapor pressure. Journal of Applied Meteorology 6, 203–204.
  • Tetens, O. (1930). Über einige meteorologische Begriffe. Zeitschrift für Geophysik 6, 297–309.
  • Wikipedia: Tetens equation; https://en.wikipedia.org/wiki/Tetens_equation

Example

julia> using Breeze.Thermodynamicsjulia> tf = TetensFormula()TetensFormula{Float64}(pᵣ=610.0, Tᵣ=273.15, aˡ=17.27, δTˡ=35.85, aⁱ=21.875, δTⁱ=7.65)
source
Breeze.Thermodynamics.ThermodynamicConstantsType
ThermodynamicConstants(; ...) -> ThermodynamicConstants
ThermodynamicConstants(
    FT;
    molar_gas_constant,
    gravitational_acceleration,
    energy_reference_temperature,
    triple_point_temperature,
    triple_point_pressure,
    dry_air_molar_mass,
    dry_air_heat_capacity,
    vapor_molar_mass,
    vapor_heat_capacity,
    liquid,
    ice,
    saturation_vapor_pressure
) -> ThermodynamicConstants

Return ThermodynamicConstants with parameters that represent gaseous mixture of dry "air" and vapor, as well as condensed liquid and ice phases. The triple_point_temperature and triple_point_pressure may be combined with internal energy parameters for condensed phases to compute the vapor pressure at the boundary between vapor and a homogeneous sample of the condensed phase. The gravitational_acceleration parameter is included to compute ReferenceState quantities associated with hydrostatic balance.

source
Breeze.Thermodynamics.adiabatic_hydrostatic_densityMethod
adiabatic_hydrostatic_density(
    z,
    p₀,
    θ₀,
    pˢᵗ,
    constants
) -> Any

Compute the reference density at height z that associated with the reference pressure p₀, potential temperature θ₀, and standard pressure pˢᵗ. The reference density is defined as the density of dry air at the reference pressure and temperature.

source
Breeze.Thermodynamics.adiabatic_hydrostatic_pressureMethod
adiabatic_hydrostatic_pressure(
    z,
    p₀,
    θ₀,
    pˢᵗ,
    constants
) -> Any

Compute the reference pressure at height z that associated with the reference pressure p₀, potential temperature θ₀, and standard pressure pˢᵗ. The reference pressure is defined as the pressure of dry air at the reference pressure and temperature.

source
Breeze.Thermodynamics.adjustment_saturation_specific_humidityMethod
adjustment_saturation_specific_humidity(
    T,
    pᵣ,
    qᵗ,
    constants,
    surface
) -> Any

Compute the saturation specific humidity $qᵛ⁺$ for use in saturation adjustment, assuming saturated conditions where condensate is present.

This function always uses the saturated formula (equation 37 in paper by Pressel et al. 2015):

\[qᵛ⁺ = ϵᵈᵛ (1 - qᵗ) \frac{pᵛ⁺}{pᵣ - pᵛ⁺}\]

where $ϵᵈᵛ = Rᵈ / Rᵛ ≈ 0.622$.

Unlike equilibrium_saturation_specific_humidity, this function does not check whether the air is actually saturated. It is intended for use within the saturation adjustment iteration where we assume saturated conditions throughout.

source
Breeze.Thermodynamics.adjustment_saturation_specific_humidityMethod
adjustment_saturation_specific_humidity(
    T,
    pᵣ,
    qᵗ,
    constants,
    equilibrium::Breeze.Thermodynamics.AbstractPhaseEquilibrium
) -> Any

Compute the adjustment saturation specific humidity using a phase equilibrium model to determine the condensation surface based on temperature T.

source
Breeze.Thermodynamics.compute_hydrostatic_reference!Method
compute_hydrostatic_reference!(
    ref::ReferenceState,
    constants
)

Compute the hydrostatic reference pressure and density profiles from the temperature and moisture mass fraction profiles stored in ref.

The integration uses the mixture gas constant Rᵐ = qᵈ Rᵈ + qᵛ Rᵛ (where qᵈ = 1 - qᵛ - qˡ - qⁱ) and the ideal gas law ρ = p / (Rᵐ T).

source
Breeze.Thermodynamics.compute_reference_state!Method
compute_reference_state!(
    ref::ReferenceState,
    T̄,
    q̄ᵗ,
    constants
)

Convenience method that assumes all moisture is vapor (no condensate in the reference state). Equivalent to compute_reference_state!(reference_state, T̄, q̄ᵗ, 0, 0, constants).

source
Breeze.Thermodynamics.compute_reference_state!Method
compute_reference_state!(
    ref::ReferenceState,
    T̄,
    q̄ᵛ,
    q̄ˡ,
    q̄ⁱ,
    constants
)

Recompute the reference pressure and density profiles by setting the reference temperature to and moisture mass fractions to q̄ᵛ, q̄ˡ, q̄ⁱ, then integrating the hydrostatic equation using the mixture gas constant Rᵐ = qᵈ Rᵈ + qᵛ Rᵛ and ideal gas law ρ = p / (Rᵐ T).

, q̄ᵛ, q̄ˡ, q̄ⁱ can be Numbers, Function(z)s, or Fields.

This function is useful for:

  • Initialization: setting the reference state to match a non-constant-θ initial condition
  • Runtime: calling from a callback to keep the reference state close to the evolving mean state
source
Breeze.Thermodynamics.dewpoint_temperatureMethod
dewpoint_temperature(
    pᵛ,
    T,
    constants,
    surface,
    solver
) -> Any

Compute the dewpoint temperature $T⁺$ given the vapor pressure pᵛ, actual temperature T, thermodynamic constants, and condensation surface.

The dewpoint temperature is defined as the temperature at which the saturation vapor pressure equals the actual vapor pressure:

\[pᵛ⁺(T⁺) = pᵛ\]

This implicit equation is solved using secant iteration, which works with any saturation vapor pressure formulation.

If the air is saturated or supersaturated ($pᵛ ≥ pᵛ⁺(T)$), the dewpoint equals the actual temperature and T is returned.

Arguments

  • pᵛ: Vapor pressure (Pa)

  • T: Actual temperature (K), used as upper bound and first guess

  • constants: ThermodynamicConstants

  • surface: Surface type for saturation vapor pressure calculation

  • solver: Iterative solver controlling the secant iteration; the convergence criterion compares the vapor pressure residual against pᵛ. When omitted, defaults to SecantSolver(reltol=1e-4, abstol=0, maxiter=10).

source
Breeze.Thermodynamics.dewpoint_temperatureMethod
dewpoint_temperature(
    pᵛ,
    T,
    constants,
    equilibrium::Breeze.Thermodynamics.AbstractPhaseEquilibrium,
    solver
) -> Any

Compute the dewpoint temperature using a phase equilibrium model to determine the condensation surface based on temperature T.

source
Breeze.Thermodynamics.equilibrated_surfaceFunction
equilibrated_surface(phase_equilibrium::AbstractPhaseEquilibrium, T)

Return the appropriate surface type for computing saturation vapor pressure given the phase equilibrium model and temperature T.

source
Breeze.Thermodynamics.equilibrium_saturation_specific_humidityMethod
equilibrium_saturation_specific_humidity(
    T,
    p,
    qᵗ,
    constants,
    surface
) -> Any

Compute the equilibrium saturation specific humidity $qᵛ⁺$ for air at temperature T, reference pressure p, and total specific moisture qᵗ, over a given surface. The function returns the correct saturation specific humidity in both saturated and unsaturated conditions:

  • In saturated conditions ($qᵗ ≥ qᵛ⁺$), condensate is present and $qᵛ = qᵛ⁺$. The dry-air mass fraction is fixed by $qᵗ$ (since $qᵈ = 1 - qᵗ$), and the equation of state can be solved in closed form or $qᵛ⁺$, yielding equation (37) of Pressel et al. (2015):

    \[qᵛ⁺ = \frac{ϵᵈᵛ \, (1 - qᵗ) \, pᵛ⁺(T)}{p - pᵛ⁺(T)} ,\]

    where $ϵᵈᵛ ≡ Rᵈ / Rᵛ ≈ 0.622$.

  • In unsaturated conditions ($qᵗ < qᵛ⁺$), all moisture is vapor and $qᵛ = qᵗ$. The density is then $ρ = p / (Rᵐ T)$ with mixture gas constant $Rᵐ = (1 - qᵗ) Rᵈ + qᵗ Rᵛ$, and

    \[qᵛ⁺ = \frac{pᵛ⁺(T)}{ρ \, Rᵛ \, T} .\]

The function selects the branch by computing the unsaturated $qᵛ⁺$ and comparing with qᵗ. See also saturation_total_specific_moisture, which is the special case $qᵗ = qᵛ⁺$, and the Atmosphere Thermodynamics section of the documentation for a derivation.

source
Breeze.Thermodynamics.equilibrium_saturation_specific_humidityMethod
equilibrium_saturation_specific_humidity(
    T,
    pᵣ,
    qᵗ,
    constants,
    equilibrium::Breeze.Thermodynamics.AbstractPhaseEquilibrium
) -> Any

Compute the equilibrium saturation specific humidity using a phase equilibrium model to determine the condensation surface based on temperature T.

source
Breeze.Thermodynamics.ice_latent_heatMethod
ice_latent_heat(T, constants::ThermodynamicConstants) -> Any

Return the latent heat of sublimation (vapor → ice) at temperature T.

The latent heat varies linearly with temperature:

\[ℒⁱ(T) = ℒⁱᵣ + (cᵖᵛ - cⁱ)(T - Tᵣ)\]

where $ℒⁱᵣ$ is the reference latent heat at the energy reference temperature $Tᵣ$, $cᵖᵛ$ is the heat capacity of vapor, and $cⁱ$ is the heat capacity of ice.

source
Breeze.Thermodynamics.liquid_latent_heatMethod
liquid_latent_heat(
    T,
    constants::ThermodynamicConstants
) -> Any

Return the latent heat of vaporization (vapor → liquid) at temperature T.

The latent heat varies linearly with temperature:

\[ℒˡ(T) = ℒˡᵣ + (cᵖᵛ - cˡ)(T - Tᵣ)\]

where $ℒˡᵣ$ is the reference latent heat at the energy reference temperature $Tᵣ$, $cᵖᵛ$ is the heat capacity of vapor, and $cˡ$ is the heat capacity of liquid water.

source
Breeze.Thermodynamics.mixture_gas_constantMethod
mixture_gas_constant(
    q::Breeze.Thermodynamics.MoistureMassFractions,
    constants::ThermodynamicConstants
) -> Any

Return the gas constant of moist air mixture [in J/(kg K)] given the specific humidity q and thermodynamic parameters constants.

The mixture gas constant is calculated as a weighted average of the dry air and water vapor gas constants:

\[Rᵐ = qᵈ Rᵈ + qᵛ Rᵛ ,\]

where:

  • Rᵈ is the dry air gas constant,
  • Rᵛ is the water vapor gas constant,
  • qᵈ is the mass fraction of dry air, and
  • qᵛ is the mass fraction of water vapor.

Arguments

  • q: the moisture mass fractions (vapor, liquid, and ice)
  • constants: ThermodynamicConstants instance containing gas constants
source
Breeze.Thermodynamics.mixture_gas_constantMethod
mixture_gas_constant(
    r::Breeze.Thermodynamics.MoistureMixingRatio,
    constants::ThermodynamicConstants
) -> Any

Compute the gas constant of a moist air mixture given moisture mixing ratios.

Converts mixing ratios to mass fractions and calls mixture_gas_constant(q::MMF, constants).

source
Breeze.Thermodynamics.mixture_heat_capacityMethod
mixture_heat_capacity(
    q::Breeze.Thermodynamics.MoistureMassFractions,
    constants::ThermodynamicConstants
) -> Any

Compute the heat capacity of a mixture of dry air, vapor, liquid, and ice, where the mass fractions of vapor, liquid, and ice are given by q. The heat capacity of moist air is the weighted sum of its constituents:

\[cᵖᵐ = qᵈ cᵖᵈ + qᵛ cᵖᵛ + qˡ cˡ + qⁱ cⁱ ,\]

where qᵛ = q.vapor, qˡ = q.liquid, qⁱ = q.ice are the mass fractions of vapor, liquid, and ice constituents, respectively, and qᵈ = 1 - qᵛ - qˡ - qⁱ is the mass fraction of dry air. The heat capacities cᵖᵈ, cᵖᵛ, , cⁱ are the heat capacities of dry air, vapor, liquid, and ice at constant pressure, respectively. The liquid and ice phases are assumed to be incompressible.

source
Breeze.Thermodynamics.mixture_heat_capacityMethod
mixture_heat_capacity(
    r::Breeze.Thermodynamics.MoistureMixingRatio,
    constants::ThermodynamicConstants
) -> Any

Compute the heat capacity of a moist air mixture given moisture mixing ratios.

Converts mixing ratios to mass fractions and calls mixture_heat_capacity(q::MMF, constants).

source
Breeze.Thermodynamics.potential_temperature_from_temperatureMethod
potential_temperature_from_temperature(
    T,
    p,
    pˢᵗ,
    constants,
    qᵛ
) -> Any

Compute potential temperature from temperature and pressure.

This is a convenience function that constructs a LiquidIcePotentialTemperatureState with no condensate and computes potential temperature using the standard thermodynamic relations.

Arguments

  • T: Temperature [K]
  • p: Pressure [Pa]
  • constants: Thermodynamic constants

Additional Arguments

  • pˢᵗ: Standard pressure for potential temperature definition [Pa]
  • qᵛ: Specific humidity [kg/kg]
source
Breeze.Thermodynamics.pressure_balanced_densityMethod
pressure_balanced_density(
    ρ_background,
    θ_background,
    θ_initial
) -> Any

Return the density that keeps pressure unchanged when applying a potential-temperature perturbation at fixed composition.

pressure_balanced_density(ρ_background, θ_background, θ_initial) applies the dry-air / vapor-only relation, for which holding $ρ θ$ fixed avoids seeding an acoustic pressure perturbation.

For fixed-composition states with nonzero liquid or ice condensate, use pressure_balanced_density(ρ_background, θ_background, θ_initial, q, pᵣ, pˢᵗ, constants) instead. The condensate-aware method evaluates the full liquid-ice potential-temperature equation of state before balancing density.

Examples

using Breeze.Thermodynamics: pressure_balanced_densityρ_background = 1.0θ_background = 300.0θ_initial = 303.0pressure_balanced_density(ρ_background, θ_background, θ_initial)# output0.9900990099009901
source
Breeze.Thermodynamics.relative_humidityFunction
relative_humidity(T, ρ, qᵛ, constants) -> Any
relative_humidity(T, ρ, qᵛ, constants, surface) -> Any

Compute the relative humidity as the ratio of vapor pressure to saturation vapor pressure:

\[ℋ = pᵛ / pᵛ⁺ = qᵛ / qᵛ⁺\]

source
Breeze.Thermodynamics.saturation_specific_humidityMethod
saturation_specific_humidity(
    T,
    ρ,
    constants,
    surface
) -> Any

Compute the saturation specific humidity for a gas at temperature T, total density ρ, constantsdynamics, and over surface via:

\[qᵛ⁺ = pᵛ⁺ / (ρ Rᵛ T) ,\]

where $pᵛ⁺$ is the saturation_vapor_pressure over surface, $ρ$ is total density, and $Rᵛ$ is the specific gas constant for water vapor.

Examples

First we compute the saturation specific humidity over a liquid surface:

using Breezeusing Breeze.Thermodynamics: PlanarLiquidSurface, PlanarIceSurface, PlanarMixedPhaseSurfaceconstants = ThermodynamicConstants()T = 288.0 # Room temperature (K)p = 101325.0 # Mean sea-level pressureRᵈ = Breeze.Thermodynamics.dry_air_gas_constant(constants)q = zero(Breeze.Thermodynamics.MoistureMassFractions{Float64})ρ = Breeze.Thermodynamics.density(T, p, q, constants)qᵛ⁺ˡ = Breeze.Thermodynamics.saturation_specific_humidity(T, ρ, constants, PlanarLiquidSurface())# output0.010359995391195264

Note, this is slightly smaller than the saturation specific humidity over an ice surface:

julia> qᵛ⁺ˡ = Breeze.Thermodynamics.saturation_specific_humidity(T, ρ, constants, PlanarIceSurface())0.011945100768555072

If a medium contains a mixture of 40% water and 60% ice that has (somehow) acquired thermodynamic equilibrium, we can compute the saturation specific humidity over the mixed phase surface,

mixed_surface = PlanarMixedPhaseSurface(0.4)qᵛ⁺ᵐ = Breeze.Thermodynamics.saturation_specific_humidity(T, ρ, constants, mixed_surface)# output0.01128386068542303
source
Breeze.Thermodynamics.saturation_vapor_pressureMethod
saturation_vapor_pressure(
    T,
    constants::Breeze.Thermodynamics.ClausiusClapeyronThermodynamicConstants,
    surface
) -> Any

Compute the saturation vapor pressure $pᵛ⁺$ over a surface labeled $β$ (for example, a planar liquid surface, or curved ice surface) using the Clausius-Clapeyron relation,

\[𝖽pᵛ⁺ / 𝖽T = pᵛ⁺ ℒᵝ(T) / (Rᵛ T^2) ,\]

where the temperature-dependent latent heat of the surface is $ℒᵝ(T)$.

Using a model for the latent heat that is linear in temperature, eg

\[ℒᵝ = ℒᵝ₀ + Δcᵝ T,\]

where $ℒᵝ₀ ≡ ℒᵝ(T=0)$ is the latent heat at absolute zero and $Δcᵝ ≡ cᵖᵛ - cᵝ$ is the constant difference between the vapor specific heat and the specific heat of phase $β$.

Note that we typically parameterize the latent heat in terms of a reference temperature $T = Tᵣ$ that is well above absolute zero. In that case, the latent heat is written

\[ℒᵝ = ℒᵝᵣ + Δcᵝ (T - Tᵣ) \qquad \text{and} \qquad ℒᵝ₀ = ℒᵝᵣ - Δcᵝ Tᵣ .\]

Integrating the Clausius-Clapeyron relation with a temperature-linear latent heat model, from the triple point pressure and temperature $(pᵗʳ, Tᵗʳ)$ to pressure $pᵛ⁺$ and temperature $T$, we obtain

\[\log(pᵛ⁺ / pᵗʳ) = - ℒᵝ₀ / (Rᵛ T) + ℒᵝ₀ / (Rᵛ Tᵗʳ) + (Δcᵝ / Rᵛ) \log(T / Tᵗʳ) ,\]

which then becomes

\[pᵛ⁺(T) = pᵗʳ (T / Tᵗʳ)^{Δcᵝ / Rᵛ} \exp \left [ (1/Tᵗʳ - 1/T) ℒᵝ₀ / Rᵛ \right ] .\]

Note

Any reference values for pressure and temperature can be used in principle. The advantage of using reference values at the triple point is that the same values can then be used for both condensation (vapor → liquid) and deposition (vapor → ice).

source
Breeze.Thermodynamics.saturation_vapor_pressureMethod
saturation_vapor_pressure(
    T,
    constants::Breeze.Thermodynamics.FlatauPolynomialThermodynamicConstants,
    surface::Breeze.Thermodynamics.PlanarMixedPhaseSurface
) -> Any

Compute the saturation vapor pressure over a planar mixed-phase surface by linearly interpolating the liquid and ice Flatau polynomials by liquid_fraction.

source
Breeze.Thermodynamics.saturation_vapor_pressureMethod
saturation_vapor_pressure(
    T,
    constants::Breeze.Thermodynamics.FlatauPolynomialThermodynamicConstants,
    _::PlanarIceSurface
) -> Any

Compute the saturation vapor pressure over a planar ice surface from the Flatau et al. (1992) eighth-order polynomial in $T - Tᵣ$.

source
Breeze.Thermodynamics.saturation_vapor_pressureMethod
saturation_vapor_pressure(
    T,
    constants::Breeze.Thermodynamics.FlatauPolynomialThermodynamicConstants,
    _::PlanarLiquidSurface
) -> Any

Compute the saturation vapor pressure over a planar liquid surface from the Flatau et al. (1992) eighth-order polynomial in $T - Tᵣ$.

source
Breeze.Thermodynamics.saturation_vapor_pressureMethod
saturation_vapor_pressure(
    T,
    constants::Breeze.Thermodynamics.TetensFormulaThermodynamicConstants,
    surface::Breeze.Thermodynamics.PlanarMixedPhaseSurface
) -> Any

Compute the saturation vapor pressure over a mixed-phase surface by linearly interpolating between liquid and ice saturation vapor pressures based on the liquid fraction.

source
Breeze.Thermodynamics.saturation_vapor_pressureMethod
saturation_vapor_pressure(
    T,
    constants::Breeze.Thermodynamics.TetensFormulaThermodynamicConstants,
    _::PlanarIceSurface
) -> Any

Compute the saturation vapor pressure over a planar ice surface using Tetens' empirical formula with ice coefficients from Murray (1967):

\[pᵛ⁺(T) = pᵛ⁺ᵣ \exp \left( aⁱ \frac{T - Tᵣ}{T - δTⁱ} \right)\]

References

  • Murray, F. W. (1967). On the computation of saturation vapor pressure. Journal of Applied Meteorology 6, 203–204.
  • Tetens, O. (1930). Über einige meteorologische Begriffe. Zeitschrift für Geophysik 6, 297–309.
source
Breeze.Thermodynamics.saturation_vapor_pressureMethod
saturation_vapor_pressure(
    T,
    constants::Breeze.Thermodynamics.TetensFormulaThermodynamicConstants,
    _::PlanarLiquidSurface
) -> Any

Compute the saturation vapor pressure over a planar liquid surface using Tetens' empirical formula:

\[pᵛ⁺(T) = pᵛ⁺ᵣ \exp \left( aˡ \frac{T - Tᵣ}{T - δTˡ} \right)\]

source
Breeze.Thermodynamics.supersaturationMethod
supersaturation(
    T,
    ρ,
    q::Breeze.Thermodynamics.MoistureMassFractions,
    constants,
    surface
) -> Any

Compute the supersaturation $𝒮 = pᵛ/pᵛ⁺ - 1$ over a given surface.

  • $𝒮 < 0$ indicates subsaturation (evaporation conditions)
  • $𝒮 = 0$ indicates saturation (equilibrium)
  • $𝒮 > 0$ indicates supersaturation (condensation conditions)

Arguments

  • T: Temperature
  • ρ: Total air density
  • q: MoistureMassFractions containing vapor, liquid, and ice mass fractions
  • constants: ThermodynamicConstants
  • surface: Surface type (e.g., PlanarLiquidSurface(), PlanarIceSurface())
source
Breeze.Thermodynamics.surface_densityMethod
surface_density(p₀, θ₀, pˢᵗ, constants)

Compute the surface air density from surface pressure p₀, potential temperature θ₀, standard pressure pˢᵗ, and thermodynamic constants using the ideal gas law for dry air.

The temperature is computed from potential temperature using the Exner function: T₀ = Π₀ * θ₀ where Π₀ = (p₀ / pˢᵗ)^(Rᵈ/cᵖᵈ).

source
Breeze.Thermodynamics.surface_densityMethod
surface_density(p₀, T₀, constants)

Compute the surface air density from surface pressure p₀, surface temperature T₀, and thermodynamic constants using the ideal gas law for dry air.

source
Breeze.Thermodynamics.temperature_from_potential_temperatureMethod
temperature_from_potential_temperature(
    θ,
    p,
    pˢᵗ,
    constants,
    qᵛ
) -> Any

Compute temperature from potential temperature and pressure.

This is a convenience function that constructs a LiquidIcePotentialTemperatureState with no condensate and computes temperature using the standard thermodynamic relations.

Arguments

  • θ: Potential temperature [K]
  • p: Pressure [Pa]
  • constants: Thermodynamic constants

Additional Arguments

  • pˢᵗ: Standard pressure for potential temperature definition [Pa]
  • qᵛ: Specific humidity [kg/kg]
source

TimeSteppers

Breeze.TimeSteppersModule

TimeSteppers module for Breeze.jl

Provides time stepping schemes for AtmosphereModel, including:

  • SSPRungeKutta3: Standard SSP RK3 scheme for explicit time stepping
  • AcousticRungeKutta3: Wicker-Skamarock RK3 with acoustic substepping for compressible dynamics
source
Breeze.TimeSteppers.AcousticRungeKutta3Type
struct AcousticRungeKutta3{FT, U0, TG, TI, AS} <: Oceananigans.TimeSteppers.AbstractTimeStepper

Wicker–Skamarock third-order Runge–Kutta time stepper with linearized acoustic substepping for fully compressible dynamics. Stage fractions $β = (1/3, 1/2, 1)$. Each stage:

  1. Re-evaluates slow tendencies (advection + Coriolis + closure + forcing only — PGF and buoyancy are handled inside the substep loop in linearized form).
  2. Runs an inner substep loop that evolves linearized acoustic perturbations from the RK stage-entry state, initialized with a rewind term so every stage still advances from the outer-step-start prognostic state.

The acoustic substep loop is in acoustic_rk3_substep_loop!; see AcousticSubstepper for the substepper's storage and parameters.

Fields

  • β₁, β₂, β₃: Stage fractions (1/3, 1/2, 1).
  • U⁰: Storage for state at the beginning of the outer time-step.
  • Gⁿ: Slow-tendency fields, recomputed each stage.
  • implicit_solver: Optional implicit solver for diffusion.
  • substepper: AcousticSubstepper for the linearized acoustic substep loop.

References

Wicker, L. J. & Skamarock, W. C. (2002). Time-splitting methods for elastic models using forward time schemes. MWR 130, 2088–2097.

source
Breeze.TimeSteppers.AcousticRungeKutta3Method
AcousticRungeKutta3(grid, prognostic_fields;
                    dynamics,
                    implicit_solver = nothing,
                    Gⁿ = map(similar, prognostic_fields),
                    U⁰ = map(similar, prognostic_fields))

Construct an AcousticRungeKutta3 time stepper for fully compressible dynamics.

Gⁿ and U⁰ may be supplied to alias another stepper's tendency storage instead of allocating fresh fields (used by the native-stepper adiabatic-balance twin).

source
Breeze.TimeSteppers.SSPRungeKutta3Type
struct SSPRungeKutta3{FT, U0, TG, TI} <: Oceananigans.TimeSteppers.AbstractTimeStepper

A strong stability preserving (SSP) third-order Runge-Kutta time stepper.

This time stepper uses the classic SSP RK3 scheme (Shu-Osher 2006 form):

\[\begin{align*} u^{(1)} &= u^{(0)} + Δt \, G(u^{(0)}) \\ u^{(2)} &= \frac{3}{4} u^{(0)} + \frac{1}{4} u^{(1)} + \frac{1}{4} Δt \, G(u^{(1)}) \\ u^{(3)} &= \frac{1}{3} u^{(0)} + \frac{2}{3} u^{(2)} + \frac{2}{3} Δt \, G(u^{(2)}) \end{align*}\]

where $G$ above is the right-hand-side, e.g., $\partial_t u = G(u)$.

Each stage can be written in the form:

\[u^{(m)} = (1 - α) u^{(0)} + α \left[u^{(m-1)} + Δt \, G(u^{(m-1)}) \right]\]

with $α = 1, 1/4, 2/3$ for stages 1, 2, 3 respectively.

This scheme has CFL coefficient equal to 1 and it is TVD (total variation diminishing).

Fields

  • α¹, α², α³: Stage coefficients (1, 1/4, 2/3)
  • U⁰: Storage for state at beginning of time step
  • Gⁿ: Tendency fields at current stage
  • implicit_solver: Optional implicit solver for diffusion
source
Breeze.TimeSteppers.SSPRungeKutta3Method
SSPRungeKutta3(
    grid,
    prognostic_fields;
    dynamics,
    implicit_solver,
    Gⁿ,
    U⁰
) -> SSPRungeKutta3{_A, _B, _C, Nothing} where {_A, _B, _C}

Construct an SSPRungeKutta3 on grid with prognostic_fields as described by Shu and Osher (1988).

Keyword Arguments

  • implicit_solver: Optional implicit solver for diffusion. Default: nothing
  • Gⁿ: Tendency fields at current stage. Default: similar to prognostic_fields
  • U⁰: Storage for the state at the beginning of the step. Default: similar to prognostic_fields. Accepting it as a keyword lets callers (e.g. the adiabatic-balance twin) alias another stepper's tendency storage instead of allocating fresh fields.

References

Shu, C.-W., & Osher, S. (1988). Efficient implementation of essentially non-oscillatory shock-capturing schemes. Journal of Computational Physics, 77(2), 439-471.

source
Breeze.TimeSteppers.ssp_rk3_substep!Method
ssp_rk3_substep!(model, Δt, α)

Apply an SSP RK3 substep with coefficient $α$:

\[u^{(m)} = (1 - α) u^{(0)} + α \left[ u^{(m-1)} + Δt \, G \right]\]

where $u^{(0)}$ is stored in the time stepper, $u^{(m-1)}$ is the current field value, and $G$ is the current tendency.

source

TurbulenceClosures

VerticalGrids

Breeze.VerticalGrids.PiecewiseStretchedDiscretizationType
PiecewiseStretchedDiscretization(; z, Δz)

Construct a stretched vertical grid where the spacing varies piecewise-linearly between breakpoints. The grid spacing is specified at breakpoint heights z, and linearly interpolated between them.

Between breakpoints where Δz values are equal, the grid is uniform. Where they differ, the spacing transitions linearly.

The result behaves as a vector of face positions and can be passed directly to RectilinearGrid as a coordinate argument.

Keyword Arguments

  • z: sorted vector of breakpoint heights (length ≥ 2)
  • Δz: vector of grid spacings at each breakpoint (same length as z, all positive)

Examples

A three-region grid with uniform fine spacing, a linear transition, and uniform coarse spacing (as used for tropical cyclone simulations):

z = PiecewiseStretchedDiscretization(    z  = [0, 1000, 3500, 28000],    Δz = [62.5, 62.5, 2000, 2000])Nz = length(z) - 1grid = RectilinearGrid(arch; size=(Nx, Ny, Nz), x=(0, Lx), y=(0, Ly), z)

A four-region grid for deep convection (fine near surface, transition to moderate, uniform through the troposphere, then stretched to the model top):

z = PiecewiseStretchedDiscretization(    z  = [0, 1275, 5100, 18000, 27000],    Δz = [50, 50, 100, 100, 300])
source

BreezeRRTMGPExt

BreezeCloudMicrophysicsExt

Private API

Advection

AnelasticEquations

Breeze.AtmosphereModels.buoyancy_forceᶜᶜᶜMethod
buoyancy_forceᶜᶜᶜ(
    i,
    j,
    k,
    grid,
    dynamics::AnelasticDynamics,
    temperature,
    specific_prognostic_moisture,
    microphysics,
    microphysical_fields,
    constants
) -> Any

Compute the buoyancy force density for anelastic dynamics at cell center (i, j, k).

The anelastic buoyancy force is the gravitational force on the density anomaly:

\[-g ρ' = -g (ρ - ρ_r)\]

where $ρ = p_r / (R^m T)$ is the in-situ density from the ideal gas law, and $ρ_r = p_r / (R^m_r T_r)$ is the reference density. Substituting:

\[\rho' = \frac{p_r}{R^m T} - \frac{p_r}{R^m_r T_r} = \frac{p_r}{R^m_r T_r} \left( \frac{R^m_r T_r}{R^m T} - 1 \right) = \rho_r \left( \frac{R^m_r T_r}{R^m T} - 1 \right)\]

This "perturbation form" avoids subtracting two large, nearly-equal numbers ($p_r / (R^m T) - ρ_r$), which causes catastrophic cancellation when $T ≈ T_r$. Instead, the ratio $R^m_r T_r / (R^m T)$ is close to 1, and the subtraction of 1 preserves relative precision.

Here, $R^m = q^d R^d + q^v R^v$ is the mixture gas constant for the current moisture state and $R^m_r$ is the mixture gas constant for the reference moisture state.

source
Breeze.AtmosphereModels.default_drag_surface_temperatureMethod
default_drag_surface_temperature(
    dynamics::AnelasticDynamics,
    grid,
    constants
) -> Any

Default surface temperature for BulkDrag under AnelasticDynamics: the reference-state surface temperature, recovered from the reference potential temperature via the surface Exner function $T₀ = (p₀/pˢᵗ)^{Rᵈ/cᵖᵈ}\,θ₀$.

Used only when the user constructs BulkDrag without an explicit surface_temperature. The result is a horizontally uniform scalar.

source
Breeze.AtmosphereModels.default_dynamicsMethod
default_dynamics(
    grid,
    constants
) -> AnelasticDynamics{R, Nothing} where R<:(ReferenceState{_A, P, D, T, QV, QL, QI} where {_A, P<:(Field{Nothing, Nothing, Center, Nothing, G, I, D, T, B, Nothing} where {G, I, D, T, B}), D<:(Field{Nothing, Nothing, Center, Nothing, G, I, D, T, B, Nothing} where {G, I, D, T, B}), T<:(Field{Nothing, Nothing, Center, Nothing, G, I, D, T, B, Nothing} where {G, I, D, T, B}), QV<:(Oceananigans.Fields.ZeroField{_A, 3} where _A), QL<:(Oceananigans.Fields.ZeroField{_A, 3} where _A), QI<:(Oceananigans.Fields.ZeroField{_A, 3} where _A)})

Construct a "stub" AnelasticDynamics with just the reference_state. The pressure anomaly field is materialized later in the model constructor.

source
Breeze.AtmosphereModels.dynamics_densityMethod
dynamics_density(dynamics::AnelasticDynamics) -> Any

Return the reference density field for AnelasticDynamics.

For anelastic models, the dynamics density is the time-independent reference state density $ρᵣ(z)$.

source
Breeze.AtmosphereModels.dynamics_pressureMethod
dynamics_pressure(dynamics::AnelasticDynamics) -> Any

Return the dynamics pressure field for AnelasticDynamics, in Pa.

For anelastic models, this is the time-independent hydrostatic reference state pressure $pᵣ(z)$.

source
Breeze.AtmosphereModels.make_pressure_correction!Method
make_pressure_correction!(
    model::AtmosphereModel{<:AnelasticDynamics},
    Δt
)

Update the predictor momentum $(ρu, ρv, ρw)$ with the non-hydrostatic pressure via

\[(\rho\boldsymbol{u})^{n+1} = (\rho\boldsymbol{u})^n - \Delta t \, \rho_r \boldsymbol{\nabla} \left( \alpha_r p_{nh} \right)\]

source
Breeze.AtmosphereModels.materialize_dynamicsMethod
materialize_dynamics(
    dynamics::AnelasticDynamics,
    grid,
    boundary_conditions,
    thermodynamic_constants
) -> AnelasticDynamics{_A, P} where {_A, P<:(Field{Center, Center, Center, Nothing, G, I, D, T, B, Nothing} where {G, I, D, T, B})}

Materialize a stub AnelasticDynamics into a full dynamics object with the pressure anomaly field.

source
Breeze.AtmosphereModels.pressure_anomalyMethod
pressure_anomaly(dynamics::AnelasticDynamics) -> Any

Return the non-hydrostatic pressure anomaly for AnelasticDynamics, in Pa.

Kinematic pressure versus pressure

The internal field stores the kinematic pressure anomaly, i.e., $p' / ρᵣ$ (in m²/s²); this function returns $p'$ in Pa.

source
Breeze.AtmosphereModels.total_pressureMethod
total_pressure(dynamics::AnelasticDynamics) -> Any

Return the total pressure for AnelasticDynamics, in Pa. That is $p = p̄ + p'$, where $p̄$ is the hydrostatic reference pressure and $p'$ is the non-hydrostatic pressure anomaly.

source

AtmosphereModels

Breeze.AtmosphereModels.DefaultTimeSteppingType
struct DefaultTimeStepping

Sentinel for AdiabaticBalancer's default time_stepping: the fully-explicit twin for CompressibleDynamics, and the native scheme for solvers without a separable time discretization (e.g. AnelasticDynamics). It lets the default avoid naming a concrete time discretization, whose type lives in a submodule loaded after AtmosphereModels.

source
Breeze.AtmosphereModels.adiabatic_balance_twinFunction
adiabatic_balance_twin(
    model::AtmosphereModel
) -> Union{AtmosphereModel{_A, Frm, _B, _C, _D, Clk, _E, Mom, Moi, Nothing, _F, _G, _H, Trc, Adv, _I, Frc, Nothing, Cnd, Nothing, _J, Nothing} where {_A, Frm<:(LiquidIcePotentialTemperatureFormulation{F} where F<:Field), _B, _C, _D, Clk<:(Clock{Float64, _A, Float64, Int64, Int64} where _A), _E, Mom<:NamedTuple, Moi<:Field, _F, _G, _H, Trc<:NamedTuple, Adv<:NamedTuple, _I, Frc<:NamedTuple, Cnd<:(NamedTuple{(:qᵛ,), <:Tuple{Any}}), _J}, AtmosphereModel{_A, Frm, _B, _C, _D, Clk, _E, Mom, Moi, Nothing, _F, _G, _H, Trc, Adv, _I, Frc, Nothing, Cnd, Nothing, _J, Nothing} where {_A, Frm<:(StaticEnergyFormulation{E} where E<:Field), _B, _C, _D, Clk<:(Clock{Float64, _A, Float64, Int64, Int64} where _A), _E, Mom<:NamedTuple, Moi<:Field, _F, _G, _H, Trc<:NamedTuple, Adv<:NamedTuple, _I, Frc<:NamedTuple, Cnd<:(NamedTuple{(:qᵛ,), <:Tuple{Any}}), _J}}
adiabatic_balance_twin(
    model::AtmosphereModel,
    balancer::AdiabaticBalancer
) -> Union{AtmosphereModel{_A, Frm, _B, _C, _D, Clk, _E, Mom, Moi, Nothing, _F, _G, _H, Trc, Adv, _I, Frc, Nothing, Cnd, Nothing, _J, Nothing} where {_A, Frm<:(LiquidIcePotentialTemperatureFormulation{F} where F<:Field), _B, _C, _D, Clk<:(Clock{Float64, _A, Float64, Int64, Int64} where _A), _E, Mom<:NamedTuple, Moi<:Field, _F, _G, _H, Trc<:NamedTuple, Adv<:NamedTuple, _I, Frc<:NamedTuple, Cnd<:(NamedTuple{(:qᵛ,), <:Tuple{Any}}), _J}, AtmosphereModel{_A, Frm, _B, _C, _D, Clk, _E, Mom, Moi, Nothing, _F, _G, _H, Trc, Adv, _I, Frc, Nothing, Cnd, Nothing, _J, Nothing} where {_A, Frm<:(StaticEnergyFormulation{E} where E<:Field), _B, _C, _D, Clk<:(Clock{Float64, _A, Float64, Int64, Int64} where _A), _E, Mom<:NamedTuple, Moi<:Field, _F, _G, _H, Trc<:NamedTuple, Adv<:NamedTuple, _I, Frc<:NamedTuple, Cnd<:(NamedTuple{(:qᵛ,), <:Tuple{Any}}), _J}}

Build a stripped adiabatic twin of model that SHARES all field memory (momentum, velocities, densities, ρθ, moisture, tracers, temperature, pressure solver, dynamics fields) and steps it in place. Every prognostic scalar — momentum, ρθ/ρe, moisture, and tracers — is rewrapped with its surface fluxes stripped to no-flux (see adiabatic_scalar_bcs), sharing the production data so no memory is reallocated. The twin's dynamics comes from adiabatic_twin_dynamics (per balancer.time_stepping); microphysics, closure, the implicit diffusion solver, the sponge, and forcing — all dissipative/irreversible — are removed; the time stepper's Gⁿ/U⁰ tendency storage aliases the production stepper's same-named arrays (moisture key re-mapped from the microphysics name, e.g. :ρqᵉ, to the moistureless :ρqᵛ); and a fresh Clock is used so the balance's clock reset does not touch the production clock.

source
Breeze.AtmosphereModels.adiabatic_scalar_bcsFunction
adiabatic_scalar_bcs(bcs)

Return a copy of the prognostic-scalar FieldBoundaryConditions bcs with every surface flux replaced by a no-flux condition, leaving all other (dynamical) boundary conditions untouched. Applied to both the thermodynamic density (bulk sensible-heat / energy / θ flux) and the moisture density (vapor flux) to strip surface sources from the adiabatic initialization twin, so its symmetric forward/backward excursion stays pure, reversible dynamics (see balance_adiabatically!). Extended by the BoundaryConditions module, which owns the flux BC types.

source
Breeze.AtmosphereModels.adiabatic_twin_dynamicsMethod
adiabatic_twin_dynamics(
    dynamics,
    time_stepping
) -> CompressibleDynamics{ExplicitTimeStepping}

Return the dynamics for the adiabatic-balance twin, given the production dynamics and the requested time_stepping. The generic fallback reuses dynamics unchanged — correct for solvers without a separable time discretization (e.g. AnelasticDynamics) and for any future solver, keeping the balance solver-agnostic. CompressibleDynamics extends this to swap the time discretization (sponge always stripped, as it is irreversible).

source
Breeze.AtmosphereModels.adjust_thermodynamic_stateMethod
adjust_thermodynamic_state(
    state,
    scheme::Nothing,
    thermo
) -> Any

Adjust the thermodynamic state according to the scheme. For example, if scheme isa SaturationAdjustment, then this function will adjust and return a new thermodynamic state given the specifications of the saturation adjustment scheme.

If a scheme is non-adjusting, we just return state.

source
Breeze.AtmosphereModels.advecting_vertical_velocityMethod
advecting_vertical_velocity(dynamics, velocities)

Return the vertical velocity that advects momentum through the grid's coordinate surfaces: the Cartesian velocities.w on height-coordinate grids, and the contravariant vertical velocity on terrain-following grids (mirroring advecting_momentum, whose vertical component is the contravariant momentum). The adaptive-implicit vertical-advection split must partition this velocity on both the explicit (flux-scaling) and implicit (tridiagonal) sides, so it stays consistent with the momentum flux divergence.

source
Breeze.AtmosphereModels.boundary_conditions_reference_stateMethod
boundary_conditions_reference_state(dynamics, grid, thermodynamic_constants)

Return a reference state with pressure, density, and standard_pressure fields suitable for constructing boundary-condition diagnostics (e.g. virtual potential temperature for stability-dependent bulk fluxes).

Boundary conditions are materialized before materialize_dynamics runs, so this hook lets each dynamics type decide what to expose at that point. The default returns dynamics.reference_state, which works for dynamics where the user constructs a fully-built reference state up front (e.g. AnelasticDynamics).

source
Breeze.AtmosphereModels.cloud_ice_effective_radiusMethod
cloud_ice_effective_radius(
    i,
    j,
    k,
    grid,
    effective_radius_model::ConstantRadiusParticles,
    args...
) -> Any

Return the effective radius of cloud ice particles in meters.

This function dispatches on the effective_radius_model argument. The default implementation for ConstantRadiusParticles returns a constant value.

Microphysics schemes can extend this function to provide diagnosed effective radii based on cloud properties.

source
Breeze.AtmosphereModels.cloud_liquid_effective_radiusMethod
cloud_liquid_effective_radius(
    i,
    j,
    k,
    grid,
    effective_radius_model::ConstantRadiusParticles,
    args...
) -> Any

Return the effective radius of cloud liquid droplets in meters.

This function dispatches on the effective_radius_model argument. The default implementation for ConstantRadiusParticles returns a constant value.

Microphysics schemes can extend this function to provide diagnosed effective radii based on cloud properties.

source
Breeze.AtmosphereModels.compute_auxiliary_dynamics_variables!Method
compute_auxiliary_dynamics_variables!(model)

Compute auxiliary (diagnostic) variables specific to the dynamics formulation.

For anelastic dynamics, this is a no-op (pressure is computed during time-stepping via the pressure Poisson equation).

For compressible dynamics, this computes the pressure field from the equation of state:

\[p = ρ R^m T\]

where $R^m$ is the mixture gas constant.

source
Breeze.AtmosphereModels.compute_auxiliary_variables!Method
compute_auxiliary_variables!(model)

Compute auxiliary model variables:

  • velocities from momentum and density (eg $u = ρu / ρ$)

  • thermodynamic variables from the prognostic thermodynamic state,

    • temperature $T$, possibly involving saturation adjustment
    • specific thermodynamic variable ($e = ρe / ρ$ or $θ = ρθ / ρ$)
    • moisture mass fraction $qᵗ = ρqᵗ / ρ$
source
Breeze.AtmosphereModels.compute_dynamics_tendency!Method
compute_dynamics_tendency!(model)

Compute tendencies for dynamics-specific prognostic fields.

For anelastic dynamics, this is a no-op (no prognostic density). For compressible dynamics, this computes the density tendency from the continuity equation:

\[\partial_t \rho = -\boldsymbol{\nabla \cdot \,} (\rho \boldsymbol{u})\]

source
Breeze.AtmosphereModels.condensate_field_namesMethod
condensate_field_names(microphysics) -> Tuple{}

Return the names of the prognostic microphysical fields that carry condensate mass (condensate and precipitation densities), excluding number-concentration fields.

This is the subset of prognostic_field_names that, together with the moisture density, is summed by total_condensate_density to form the total condensate mass per unit volume. It defaults to all prognostic fields; schemes with prognostic number concentrations (e.g. two-moment) override it to drop the ρnˣ fields.

source
Breeze.AtmosphereModels.correction_moisture_fieldsMethod
correction_moisture_fields(
    microphysics,
    microphysical_fields
) -> Tuple{Any}

Return a tuple of Field objects for density-weighted prognostic moisture mass fields that participate in the negative-moisture correction, ordered from heaviest hydrometeor to lightest.

Each field borrows from the next in the chain. The lightest field borrows from the moisture prognostic (vapor or equilibrium moisture, stored in model.moisture_density). Remaining vapor deficits are fixed by vertical borrowing when enabled.

Default: empty tuple (no correction).

source
Breeze.AtmosphereModels.correction_number_fieldsMethod
correction_number_fields(
    microphysics,
    microphysical_fields
) -> Tuple{Any, Any, Any}

Return a tuple of Field objects for density-weighted number concentration fields that should be clamped to non-negative after advection.

Number concentrations can become negative because the advection scheme might not be positive-definite. Unlike mass fields (which use borrowing to preserve conservation), number concentrations are simply zeroed since there is no meaningful conservation constraint for droplet number.

Only called for microphysics whose categories subtype AbstractNumberConcentrationCategories.

Default: empty tuple (no number fields to clamp).

source
Breeze.AtmosphereModels.correction_number_mass_pairsMethod
correction_number_mass_pairs(
    microphysics,
    microphysical_fields
) -> Tuple{Tuple{Any, Any}, Tuple{Any, Any}}

Return a tuple of (number_field, mass_field) pairs for number concentration consistency. After species borrowing, any number field whose corresponding mass field is non-positive is zeroed to avoid unphysical states (e.g., finite droplet number with zero mass).

Only called for microphysics whose categories subtype AbstractNumberConcentrationCategories.

Default: empty tuple (no number fields to correct).

source
Breeze.AtmosphereModels.default_drag_surface_temperatureMethod
default_drag_surface_temperature(dynamics, grid, thermodynamic_constants)

Return a default surface temperature for BulkDrag when the user has not supplied one. Dispatched on the dynamics type because the notion of a "default" surface temperature depends on what reference structure the dynamics carries: anelastic has a full reference profile whose surface value is well-defined; compressible has no equivalent up-front surface temperature and therefore requires the user to provide one explicitly.

The default (no method) throws an informative error. Each dynamics type extends this hook.

source
Breeze.AtmosphereModels.default_timestepperMethod
default_timestepper(dynamics) -> Symbol

Return the default timestepper symbol for the given dynamics.

For anelastic dynamics or compressible dynamics with explicit timestepping, returns :SSPRungeKutta3. For compressible dynamics with acoustic substepping, returns :AcousticRungeKutta3.

source
Breeze.AtmosphereModels.diagnose_thermodynamic_stateFunction
diagnose_thermodynamic_state(i, j, k, grid, formulation, dynamics, q)

Diagnose the thermodynamic state at grid point (i, j, k) from the given formulation, dynamics, and pre-computed moisture mass fractions q.

Moisture mass fractions computation

This function does not compute moisture fractions internally to avoid circular dependencies. The caller is responsible for computing q = grid_moisture_fractions(...) before passing q to this function.

source
Breeze.AtmosphereModels.dynamics_prognostic_fieldsMethod
dynamics_prognostic_fields(dynamics)

Return a NamedTuple of prognostic fields specific to the dynamics formulation.

For anelastic dynamics, returns an empty NamedTuple. For compressible dynamics, returns (ρ=density_field,).

source
Breeze.AtmosphereModels.dynamics_reference_stateMethod
dynamics_reference_state(dynamics)

Return the dynamics' reference state (an anelastic ReferenceState or a split-explicit ExnerReferenceState), or nothing if the dynamics carries none. Dispatched so that reset_reference_state! needn't reach into fields by name.

source
Breeze.AtmosphereModels.establish_densities!Method
establish_densities!(model, total_density_given, dry_density_given)

Mid-set! hook (run after density + moisture are set, before the thermodynamic variable and velocities) that makes the dry density ρᵈ and the diagnosed total density ρ mutually consistent and available to the phase-2 kernels. The two density-input modes need different computations:

  • total_density_given (): the field holds the total ρ (placeholder); split it into the total-density field and back out ρᵈ = ρ − Σρqˣ (the moisture partial densities were already weighted by the total).
  • dry_density_given (:ρᵈ): the field holds ρᵈ; recover the total ρ = ρᵈ/qᵈ (with qᵈ = 1 − qᵗ, taking the moisture into account) and (re)weight the moisture partial densities ρqˣ = ρ·qˣ.
  • neither: diagnose ρ = ρᵈ + Σρqˣ from the existing fields.

No-op by default (single-density formulations like anelastic, where total_density === dynamics_density); CompressibleModel overrides it.

source
Breeze.AtmosphereModels.extract_microphysical_prognosticsMethod
extract_microphysical_prognostics(
    i,
    j,
    k,
    microphysics,
    μ_fields
) -> NamedTuple

Extract prognostic microphysical variables at grid point (i, j, k) into a NamedTuple of scalar values.

Uses prognostic_field_names to determine which fields to extract. The result is a NamedTuple with density-weighted values (e.g., (ρqᶜˡ=..., ρqʳ=...)).

This function enables a generic grid-indexed microphysical_state that extracts prognostics and delegates to the gridless version.

source
Breeze.AtmosphereModels.fix_negative_moisture!Method
fix_negative_moisture!(model)

Fix negative moisture mixing ratios produced by the advection operator.

Operates in one or two phases depending on the correction scheme:

  1. Species borrowing (SpeciesBorrowing, optional): at each grid cell, negative hydrometeors borrow from lighter species (rain <- cloud <- vapor).
  2. Vertical borrowing (VerticalBorrowing, optional): negative vapor is redistributed vertically within each column (top->bottom sweep, then one bottom->top step).

For microphysics with number concentrations (categories subtying AbstractNumberConcentrationCategories), orphaned number concentrations are zeroed and negatives are clamped after mass borrowing.

The correction is mass-conserving at each level for species borrowing and column-integrated for vertical borrowing. No energy adjustment is needed because Breeze's thermodynamic prognostics are moist-conserved variables.

The borrowing chain is defined by correction_moisture_fields, which microphysics schemes extend to specify their prognostic mass fields.

source
Breeze.AtmosphereModels.grid_microphysical_stateMethod
grid_microphysical_state(i, j, k, grid, microphysics, μ_fields, ρ, 𝒰, velocities)

Build an AbstractMicrophysicalState (ℳ) at grid point (i, j, k).

This is the grid-indexed wrapper that:

  1. Extracts prognostic values from μ_fields via extract_microphysical_prognostics
  2. Calls the gridless microphysical_state(microphysics, ρ, μ, 𝒰, velocities)

Microphysics schemes should implement the gridless version, not this one.

Arguments

  • i, j, k: Grid indices
  • grid: The computational grid
  • microphysics: The microphysics scheme
  • μ_fields: NamedTuple of microphysical fields
  • ρ: Local density (scalar)
  • 𝒰: Thermodynamic state
  • velocities: Velocity fields $(u, v, w)$. Velocities are interpolated to cell centers for use by microphysics schemes (e.g., aerosol activation uses vertical velocity).

Returns

An AbstractMicrophysicalState subtype containing the local microphysical variables.

See also microphysical_tendency, AbstractMicrophysicalState.

source
Breeze.AtmosphereModels.initialize_model_thermodynamics!Method
initialize_model_thermodynamics!(model)

Initialize the thermodynamic state for a newly constructed model. For anelastic dynamics, sets initial θ to the reference potential temperature. For compressible dynamics, no default initialization is performed.

source
Breeze.AtmosphereModels.materialize_dynamicsFunction
materialize_dynamics(dynamics_stub, grid, boundary_conditions, thermodynamic_constants, microphysics=nothing)

Materialize a dynamics stub into a complete dynamics object with all required fields.

The microphysics argument is optional and used by dynamics types that need to know the microphysics scheme to create appropriate prognostic state (e.g., ParcelDynamics).

source
Breeze.AtmosphereModels.materialize_formulationFunction
materialize_formulation(formulation, dynamics, grid, boundary_conditions)

Materialize a thermodynamic formulation from a Symbol (or formulation struct) into a complete formulation with all required fields.

Valid symbols:

  • :LiquidIcePotentialTemperature, , :ρθ, :PotentialTemperatureLiquidIcePotentialTemperatureFormulation
  • :StaticEnergy, :e, :ρeStaticEnergyFormulation
source
Breeze.AtmosphereModels.materialize_microphysical_fieldsMethod
materialize_microphysical_fields(
    microphysics::Nothing,
    grid,
    boundary_conditions
) -> NamedTuple{(:qᵛ,), <:Tuple{Field{Center, Center, Center, Nothing, G, I, D, T, B, Nothing} where {G, I, D, T, B}}}

Build microphysical fields associated with microphysics on grid and with user defined boundary_conditions.

source
Breeze.AtmosphereModels.maybe_adjust_thermodynamic_stateMethod
maybe_adjust_thermodynamic_state(
    state,
    _::Nothing,
    qᵛ,
    constants
) -> Any

Possibly apply saturation adjustment. If a microphysics scheme does not invoke saturation adjustment, just return the state unmodified.

This function takes the thermodynamic state, microphysics scheme, total moisture, and thermodynamic constants. Schemes that use saturation adjustment override this to adjust the moisture partition. Non-equilibrium schemes simply return the state unchanged.

source
Breeze.AtmosphereModels.microphysical_velocitiesMethod
microphysical_velocities(
    microphysics::Nothing,
    microphysical_fields,
    name
)

Return the microphysical velocities associated with microphysics, microphysical_fields, and tracer name.

Must be either nothing, or a NamedTuple with three components u, v, w. The velocities are added to the bulk flow velocities for advecting the tracer. For example, the terminal velocity of falling rain.

source
Breeze.AtmosphereModels.microphysics_model_update!Method
microphysics_model_update!(microphysics::Nothing, model)

Apply the operator-split microphysics update for the given microphysics scheme.

This is called once per time step by the time-stepper (not from update_state!) to apply microphysics processes that operate on the full model state by the full Δt, rather than through the per-stage tendency interface. It runs after the time-stepper's update_state! has refreshed the diagnostic state it reads. Schemes that mutate prognostic fields here are responsible for restoring a consistent model state (halos, diagnostics, and tendencies) before returning — e.g. by calling update_state!. Defaults to a no-op; specific microphysics schemes extend this function.

source
Breeze.AtmosphereModels.prognostic_dynamics_field_namesMethod
prognostic_dynamics_field_names(dynamics)

Return a tuple of prognostic field names specific to the dynamics formulation.

For anelastic dynamics, returns an empty tuple (no prognostic density). For compressible dynamics, returns (:ρᵈ,) for prognostic density.

source
Breeze.AtmosphereModels.prognostic_momentum_field_namesMethod
prognostic_momentum_field_names(dynamics)

Return a tuple of prognostic momentum field names.

For prognostic dynamics (anelastic, compressible), returns (:ρu, :ρv, :ρw). For kinematic dynamics (prescribed velocities), returns an empty tuple.

source
Breeze.AtmosphereModels.rescale_density_weighted_fields!Method
rescale_density_weighted_fields!(model, ρ⁻)

Rescale all density-weighted prognostic fields so that specific quantities (velocity, potential temperature, moisture, etc.) are preserved after a change in the reference density ρᵣ. Each field is multiplied by ρᵣ_new / ρᵣ_old.

Momentum fields (ρu, ρv, ρw) live at staggered face locations and require interpolation of the cell-centered density; a dedicated kernel handles this. All other prognostic fields are cell-centered and rescaled with broadcasting.

source
Breeze.AtmosphereModels.reset_reference_state!Method
reset_reference_state!(model)

Recompute the dynamics' reference state from the horizontal means of the model's current state via set_to_mean! — works for both the anelastic ReferenceState and the split-explicit ExnerReferenceState — if the dynamics carries one; a no-op otherwise. Invoked by set!(model; compute_reference_state=true).

source
Breeze.AtmosphereModels.set_hydrostatically_balanced_density!Method
set_hydrostatically_balanced_density!(
    model,
    spec::HydrostaticallyBalancedDensity
)

Set the prognostic density of a CompressibleDynamics model into discrete hydrostatic balance with the current θˡⁱ/qᵛ, per HydrostaticallyBalancedDensity. Runs the same per-column Exner integration the reference-state constructor uses, then scales the dry density (and rescales the density-weighted prognostics, preserving θ, , and velocities) so the total density matches the balanced column.

source
Breeze.AtmosphereModels.settable_specific_microphysical_namesMethod
settable_specific_microphysical_names(
    microphysics
) -> Tuple{}

Return a tuple of specific (non-density-weighted) names that can be set for the given microphysics scheme. These are derived from the prognostic field names by removing the 'ρ' prefix.

For mass fields (e.g., ρqᶜˡqᶜˡ) and number fields (e.g., ρnᶜˡnᶜˡ).

source
Breeze.AtmosphereModels.specific_to_density_weightedMethod
specific_to_density_weighted(
    name::Symbol
) -> Union{Nothing, Symbol}

Convert a specific microphysical variable name to its density-weighted counterpart. For example, :qᶜˡ:ρqᶜˡ, :qʳ:ρqʳ, :nᶜˡ:ρnᶜˡ.

Returns nothing if the name doesn't start with 'q' or 'n'.

source
Breeze.AtmosphereModels.surface_pressureFunction
surface_pressure(dynamics)

Return the surface pressure used for boundary condition regularization. For anelastic dynamics, this is the reference state surface pressure. For compressible dynamics, this may be a constant or computed value.

source
Breeze.AtmosphereModels.total_condensate_densityMethod
total_condensate_density(
    i,
    j,
    k,
    microphysics,
    moisture_density,
    microphysical_fields
) -> Any

Total condensate density $ρᵗ = ρqᵛᵉ + Σ ρqᶜ$ at (i, j, k): the moisture density $ρqᵛᵉ$ (vapor or equilibrium moisture) plus every condensed-species density named by condensate_field_names. Number-concentration fields (ρnˣ) are excluded. This sums all phases of the condensable species (water by default), so other condensates can be added by extending condensate_field_names.

source
Breeze.AtmosphereModels.total_densityMethod
total_density(
    i,
    j,
    k,
    dry_density,
    microphysics,
    moisture_density,
    microphysical_fields
) -> Any

Total air density $ρ = ρᵈ + ρᵗ$ at (i, j, k): the dry-air density dry_density plus the total_condensate_density $ρᵗ$. This is the diagnosed total mass density used where total mass enters the physics — the gravitational/buoyancy term and the equation of state.

source
Breeze.AtmosphereModels.total_densityMethod
total_density(dynamics)

Return the total air density ρ = ρᵈ + Σρˣ used by the thermodynamics, scalar advection, equation of state, and buoyancy. Defaults to dynamics_density — correct for formulations with a single density (e.g. the anelastic reference density). CompressibleDynamics overrides it with a diagnosed total-density field, distinct from the coupling density ρᵈ.

source
Breeze.AtmosphereModels.update_radiation!Method
update_radiation!(rtm, model)

Update the radiative fluxes from the current model state.

This function checks the radiation schedule and only updates if the schedule returns true. The actual radiation computation is dispatched to _update_radiation!(rtm, model).

Radiation is always computed on the first iteration (iteration 0) to ensure valid radiative fluxes before the first time step.

source
Breeze.AtmosphereModels.validate_microphysicsMethod
validate_microphysics(microphysics, thermodynamic_constants)

Validate that microphysics is compatible with the model's thermodynamic_constants.

Defaults to a no-op. Schemes that require a particular thermodynamic formulation (for example a specific saturation vapor pressure formula) extend this method to throw a clear ArgumentError at model construction, rather than failing later inside a kernel — where the failure surfaces as an opaque dynamic getproperty / GPU compilation error.

source
Breeze.AtmosphereModels.validate_velocity_boundary_conditionsMethod
validate_velocity_boundary_conditions(dynamics, user_boundary_conditions)

Validate that velocity boundary conditions are only provided for dynamics that support them.

By default, throws an error if the user provides boundary conditions for :u, :v, or :w, since velocity is a diagnostic field for most dynamics (e.g., anelastic, compressible).

For PrescribedDynamics, velocity boundary conditions are allowed since velocities are regular fields that can be set directly.

source
Breeze.AtmosphereModels.velocity_boundary_condition_namesMethod
velocity_boundary_condition_names(dynamics)

Return a tuple of velocity field names that need default boundary conditions.

For most dynamics (anelastic, compressible), velocities are diagnostic and their boundary conditions are created internally. Returns an empty tuple.

For PrescribedDynamics, velocities are regular fields that can have user-provided boundary conditions, so this returns (:u, :v, :w).

source
Breeze.AtmosphereModels.with_thermodynamic_densityFunction
with_thermodynamic_density(formulation, ρᵡ)

Return a copy of formulation whose thermodynamic density field (see thermodynamic_density) is replaced by ρᵡ, leaving the diagnostic fields and solvers untouched. Used to swap in a thermodynamic field carrying different boundary conditions without reallocating the diagnostics.

source
Breeze.AtmosphereModels.wrap_specific_forcingFunction
wrap_specific_forcing(value, density_name)

Wrap value so that the kernel-time density factor ρ is applied automatically when the user supplies a forcing keyed by a specific (per-unit-mass) variable name like θ, u, qᵉ. Implemented in the Forcings module: constructs a SpecificForcing, recurses into tuples, and errors if value is itself a density-tendency forcing like SubsidenceForcing (which would double-count ρ).

density_name is the corresponding density-weighted prognostic name (e.g. :ρθ) used to produce a helpful error message when the wrap is rejected.

source
Breeze.AtmosphereModels.x_pressure_gradientMethod
x_pressure_gradient(i, j, k, grid, dynamics)

Return the x-component of the pressure gradient force at (Face, Center, Center).

For anelastic dynamics, returns zero (pressure is handled via projection). For compressible dynamics, returns -∂p/∂x.

source
Breeze.AtmosphereModels.y_pressure_gradientMethod
y_pressure_gradient(i, j, k, grid, dynamics)

Return the y-component of the pressure gradient force at (Center, Face, Center).

For anelastic dynamics, returns zero (pressure is handled via projection). For compressible dynamics, returns -∂p/∂y.

source
Breeze.AtmosphereModels.z_pressure_gradientMethod
z_pressure_gradient(i, j, k, grid, dynamics)

Return the z-component of the pressure gradient force at (Center, Center, Face).

For anelastic dynamics, returns zero (pressure is handled via projection). For compressible dynamics, returns -∂p/∂z.

source
Breeze.AtmosphereModels.∇_dot_JᶜMethod
∇_dot_Jᶜ(i, j, k, grid, ρ, closure::AbstractTurbulenceClosure, closure_fields,
         id, c, clock, model_fields, buoyancy)

Return the discrete divergence of the dynamic scalar flux Jᶜ = ρ jᶜ, where jᶜ is the "kinematic scalar flux", using area-weighted differences divided by cell volume. Similar to Oceananigans' ∇_dot_qᶜ signature with the additional density factor ρ, where in Oceananigans qᶜ is the kinematic tracer flux.

source
Oceananigans.Fields.set!Method
set!(model::AtmosphereModel; enforce_mass_conservation=true, kw...)

Set variables in an AtmosphereModel.

Keyword Arguments

Variables are set via keyword arguments. Supported variables include:

Prognostic variables (density-weighted):

  • ρ/ρᵈ: total / dry density (compressible). ρ may also be set to HydrostaticallyBalancedDensity(), which derives the density from the just-set θˡⁱ/qᵛ so the initial column is in discrete hydrostatic balance.
  • ρu, ρv, ρw: momentum components
  • ρqᵉ/ρqᵛ/ρqᵗ: moisture density (scheme-dependent)
  • Prognostic microphysical variables
  • Prognostic user-specified tracer fields

Settable thermodynamic variables:

  • T: in-situ temperature
  • θ: potential temperature
  • θˡⁱ: liquid-ice potential temperature
  • e: static energy
  • ρθ: potential temperature density
  • ρθˡⁱ: liquid-ice potential temperature density
  • ρe: static energy density (for StaticEnergyThermodynamics)

Diagnostic variables (specific, i.e., per unit mass):

  • u, v, w: velocity components (sets both velocity and momentum)
  • qᵗ: total specific moisture (sets both specific and density-weighted moisture)
  • : relative humidity (sets total moisture via qᵗ = ℋ * qᵛ⁺, where qᵛ⁺ is the saturation specific humidity at the current temperature). Relative humidity is in the range [0, 1]. For models with saturation adjustment microphysics, ℋ > 1 throws an error since the saturation adjustment would immediately reduce it to 1.

Specific microphysical variables (automatically converted to density-weighted):

  • qᶜˡ: specific cloud liquid, sets ρqᶜˡ = ρᵣ * qᶜˡ
  • : specific rain, sets ρqʳ = ρᵣ * qʳ
  • nᶜˡ: specific cloud liquid number [1/kg], sets ρnᶜˡ = ρᵣ * nᶜˡ
  • : specific rain number [1/kg], sets ρnʳ = ρᵣ * nʳ
  • Other prognostic microphysical variables with the ρ prefix removed
The meaning of `θ`

When using set!(model, θ=...), the value is interpreted as the liquid-ice potential temperature $θˡⁱ$.

Options

  • enforce_mass_conservation: If true (default), applies a pressure correction to ensure the velocity field satisfies the anelastic continuity equation. If balancer is also used, a final correction is applied after the balance.

  • compute_reference_state: If true (default false), recompute the dynamics' hydrostatic reference state from the horizontal means of the just-set state (see set_to_mean!), before the mass-conservation correction. A no-op for dynamics without a reference state. Useful when initializing from an analysis whose mean profile should define the perturbation base state; otherwise the reference built at construction is preserved. For compressible dynamics, supply both a density and a thermodynamic variable in the same set! call, since the recomputation integrates the hydrostatic column from the model's current state.

  • balancer: adiabatic (FV3 na_init) spin-up of the nonhydrostatic state, run in place after the rest of set! — equivalent to calling balance_adiabatically!(model, balancer). false (default) does nothing; true uses AdiabaticBalancer() (auto step size); pass an AdiabaticBalancer to control Δt, cycles, weight, with_moisture, and (compressible) time_stepping. The balance runs on a stripped twin that shares all field memory with model (no second field set, no graft). Works for both CompressibleDynamics and AnelasticDynamics.

source

AtmosphereModels.Diagnostics

Breeze.AtmosphereModels.Diagnostics.saturation_total_specific_moistureMethod
saturation_total_specific_moisture(
    T,
    pᵣ,
    constants,
    surface
) -> Any

Compute the saturation total specific moisture under the assumption that all moisture is vapor at saturation, $qᵗ = qᵛ⁺$. With this assumption, the equation of state for moist air can be solved in closed form, yielding an expression for the saturation specific humidity in terms of temperature T and reference pressure pᵣ alone:

\[qᵛ⁺ = \frac{ϵᵈᵛ \, pᵛ⁺(T)}{pᵣ + δᵈᵛ \, pᵛ⁺(T)} ,\]

where $ϵᵈᵛ ≡ Rᵈ / Rᵛ ≈ 0.622$ and $δᵈᵛ ≡ ϵᵈᵛ - 1 ≈ -0.378$.

The resulting expression coincides with the saturation specific humidity used in the COARE 3.6 Edson (2013) air-sea bulk-flux algorithms, where the air-side specific humidity at the surface is unknown a priori and saturation_specific_humidity cannot be evaluated directly.

See the Atmosphere Thermodynamics section of the documentation for a derivation.

source

BoundaryConditions

Breeze.AtmosphereModels.materialize_atmosphere_model_boundary_conditionsMethod
materialize_atmosphere_model_boundary_conditions(
    boundary_conditions,
    grid,
    formulation,
    dynamics,
    microphysics,
    surface_pressure,
    thermodynamic_constants,
    microphysical_fields,
    specific_prognostic_moisture,
    temperature
) -> NamedTuple

Regularize boundary conditions for AtmosphereModel. This function walks through all boundary conditions and calls materialize_atmosphere_boundary_condition on each one, allowing specialized handling for bulk flux boundary conditions and other atmosphere-specific boundary condition types.

If formulation is :LiquidIcePotentialTemperature and ρe boundary conditions are provided, they are automatically converted to ρθ boundary conditions using EnergyFluxBoundaryCondition.

source
Breeze.BoundaryConditions.bulk_richardson_numberFunction
bulk_richardson_number(h, θᵥ, θᵥ₀, U, U_min) -> Any
bulk_richardson_number(h, θᵥ, θᵥ₀, U, U_min, g) -> Any

Compute bulk Richardson number:

\[Riᴮ = (g / θ̄ᵥ) h (θᵥ - θᵥ₀) / U²\]

Wind speed is clamped to U_min to avoid singularity.

Arguments

  • h: Measurement height (m)
  • θᵥ: Virtual potential temperature at measurement height (K)
  • θᵥ₀: Virtual potential temperature at surface (K)
  • U: Wind speed (m/s)
  • U_min: Minimum wind speed (m/s)
  • g: Gravitational acceleration (m/s², default: 9.81)
source
Breeze.BoundaryConditions.neutral_coefficient_10mMethod
neutral_coefficient_10m(polynomial, U₁₀, U_min) -> Any

Compute neutral transfer coefficient at 10 m using the Large and Yeager (2009) form:

\[C^N_{10}(U) = (a_0 + a_1 U + a_2 / U) × 10^{-3}\]

Wind speed is clamped to U_min to avoid singularity in the $a_2/U$ term.

References

  • Large, W., & Yeager, S. G. (2009). The global climatology of an interannually varying air–sea flux data set. Climate dynamics, 33(2), 341-364.
source
Breeze.BoundaryConditions.surface_virtual_potential_temperatureMethod
surface_virtual_potential_temperature(
    T₀,
    p₀,
    constants,
    surface
) -> Any

Compute virtual potential temperature over a planar surface with surface temperature T₀ and surface pressure p₀,

\[θᵥ₀ = T₀ (1 + δᵛᵈ qᵛ⁺)\]

where $qᵛ⁺$ is the saturation specific humidity at the surface and $δᵛᵈ = Rᵛ/Rᵈ - 1$ (≈ 0.608 for water vapor in Earth's atmosphere; the actual value depends on the gas constants in constants).

source
Breeze.BoundaryConditions.update!Method
update!(fv::FilteredSurfaceVelocities, velocities, grid, Δt)

Update the filtered surface velocities using the exponential filter with time step Δt. velocities should be a NamedTuple with fields u and v.

source

CelestialMechanics

CompressibleEquations

Breeze.CompressibleEquations.HeightProfileType
struct HeightProfile{P} <: Function

Adapter that makes a vertical profile — a Number, a callable φ(z), or a HorizontalMeanProfile — settable onto a Field of any dimensionality. set! calls it with the field's node coordinates, which are (x, z) on a Flat-y grid, (x, y, z) in 3D and (λ, φ, z) on a latitude-longitude grid; only the last of those — the physical height, which on a terrain-following grid varies per column — is used. Subtypes Function so set! takes its function-evaluation path (which evaluates on the host and transfers once).

source
Breeze.CompressibleEquations.HorizontalMeanProfileType
struct HorizontalMeanProfile{H, V} <: Function

Callable piecewise-linear vertical profile. profile(z) linearly interpolates values against heights (both ordered bottom-to-top) and holds the nearest end value constant for z below heights[1] or above heights[end]. Subtypes Function so it is picked up by evaluate_profile wherever a z-dependent reference profile is expected.

source
Breeze.AtmosphereModels.boundary_conditions_reference_stateMethod
boundary_conditions_reference_state(
    dynamics::CompressibleDynamics,
    grid,
    thermodynamic_constants
) -> Union{Nothing, ExnerReferenceState}

Return a reference state suitable for boundary-condition diagnostics.

Boundary conditions are materialized before materialize_dynamics runs, so the stub CompressibleDynamics.reference_state field still holds the reference spec rather than an ExnerReferenceState. This method builds explicit and automatic references on demand using the same grid-dependent logic as materialize_dynamics, so boundary conditions that require a reference profile can be materialized before the dynamics. When the reference is disabled (nothing) or the dynamics has already been materialized, the existing value is returned.

source
Breeze.AtmosphereModels.buoyancy_forceᶜᶜᶜMethod
buoyancy_forceᶜᶜᶜ(
    i,
    j,
    k,
    grid,
    dynamics::CompressibleDynamics,
    temperature,
    specific_prognostic_moisture,
    microphysics,
    microphysical_fields,
    constants
) -> Any

Compute the buoyancy force density for compressible dynamics at cell center (i, j, k).

When a reference state is provided, the buoyancy force is computed as a perturbation:

\[ρ b = -g (ρ - ρ_r)\]

where $ρ_r$ is the reference density in discrete hydrostatic balance. This eliminates the $O(Δz^2)$ truncation error from the near-cancellation of $∂p/∂z$ and $gρ$, which is essential for stability with acoustic substepping at large time steps.

Without a reference state, the full gravitational force $-gρ$ is used.

source
Breeze.AtmosphereModels.compute_auxiliary_dynamics_variables!Method
compute_auxiliary_dynamics_variables!(
    model::AtmosphereModel{<:CompressibleDynamics}
)

Compute temperature and pressure jointly for CompressibleModel.

For compressible dynamics with potential temperature thermodynamics, temperature and pressure are coupled via the ideal gas law and the potential temperature definition:

\[θ = T (p₀/p)^κ \quad \text{and} \quad p = ρ R^m T\]

Eliminating the circular dependency gives the direct formula:

\[T = θ^γ \left(\frac{ρ R^m}{p₀}\right)^{γ-1}\]

where $γ = c_p / c_v$ is the heat capacity ratio. Once temperature is known, pressure is computed from the ideal gas law $p = ρ R^m T$.

This joint computation is necessary because, unlike anelastic dynamics where pressure comes from a reference state, compressible dynamics requires solving for both temperature and pressure simultaneously.

source
Breeze.AtmosphereModels.compute_dynamics_tendency!Method
compute_dynamics_tendency!(
    model::AtmosphereModel{<:CompressibleDynamics}
)

Compute the density tendency for compressible dynamics using the continuity equation.

The density evolves according to:

\[\partial_t \rho = -\boldsymbol{\nabla \cdot \,} (\rho \boldsymbol{u})\]

Since momentum ρu is already available, this is simply the negative divergence of momentum.

source
Breeze.AtmosphereModels.default_drag_surface_temperatureMethod
default_drag_surface_temperature(
    _::CompressibleDynamics,
    grid,
    constants
)

BulkDrag under CompressibleDynamics requires the user to supply surface_temperature explicitly. Unlike AnelasticDynamics, compressible dynamics does not carry a reference profile from which a surface temperature can be unambiguously derived. A clean default would require either coupling to a surface model or diagnosing the surface state from the prognostic fields (which would make ρ₀ grid-dependent and break MO consistency at the surface); both are out of scope for now.

source
Breeze.AtmosphereModels.dynamics_pressureMethod
dynamics_pressure(dynamics::CompressibleDynamics) -> Any

Return the dynamics pressure for CompressibleDynamics. For compressible dynamics, there is no background/anomaly decomposition - returns the prognostic pressure field, computed diagnostically from the equation of state.

source
Breeze.AtmosphereModels.materialize_dynamicsMethod
materialize_dynamics(
    dynamics::CompressibleDynamics,
    grid,
    boundary_conditions,
    thermodynamic_constants
) -> CompressibleDynamics{_A, D, DT, P, _B, RS, TM, CV, CM} where {_A, D<:(Field{Center, Center, Center, Nothing, G, I, D, T, B, Nothing} where {G, I, D, T, B}), DT<:(Field{Center, Center, Center, Nothing, G, I, D, T, B, Nothing} where {G, I, D, T, B}), P<:(Field{Center, Center, Center, Nothing, G, I, D, T, B, Nothing} where {G, I, D, T, B}), _B, RS<:Union{Nothing, ExnerReferenceState{_A, FP, FD, FE} where {_A, FP<:Union{Field{Nothing, Nothing, Center, Nothing, G, I, D, T, B, Nothing} where {G, I, D, T, B}, Field{Center, Center, Center, Nothing, G, I, D, T, B, Nothing} where {G, I, D, T, B}}, FD<:Union{Field{Nothing, Nothing, Center, Nothing, G, I, D, T, B, Nothing} where {G, I, D, T, B}, Field{Center, Center, Center, Nothing, G, I, D, T, B, Nothing} where {G, I, D, T, B}}, FE<:Union{Field{Nothing, Nothing, Center, Nothing, G, I, D, T, B, Nothing} where {G, I, D, T, B}, Field{Center, Center, Center, Nothing, G, I, D, T, B, Nothing} where {G, I, D, T, B}}}}, TM<:Union{Nothing, TerrainMetrics}, CV<:Union{Nothing, Field{Center, Center, Face, Nothing, G, I, D, T, B, Nothing} where {G, I, D, T, B}}, CM<:Union{Nothing, Field{Center, Center, Face, Nothing, G, I, D, T, B, Nothing} where {G, I, D, T, B}}}

Materialize a stub CompressibleDynamics into a full dynamics object with density and pressure fields.

source
Breeze.AtmosphereModels.pressure_anomalyMethod
pressure_anomaly(dynamics::CompressibleDynamics) -> Int64

Return the pressure anomaly for CompressibleDynamics. For compressible dynamics, there is no decomposition - returns zero.

source
Breeze.AtmosphereModels.reset_reference_state!Method
reset_reference_state!(
    model::AtmosphereModel{<:CompressibleDynamics{<:Any, <:Any, <:Any, <:Any, <:Any, <:Any, <:TerrainMetrics}}
)

Recompute the terrain-following model's 3D ExnerReferenceState in place from the height-resolved horizontal-mean state, via compute_terrain_reference_state!. Unlike the flat Exner / anelastic set_to_mean! reset, this specializes on the model (rather than the reference type) because the terrain mean must be taken at constant physical height (horizontal_mean_profile), not per computational level. No update_state! follows: the terrain reference feeds only the buoyancy and pressure-gradient tendencies, not any diagnostic field. A no-op if the dynamics carries no reference.

source
Breeze.AtmosphereModels.surface_pressureMethod
surface_pressure(dynamics::CompressibleDynamics) -> Any

Return a standard surface pressure for boundary condition regularization. For compressible dynamics, uses the standard atmospheric pressure (101325 Pa).

source
Breeze.CompressibleEquations.compute_acoustic_substepsMethod
compute_acoustic_substeps(
    grid,
    Δt,
    thermodynamic_constants,
    acoustic_cfl
) -> Any

Compute the number of acoustic substeps $N$ from the horizontal acoustic CFL:

\[N \approx \left\lceil \frac{|\Delta t| \, \mathbb{C}^{ac}}{\nu \, \Delta x_\min} \right\rceil ,\]

with $\mathbb{C}^{ac} = \sqrt{γ^d R^d T_r}$ for a nominal reference temperature $T_r = 300\,\mathrm{K}$ and $ν$ the target acoustic Courant number acoustic_cfl (default 0.5, the conventional ERF/WRF target — equivalent to a safety factor of 2).

source
Breeze.CompressibleEquations.compute_contravariant_velocity!Method
compute_contravariant_velocity!(
    model::AtmosphereModel{<:CompressibleDynamics{<:Any, <:Any, <:Any, <:Any, <:Any, <:Any, <:TerrainMetrics}}
)

Compute the contravariant vertical velocity $\tilde{w}$ and contravariant vertical momentum $\rho \tilde{w}$ from the Cartesian velocity and momentum fields.

The contravariant vertical velocity is the velocity component normal to the terrain-following coordinate surfaces:

\[\tilde{w} = w - \left(\frac{\partial z}{\partial x}\right)_r u - \left(\frac{\partial z}{\partial y}\right)_r v\]

source
Breeze.CompressibleEquations.compute_terrain_reference_state!Method
compute_terrain_reference_state!(
    pᵣ,
    ρᵣ,
    πᵣ,
    grid,
    p₀,
    ref_spec,
    pˢᵗ,
    constants
)

Fill the 3D fields pᵣ, ρᵣ and πᵣ with the hydrostatic reference pressure, density and Exner function, solving the discrete hydrostatic balance per column. On a terrain-following grid, different columns have different physical heights at the same computational index k, so the reference state varies horizontally even though the reference atmosphere is horizontally uniform.

Each column is anchored at its own terrain surface with the continuous hydrostatic state at that physical height, and every face above it — starting with the surface-to-first-center half cell — is closed by the Newton solve of the discrete balance

\[\frac{p_{ref}[k] - p_{ref}[k-1]}{Δz} + g \frac{ρ_{ref}[k] + ρ_{ref}[k-1]}{2} = 0\]

to near machine precision (the Exner integration provides only the Newton initial guess). The reference atmosphere uses level-local moist constants $Rᵐ = qᵈ Rᵈ + qᵛ Rᵛ$, $cᵖᵐ = qᵈ cᵖᵈ + qᵛ cᵖᵛ$, $κᵐ = Rᵐ/cᵖᵐ$, with the dry case recovered exactly when $qᵛ ≡ 0$. Enforcing the discrete balance is essential for reducing the truncation error in the vertical momentum equation ($-∂p/∂z - gρ$), which would otherwise be dominated by the near-cancellation of two large terms.

The reference pressure is also used for the perturbation horizontal pressure gradient, reducing the terrain-following PGF error.

source
Breeze.CompressibleEquations.converged_hydrostatic_pressureMethod
converged_hydrostatic_pressure(
    z,
    p₀,
    dpdz;
    tolerance,
    initial_steps,
    max_steps
) -> Any

Integrate the hydrostatic equation $∂p/∂z = \mathrm{dpdz}(z, p)$ from the surface to height $z$, repeatedly doubling the number of steps until the pressure at $z$ changes by less than the relative tolerance between successive refinements. dpdz(z, p) returns the local pressure gradient $-g ρ$ given height and pressure.

source
Breeze.CompressibleEquations.convert_acoustic_parameterMethod

Split-explicit time discretization for compressible dynamics.

Outer integration is the Wicker–Skamarock RK3 scheme (Wicker and Skamarock 2002) with stage fractions $β = (1/3, 1/2, 1)$. Within each stage, an inner substep loop evolves linearized acoustic perturbations about each RK stage-entry state. The vertically implicit solve uses an off-centered Crank-Nicolson scheme with off-centering parameter $\omega$ (default 0.65; $\omega = 0.5$ is classic centered CN). In multi-substep stages, the first acoustic substep includes the frozen stage-entry horizontal pressure gradient but skips the acoustic perturbation pressure gradient, which is applied on subsequent substeps following the MPAS forward-backward sequencing.

The substep distribution across stages is selectable via the AcousticSubstepDistribution interface.

Fields

  • substeps: Number of acoustic substeps $N$ per outer $Δt$. Default nothing adaptively chooses $N$ from the horizontal acoustic CFL each step (see acoustic_cfl).

  • acoustic_cfl: Target horizontal acoustic Courant number used by the adaptive substep count when substeps === nothing. The substep count is $N \approx \lceil \Delta t \, \mathbb{C}^{ac} / (\mathrm{acoustic\_cfl} \cdot \Delta x_\min) \rceil$, so smaller values give more substeps. Default 0.5 (the ERF/WRF target — equivalent to the conventional safety factor of 2). Ignored when substeps is set explicitly.

  • forward_weight: Off-centering parameter $\omega$ for the vertically implicit solve. $\omega = 0.5$ is classic centered Crank-Nicolson; the default $\omega = 0.65$ adds modest off-centering ($\varepsilon = 2\omega - 1 = 0.3$). Combined with the default divergence damping, it keeps a rest atmosphere at machine ε at production $\Delta t = 20$ s and survives the DCMIP-2016 dry/moist baroclinic-wave smoke tests at production grid.

    Note on residual non-normality: the column tridiag has anti-symmetric buoyancy off-diagonals (gravity-wave physics) and asymmetric PGF off-diagonals on a stratified $\bar\theta(z)$, so the substep operator $U$ has spectral radius $\rho(U) = 1$ but operator norm $\|U\|_2 \gg 1$ (≈ 44 at $\Delta t = 20$ s, $\omega = 0.55$, no damping). Perturbations can transiently project onto the non-normal amplified subspace. The stage-rewind formulation keeps the exact discrete rest atmosphere bounded even without divergence damping, while the default off-centering plus Klemp horizontal divergence damping damps acoustic noise in production baroclinic-wave and LES runs.

  • damping: Acoustic divergence damping strategy. Default: ThermalDivergenceDamping with coefficient 0.1. The exact discrete rest atmosphere is covered by test/substepper_rest_state.jl even with NoDivergenceDamping, but noisy acoustic production cases use damping to control grid-scale divergent modes.

  • sponge: Optional UpperSponge that applies implicit Rayleigh damping to $(ρw)′$ inside the substep loop's column tridiag, absorbing acoustic / gravity-wave energy in a layer below the rigid lid. Default nothing (off). Passing UpperSponge(; ...) enables it with the configured damping_rate and depth.

  • substep_distribution: How acoustic substeps are distributed across the three WS-RK3 stages.

  • open_boundary_relaxation: Per-substep relaxation factor $α \in (0, 1]$ applied at the outermost open-boundary cell of $ρ′,(ρθ)′$ to enforce the prescribed wall value across the acoustic substeps. Default $α = 0.5$, matching FV3-LAM's outermost-blend-row weight ($\approx 0.6$). Without this enforcement the perturbation halos reflect, biasing the discrete mass balance under transient open-boundary inflow (issue #738). The relaxation is a no-op when no side carries an active open BC (periodic, walls, impenetrable defaults all skip it).

Backward integration

Backward integration (Δt < 0) is supported. The off-centered Crank–Nicolson vertical solve with $ω ∈ [0.5, 1]$ has amplification factor $|A|^2 = (1 + ((1-ω) ω_0 Δτ)^2) / (1 + (ω ω_0 Δτ)^2) \le 1$ for either sign of $Δτ$, so the linearized acoustic substep is A-stable in both directions. Horizontal divergence damping is sign-self-consistent ($γ \propto Δτ^{-1}$ and $(ρθ)' - (ρθ)'_\mathrm{old} \propto Δτ$ both flip sign with Δt). The adaptive substep count uses $|Δt|$, and the optional UpperSponge keeps its dissipative sign so it acts as a one-sided regularizer in both directions (i.e. backward integration through a sponge layer is stable but not an exact inverse of the forward step inside the sponge).

See also ExplicitTimeStepping.

source
Breeze.CompressibleEquations.horizontal_mean_profileMethod
horizontal_mean_profile(
    field
) -> Breeze.CompressibleEquations.HorizontalMeanProfile

Reduce a 3D field to a HorizontalMeanProfile of its horizontal mean at constant physical height. On a terrain-following grid the cell-center height znode(i, j, k, …) varies with (i, j), so a plain per-k average would blend, e.g., valley-floor and mountain-top air at the same computational level. Instead every column is first interpolated onto a common set of physical heights and the mean is taken there, giving a genuine θ̄(z) — the horizontally-uniform reference profile that WRF-style base states use, evaluated per column at its own terrain by compute_terrain_reference_state!.

The common heights are the columnwise minima of the cell-center heights at each level k, obtained by a minimum! reduction: on a terrain-following grid these are the levels of the lowest-terrain column, they increase strictly with k, and every column's level-k center lies at or above them — so the per-column interpolation never extrapolates above a column's top.

A column whose terrain rises above a given height has no air there, and contributes nothing to that height's mean: the interpolation kernel also fills an indicator field, and the mean is the ratio of the two sum! reductions. Extending such columns downward instead (holding the surface value) would bias the mean towards near-surface air by ~(z̄ − z_surface)·dφ/dz at the lowest levels. The lowest-terrain column contributes to every height, so no level is ever empty.

source
Breeze.CompressibleEquations.terrain_exner_reference_stateMethod
terrain_exner_reference_state(
    grid,
    surface_pressure,
    ref_spec,
    standard_pressure,
    constants
) -> ExnerReferenceState{_A, FP, FD, FE} where {_A, FP<:(Field{Center, Center, Center, Nothing, G, I, D, T, B, Nothing} where {G, I, D, T, B}), FD<:(Field{Center, Center, Center, Nothing, G, I, D, T, B, Nothing} where {G, I, D, T, B}), FE<:(Field{Center, Center, Center, Nothing, G, I, D, T, B, Nothing} where {G, I, D, T, B})}

Build the single 3D ExnerReferenceState for a terrain-following compressible model from an explicit reference profile ref_spec (a reference_potential_temperature — constant or θ(z) — optionally with reference_vapor_mass_fraction). Its pressure/density/exner_function are horizontally-varying CenterFields in per-column discrete hydrostatic balance (compute_terrain_reference_state!); only pressure/density are read by the terrain kernels, but exner_function is filled for consistency with the 1D-column form.

source
Breeze.CompressibleEquations.terrain_reference_mean_profilesMethod
terrain_reference_mean_profiles(
    model
) -> NamedTuple{(:reference_potential_temperature, :reference_vapor_mass_fraction), <:Tuple{Breeze.CompressibleEquations.HorizontalMeanProfile, Union{Nothing, Breeze.CompressibleEquations.HorizontalMeanProfile}}}

Build the reference specification (reference_potential_temperature, reference_vapor_mass_fraction) for a terrain-following compressible model from the horizontal means of its current θˡⁱ and qᵛ. The vapor profile is dropped (set to nothing, selecting the dry reference path) when the mean moisture is identically zero.

source
Breeze.CompressibleEquations.terrain_surface_reference_fieldsMethod
terrain_surface_reference_fields(
    grid,
    p₀,
    θᵣ,
    qᵛᵣ,
    pˢᵗ,
    constants
) -> Tuple{Field{Center, Center, Nothing, Nothing, G, I, D, T, B, Nothing} where {G, I, D, T, B}, Union{Field{Center, Center, Nothing, Nothing, G, I, D, T, B, Nothing} where {G, I, D, T, B}, Oceananigans.Fields.ZeroField{_A, 3} where _A}, Field{Center, Center, Nothing, Nothing, G, I, D, T, B, Nothing} where {G, I, D, T, B}}

Return the reference (θˢ, qᵛˢ, pˢ) at the terrain surface — the bottom face of each column — as 2D fields. is the continuous hydrostatic pressure at the local terrain height, which anchors the column integration in compute_terrain_reference_state!.

The surface heights come from a kernel; the profiles and the hydrostatic integration are host callables (an arbitrary user θ(z) and, for moist references, an adaptive vertical integration), so they are evaluated in a single vectorized pass over those heights — one evaluation per column, not per cell — and transferred back. A dry reference returns qᵛˢ::ZeroField.

source
Breeze.CompressibleEquations.with_time_discretizationMethod
with_time_discretization(
    dynamics::CompressibleDynamics,
    time_discretization
) -> CompressibleDynamics

Return a CompressibleDynamics identical to dynamics but with its time_discretization replaced. Every field (densities, pressure, reference and terrain states) is shared by reference — only the immutable scheme wrapper changes — so this allocates no field memory. Used to build the adiabatic-balance twin (an ExplicitTimeStepping view of a production model).

source
Breeze.CompressibleEquations.without_spongeMethod
without_sponge(
    time_discretization
) -> SplitExplicitTimeDiscretization{_A, _B, _C, Nothing} where {_A, _B, _C}

Return a copy of time_discretization with its upper sponge removed. The adiabatic-balance excursion must be reversible, and the sponge (like divergence damping) is an irreversible term; balance_adiabatically! therefore requires a sponge-free model. No-op for discretizations that carry no sponge (e.g. ExplicitTimeStepping).

source

Forcings

KinematicDriver

Microphysics

Breeze.Microphysics.NumberConcentrationKernelFunctionType
NumberConcentrationKernelFunction{P, M, Q, R}

Kernel callable for the lazy total number concentration $ρnˣ$ (m⁻³) of a one-moment microphysics species, computed from the prognostic mass density $ρqˣ$ and the species' assumed Marshall–Palmer size distribution as $ρnˣ = n_0 \, λ^{-1}$.

Fields

  • pdf: size distribution (ParticlePDFIceRain or ParticlePDFSnow)
  • mass: mass(radius) parameters (ParticleMass)
  • ρq: prognostic mass density field for the species [kg/m³]
  • reference_density: air density field [kg/m³]
source
Breeze.AtmosphereModels.materialize_microphysical_fieldsMethod
materialize_microphysical_fields(
    _::Breeze.Microphysics.DCMIP2016KesslerMicrophysics,
    grid,
    boundary_conditions
) -> NamedTuple{(:ρqᶜˡ, :ρqʳ, :qᵛ, :qᶜˡ, :, :precipitation_rate, :𝕎ʳ), <:Tuple{Field{Center, Center, Center, Nothing, G, I, D, T, B, Nothing} where {G, I, D, T, B}, Field{Center, Center, Center, Nothing, G, I, D, T, B, Nothing} where {G, I, D, T, B}, Field{Center, Center, Center, Nothing, G, I, D, T, B, Nothing} where {G, I, D, T, B}, Field{Center, Center, Center, Nothing, G, I, D, T, B, Nothing} where {G, I, D, T, B}, Field{Center, Center, Center, Nothing, G, I, D, T, B, Nothing} where {G, I, D, T, B}, Field{Center, Center, Nothing, Nothing, G, I, D, T, B, Nothing} where {G, I, D, T, B}, Field{Center, Center, Center, Nothing, G, I, D, T, B, Nothing} where {G, I, D, T, B}}}

Create and return the microphysical fields for the Kessler scheme.

Prognostic Fields (Density-Weighted)

  • ρqᶜˡ: Density-weighted cloud liquid mass fraction.
  • ρqʳ: Density-weighted rain mass fraction.

Diagnostic Fields (Mass Fractions)

  • qᵛ: Water vapor mass fraction, diagnosed as $q^v = q^t - q^{cl} - q^r$.
  • qᶜˡ: Cloud liquid mass fraction (kg/kg).
  • : Rain mass fraction (kg/kg).
  • precipitation_rate: Surface precipitation rate (m/s), defined as $q^r v^t_{rain}$ to match one-moment microphysics.
  • 𝕎ʳ: Rain terminal velocity (m/s).
source
Breeze.AtmosphereModels.maybe_adjust_thermodynamic_stateMethod
maybe_adjust_thermodynamic_state(
    𝒰,
    _::Breeze.Microphysics.DCMIP2016KesslerMicrophysics,
    qᵛ,
    constants
) -> Any

Return the thermodynamic state without adjustment.

The Kessler scheme performs its own saturation adjustment internally via the kernel.

source
Breeze.AtmosphereModels.microphysical_tendencyMethod
microphysical_tendency(
    _::Breeze.Microphysics.DCMIP2016KesslerMicrophysics,
    name,
    ρ,
    ℳ,
    𝒰,
    constants
) -> Any

Return zero tendency.

All microphysical source/sink terms are applied directly to the prognostic fields via the microphysics_model_update! kernel, bypassing the standard tendency interface.

source
Breeze.AtmosphereModels.microphysics_model_update!Method
microphysics_model_update!(
    microphysics::Breeze.Microphysics.DCMIP2016KesslerMicrophysics,
    model
)

Apply the Kessler microphysics to the model.

This function launches a kernel that processes each column independently, with rain sedimentation subcycling.

The kernel handles conversion between mass fractions and mixing ratios internally for efficiency. Water vapor is diagnosed from $q^v = q^t - q^{cl} - q^r$.

The kernel writes prognostic fields in the interior only, so update_state! is called afterwards to restore a consistent model state (halos, diagnostics, and tendencies).

source
Breeze.AtmosphereModels.microphysics_model_update!Method
microphysics_model_update!(
    microphysics::Breeze.Microphysics.DCMIP2016KesslerMicrophysics,
    model::AtmosphereModel{<:ParcelDynamics}
)

Apply DCMIP2016 Kessler microphysics to a parcel model.

For a Lagrangian parcel, the microphysics processes are:

  1. Autoconversion: Cloud water → rain when cloud exceeds threshold
  2. Accretion: Rain + cloud → rain (collection)
  3. Saturation adjustment: Vapor ↔ cloud to maintain equilibrium
  4. Rain evaporation: Rain → vapor in subsaturated air

Note: Rain sedimentation is not applicable to a Lagrangian parcel since the parcel is a closed system (rain does not fall out of the parcel).

source
Breeze.AtmosphereModels.microphysics_model_update!Method
microphysics_model_update!(
    microphysics::InstantaneousPrecipitation,
    model
)

Condense supersaturation, retain the released latent heat, and remove the condensate as precipitation — applied directly to the prognostic vapor ρqᵛ and liquid-ice potential temperature density ρθˡⁱ.

source
Breeze.AtmosphereModels.precipitation_rateMethod
precipitation_rate(
    model,
    _::Breeze.Microphysics.DCMIP2016KesslerMicrophysics,
    _::Val{:liquid}
) -> Any

Return the liquid precipitation rate field for the DCMIP2016 Kessler microphysics scheme.

The precipitation rate is computed internally by the Kessler kernel and stored in μ.precipitation_rate. It is defined as $q^r v^t_{rain}$ (rain mass fraction times terminal velocity), matching the one-moment microphysics definition. Units are m/s.

This implements the Breeze precipitation_rate(model, phase) interface, allowing the DCMIP2016 Kessler scheme to integrate with Breeze's standard diagnostics.

source
Breeze.AtmosphereModels.prognostic_field_namesMethod
prognostic_field_names(
    _::Breeze.Microphysics.DCMIP2016KesslerMicrophysics
) -> Tuple{Symbol, Symbol}

Return the names of prognostic microphysical fields for the Kessler scheme.

Fields

  • :ρqᶜˡ: Density-weighted cloud liquid mass fraction (kg/m³).
  • :ρqʳ: Density-weighted rain mass fraction (kg/m³).
source
Breeze.AtmosphereModels.surface_precipitation_fluxMethod
surface_precipitation_flux(
    model,
    _::Breeze.Microphysics.DCMIP2016KesslerMicrophysics
) -> Field{LX, LY, LZ, O, G, I, D, T, B, Oceananigans.Fields.FieldStatus{Float64}} where {LX, LY, LZ, O, G, I, D, T, B}

Return the surface precipitation flux field for the DCMIP2016 Kessler microphysics scheme.

The surface precipitation flux is $ρ q^r v^t_{rain}$ at the surface, matching the one-moment microphysics definition. Units are kg/m²/s.

This implements the Breeze surface_precipitation_flux(model) interface.

source
Breeze.AtmosphereModels.surface_precipitation_fluxMethod
surface_precipitation_flux(
    model,
    _::InstantaneousPrecipitation
) -> Field{LX, LY, LZ, O, G, I, D, T, B, Oceananigans.Fields.FieldStatus{Float64}} where {LX, LY, LZ, O, G, I, D, T, B}

Return the surface precipitation flux for the instantaneous-precipitation scheme.

The scheme removes condensed water immediately, so the surface flux is the column integral of the volumetric precipitation rate. Units are kg/m²/s.

source
Breeze.Microphysics.cloud_to_rain_productionMethod
cloud_to_rain_production(rᶜˡ, rʳ, Δt, microphysics)

Compute cloud-to-rain production rate from autoconversion and accretion (Klemp and Wilhelmson 1978, eq. 2.13).

This implements the combined effect of:

  • Autoconversion: Cloud water spontaneously converting to rain when rᶜˡ > rᶜˡ★
  • Accretion: Rain collecting cloud water as it falls

The formula uses an implicit time integration for numerical stability.

References

  • Klemp, J. B., & Wilhelmson, R. B. (1978). The simulation of three-dimensional convective storm dynamics. Journal of the Atmospheric Sciences, 35(6), 1070-1096.
source
Breeze.Microphysics.condensation_rateMethod
condensation_rate(
    qᵛ,
    qᵛ⁺,
    qᶜˡ,
    T,
    ρ,
    q,
    τᶜˡ,
    constants
) -> Any

Compute the condensation/evaporation rate for cloud liquid water in a relaxation-to-saturation model.

This returns the rate of change of cloud liquid mass fraction (kg/kg/s). Positive values indicate condensation; negative values indicate evaporation. Evaporation is limited by the available cloud liquid.

source
Breeze.Microphysics.deposition_rateMethod
deposition_rate(
    qᵛ,
    qᵛ⁺ⁱ,
    qᶜⁱ,
    T,
    ρ,
    q,
    τᶜⁱ,
    constants
) -> Any

Compute the deposition/sublimation rate for cloud ice in a relaxation-to-saturation model.

This returns the rate of change of cloud ice mass fraction (kg/kg/s). Positive values indicate deposition; negative values indicate sublimation. Sublimation is limited by the available cloud ice.

source
Breeze.Microphysics.ice_thermodynamic_adjustment_factorMethod
ice_thermodynamic_adjustment_factor(
    qᵛ⁺ⁱ,
    T,
    q,
    constants
) -> Any

Compute the thermodynamic adjustment factor Γ used in relaxation-to-saturation deposition/sublimation tendencies (ice analogue of thermodynamic_adjustment_factor).

source
Breeze.Microphysics.step_kessler_microphysicsMethod
step_kessler_microphysics(
    rᵛ,
    rᶜˡ,
    rʳ,
    Δr𝕎,
    T,
    ρ,
    p,
    Δt,
    microphysics,
    constants,
    f₅,
    δT,
    FT
) -> NTuple{4, Any}

Apply one Kessler microphysics step: autoconversion, accretion, saturation adjustment, rain evaporation, and condensation.

Δr𝕎 is the sedimentation flux divergence (zero for parcel models).

Returns (rᵛ, rᶜˡ, rʳ, Δrˡ).

source

MoistAirBuoyancies

Breeze.MoistAirBuoyancies.compute_boussinesq_adjustment_temperatureMethod
compute_boussinesq_adjustment_temperature(
    𝒰₀::Breeze.Thermodynamics.LiquidIcePotentialTemperatureState{FT},
    constants::ThermodynamicConstants
) -> Any

Return the temperature $T$ corresponding to thermodynamic equilibrium between the specific humidity and liquid mass fractions of the input thermodynamic state 𝒰₀, wherein the specific humidity is equal to or less than the saturation specific humidity at the given conditions and affiliated with theromdynamic constants constants.

The saturation equilibrium temperature satisfies the nonlinear relation

\[θ = [1 - ℒˡᵣ qˡ / (cᵖᵐ T)] T / Π ,\]

with $ℒˡᵣ$ the latent heat at the reference temperature $Tᵣ$, $cᵖᵐ$ the mixture specific heat, $Π$ the Exner function, $qˡ = \max(0, qᵗ - qᵛ⁺)$ the condensate specific humidity, $qᵗ$ is the total specific humidity, and $qᵛ⁺$ is the saturation specific humidity.

The saturation equilibrium temperature is thus obtained by solving $r(T) = 0$, where

\[r(T) ≡ T - θ Π - ℒˡᵣ qˡ / cᵖᵐ .\]

Solution of $r(T) = 0$ is found via the secant method.

source

ParcelModels

Breeze.ParcelModels.check_domain_bounds!Method
check_domain_bounds!(state, grid)

Check that the parcel remains within the vertical grid domain [0, Lz].

Throws an error if the parcel escapes the domain, since extrapolation of environmental profiles (pressure, density) beyond the grid is unphysical.

source
Breeze.ParcelModels.set_moisture_from_relative_humidity!Method
set_moisture_from_relative_humidity!(
    qᵗ_field,
    ℋ,
    T_field,
    ρ_field,
    constants
)

Set specific humidity field from relative humidity, computing

\[qᵗ = ℋ qᵛ⁺(T, ρ).\]

where $qᵗ$ is the total specific moisture, $ℋ$ is the relative humidity, and $qᵛ⁺$ is the saturation specific humidity at temperature $T$ and density $ρ$.

source
Oceananigans.Fields.set!Method
set!(
    model::AtmosphereModel{<:ParcelDynamics};
    T,
    θ,
    ρ,
    p,
    qᵗ,
    ℋ,
    u,
    v,
    w,
    w_parcel,
    x,
    y,
    z
)

Set the environmental profiles and initial parcel state for a ParcelModel.

Environmental profiles are set on the model's fields (temperature, density, pressure, velocities). The parcel is initialized at the specified position with environmental conditions interpolated at that height.

Keyword Arguments

Thermodynamic profiles (provide one of T or θ):

  • T: Temperature profile T(z) [K] - function, array, Field, or constant
  • θ: Potential temperature profile θ(z) [K] - function, array, or constant. If provided, T is computed from θ and p using thermodynamic relations.
  • ρ: Density profile ρ(z) [kg/m³] - function, array, Field, or constant
  • p: Pressure profile p(z) [Pa] - function, array, Field, or constant

Moisture (provide one of qᵗ or ):

  • qᵗ: Specific humidity profile qᵗ(z) [kg/kg] - function, array, or constant (default: 0)
  • : Relative humidity profile ℋ(z) [0-1] - function, array, or constant. If provided, qᵗ is computed as qᵗ = ℋ * qᵛ⁺(T, ρ).

Velocities:

  • u: Zonal velocity u(z) [m/s] - function, array, or constant (default: 0)
  • v: Meridional velocity v(z) [m/s] - function, array, or constant (default: 0)
  • w: Vertical velocity w(z) [m/s] - function, array, or constant (default: 0)

Parcel state:

  • x: Initial parcel x-position [m], default: 0
  • y: Initial parcel y-position [m], default: 0
  • z: Initial parcel height [m], required to initialize parcel state
  • w_parcel: Initial parcel vertical velocity [m/s], for PrognosticVerticalVelocity
source
Oceananigans.TimeSteppers.time_step!Method
time_step!(
    model::AtmosphereModel{<:ParcelDynamics, <:Any, <:Any, <:SSPRungeKutta3},
    Δt;
    callbacks
)

Advance the parcel model by one time step $Δt$ using SSP RK3.

The SSP RK3 scheme Shu and Osher (1988) is:

\[\begin{align*} u^{(1)} &= u^{(0)} + Δt \, G(u^{(0)}) \\ u^{(2)} &= \frac{3}{4} u^{(0)} + \frac{1}{4} u^{(1)} + \frac{1}{4} Δt \, G(u^{(1)}) \\ u^{(3)} &= \frac{1}{3} u^{(0)} + \frac{2}{3} u^{(2)} + \frac{2}{3} Δt \, G(u^{(2)}) \end{align}\]

This scheme has CFL coefficient = 1 and is TVD (total variation diminishing).

source
Oceananigans.TimeSteppers.update_state!Function
update_state!(model::AtmosphereModel{<:ParcelDynamics}; ...)
update_state!(
    model::AtmosphereModel{<:ParcelDynamics},
    callbacks;
    compute_tendencies
)

Update the parcel model state, computing tendencies and auxiliary variables.

This function is called at the beginning of each time step and after each substep in multi-stage time steppers. It mirrors the role of update_state! for AtmosphereModel and consolidates all state-dependent computations:

  1. Compute position tendencies (Gx, Gy, Gz) from environmental velocity profiles
  2. Any other auxiliary state computations (currently none)

Keyword Arguments

  • compute_tendencies: If true (default), compute tendencies for prognostic variables.
source

PotentialTemperatureFormulations

Breeze.AtmosphereModels.diagnose_thermodynamic_stateMethod
diagnose_thermodynamic_state(
    i,
    j,
    k,
    grid,
    formulation::LiquidIcePotentialTemperatureFormulation,
    dynamics,
    q
) -> Breeze.Thermodynamics.LiquidIceDensityState

Build a LiquidIcePotentialTemperatureState at grid point (i, j, k) from the given formulation, dynamics, and pre-computed moisture mass fractions q.

source
Breeze.AtmosphereModels.set_thermodynamic_variable!Method
set_thermodynamic_variable!(
    model::AtmosphereModel{<:Any, <:LiquidIcePotentialTemperatureFormulation},
    _::Val{:T},
    value
)

Set the thermodynamic state from in-situ temperature $T$.

The temperature is converted to liquid-ice potential temperature θˡⁱ using the relation between $T$ and θˡⁱ` that accounts for the moisture distribution.

For unsaturated air (no condensate), this simplifies to $θ = T / Π$ where $Π$ is the Exner function.

source
Breeze.AtmosphereModels.static_energy_densityMethod
static_energy_density(model::PotentialTemperatureModel)

Return the static energy density as a Field with boundary conditions that return energy fluxes when used with BoundaryConditionOperation.

For LiquidIcePotentialTemperatureFormulation, the prognostic variable is potential temperature density ρθ. This function converts the ρθ boundary conditions to energy flux boundary conditions by multiplying by the mixture heat capacity cᵖᵐ.

source

Solvers

Breeze.Solvers.materialize_solverMethod
materialize_solver(solver::NewtonSolver, FT) -> NewtonSolver

Return solver with its tolerances converted to float type FT, so that solver parameters stored on Float32 models do not promote kernel arithmetic.

source
Breeze.Solvers.newton_solveMethod
newton_solve(
    residual_and_derivative,
    solver::NewtonSolver,
    x
) -> Any

Solve r(x) = 0 by Newton iteration from initial guess x, where residual_and_derivative(x) returns the tuple (r(x), r′(x)).

The iteration is controlled by solver:

  • NewtonSolver: iterate until |Δx| ≤ max(abstol, reltol * |x|) or maxiter is reached
  • FixedIterations: perform exactly iterations Newton steps (no convergence test)
  • nothing: return the initial guess x unmodified
using Breezeusing Breeze.Solvers: newton_solvesolver = NewtonSolver(reltol=1e-12, maxiter=20)x = newton_solve(x -> (x^2 - 2, 2x), solver, 1.0)round(x, digits=10)# output1.4142135624
source
Breeze.Solvers.secant_solveMethod
secant_solve(
    residual,
    solver::SecantSolver,
    x₁,
    x₂,
    scale
) -> Any

Solve r(x) = 0 by secant iteration from the initial guesses x₁ and x₂, where residual(x) returns r(x). The convergence criterion compares the residual against scale: iteration stops when |r| ≤ max(abstol, reltol * |scale|).

The iteration is controlled by solver:

  • SecantSolver: iterate until the residual converges or maxiter is reached
  • FixedIterations: perform exactly iterations secant steps (no convergence test)

A degenerate step (r₂ = r₁, slope undefined) terminates a SecantSolver iteration at the current iterate and leaves a FixedIterations iterate unchanged.

using Breezeusing Breeze.Solvers: secant_solvesolver = SecantSolver(abstol=1e-12, maxiter=20)x = secant_solve(x -> x^2 - 2, solver, 1.0, 2.0, 1.0)round(x, digits=10)# output1.4142135624
source

StaticEnergyFormulations

Breeze.AtmosphereModels.diagnose_thermodynamic_stateMethod
diagnose_thermodynamic_state(
    i,
    j,
    k,
    grid,
    formulation::StaticEnergyFormulation,
    dynamics,
    q
) -> Breeze.Thermodynamics.StaticEnergyState

Build a StaticEnergyState at grid point (i, j, k) from the given formulation, dynamics, and pre-computed moisture mass fractions q.

source
Breeze.AtmosphereModels.set_thermodynamic_variable!Method
set_thermodynamic_variable!(
    model::AtmosphereModel{<:Any, <:StaticEnergyFormulation},
    _::Val{:T},
    value
)

Set the thermodynamic state from temperature $T$.

The temperature is converted to static energy $e$ using the relation:

\[e = cᵖᵐ T + g z - ℒˡ qˡ - ℒⁱ qⁱ .\]

source

TerrainFollowingDiscretization

Thermodynamics

Breeze.Thermodynamics.enforce_discrete_hydrostatic_balance!Method
enforce_discrete_hydrostatic_balance!(pᵣ, ρᵣ, grid, g)

Recompute the reference pressure pᵣ from the reference density ρᵣ by discrete upward integration, ensuring that the discrete hydrostatic balance

\[\frac{p_{ref}[k] - p_{ref}[k-1]}{Δz} + g \frac{ρ_{ref}[k] + ρ_{ref}[k-1]}{2} = 0\]

holds exactly at every interior z-face. This guarantees that reference-state subtraction in the pressure gradient and buoyancy cancels to machine precision, eliminating the $O(Δz^2)$ truncation error that would otherwise dominate the momentum tendency for nearly-hydrostatic flows.

source
Breeze.Thermodynamics.numerically_integrated_hydrostatic_pressureMethod
numerically_integrated_hydrostatic_pressure(z, p₀, θ_func, pˢᵗ, constants)

Compute the dry hydrostatic pressure at height $z$ by numerically integrating $∂p/∂z = -g ρ$ from $z=0$, where $ρ = p/(Rᵈ T)$ and $T = θ(z) (p/pˢᵗ)^κ$.

This function handles non-uniform potential temperature profiles $θ(z)$ for which the closed-form adiabatic solution does not apply. The integration is carried out in the dry Exner function $Π = (p / pˢᵗ)^κ$, which satisfies the linear equation $∂Π/∂z = -g / (cᵖᵈ θ(z))$.

source

TimeSteppers

Breeze.TimeSteppers.acoustic_rk3_substep!Method
acoustic_rk3_substep!(model::AtmosphereModel, Δt, β)

Run one Wicker–Skamarock RK3 stage: compute slow tendencies, then execute the linearized-acoustic substep loop, then update remaining scalars.

source
Breeze.TimeSteppers.compute_slow_momentum_tendencies!Method
compute_slow_momentum_tendencies!(model)

Compute slow momentum tendencies (advection, Coriolis, closure, forcing). The pressure-gradient force and buoyancy are excluded; they are handled in linearized form inside the acoustic substep loop.

source
Breeze.TimeSteppers.compute_slow_scalar_tendencies!Method
compute_slow_scalar_tendencies!(model)

Compute slow tendencies for density and the thermodynamic variable:

  • $Gˢ_ρᵈ = -∇·m$: full dry-density tendency (continuity equation), written into model.timestepper.Gⁿ.ρᵈ.
  • $Gˢ_ρᵡ$: full thermodynamic-density tendency (advection + physics).
source
Breeze.TimeSteppers.implicit_substep!Method
implicit_substep!(model, Δt_stage)

Apply the vertically-implicit tridiagonal solve to the prognostics that the acoustic substep loop advances: momentum and the thermodynamic variable. Dispatch on the timestepper's implicit_solver selects the method: nothing means nothing in the model is vertically implicit and the substep is a no-op.

Each field's solve combines every implicit vertical piece into a single tridiagonal system: the first-order-upwind remainder of adaptive implicit vertical advection (whose CFL-limited explicit flux the slow tendencies carry through the advection dispatch), plus vertically-implicit closure diffusion. Explicit advection schemes contribute no advection coefficients and explicit closures no diffusion coefficients, so each combination reduces to the right system. The solve runs once per RK stage after the substep loop, over the stage interval — the operator split WRF and CM1 use for their implicit vertical pieces. Continuity takes no implicit solve: the coupling-density tendency is the acoustic mass-flux divergence itself, not scalar advection.

The advecting velocity passed to each solve must be the one its slow tendency was built with, so the explicit/implicit velocity split is consistent: the RK stage-entry predictor velocities (see compute_slow_momentum_tendencies! and compute_slow_scalar_tendencies!), not the substepper's time-averaged transport velocities that moisture and tracers use.

source
Breeze.TimeSteppers.scalar_substep!Method
scalar_substep!(model, kernel!, Δt_implicit, kernel_args...)

Update non-acoustic scalar fields (moisture, tracers) using the given kernel. Iterates over prognostic fields, skipping the first 5 ($ρ, ρu, ρv, ρw, ρθ$) which are handled by the acoustic substep loop.

source
Oceananigans.TimeSteppers.time_step!Method
time_step!(
    model::AtmosphereModel{<:Any, <:Any, <:Any, <:SSPRungeKutta3},
    Δt;
    callbacks
)

Step forward model one time step $Δt$ with the SSP RK3 method.

The algorithm is:

\[\begin{align*} u^{(1)} &= u^{(0)} + Δt \, G(u^{(0)}) \\ u^{(2)} &= \frac{3}{4} u^{(0)} + \frac{1}{4} u^{(1)} + \frac{1}{4} Δt \, G(u^{(1)}) \\ u^{(3)} &= \frac{1}{3} u^{(0)} + \frac{2}{3} u^{(2)} + \frac{2}{3} Δt \, G(u^{(2)}) \end{align*}\]

where $G$ above is the right-hand-side, e.g., $∂u/∂t = G(u)$.

source
Oceananigans.TimeSteppers.time_step!Method
time_step!(
    model::AtmosphereModel{<:CompressibleDynamics, <:Any, <:Any, <:AcousticRungeKutta3},
    Δt;
    callbacks
)

Step forward model one time step Δt with Wicker–Skamarock RK3 and linearized acoustic substepping.

source

TurbulenceClosures

VerticalGrids

BreezeRRTMGPExt

Breeze.AtmosphereModels.RadiativeTransferModelMethod
RadiativeTransferModel(
    grid::Oceananigans.Grids.AbstractGrid,
    ::AllSkyOptics,
    constants::ThermodynamicConstants;
    background_atmosphere,
    surface_temperature,
    solar_position,
    surface_emissivity,
    direct_surface_albedo,
    diffuse_surface_albedo,
    surface_albedo,
    solar_constant,
    schedule,
    liquid_effective_radius,
    ice_effective_radius,
    ice_roughness
)

Construct an all-sky (gas + cloud) full-spectrum RadiativeTransferModel for the given grid.

This constructor requires that NCDatasets is loadable in the user environment because RRTMGP loads lookup tables from netCDF via an extension.

Keyword Arguments

  • background_atmosphere: Background atmospheric gas composition (default: BackgroundAtmosphere()). O₃ can be a Number or Function of z; other gases are global mean constants. O₃ can be a Number, Function, or Field; other gases are global mean constants.
  • surface_temperature: Surface temperature in Kelvin, a Number or 2D Field. Default: nothing — bind one before the first radiation update (a coupled model wires its interface surface temperature into the radiation automatically).
  • solar_position: Specification of the solar zenith angle. See AbstractSolarPosition and its subtypes:
  • surface_emissivity: Surface emissivity, 0-1 (default: 0.98). Scalar.
  • surface_albedo: Surface albedo, 0-1. Can be scalar or 2D field. Alternatively, provide both direct_surface_albedo and diffuse_surface_albedo.
  • direct_surface_albedo: Direct surface albedo, 0-1. Can be scalar or 2D field.
  • diffuse_surface_albedo: Diffuse surface albedo, 0-1. Can be scalar or 2D field.
  • solar_constant: Top-of-atmosphere solar flux in W/m² (default: 1361)
  • liquid_effective_radius: Model for cloud liquid effective radius in meters (default: ConstantRadiusParticles(10e-6))
  • ice_effective_radius: Model for cloud ice effective radius in meters (default: ConstantRadiusParticles(30e-6))
  • ice_roughness: Ice crystal roughness for cloud optics (1=smooth, 2=medium, 3=rough; default: 2)
source
Breeze.AtmosphereModels.RadiativeTransferModelMethod
RadiativeTransferModel(
    grid::Oceananigans.Grids.AbstractGrid,
    ::ClearSkyOptics,
    constants::ThermodynamicConstants;
    background_atmosphere,
    surface_temperature,
    solar_position,
    surface_emissivity,
    direct_surface_albedo,
    diffuse_surface_albedo,
    surface_albedo,
    solar_constant,
    schedule
)

Construct a clear-sky (gas-only) full-spectrum RadiativeTransferModel for the given grid.

This constructor requires that NCDatasets is loadable in the user environment because RRTMGP loads lookup tables from netCDF via an extension.

Keyword Arguments

  • background_atmosphere: Background atmospheric gas composition (default: BackgroundAtmosphere()). O₃ can be a Number or Function of z; other gases are global mean constants.
  • surface_temperature: Surface temperature in Kelvin, a Number or 2D Field. Default: nothing — bind one before the first radiation update (a coupled model wires its interface surface temperature into the radiation automatically).
  • solar_position: Specification of the solar zenith angle. See AbstractSolarPosition and its subtypes:
  • surface_emissivity: Surface emissivity, 0-1 (default: 0.98). Scalar.
  • surface_albedo: Surface albedo, 0-1. Can be scalar or 2D field. Alternatively, provide both direct_surface_albedo and diffuse_surface_albedo.
  • direct_surface_albedo: Direct surface albedo, 0-1. Can be scalar or 2D field.
  • diffuse_surface_albedo: Diffuse surface albedo, 0-1. Can be scalar or 2D field.
  • solar_constant: Top-of-atmosphere solar flux in W/m² (default: 1361)
source
Breeze.AtmosphereModels.RadiativeTransferModelMethod
RadiativeTransferModel(
    grid::Oceananigans.Grids.AbstractGrid,
    ::GrayOptics,
    constants::ThermodynamicConstants;
    optical_thickness,
    surface_temperature,
    solar_position,
    surface_emissivity,
    direct_surface_albedo,
    diffuse_surface_albedo,
    surface_albedo,
    solar_constant,
    schedule
)

Construct a gray atmosphere radiative transfer model for the given grid.

Keyword Arguments

  • optical_thickness: Optical thickness parameterization (default: GrayOpticalThicknessOGorman2008(FT)).
  • surface_temperature: Surface temperature in Kelvin, a Number or 2D Field. Default: nothing — bind one before the first radiation update (a coupled model wires its interface surface temperature into the radiation automatically).
  • solar_position: Specification of the solar zenith angle. See AbstractSolarPosition and its subtypes:
  • surface_emissivity: Surface emissivity, 0-1 (default: 0.98). Scalar.
  • surface_albedo: Surface albedo, 0-1. Can be scalar or 2D field. Alternatively, provide both direct_surface_albedo and diffuse_surface_albedo.
  • direct_surface_albedo: Direct surface albedo, 0-1. Can be scalar or 2D field.
  • diffuse_surface_albedo: Diffuse surface albedo, 0-1. Can be scalar or 2D field.
  • solar_constant: Top-of-atmosphere solar flux in W/m² (default: 1361)
source
Breeze.AtmosphereModels._update_radiation!Method
_update_radiation!(
    rtm::RadiativeTransferModel{<:Any, <:Any, <:Any, <:BackgroundAtmosphere, <:RRTMGP.AtmosphericStates.AtmosphericState{<:Any, <:Any, <:Any, <:Any, <:Any, <:RRTMGP.AtmosphericStates.CloudState}},
    model
)

Update the all-sky (gas + cloud) full-spectrum radiative fluxes from the current model state.

source
Breeze.AtmosphereModels._update_radiation!Method
_update_radiation!(
    rtm::RadiativeTransferModel{<:Any, <:Any, <:Any, <:BackgroundAtmosphere},
    model
)

Update the clear-sky full-spectrum radiative fluxes from the current model state.

source
Breeze.AtmosphereModels._update_radiation!Method
_update_radiation!(
    rtm::RadiativeTransferModel{<:Any, <:Any, <:Any, Nothing},
    model
)

Update the radiative fluxes from the current model state.

This function:

  1. Updates the RRTMGP atmospheric state from model fields (T, p)
  2. Computes the solar zenith angle from the model clock and grid location
  3. Solves the longwave and shortwave RTE
  4. Copies the fluxes to Oceananigans fields for output

Sign convention: positive flux = upward, negative flux = downward.

source
BreezeRRTMGPExt.copy_fluxes_to_fields!Method
copy_fluxes_to_fields!(
    rtm::RadiativeTransferModel{<:Any, <:Any, <:Any, Nothing},
    grid
)

Copy RRTMGP flux arrays to Oceananigans ZFaceFields.

Applies sign convention:

  • positive = upward
  • negative = downward.

For the non-scattering shortwave solver, only the direct beam flux is computed.

source
BreezeRRTMGPExt.update_rrtmgp_state!Method
update_rrtmgp_state!(
    rrtmgp_state::RRTMGP.AtmosphericStates.GrayAtmosphericState,
    model,
    surface_temperature
)

Update the RRTMGP GrayAtmosphericState arrays from model fields.

Grid staggering: layers vs levels

RRTMGP requires atmospheric state at both "layers" (cell centers) and "levels" (cell faces). This matches the finite-volume staggering used in Oceananigans:

                        ┌─────────────────────────────────────────────────┐    z_lev[Nz+1] ━━━━━━━ │  level Nz+1 (TOA):  p_lev, t_lev, z_lev         │  extrapolated                        └─────────────────────────────────────────────────┘                        ┌─────────────────────────────────────────────────┐                        │  layer Nz:  T[Nz], p_lay[Nz] = pᵣ[Nz]           │  from model                        └─────────────────────────────────────────────────┘    z_lev[Nz]   ━━━━━━━   level Nz:   p_lev, t_lev, z_lev                    interpolated                        ┌─────────────────────────────────────────────────┐                        │  layer Nz-1                        └─────────────────────────────────────────────────┘                                                                    ┌─────────────────────────────────────────────────┐                        │  layer 2                        └─────────────────────────────────────────────────┘    z_lev[2]    ━━━━━━━   level 2:    p_lev, t_lev, z_lev                    interpolated                        ┌─────────────────────────────────────────────────┐                        │  layer 1:   T[1], p_lay[1] = pᵣ[1]              │  from model                        └─────────────────────────────────────────────────┘    z_lev[1]    ━━━━━━━   level 1 (surface, z=0):  p_lev = p₀, t_lev      │  from reference state                        ══════════════════════════════════════════════════                                        GROUND (t_sfc)

Why the model must provide level values

RRTMGP is a general-purpose radiative transfer solver that operates on columns of atmospheric data. It does not interpolate from layers to levels internally because:

  1. Boundary conditions: The surface (level 1) and TOA (level Nz+1) require boundary values that only the atmospheric model knows. For pressure, we use the reference state's surface_pressure at z=0. For the top, we extrapolate using the adiabatic hydrostatic formula.

  2. Physics-appropriate interpolation: Different quantities need different interpolation methods. Pressure uses geometric mean (log-linear interpolation) because it varies exponentially with height. Temperature uses arithmetic mean.

  3. Model consistency: The pressure profile must be consistent with the atmospheric model's reference state. RRTMGP has no knowledge of the anelastic approximation or the reference potential temperature θ₀.

Physics notes

Temperature: We use the actual temperature field T from the model state. This is the temperature that matters for thermal emission and absorption.

Pressure: In the anelastic approximation, pressure perturbations are negligible compared to the hydrostatic reference pressure. We use reference_state.pressure at cell centers, computed via adiabatic_hydrostatic_pressure(z, p₀, θ₀).

RRTMGP array layout

  • Layer arrays (Nz, Nc): values at cell centers, layer 1 at bottom
  • Level arrays (Nz+1, Nc): values at cell faces, level 1 at surface (z=0)
source
BreezeRRTMGPExt.update_solar_zenith_angle!Method
update_solar_zenith_angle!(
    sw_solver,
    _::FixedCosineZenith,
    grid,
    clock
)

Update the cosine of the solar zenith angle in the shortwave solver's boundary condition array, dispatched on the solar-position specification:

  • ApparentSolarPosition: recompute cos(θ_z) from the model clock and observer (λ, φ) — either an explicit coordinate or the grid's λ/φ per column.
  • FixedCosineZenith: no-op. The BC array was set once at construction by initialize_cos_zenith!.
source

BreezeCloudMicrophysicsExt

BreezeCloudMicrophysicsExt.AerosolActivationType
AerosolActivation{AP, AD, FT}

Aerosol activation parameters for two-moment microphysics.

Aerosol activation is the physical process that creates cloud droplets from aerosol particles when air becomes supersaturated. This struct bundles the parameters needed to compute the activation source term for cloud droplet number concentration.

Fields

  • activation_parameters: AerosolActivationParameters from CloudMicrophysics.jl
  • aerosol_distribution: Aerosol size distribution (modes with number, size, hygroscopicity)
  • nucleation_timescale: Nucleation timescale [s] for converting activation deficit to rate (default: 1s)

References

  • Abdul-Razzak, H. and Ghan, S.J. (2000). A parameterization of aerosol activation: 2. Multiple aerosol types. J. Geophys. Res., 105(D5), 6837-6844.
source
BreezeCloudMicrophysicsExt.MixedPhaseOneMomentStateType
MixedPhaseOneMomentState{FT} <: AbstractMicrophysicalState{FT}

Microphysical state for mixed-phase one-moment bulk microphysics.

Contains the local mixing ratios for cloud liquid, cloud ice, rain, and snow. This state is used for both saturation adjustment and non-equilibrium cloud formation in mixed-phase simulations.

Fields

  • qᶜˡ: Cloud liquid mixing ratio (kg/kg)
  • qᶜⁱ: Cloud ice mixing ratio (kg/kg)
  • : Rain mixing ratio (kg/kg)
  • : Snow mixing ratio (kg/kg)
source
BreezeCloudMicrophysicsExt.OneMomentCloudMicrophysicsType
OneMomentCloudMicrophysics(
;
    ...
) -> BulkMicrophysics{N, C, Nothing, Nothing} where {N<:(NonEquilibriumCloudFormation{ConstantRateCondensateFormation{FT}, Nothing} where FT), C<:(BreezeCloudMicrophysicsExt.OneMomentCloudMicrophysicsCategories{P, V} where {P<:(CloudMicrophysics.Parameters.Microphysics1MParams{OPT, CP, PP, AP, VL} where {OPT<:(CloudMicrophysics.Parameters.Microphysics1MOptions{CLF, CIF, CloudMicrophysics.Parameters.CloudIceMelt, RA, SA, CloudMicrophysics.Parameters.RainEvaporation, CloudMicrophysics.Parameters.DepositionAndSublimation, CloudMicrophysics.Parameters.SnowMelt, CLRA, CLSA, CIRA, CISA, RSA} where {CLF<:CloudMicrophysics.Parameters.CloudLiquidFormation, CIF<:CloudMicrophysics.Parameters.ConstantTimescale, RA<:(CloudMicrophysics.Parameters.Kessler1M{AC} where AC<:CloudMicrophysics.Parameters.Acnv1M), SA<:(CloudMicrophysics.Parameters.NoSupersaturation{AC} where AC<:CloudMicrophysics.Parameters.Acnv1M), CLRA<:CloudMicrophysics.Parameters.CloudLiquidRainAccretion, CLSA<:CloudMicrophysics.Parameters.CloudLiquidSnowAccretion, CIRA<:CloudMicrophysics.Parameters.CloudIceRainAccretion, CISA<:CloudMicrophysics.Parameters.CloudIceSnowAccretion, RSA<:CloudMicrophysics.Parameters.RainSnowAccretion}), CP<:(CloudMicrophysics.Parameters.CloudPhaseParams1M{LCL, ICL} where {LCL<:CloudMicrophysics.Parameters.CloudLiquid, ICL<:(CloudMicrophysics.Parameters.CloudIce{_A, PD, MS} where {_A, PD<:CloudMicrophysics.Parameters.ParticlePDFIceRain, MS<:CloudMicrophysics.Parameters.ParticleMass})}), PP<:(CloudMicrophysics.Parameters.PrecipPhaseParams1M{RAI, SNO} where {RAI<:(CloudMicrophysics.Parameters.Rain{PD, MS, AR, VT} where {PD<:CloudMicrophysics.Parameters.ParticlePDFIceRain, MS<:CloudMicrophysics.Parameters.ParticleMass, AR<:CloudMicrophysics.Parameters.ParticleArea, VT<:CloudMicrophysics.Parameters.Ventilation}), SNO<:(CloudMicrophysics.Parameters.Snow{_A, PD, MS, AR, VT, AP} where {_A, PD<:CloudMicrophysics.Parameters.ParticlePDFSnow, MS<:CloudMicrophysics.Parameters.ParticleMass, AR<:CloudMicrophysics.Parameters.ParticleArea, VT<:CloudMicrophysics.Parameters.Ventilation, AP<:CloudMicrophysics.Parameters.SnowAspectRatio})}), AP<:CloudMicrophysics.Parameters.AirProperties, VL<:(CloudMicrophysics.Parameters.Blk1MVelType{R, S} where {R<:CloudMicrophysics.Parameters.Blk1MVelTypeRain, S<:CloudMicrophysics.Parameters.Blk1MVelTypeSnow})}), V<:(CloudMicrophysics.Parameters.TerminalVelocityParams{STOKES, CHEN, BLK1M} where {STOKES<:CloudMicrophysics.Parameters.StokesRegimeVelType, CHEN<:(CloudMicrophysics.Parameters.Chen2022VelType{R, SI, LI} where {R<:(CloudMicrophysics.Parameters.Chen2022VelTypeRain{FT, 3} where FT<:AbstractFloat), SI<:(CloudMicrophysics.Parameters.Chen2022VelTypeSmallIce{FT, 3, 4} where FT<:AbstractFloat), LI<:(CloudMicrophysics.Parameters.Chen2022VelTypeLargeIce{FT, 3} where FT<:AbstractFloat)}), BLK1M<:(CloudMicrophysics.Parameters.Blk1MVelType{R, S} where {R<:CloudMicrophysics.Parameters.Blk1MVelTypeRain, S<:CloudMicrophysics.Parameters.Blk1MVelTypeSnow})})})}
OneMomentCloudMicrophysics(
    FT::DataType;
    cloud_formation,
    categories,
    precipitation_boundary_condition,
    negative_moisture_correction
) -> BulkMicrophysics{N, C, Nothing, Nothing} where {N<:(NonEquilibriumCloudFormation{ConstantRateCondensateFormation{FT}, Nothing} where FT), C<:(BreezeCloudMicrophysicsExt.OneMomentCloudMicrophysicsCategories{P, V} where {P<:(CloudMicrophysics.Parameters.Microphysics1MParams{OPT, CP, PP, AP, VL} where {OPT<:(CloudMicrophysics.Parameters.Microphysics1MOptions{CLF, CIF, CloudMicrophysics.Parameters.CloudIceMelt, RA, SA, CloudMicrophysics.Parameters.RainEvaporation, CloudMicrophysics.Parameters.DepositionAndSublimation, CloudMicrophysics.Parameters.SnowMelt, CLRA, CLSA, CIRA, CISA, RSA} where {CLF<:CloudMicrophysics.Parameters.CloudLiquidFormation, CIF<:CloudMicrophysics.Parameters.ConstantTimescale, RA<:(CloudMicrophysics.Parameters.Kessler1M{AC} where AC<:CloudMicrophysics.Parameters.Acnv1M), SA<:(CloudMicrophysics.Parameters.NoSupersaturation{AC} where AC<:CloudMicrophysics.Parameters.Acnv1M), CLRA<:CloudMicrophysics.Parameters.CloudLiquidRainAccretion, CLSA<:CloudMicrophysics.Parameters.CloudLiquidSnowAccretion, CIRA<:CloudMicrophysics.Parameters.CloudIceRainAccretion, CISA<:CloudMicrophysics.Parameters.CloudIceSnowAccretion, RSA<:CloudMicrophysics.Parameters.RainSnowAccretion}), CP<:(CloudMicrophysics.Parameters.CloudPhaseParams1M{LCL, ICL} where {LCL<:CloudMicrophysics.Parameters.CloudLiquid, ICL<:(CloudMicrophysics.Parameters.CloudIce{_A, PD, MS} where {_A, PD<:CloudMicrophysics.Parameters.ParticlePDFIceRain, MS<:CloudMicrophysics.Parameters.ParticleMass})}), PP<:(CloudMicrophysics.Parameters.PrecipPhaseParams1M{RAI, SNO} where {RAI<:(CloudMicrophysics.Parameters.Rain{PD, MS, AR, VT} where {PD<:CloudMicrophysics.Parameters.ParticlePDFIceRain, MS<:CloudMicrophysics.Parameters.ParticleMass, AR<:CloudMicrophysics.Parameters.ParticleArea, VT<:CloudMicrophysics.Parameters.Ventilation}), SNO<:(CloudMicrophysics.Parameters.Snow{_A, PD, MS, AR, VT, AP} where {_A, PD<:CloudMicrophysics.Parameters.ParticlePDFSnow, MS<:CloudMicrophysics.Parameters.ParticleMass, AR<:CloudMicrophysics.Parameters.ParticleArea, VT<:CloudMicrophysics.Parameters.Ventilation, AP<:CloudMicrophysics.Parameters.SnowAspectRatio})}), AP<:CloudMicrophysics.Parameters.AirProperties, VL<:(CloudMicrophysics.Parameters.Blk1MVelType{R, S} where {R<:CloudMicrophysics.Parameters.Blk1MVelTypeRain, S<:CloudMicrophysics.Parameters.Blk1MVelTypeSnow})}), V<:(CloudMicrophysics.Parameters.TerminalVelocityParams{STOKES, CHEN, BLK1M} where {STOKES<:CloudMicrophysics.Parameters.StokesRegimeVelType, CHEN<:(CloudMicrophysics.Parameters.Chen2022VelType{R, SI, LI} where {R<:(CloudMicrophysics.Parameters.Chen2022VelTypeRain{FT, 3} where FT<:AbstractFloat), SI<:(CloudMicrophysics.Parameters.Chen2022VelTypeSmallIce{FT, 3, 4} where FT<:AbstractFloat), LI<:(CloudMicrophysics.Parameters.Chen2022VelTypeLargeIce{FT, 3} where FT<:AbstractFloat)}), BLK1M<:(CloudMicrophysics.Parameters.Blk1MVelType{R, S} where {R<:CloudMicrophysics.Parameters.Blk1MVelTypeRain, S<:CloudMicrophysics.Parameters.Blk1MVelTypeSnow})})})}

Return a OneMomentCloudMicrophysics microphysics scheme for warm-rain and mixed-phase precipitation.

The one-moment scheme uses CloudMicrophysics.jl 1M processes:

  • Condensation/evaporation of cloud liquid (relaxation toward saturation)
  • Autoconversion of cloud liquid to rain
  • Accretion of cloud liquid by rain
  • Terminal velocity for rain sedimentation

By default, non-equilibrium cloud formation is used, where cloud liquid is a prognostic variable that evolves via condensation/evaporation tendencies following Morrison and Grabowski (2008) (see Appendix A). The prognostic variables are ρqᶜˡ (cloud liquid mass density) and ρqʳ (rain mass density).

For equilibrium (saturation adjustment) cloud formation, pass:

using Breeze.Microphysicscloud_formation = SaturationAdjustment(equilibrium=WarmPhaseEquilibrium())# outputSaturationAdjustment{WarmPhaseEquilibrium, Breeze.Solvers.SecantSolver{Float64}}(WarmPhaseEquilibrium(), SecantSolver(reltol=0.0, abstol=0.0001, maxiter=20))

Keyword arguments

  • categories: One-moment parameters and terminal velocities, typically built with one_moment_cloud_microphysics_categories.
  • precipitation_boundary_condition: Controls whether precipitation passes through the bottom boundary.
    • nothing (default): Rain exits through the bottom (open boundary)
    • ImpenetrableBoundaryCondition(): Rain collects at the bottom (zero terminal velocity at surface)

See the CloudMicrophysics.jl documentation for details.

References

  • Morrison, H. and Grabowski, W. W. (2008). A novel approach for representing ice microphysics in models: Description and tests using a kinematic framework. J. Atmos. Sci., 65, 1528–1548. https://doi.org/10.1175/2007JAS2491.1
source
BreezeCloudMicrophysicsExt.TwoMomentCategoriesType
TwoMomentCategories{W, AP, LV, RV, AA, TL}

Parameters for two-moment (Seifert and Beheng, 2006) warm-rain microphysics.

Fields

  • warm_processes: Seifert and Beheng (2006) parameters bundling autoconversion, accretion, self-collection, breakup, evaporation, number adjustment, and size distribution parameters
  • air_properties: AirProperties for thermodynamic calculations
  • cloud_liquid_fall_velocity: StokesRegimeVelType for cloud droplet terminal velocity
  • rain_fall_velocity: SB2006VelType or Chen2022VelTypeRain for raindrop terminal velocity
  • aerosol_activation: AerosolActivation parameters for cloud droplet nucleation (or nothing to disable)
  • τⁿᵘᵐ: Timescale [s] for per-reservoir tendency limiting (default: 10)

References

  • Abdul-Razzak, H. and Ghan, S.J. (2000). A parameterization of aerosol activation: 2. Multiple aerosol types. J. Geophys. Res., 105(D5), 6837-6844.
  • Seifert, A. and Beheng, K. D. (2006). A two-moment cloud microphysics parameterization for mixed-phase clouds. Part 1: Model description. Meteorol. Atmos. Phys., 92, 45-66. https://doi.org/10.1007/s00703-005-0112-4
source
BreezeCloudMicrophysicsExt.TwoMomentCloudMicrophysicsType
TwoMomentCloudMicrophysics(FT = Oceananigans.defaults.FloatType;
                           cloud_formation = NonEquilibriumCloudFormation(nothing, nothing),
                           categories = two_moment_cloud_microphysics_categories(FT),
                           precipitation_boundary_condition = nothing)

Return a TwoMomentCloudMicrophysics microphysics scheme for warm-rain precipitation using the Seifert and Beheng (2006) two-moment parameterization.

The two-moment scheme tracks both mass and number concentration for cloud liquid and rain, using CloudMicrophysics.jl 2M processes:

  • Aerosol activation: Creates cloud droplets when supersaturation develops (enabled by default)
  • Condensation/evaporation of cloud liquid (relaxation toward saturation)
  • Autoconversion of cloud liquid to rain (mass and number)
  • Accretion of cloud liquid by rain (mass and number)
  • Cloud liquid self-collection (number only)
  • Rain self-collection and breakup (number only)
  • Rain evaporation (mass and number)
  • Number adjustment to maintain physical mean particle mass bounds
  • Terminal velocities (number-weighted and mass-weighted)

Non-equilibrium cloud formation is used, where cloud liquid mass and number are prognostic variables that evolve via condensation/evaporation, aerosol activation, and microphysical tendencies.

The prognostic variables are:

  • ρqᶜˡ: cloud liquid mass density [kg/m³]
  • ρnᶜˡ: cloud liquid number density [1/m³]
  • ρqʳ: rain mass density [kg/m³]
  • ρnʳ: rain number density [1/m³]

Aerosol Activation

Aerosol activation is enabled by default and provides the physical source term for cloud droplet number concentration. Without activation, cloud droplets cannot form. The default aerosol population represents typical continental conditions (~100 cm⁻³).

To customize the aerosol population, pass a custom categories with different aerosol_activation:

# Marine aerosol (fewer, more hygroscopic particles)marine_mode = CMAM.Mode_κ(0.08e-6, 1.8, 50e6, (1.0,), (1.0,), (0.058,), (1.0,))marine_activation = AerosolActivation(    AerosolActivationParameters(Float64),    CMAM.AerosolDistribution((marine_mode,)))categories = two_moment_cloud_microphysics_categories(aerosol_activation = marine_activation)microphysics = TwoMomentCloudMicrophysics(categories = categories)

Keyword arguments

  • cloud_formation: Cloud formation scheme (default: NonEquilibriumCloudFormation)
  • categories: TwoMomentCategories containing SB2006 and aerosol activation parameters
  • precipitation_boundary_condition: Controls whether precipitation passes through the bottom boundary.
    • nothing (default): Rain exits through the bottom (open boundary)
    • ImpenetrableBoundaryCondition(): Rain collects at the bottom (zero terminal velocity at surface)

See the CloudMicrophysics.jl 2M documentation for details on the Seifert and Beheng (2006) scheme.

References

  • Seifert, A. and Beheng, K. D. (2006). A two-moment cloud microphysics parameterization for mixed-phase clouds. Part 1: Model description. Meteorol. Atmos. Phys., 92, 45-66. https://doi.org/10.1007/s00703-005-0112-4
  • Abdul-Razzak, H. and Ghan, S.J. (2000). A parameterization of aerosol activation: 2. Multiple aerosol types. J. Geophys. Res., 105(D5), 6837-6844.
source
BreezeCloudMicrophysicsExt.WarmPhaseOneMomentStateType
WarmPhaseOneMomentState{FT} <: AbstractMicrophysicalState{FT}

Microphysical state for warm-phase one-moment bulk microphysics.

Contains the local mixing ratios needed to compute tendencies for cloud liquid and rain. This state is used for both saturation adjustment and non-equilibrium cloud formation in warm-phase (liquid only) simulations.

Fields

  • qᶜˡ: Cloud liquid mixing ratio (kg/kg)
  • : Rain mixing ratio (kg/kg)
source
BreezeCloudMicrophysicsExt.WarmPhaseTwoMomentStateType
WarmPhaseTwoMomentState{FT, V} <: AbstractMicrophysicalState{FT}

Microphysical state for warm-phase two-moment bulk microphysics.

Contains the local mixing ratios and number concentrations needed to compute tendencies for cloud liquid and rain following the Seifert-Beheng 2006 scheme.

Fields

  • qᶜˡ: Cloud liquid mixing ratio (kg/kg)
  • nᶜˡ: Cloud liquid number per unit mass (1/kg)
  • : Rain mixing ratio (kg/kg)
  • : Rain number per unit mass (1/kg)
  • nᵃ: Aerosol number per unit mass (1/kg)
  • velocities: NamedTuple of velocity components (; u, v, w) [m/s]. The vertical velocity w is used for aerosol activation.

References

  • Seifert, A. and Beheng, K. D. (2006). A two-moment cloud microphysics parameterization for mixed-phase clouds. Part 1: Model description. Meteorol. Atmos. Phys., 92, 45-66. https://doi.org/10.1007/s00703-005-0112-4
source
Breeze.AtmosphereModels.surface_precipitation_fluxMethod
surface_precipitation_flux(
    model,
    microphysics::BulkMicrophysics{<:Any, <:BreezeCloudMicrophysicsExt.OneMomentCloudMicrophysicsCategories{<:CloudMicrophysics.Parameters.Microphysics1MParams, <:CloudMicrophysics.Parameters.TerminalVelocityParams}}
) -> Field{LX, LY, LZ, O, G, I, D, T, B, Oceananigans.Fields.FieldStatus{Float64}} where {LX, LY, LZ, O, G, I, D, T, B}

Return a 2D Field representing the precipitation flux at the bottom boundary.

The surface precipitation flux is $wʳ ρqʳ$ at k = 1 (bottom face), representing the rate at which rain mass leaves the domain through the bottom boundary.

Units: kg/m²/s (positive = downward, out of domain)

Sign convention

The returned value is positive when rain is falling out of the domain (the terminal velocity $wʳ$ is negative, and we flip the sign).

source
Breeze.AtmosphereModels.surface_precipitation_fluxMethod
surface_precipitation_flux(
    model,
    microphysics::BulkMicrophysics{<:Any, <:BreezeCloudMicrophysicsExt.TwoMomentCategories{<:CloudMicrophysics.Parameters.SB2006, <:CloudMicrophysics.Parameters.AirProperties, <:CloudMicrophysics.Parameters.StokesRegimeVelType}}
) -> Field{LX, LY, LZ, O, G, I, D, T, B, Oceananigans.Fields.FieldStatus{Float64}} where {LX, LY, LZ, O, G, I, D, T, B}

Return a 2D Field representing the precipitation flux at the bottom boundary.

The surface precipitation flux is $wʳ ρqʳ$ at k = 1 (bottom face), representing the rate at which rain mass leaves the domain through the bottom boundary.

Units: kg/m²/s (positive = downward, out of domain)

Sign convention

The returned value is positive when rain is falling out of the domain (the terminal velocity $wʳ$ is negative, and we flip the sign).

source
BreezeCloudMicrophysicsExt.aerosol_activated_fractionMethod
aerosol_activated_fraction(aerosol_activation, aps, ρ, ℳ, 𝒰, constants)

Compute the fraction of aerosol that activates given current thermodynamic conditions. Uses the maximum supersaturation to determine which aerosol modes activate.

source
BreezeCloudMicrophysicsExt.aerosol_activation_mass_tendencyMethod
aerosol_activation_mass_tendency(aerosol_activation, aps, ρ, ℳ, 𝒰, constants)

Compute the cloud liquid mass tendency from aerosol activation.

When aerosol particles activate to form cloud droplets, the newly formed droplets have a finite initial size given by the activation radius. This function computes the corresponding mass source term for cloud liquid water.

The activation radius is derived from Köhler theory:

\[r_{act} = \frac{2A}{3 S}\]

where $A = 2σ/(ρ_w R_v T)$ is the curvature parameter and $S$ is the instantaneous supersaturation. See eq. 19 in Abdul-Razzak et al. (1998).

The mass tendency is then:

\[\frac{\mathrm{d}q^{cl}}{\mathrm{d}t}_{act} = \frac{\mathrm{d}N^{cl}}{\mathrm{d}t}_{act} \frac{4}{3} π r_{act}^3 \frac{ρ_w}{ρ}\]

The activation rate is controlled by the nucleation timescale τⁿᵘᶜ stored in the AerosolActivation parameters (default: 1s).

Returns

Mass tendency for cloud liquid [kg/kg/s]

source
BreezeCloudMicrophysicsExt.cloud_ice_meltingMethod
cloud_ice_melting(
    cloud_ice::CloudMicrophysics.Parameters.CloudIce,
    air_properties::CloudMicrophysics.Parameters.AirProperties,
    qᶜⁱ,
    ρ,
    T,
    Tᶠ,
    constants
) -> Any

Compute melting of cloud ice to cloud liquid using Breeze thermodynamics.

source
BreezeCloudMicrophysicsExt.default_aerosol_activationFunction
default_aerosol_activation(FT = Float64; τⁿᵘᶜ = 1)

Create a default AerosolActivation representing a typical continental aerosol population.

The default distribution is a single mode with:

  • Mean dry radius: 0.05 μm (50 nm)
  • Geometric standard deviation: 2.0
  • Number concentration: 100 cm⁻³ (100 × 10⁶ m⁻³)
  • Hygroscopicity κ: 0.5 (typical for ammonium sulfate)

Keyword arguments

  • τⁿᵘᶜ: Nucleation timescale [s] for converting activation deficit to rate (default: 1s). Controls how quickly the cloud droplet number relaxes toward the target activated number.

This provides sensible out-of-the-box behavior for two-moment microphysics. Users can customize the aerosol population by constructing their own AerosolActivation.

Example

# Use default aerosolmicrophysics = TwoMomentCloudMicrophysics()# Custom aerosol: marine (fewer, larger particles)marine_mode = CMAM.Mode_κ(0.08e-6, 1.8, 50e6, (1.0,), (1.0,), (0.058,), (1.0,))marine_aerosol = AerosolActivation(    AerosolActivationParameters(Float64),    CMAM.AerosolDistribution((marine_mode,)),    1  # τⁿᵘᶜ = 1s)microphysics = TwoMomentCloudMicrophysics(aerosol_activation = marine_aerosol)# Disable aerosol activation (not recommended)microphysics = TwoMomentCloudMicrophysics(aerosol_activation = nothing)
source
BreezeCloudMicrophysicsExt.diffusional_growth_factorMethod
diffusional_growth_factor(
    aps::CloudMicrophysics.Parameters.AirProperties{FT},
    T,
    constants
) -> Any

Compute the thermodynamic factor $G$ that controls the rate of diffusional growth of cloud droplets and rain drops.

The $G$ factor combines the effects of thermal conductivity and vapor diffusivity on phase change. It appears in the Mason equation for droplet growth:

\[\frac{\mathrm{d}m}{\mathrm{d}t} = 4π r G 𝒮\]

where $𝒮$ is supersaturation and $r$ is droplet radius.

This is a translation of CloudMicrophysics.Common.G_func_liquid using Breeze's thermodynamics instead of Thermodynamics.jl.

See Eq. (13.28) by Pruppacher & Klett (2010).

References

  • Pruppacher, H. R., Klett, J. D. (2010). Microphysics of clouds and precipitation. Springer Netherlands. 2nd Edition
source
BreezeCloudMicrophysicsExt.ice_autoconversion_with_supersaturationMethod
ice_autoconversion_with_supersaturation(
    option::CloudMicrophysics.Parameters.WithSupersaturation,
    parameters::CloudMicrophysics.Parameters.Microphysics1MParams,
    q::Breeze.Thermodynamics.MoistureMassFractions{FT},
    qᶜⁱ,
    ρ,
    T,
    Tᶠ,
    constants
) -> Any

Compute supersaturation-dependent autoconversion of cloud ice to snow using Breeze thermodynamics.

source
BreezeCloudMicrophysicsExt.max_supersaturation_breezeMethod
max_supersaturation_breeze(aerosol_activation, aps, ρ, ℳ, 𝒰, constants)

Compute the maximum supersaturation using the Abdul-Razzak and Ghan (2000) parameterization.

This is a translation of CloudMicrophysics.AerosolActivation.max_supersaturation that uses Breeze's thermodynamics instead of Thermodynamics.jl.

Arguments

  • aerosol_activation: AerosolActivation containing activation parameters and aerosol distribution
  • aps: AirProperties (thermal conductivity, vapor diffusivity)
  • ρ: Air density [kg/m³]
  • : Microphysical state containing updraft velocity and number concentrations
  • 𝒰: Thermodynamic state
  • constants: Breeze ThermodynamicConstants

Returns

Maximum supersaturation (dimensionless, e.g., 0.01 = 1% supersaturation)

References

  • Abdul-Razzak, H. and Ghan, S.J. (2000). A parameterization of aerosol activation: 2. Multiple aerosol types. J. Geophys. Res., 105(D5), 6837-6844.
source
BreezeCloudMicrophysicsExt.one_moment_cloud_microphysics_categoriesFunction
one_moment_cloud_microphysics_categories(
;
    ...
) -> BreezeCloudMicrophysicsExt.OneMomentCloudMicrophysicsCategories{P, V} where {P<:(CloudMicrophysics.Parameters.Microphysics1MParams{OPT, CP, PP, AP, VL} where {OPT<:(CloudMicrophysics.Parameters.Microphysics1MOptions{CLF, CIF, CloudMicrophysics.Parameters.CloudIceMelt, RA, SA, CloudMicrophysics.Parameters.RainEvaporation, CloudMicrophysics.Parameters.DepositionAndSublimation, CloudMicrophysics.Parameters.SnowMelt, CLRA, CLSA, CIRA, CISA, RSA} where {CLF<:CloudMicrophysics.Parameters.CloudLiquidFormation, CIF<:CloudMicrophysics.Parameters.ConstantTimescale, RA<:(CloudMicrophysics.Parameters.Kessler1M{AC} where AC<:CloudMicrophysics.Parameters.Acnv1M), SA<:(CloudMicrophysics.Parameters.NoSupersaturation{AC} where AC<:CloudMicrophysics.Parameters.Acnv1M), CLRA<:CloudMicrophysics.Parameters.CloudLiquidRainAccretion, CLSA<:CloudMicrophysics.Parameters.CloudLiquidSnowAccretion, CIRA<:CloudMicrophysics.Parameters.CloudIceRainAccretion, CISA<:CloudMicrophysics.Parameters.CloudIceSnowAccretion, RSA<:CloudMicrophysics.Parameters.RainSnowAccretion}), CP<:(CloudMicrophysics.Parameters.CloudPhaseParams1M{LCL, ICL} where {LCL<:CloudMicrophysics.Parameters.CloudLiquid, ICL<:(CloudMicrophysics.Parameters.CloudIce{_A, PD, MS} where {_A, PD<:CloudMicrophysics.Parameters.ParticlePDFIceRain, MS<:CloudMicrophysics.Parameters.ParticleMass})}), PP<:(CloudMicrophysics.Parameters.PrecipPhaseParams1M{RAI, SNO} where {RAI<:(CloudMicrophysics.Parameters.Rain{PD, MS, AR, VT} where {PD<:CloudMicrophysics.Parameters.ParticlePDFIceRain, MS<:CloudMicrophysics.Parameters.ParticleMass, AR<:CloudMicrophysics.Parameters.ParticleArea, VT<:CloudMicrophysics.Parameters.Ventilation}), SNO<:(CloudMicrophysics.Parameters.Snow{_A, PD, MS, AR, VT, AP} where {_A, PD<:CloudMicrophysics.Parameters.ParticlePDFSnow, MS<:CloudMicrophysics.Parameters.ParticleMass, AR<:CloudMicrophysics.Parameters.ParticleArea, VT<:CloudMicrophysics.Parameters.Ventilation, AP<:CloudMicrophysics.Parameters.SnowAspectRatio})}), AP<:CloudMicrophysics.Parameters.AirProperties, VL<:(CloudMicrophysics.Parameters.Blk1MVelType{R, S} where {R<:CloudMicrophysics.Parameters.Blk1MVelTypeRain, S<:CloudMicrophysics.Parameters.Blk1MVelTypeSnow})}), V<:(CloudMicrophysics.Parameters.TerminalVelocityParams{STOKES, CHEN, BLK1M} where {STOKES<:CloudMicrophysics.Parameters.StokesRegimeVelType, CHEN<:(CloudMicrophysics.Parameters.Chen2022VelType{R, SI, LI} where {R<:(CloudMicrophysics.Parameters.Chen2022VelTypeRain{FT, 3} where FT<:AbstractFloat), SI<:(CloudMicrophysics.Parameters.Chen2022VelTypeSmallIce{FT, 3, 4} where FT<:AbstractFloat), LI<:(CloudMicrophysics.Parameters.Chen2022VelTypeLargeIce{FT, 3} where FT<:AbstractFloat)}), BLK1M<:(CloudMicrophysics.Parameters.Blk1MVelType{R, S} where {R<:CloudMicrophysics.Parameters.Blk1MVelTypeRain, S<:CloudMicrophysics.Parameters.Blk1MVelTypeSnow})})}
one_moment_cloud_microphysics_categories(
    FT::DataType;
    parameters,
    hydrometeor_velocities,
    freezing_temperature
) -> BreezeCloudMicrophysicsExt.OneMomentCloudMicrophysicsCategories{P, V} where {P<:(CloudMicrophysics.Parameters.Microphysics1MParams{OPT, CP, PP, AP, VL} where {OPT<:(CloudMicrophysics.Parameters.Microphysics1MOptions{CLF, CIF, CloudMicrophysics.Parameters.CloudIceMelt, RA, SA, CloudMicrophysics.Parameters.RainEvaporation, CloudMicrophysics.Parameters.DepositionAndSublimation, CloudMicrophysics.Parameters.SnowMelt, CLRA, CLSA, CIRA, CISA, RSA} where {CLF<:CloudMicrophysics.Parameters.CloudLiquidFormation, CIF<:CloudMicrophysics.Parameters.ConstantTimescale, RA<:(CloudMicrophysics.Parameters.Kessler1M{AC} where AC<:CloudMicrophysics.Parameters.Acnv1M), SA<:(CloudMicrophysics.Parameters.NoSupersaturation{AC} where AC<:CloudMicrophysics.Parameters.Acnv1M), CLRA<:CloudMicrophysics.Parameters.CloudLiquidRainAccretion, CLSA<:CloudMicrophysics.Parameters.CloudLiquidSnowAccretion, CIRA<:CloudMicrophysics.Parameters.CloudIceRainAccretion, CISA<:CloudMicrophysics.Parameters.CloudIceSnowAccretion, RSA<:CloudMicrophysics.Parameters.RainSnowAccretion}), CP<:(CloudMicrophysics.Parameters.CloudPhaseParams1M{LCL, ICL} where {LCL<:CloudMicrophysics.Parameters.CloudLiquid, ICL<:(CloudMicrophysics.Parameters.CloudIce{_A, PD, MS} where {_A, PD<:CloudMicrophysics.Parameters.ParticlePDFIceRain, MS<:CloudMicrophysics.Parameters.ParticleMass})}), PP<:(CloudMicrophysics.Parameters.PrecipPhaseParams1M{RAI, SNO} where {RAI<:(CloudMicrophysics.Parameters.Rain{PD, MS, AR, VT} where {PD<:CloudMicrophysics.Parameters.ParticlePDFIceRain, MS<:CloudMicrophysics.Parameters.ParticleMass, AR<:CloudMicrophysics.Parameters.ParticleArea, VT<:CloudMicrophysics.Parameters.Ventilation}), SNO<:(CloudMicrophysics.Parameters.Snow{_A, PD, MS, AR, VT, AP} where {_A, PD<:CloudMicrophysics.Parameters.ParticlePDFSnow, MS<:CloudMicrophysics.Parameters.ParticleMass, AR<:CloudMicrophysics.Parameters.ParticleArea, VT<:CloudMicrophysics.Parameters.Ventilation, AP<:CloudMicrophysics.Parameters.SnowAspectRatio})}), AP<:CloudMicrophysics.Parameters.AirProperties, VL<:(CloudMicrophysics.Parameters.Blk1MVelType{R, S} where {R<:CloudMicrophysics.Parameters.Blk1MVelTypeRain, S<:CloudMicrophysics.Parameters.Blk1MVelTypeSnow})}), V<:(CloudMicrophysics.Parameters.TerminalVelocityParams{STOKES, CHEN, BLK1M} where {STOKES<:CloudMicrophysics.Parameters.StokesRegimeVelType, CHEN<:(CloudMicrophysics.Parameters.Chen2022VelType{R, SI, LI} where {R<:(CloudMicrophysics.Parameters.Chen2022VelTypeRain{FT, 3} where FT<:AbstractFloat), SI<:(CloudMicrophysics.Parameters.Chen2022VelTypeSmallIce{FT, 3, 4} where FT<:AbstractFloat), LI<:(CloudMicrophysics.Parameters.Chen2022VelTypeLargeIce{FT, 3} where FT<:AbstractFloat)}), BLK1M<:(CloudMicrophysics.Parameters.Blk1MVelType{R, S} where {R<:CloudMicrophysics.Parameters.Blk1MVelTypeRain, S<:CloudMicrophysics.Parameters.Blk1MVelTypeSnow})})}

Return one-moment categories backed by CloudMicrophysics' unified Microphysics1MParams container.

Keyword arguments

  • parameters: CloudMicrophysics particle parameters and process options.
  • hydrometeor_velocities: Terminal-velocity parameters for cloud condensate. Its rain and snow component is replaced with parameters.terminal_velocity so the two containers cannot diverge.
  • freezing_temperature: Temperature used to route melting and freezing processes. Defaults to CloudMicrophysics' standard value, 273.15 K.
source
BreezeCloudMicrophysicsExt.rain_evaporationMethod
rain_evaporation(
    ::CloudMicrophysics.Parameters.Rain,
    vel::CloudMicrophysics.Parameters.Blk1MVelTypeRain{FT},
    aps::CloudMicrophysics.Parameters.AirProperties{FT},
    q::Breeze.Thermodynamics.MoistureMassFractions{FT},
    qʳ,
    ρ,
    T,
    constants
) -> Any

Compute the rain evaporation rate (dqʳ/dt, negative for evaporation).

This is a translation of CloudMicrophysics.Microphysics1M.conv_q_rai_to_q_vap that uses Breeze's internal thermodynamics instead of Thermodynamics.jl.

Arguments

  • rain_params: Rain microphysics parameters (pdf, mass, vent)
  • vel: Terminal velocity parameters
  • aps: Air properties (kinematic viscosity, vapor diffusivity, thermal conductivity)
  • q: MoistureMassFractions containing vapor, liquid, and ice mass fractions
  • : Rain specific humidity
  • ρ: Air density
  • T: Temperature
  • constants: Breeze ThermodynamicConstants

Returns

Rate of change of rain specific humidity (negative = evaporation)

source
BreezeCloudMicrophysicsExt.rain_evaporation_2mMethod
rain_evaporation_2m(sb, aps, q, qʳ, ρ, Nʳ, T, constants)

Compute the two-moment rain evaporation rate returning both number and mass tendencies.

This is a translation of CloudMicrophysics.Microphysics2M.rain_evaporation that uses Breeze's internal thermodynamics instead of Thermodynamics.jl.

Arguments

  • sb: SB2006 parameters containing pdf_r and evap
  • aps: Air properties (kinematic viscosity, vapor diffusivity, thermal conductivity)
  • q: MoistureMassFractions containing vapor, liquid, and ice mass fractions
  • : Rain specific humidity [kg/kg]
  • ρ: Air density [kg/m³]
  • : Rain number concentration [1/m³]
  • T: Temperature [K]
  • constants: Breeze ThermodynamicConstants

Returns

Named tuple (; evap_rate_0, evap_rate_1) where:

  • evap_rate_0: Rate of change of number concentration [m⁻³ s⁻¹)], negative for evaporation
  • evap_rate_1: Rate of change of mass mixing ratio [kg/kg/s], negative for evaporation
source
BreezeCloudMicrophysicsExt.snow_meltingMethod
snow_melting(
    ::CloudMicrophysics.Parameters.Snow{FT},
    vel::CloudMicrophysics.Parameters.Blk1MVelTypeSnow{FT},
    aps::CloudMicrophysics.Parameters.AirProperties{FT},
    qˢ,
    ρ,
    T,
    Tᶠ,
    constants
) -> Any

Compute the snow melting rate (dqˢ/dt due to melting, always non-negative).

Sensible-heat-driven melting: heat from warm air ($T > Tᶠ$) melts snow to rain. The rate is proportional to ($T - Tᶠ$) and includes ventilation corrections.

This is a translation of CloudMicrophysics.Microphysics1M.conv_q_sno_to_q_rai that uses Breeze's internal thermodynamics instead of Thermodynamics.jl.

Arguments

  • snow_params: Snow microphysics parameters (pdf, mass, vent)
  • vel: Snow terminal velocity parameters
  • aps: Air properties (kinematic viscosity, vapor diffusivity, thermal conductivity)
  • : Snow specific humidity
  • ρ: Air density
  • T: Temperature
  • Tᶠ: Freezing temperature
  • constants: Breeze ThermodynamicConstants

Returns

Rate of snow mass lost to melting [kg/kg/s] (always non-negative)

source
BreezeCloudMicrophysicsExt.snow_sublimation_depositionMethod
snow_sublimation_deposition(
    ::CloudMicrophysics.Parameters.Snow{FT},
    vel::CloudMicrophysics.Parameters.Blk1MVelTypeSnow{FT},
    aps::CloudMicrophysics.Parameters.AirProperties{FT},
    q::Breeze.Thermodynamics.MoistureMassFractions{FT},
    qˢ,
    ρ,
    T,
    constants
) -> Any

Compute the snow sublimation/deposition rate (dqˢ/dt).

Positive values mean deposition (vapor → snow), negative means sublimation (snow → vapor). Unlike rain evaporation, both signs are physical for snow.

This is a translation of CloudMicrophysics.Microphysics1M.conv_q_sno_to_q_vap for snow that uses Breeze's internal thermodynamics instead of Thermodynamics.jl.

Arguments

  • snow_params: Snow microphysics parameters (pdf, mass, vent)
  • vel: Snow terminal velocity parameters
  • aps: Air properties (kinematic viscosity, vapor diffusivity, thermal conductivity)
  • q: MoistureMassFractions containing vapor, liquid, and ice mass fractions
  • : Snow specific humidity
  • ρ: Air density
  • T: Temperature
  • constants: Breeze ThermodynamicConstants

Returns

Rate of change of snow specific humidity (positive = deposition, negative = sublimation)

source
BreezeCloudMicrophysicsExt.temperature_dependent_ice_relaxation_timescaleMethod
temperature_dependent_ice_relaxation_timescale(
    cloud_ice::CloudMicrophysics.Parameters.CloudIce,
    air_properties::CloudMicrophysics.Parameters.AirProperties,
    frostenberg,
    qᶜⁱ,
    T
) -> Any

Return the cloud-ice deposition relaxation timescale for the CloudMicrophysics TemperatureDependent option.

This is a branch-free translation of CloudMicrophysics.MicrophysicsNonEq.τ_relax for use from Breeze GPU kernels.

source
BreezeCloudMicrophysicsExt.two_moment_cloud_microphysics_categoriesFunction
two_moment_cloud_microphysics_categories(FT = Oceananigans.defaults.FloatType;
                                         warm_processes = SB2006(FT),
                                         air_properties = AirProperties(FT),
                                         cloud_liquid_fall_velocity = StokesRegimeVelType(FT),
                                         rain_fall_velocity = SB2006VelType(FT),
                                         aerosol_activation = default_aerosol_activation(FT))

Construct TwoMomentCategories with default Seifert-Beheng 2006 parameters and aerosol activation.

Keyword arguments

  • warm_processes: Seifert-Beheng 2006 parameters for warm-rain microphysics
  • air_properties: Air properties for thermodynamic calculations
  • cloud_liquid_fall_velocity: Terminal velocity parameters for cloud droplets (Stokes regime)
  • rain_fall_velocity: Terminal velocity parameters for rain drops
  • aerosol_activation: Aerosol activation parameters (default: continental aerosol). Set to nothing to disable activation (not recommended for physical simulations).
  • τⁿᵘᵐ: Timescale [s] for per-reservoir tendency limiting. Must satisfy τⁿᵘᵐ ≥ Δt to prevent reservoir overdraw. Default: 10 seconds.

References

  • Seifert, A. and Beheng, K. D. (2006). A two-moment cloud microphysics parameterization for mixed-phase clouds. Part 1: Model description. Meteorol. Atmos. Phys., 92, 45-66. https://doi.org/10.1007/s00703-005-0112-4
source
BreezeCloudMicrophysicsExt.warm_accretion_melt_factorMethod
warm_accretion_melt_factor(T, Tᶠ, constants) -> Any

Compute the thermal melt factor for warm accretion processes.

When cloud liquid or rain collides with snow above freezing, the sensible heat carried by the warm hydrometeor melts additional snow. The factor $α$ gives the mass ratio of melted snow to accreted warm hydrometeor mass:

\[α = cˡ (T - Tᶠ) / ℒ_f\]

This is a translation of CloudMicrophysics.Microphysics1M.warm_accretion_melt_factor that uses Breeze's internal thermodynamics instead of Thermodynamics.jl.

Arguments

  • T: Temperature
  • Tᶠ: Freezing temperature
  • constants: Breeze ThermodynamicConstants

Returns

Thermal melt factor α (zero when $T ≤ Tᶠ$)

source