Skip to content

API Reference ​

Package Overview ​

Exosphere Module
julia
Exosphere

Standalone, zero-allocation planetary neutral exosphere models, PlasmaPopulations.jl-style neutral species and VDFs, EUV shadow and optical-depth/Chapman/ray attenuation, conservative one-way and two-way charge–neutral interaction kernels, structured neutral field containers, and adaptive dual-cell box quadrature.

source

Core Interfaces, Coupling Traits & State Containers ​

Exosphere.AbstractNeutralModel Type
julia
AbstractNeutralModel

Abstract supertype for single- or multi-species neutral exosphere/atmosphere models (static analytic ExosphereModel, tabulated or two-way mutable GriddedNeutralField, or external neutral solver adapters).

source
Exosphere.AbstractNeutralProfile Type
julia
AbstractNeutralProfile

Abstract supertype for scalar neutral number density profiles (1D radial, 3D asymmetric, composite, tabulated, or time-dependent).

source
Exosphere.AbstractNeutralVDF Type
julia
AbstractNeutralVDF

Abstract supertype for neutral particle velocity distribution functions normalized to   .

source
Exosphere.AbstractVelocityModel Type
julia
AbstractVelocityModel

Abstract supertype for spatial/temporal neutral bulk velocity models .

source
Exosphere.AbstractTemperatureModel Type
julia
AbstractTemperatureModel

Abstract supertype for spatial/temporal neutral temperature models .

source
Exosphere.AbstractAttenuation Type
julia
AbstractAttenuation

Abstract supertype for solar EUV radiative attenuation models returning a transmission factor in .

source
Exosphere.AbstractInteractionChannel Type
julia
AbstractInteractionChannel

Abstract supertype for charge–neutral reaction channels (photoionization, electron-impact ionization, charge exchange, elastic collisions, recombination).

source
Exosphere.AbstractNeutralGrid Type
julia
AbstractNeutralGrid

Abstract supertype for structured neutral spatial grids (CartesianNeutralGrid, SphericalNeutralGrid).

source
Exosphere.AbstractCouplingMode Type
julia
AbstractCouplingMode

Trait supertype distinguishing read-only one-way neutral backgrounds (OneWayCoupling) from mutable two-way coupled neutral models (TwoWayCoupling).

source
Exosphere.OneWayCoupling Type
julia
OneWayCoupling <: AbstractCouplingMode

Compile-time trait for read-only/static neutral models where plasma-to-neutral feedback deposition compiles away to a zero-cost no-op.

source
Exosphere.TwoWayCoupling Type
julia
TwoWayCoupling <: AbstractCouplingMode

Compile-time trait for dynamic neutral models that accumulate plasma-to-neutral mass, momentum, energy, or particle feedback.

source
Exosphere.coupling_mode Function
julia
coupling_mode(model::AbstractNeutralModel) -> AbstractCouplingMode

Return OneWayCoupling() (default) or TwoWayCoupling() for model.

source
Exosphere.NeutralState Type
julia
NeutralState(n, u, T)

Local macroscopic state of one neutral species: number density n, bulk velocity u::SVector{3}, and temperature T (in energy units when kB = 1, or Kelvin when paired with physical kB).

source
Exosphere.PlasmaState Type
julia
PlasmaState(n, u, T, m)

Local macroscopic state of one charged plasma species: number density n, bulk velocity u::SVector{3}, temperature T, and particle mass m.

source
Exosphere.MomentSource Type
julia
MomentSource(dn, dmom, dE)

Volumetric conservation-law source rates (or integrated deltas) for one species:

  • dn: number density rate

  • dmom::SVector{3}: momentum density rate

  • dE: total energy density rate , where   .

source
Exosphere.CoupledExchange Type
julia
CoupledExchange(plasma::MomentSource, neutral::MomentSource)

Paired volumetric MomentSource terms acting on the plasma (plasma) and neutral (neutral) species from one or more charge–neutral interaction channels.

source
Exosphere.NeutralParticle Type
julia
NeutralParticle(pos, vel, mass, weight, species = Int32(1))

Lightweight isbits neutral macroparticle (e.g., an energetic neutral atom produced by charge exchange or a sputtered surface neutral) for kinetic/PIC/DSMC two-way coupling.

source
Exosphere.neutral_state Function
julia
neutral_state(model::AbstractNeutralModel, loc; t = nothing, species = 1) -> NeutralState

Evaluate the local macroscopic neutral state (n, u, T) of species at spatial position or grid index loc and optional time t.

source
Exosphere.local_vdf Function
julia
local_vdf(model, loc; t = nothing, species = 1, kB = 1) -> AbstractNeutralVDF

Return the local velocity distribution function of species at position or grid index loc and optional time t.

source
Exosphere.species_mass Function
julia
species_mass(model, c = 1)

Return the particle mass of neutral component c.

source
Exosphere.deposit_neutral_source! Function
julia
deposit_neutral_source!(model::AbstractNeutralModel, loc, src::MomentSource, species = 1;
                        source_volume = nothing)

Accumulate volumetric neutral source src for species at grid index or position loc. When source_volume is provided on a continuous grid model (such as a spherical grid), the deposited CIC source is weighted by source_volume / cell_volume(grid, corner) so that volume-integrated totals are conserved across non-uniform cells. Dispatches on coupling_mode: compiles to a zero-cost no-op for OneWayCoupling models.

source
Exosphere.deposit_neutral_particle! Function
julia
deposit_neutral_particle!(model::AbstractNeutralModel, p::NeutralParticle)

Deposit a discrete neutral macroparticle (e.g., an ENA or sputtered neutral) into model. Dispatches on coupling_mode: compiles to a zero-cost no-op for OneWayCoupling models.

source
Exosphere.reset_sources! Function
julia
reset_sources!(model::AbstractNeutralModel)

Reset accumulated two-way feedback buffers at the start of a coupling step. Compiles to a zero-cost no-op for OneWayCoupling models.

source
julia
reset_sources!(buf::NeutralSourceBuffer)

Zero all accumulated Eulerian source arrays in place.

source
Exosphere.neutral_sources Function
julia
neutral_sources(model::AbstractNeutralModel)

Return the Eulerian source accumulator buffer of model, or nothing for static models.

source
Exosphere.neutral_particles Function
julia
neutral_particles(model::AbstractNeutralModel)

Return the kinetic neutral particle buffer of model, or nothing when absent.

source
Exosphere.UnitScale Type
julia
UnitScale{FT<:AbstractFloat}
UnitScale(; length = 1.0, density = 1.0, velocity = 1.0, mass = MP_SI,
          temperature = nothing, FT = Float64)

Reference scales for converting between physical (SI or Unitful.Quantity via ExosphereUnitfulExt) and dimensionless simulation code units:

  • L0: reference length [m]

  • n0: reference number density [m⁻³]

  • v0: reference velocity [m/s]

  • m0: reference particle mass [kg]

  • t0 = L0 / v0: reference time [s]

  • T0: reference temperature energy k_B * T [J] (defaults to m0 * v0^2)

source
Exosphere.to_code_units Function
julia
to_code_units(scale::UnitScale, val, quantity::Symbol)
to_code_units(scale::UnitScale, x)

Convert a physical SI value val of kind quantity (:length, :density, :velocity, :mass, :time, :frequency, :cross_section, :energy, :temperature, :number_rate, :momentum_rate, :energy_rate) to simulation code units defined by scale. With Unitful.jl loaded, Unitful.Quantity arguments infer dimensions automatically.

source
Exosphere.from_code_units Function
julia
from_code_units(scale::UnitScale, val, quantity::Symbol)

Convert a dimensionless code-unit value val of kind quantity back to SI units using scale.

source
Exosphere.strip_units Function
julia
strip_units(p::AbstractNeutralProfile, scale::UnitScale)

Convert a physical-unit profile (created via ExosphereUnitfulExt) into a zero-allocation, isbits simulation code-unit profile using scale. Returns unitless profiles unchanged.

source

Neutral Species & Velocity Distribution Functions ​

Exosphere.NeutralSpecies Type
julia
NeutralSpecies{T<:Real}
NeutralSpecies(; m)
NeutralSpecies(formula::Union{Symbol, AbstractString})
NeutralSpecies(scale::UnitScale, formula::Union{Symbol, AbstractString})

Lightweight isbits neutral atom or molecule species with mass m.

  • NeutralSpecies(; m) stores bare numeric m as given (code units or SI kg) and converts Unitful.Quantity inputs to kilograms when Unitful is loaded.

  • NeutralSpecies(formula) parses chemical and nuclide formulas (such as :H, :O, "CO2", "H2O", "SO2", "D", "{18}O") and stores the standard molecular mass in SI kilograms (weight * U_SI), matching PlasmaPopulations.Particle(formula, 0).

  • NeutralSpecies(scale, formula) converts the parsed molecular mass directly into code units m / scale.m0.

  • NeutralSpecies{T}(s) converts precision (e.g., NeutralSpecies{Float32}(s)).

source
Exosphere.atomic_mass Function
julia
atomic_mass(s::NeutralSpecies)

Return the mass of s in unified atomic mass units (s.m / U_SI), assuming s.m is stored in SI kilograms.

source
Exosphere.ColdNeutral Type
julia
ColdNeutral{T<:Real} <: AbstractNeutralVDF
ColdNeutral(; u = SVector(0.0, 0.0, 0.0))
ColdNeutral(species::NeutralSpecies; u = SVector(0.0, 0.0, 0.0))

Zero-temperature drifting neutral distribution   .

source
Exosphere.Maxwellian Type
julia
Maxwellian{T<:Real} <: AbstractNeutralVDF
Maxwellian(; vth, u = (0.0, 0.0, 0.0))
Maxwellian(species::NeutralSpecies; T, u = (0.0, 0.0, 0.0), kB = 1)

Isotropic 3D drifting Maxwellian neutral velocity distribution:

source
Exosphere.BiMaxwellianNeutral Type
julia
BiMaxwellianNeutral{T<:Real} <: AbstractNeutralVDF
BiMaxwellianNeutral(; vth_perp, vth_para, u = (0.0, 0.0, 0.0), axis = (0.0, 0.0, 1.0))
BiMaxwellianNeutral(species::NeutralSpecies; T_perp, T_para, u = (0.0, 0.0, 0.0),
                    axis = (0.0, 0.0, 1.0), kB = 1)

Anisotropic 3D drifting Maxwellian neutral velocity distribution about unit direction axis (e.g., local radial unit vector for radial vs. tangential exospheric temperatures):

source
Exosphere.pdf Function
julia
pdf(vdf::AbstractNeutralVDF, v)
pdf(vdf::AbstractNeutralVDF)

Evaluate the normalized 3D velocity probability density satisfying    at 3-vector v, or return a callable v -> pdf(vdf, v).

source
Exosphere.thermal_speed Function
julia
thermal_speed(species::NeutralSpecies, T; kB = 1)
thermal_speed(vdf::AbstractNeutralVDF)

Compute the most probable thermal speed   for species at temperature T, or extract the thermal speed of a velocity distribution vdf (matching the PlasmaPopulations.jl convention  ).

source
Exosphere.vdf_temperature Function
julia
vdf_temperature(species::NeutralSpecies, vdf::AbstractNeutralVDF; kB = 1)

Return the isotropic (or effective scalar  ) temperature corresponding to vdf for species using  .

source
Exosphere.temperature_perp_para Function
julia
temperature_perp_para(species::NeutralSpecies, vdf::AbstractNeutralVDF; kB = 1)

Return (T_perp, T_para) for species with velocity distribution vdf.

source

Neutral Density Profiles, Kinematics & Populations ​

Exosphere.ExponentialProfile Type
julia
ExponentialProfile{FT<:AbstractFloat} <: AbstractNeutralProfile
ExponentialProfile(n0, r0, H; center = (0.0, 0.0, 0.0), FT = Float64)

Exponential neutral exosphere n(r) = n0 * exp(-max(r - r0, 0) / H) around center, clamped to n0 for r <= r0. Setting H = Inf yields a uniform density n0.

source
Exosphere.PowerLawProfile Type
julia
PowerLawProfile{FT<:AbstractFloat} <: AbstractNeutralProfile
PowerLawProfile(n0, r0, k; center = (0.0, 0.0, 0.0), FT = Float64)

Power-law neutral density profile n(r) = n0 * (r0 / max(r, r0))^k around center, clamped to n0 for r <= r0.

source
Exosphere.ChamberlainProfile Type
julia
ChamberlainProfile{FT<:AbstractFloat} <: AbstractNeutralProfile
ChamberlainProfile(n0, r0, H; center = (0.0, 0.0, 0.0), FT = Float64)

Chamberlain-type hydrostatic exosphere n(r) = n0 * exp(-H * (1/r0 - 1/r)) around center, clamped to n0 for r <= r0.

source
Exosphere.KineticChamberlainProfile Type
julia
KineticChamberlainProfile{FT<:AbstractFloat} <: AbstractNeutralProfile
KineticChamberlainProfile(n_c, r_c, lambda_c; include_satellite = true,
                          normalize_exobase = false, center = (0.0, 0.0, 0.0), FT = Float64)

Full Chamberlain (1963) kinetic exosphere density profile combining the barometric factor   with the velocity-space partition function   , where   (clamped for  ).

When normalize_exobase = true, densities are scaled by so neutral_density(p, r_c) == n_c.

source
Exosphere.chamberlain_partition Function
julia
chamberlain_partition(lambda::Real, lambda_c::Real; include_satellite = true) -> (zeta_bal, zeta_sat, zeta_esc)

Evaluate the exact Chamberlain (1963) kinetic velocity-space partition fractions at dimensionless gravitational potential   given exobase parameter  :

  • zeta_bal: ballistic fraction

  • zeta_sat: trapped satellite-orbit fraction (0 when include_satellite = false)

  • zeta_esc: escaping fraction (unidirectional outward hemisphere)

source
Exosphere.jeans_escape_flux Function
julia
jeans_escape_flux(n_c::Real, v_th::Real, lambda_c::Real)
jeans_escape_flux(n_c::Real, T_c::Real, m::Real, lambda_c::Real; kB = KB_SI)

Compute the classical Jeans thermal escape number flux at the exobase:   , where  .

source
Exosphere.ExosphereProfile Type
julia
ExosphereProfile{FT<:AbstractFloat}(n0, r0, inv_H, center, power)

Concrete, allocation-free radial neutral density/rate profile for planetary exospheres and cometary comae: p(x) = n0 * (r0 / max(r, r0))^power * exp(-max(r - r0, 0) * inv_H). Callable on 1D (x,), 2D (x, y), and 3D (x, y, z) coordinates; construct via exosphere_profile.

source
Exosphere.exosphere_profile Function
julia
exosphere_profile(; n0 = 1.0, r0 = 1.0, H = 0.5, center = (0.0, 0.0, 0.0),
                  power = 0.0, FT = Float64) -> ExosphereProfile{FT}

Construct a radial neutral envelope profile:

  • power = 0, H > 0: exponential planetary exosphere n0 * exp(-max(r - r0, 0) / H).

  • power = 2, H = Inf: cometary 1 / r^2 Haser-limit coma.

source
Exosphere.neutral_density Function
julia
neutral_density(p::AbstractNeutralProfile, r::Real)
neutral_density(p::AbstractNeutralProfile, x::AbstractVector; t = nothing)
neutral_density(model::AbstractNeutralModel, loc; t = nothing, species = nothing)

Evaluate the neutral number density of profile p or neutral model at radius r, 3D position x, or grid index loc and optional time t. Radial profiles clamp to n0 for r <= r0.

source
Exosphere.local_scale_height Function
julia
local_scale_height(p::AbstractNeutralProfile, r::Real)
local_scale_height(p::AbstractNeutralProfile, x::AbstractVector; t = nothing)
local_scale_height(model::AbstractNeutralModel, loc; t = nothing, species = 1)

Return the local density scale height of profile p or neutral model (H for ExponentialProfile, r / k for PowerLawProfile, r^2 / H for ChamberlainProfile; returns 0 when degenerate or r <= 0).

source
Exosphere.DayNightProfile Type
julia
DayNightProfile{P<:AbstractNeutralProfile, FT<:AbstractFloat} <: AbstractNeutralProfile
DayNightProfile(base; solar_dir = (1.0, 0.0, 0.0), asymmetry = 0.5,
                min_factor = 0.1, center = (0.0, 0.0, 0.0), FT = Float64)

3D dayside–nightside modulated neutral profile around center:

where     is the solar zenith angle cosine along unit vector solar_dir.

source
Exosphere.PlumeProfile Type
julia
PlumeProfile{FT<:AbstractFloat} <: AbstractNeutralProfile
PlumeProfile(; n0, origin, axis, r0 = 0.05, H = Inf, k = 2.0,
             opening_angle = 0.35, FT = Float64)

3D localized volcanic, cryovolcanic, or outgassing plume centered at surface vent origin along unit direction axis with smooth von Mises–Fisher angular decay (matching a Gaussian   for small angles while remaining smooth at   for automatic differentiation):

for    (0 behind the vent plane), where    and  .

source
Exosphere.CompositeProfile Type
julia
CompositeProfile{Ps<:Tuple} <: AbstractNeutralProfile
CompositeProfile(profiles::AbstractNeutralProfile...)

Superposition of multiple AbstractNeutralProfile terms for a single neutral species (e.g., cold thermal + hot photochemical corona). Fully isbits and tuple-unrolled when all constituent profiles are isbits.

source
Exosphere.TabulatedRadialProfile Type
julia
TabulatedRadialProfile{FT, VR, VN} <: AbstractNeutralProfile
TabulatedRadialProfile(r, n; center = (0.0, 0.0, 0.0), log_interp = true,
                       clamp_outer = false)

1D tabulated radial density profile (e.g., from empirical or DSMC radial profiles) with zero-allocation binary search and linear or log-linear interpolation. Accepts SVector storage for isbits GPU execution or Vector for large tables.

source
Exosphere.TimeDependentProfile Type
julia
TimeDependentProfile(density_fn; scale_height_fn = nothing)

Wrapper for arbitrary user-defined 3D and/or time-dependent neutral density profiles density_fn(x, t) (with optional scale_height_fn(x, t)).

source
Exosphere.ZeroVelocity Type
julia
ZeroVelocity() <: AbstractVelocityModel

Static zero-velocity neutral background  .

source
Exosphere.ConstantVelocity Type
julia
ConstantVelocity(u) <: AbstractVelocityModel

Spatially uniform neutral drift velocity  .

source
Exosphere.CorotationVelocity Type
julia
CorotationVelocity(omega; center = (0.0, 0.0, 0.0), FT = Float64) <: AbstractVelocityModel

Rigid planetary/moon atmospheric corotation velocity    .

source
Exosphere.RadialOutflowVelocity Type
julia
RadialOutflowVelocity(v_out; center = (0.0, 0.0, 0.0), FT = Float64) <: AbstractVelocityModel

Spherically radial outflow velocity   around center (e.g., cometary coma or escaping atmosphere; returns zero at r == 0).

source
Exosphere.ConstantTemperature Type
julia
ConstantTemperature(T0) <: AbstractTemperatureModel

Isothermal neutral background  .

source
Exosphere.DayNightTemperature Type
julia
DayNightTemperature(; T_day, T_night, solar_dir = (1.0, 0.0, 0.0),
                    center = (0.0, 0.0, 0.0), FT = Float64) <: AbstractTemperatureModel

Solar-zenith-angle dependent exobase temperature smoothly varying between T_day (subsolar) and T_night (antisolar):     .

source
Exosphere.neutral_velocity Function
julia
neutral_velocity(v::AbstractVelocityModel, x; t = nothing) -> SVector{3}

Evaluate the local neutral bulk velocity .

source
Exosphere.neutral_temperature Function
julia
neutral_temperature(temp::AbstractTemperatureModel, x; t = nothing)

Evaluate the local neutral temperature .

source
Exosphere.NeutralPopulation Type
julia
NeutralPopulation(species::NeutralSpecies, profile::AbstractNeutralProfile;
                  velocity = ZeroVelocity(), temperature = ConstantTemperature(1.0))
NeutralPopulation(species::NeutralSpecies, profile::AbstractNeutralProfile,
                  vdf::AbstractNeutralVDF)

A neutral exosphere population combining a physical NeutralSpecies, a spatial AbstractNeutralProfile, and either spatially varying (velocity, temperature) models or a spatially uniform AbstractNeutralVDF. Fully isbits when all component types are isbits.

source
Exosphere.NeutralComponentCode Type
julia
NeutralComponentCode(profile::Symbol, n0, H, k, T0, name = "neutral")

Code-unit specification of one neutral exosphere component, where profile is one of :exponential, :powerlaw, or :chamberlain (internally encoded as kind 1, 2, 3), n0 is the surface density at planet_radius, H is the exponential/Chamberlain scale parameter, k is the power-law exponent, and T0 > 0 is the neutral temperature.

source

Multi-Component Exosphere & EUV Attenuation ​

Exosphere.NoAttenuation Type
julia
NoAttenuation() <: AbstractAttenuation

Unattenuated EUV transmission model returning 1 everywhere with zero branching.

source
Exosphere.ShadowCylinder Type
julia
ShadowCylinder{FT<:AbstractFloat} <: AbstractAttenuation
ShadowCylinder(; solar_dir = (1.0, 0.0, 0.0), radius = 1.0, half_height = Inf,
               FT = Float64)

Geometric cylindrical planetary EUV/optical shadow along unit vector dir (normalized from solar_dir, pointing toward the Sun) of cross-sectional radius and downstream half_height (defaults to Inf).

source
Exosphere.OpticalDepth Type
julia
OpticalDepth{FT<:AbstractFloat, V<:AbstractVector{FT}} <: AbstractAttenuation
OpticalDepth(; cross_sections, solar_dir = (1.0, 0.0, 0.0), scale_heights = nothing,
             chapman = false, min_production = nothing, tau_floor = 6.0e-3,
             tau_cutoff = 11.5, cos_sza_floor = 5.0e-4, chapman_tau_max = 13.8,
             chapman_component = nothing, FT = Float64)

Code-unit EUV attenuation model supporting multi-component vertical optical depth  , grazing-ray terminator transmission, and the curved-atmosphere Smith & Smith (1972) Chapman function (chapman = true).

Passing a Tuple or SVector for cross_sections produces an isbits, GPU-ready OpticalDepth{FT, SVector{N, FT}}; passing a Vector preserves dynamic length.

source
Exosphere.RayOpticalDepth Type
julia
RayOpticalDepth{FT<:AbstractFloat, V<:AbstractVector{FT}, NQ} <: AbstractAttenuation
RayOpticalDepth(; cross_sections, solar_dir = (1.0, 0.0, 0.0), s_max = 10.0,
                planet_radius = 1.0, center = (0.0, 0.0, 0.0), min_production = 1.0e-6,
                tau_cutoff = 13.8, n_quad = 16, FT = Float64)

Line-of-sight EUV column-density attenuation along the Sunward ray   for s ∈ [0, s_max], using quadratic-stretched n_quad-point (8 or 16) Gauss–Legendre quadrature with solid-body shadowing at planet_radius. Works with arbitrary 3D asymmetric profiles and dynamic two-way GriddedNeutralField models with zero heap allocations.

source
Exosphere.ExosphereModel Type
julia
ExosphereModel{FT<:AbstractFloat, Comps, Atten<:AbstractAttenuation} <: AbstractNeutralModel
ExosphereModel(populations::NeutralPopulation...; planet_radius = 1.0,
               center = (0.0, 0.0, 0.0), attenuation = NoAttenuation(),
               shadow = nothing, optical_depth = nothing,
               inner_radius = 0.0, photochem_radius = 0.0, FT = Float64)

Multi-component planetary neutral exosphere with configurable EUV attenuation (NoAttenuation, ShadowCylinder, OpticalDepth, or RayOpticalDepth). Passing a tuple or varargs of NeutralPopulation instances constructs an isbits, GPU-ready model; build_exosphere_model also supports legacy Vector{NeutralComponentCode} specifications.

source
Exosphere.build_exosphere_model Function
julia
build_exosphere_model(; planet_radius, components, center = (0.0, 0.0, 0.0),
                      attenuation = nothing, shadow = nothing, optical_depth = nothing,
                      inner_radius = 0.0, photochem_radius = 0.0,
                      FT = Float64) -> ExosphereModel

Construct and validate a multi-component ExosphereModel from either a non-empty vector of NeutralComponentCode (legacy v0.1.0 path) or a tuple/vector of NeutralPopulation / AbstractNeutralProfile entries.

At most one of attenuation, shadow (ShadowCylinder), or optical_depth (OpticalDepth) may be provided; when none is given, NoAttenuation is used and photo_attenuation returns 1 everywhere. Passing a Tuple for components produces a 100% isbits, GPU-ready ExosphereModel (promoting OpticalDepth cross-section vectors to SVector automatically).

source
Exosphere.in_shadow Function
julia
in_shadow(sc::ShadowCylinder, x::SVector{3}) -> Bool

Return true when relative position x lies inside the shadow cylinder behind the body.

source
Exosphere.shadow_factor Function
julia
shadow_factor(sc::ShadowCylinder, x::SVector{3})
shadow_factor(sc::ShadowCylinder, x::Real, y::Real, z::Real)

Return 0 inside the shadow cylinder and 1 outside.

source
Exosphere.n_components Function
julia
n_components(exo::AbstractNeutralModel) -> Int

Return the number of neutral components (species/populations) in exo.

source
Exosphere.exo_component_density Function
julia
exo_component_density(exo::ExosphereModel, r::Real, c::Integer)

Number density of neutral component c at radius r (zero inside exo.Rp).

source
Exosphere.exo_density Function
julia
exo_density(exo::ExosphereModel, r::Real)

Total neutral number density (sum over all components) at radius r.

source
Exosphere.exo_scale_height Function
julia
exo_scale_height(exo::ExosphereModel, r::Real, c::Integer)

Local scale height of component c (or explicit optical-depth scale height); returns 0 when undefined.

source
Exosphere.chapman_function Function
julia
chapman_function(Xp::Real, cos_sza::Real)

Smith & Smith (1972) Chapman grazing-incidence function for a curved atmosphere with  . Supports Float32, Float64, and ForwardDiff.Dual inputs.

source
Exosphere.photo_attenuation Function
julia
photo_attenuation(exo::ExosphereModel, x::SVector{3}, r::Real; t = nothing)
photo_attenuation(model::AbstractNeutralModel, x::AbstractVector; t = nothing)

EUV ionizing flux attenuation factor in [0, 1] at position x relative to the planet center (r = norm(x)). The 3-argument form avoids recomputing norm(x) in hot loops.

source

Ion–Neutral Source Rates & Conservative Interactions ​

Exosphere.photoionization_rate Function
julia
photoionization_rate(nu_photo::Number, neutral_n::Number, atten::Number = 1)

Local volumetric photoionization production rate nu_photo * neutral_n * atten. Supports Float32, Float64, ForwardDiff.Dual, and Unitful.Quantity inputs.

source
Exosphere.charge_exchange_rate Function
julia
charge_exchange_rate(sigma_cx::Number, ion_n::Number, neutral_n::Number, v_rel::Number)

Local resonant charge-exchange collision rate sigma_cx * ion_n * neutral_n * v_rel. Supports Float32, Float64, ForwardDiff.Dual, and Unitful.Quantity inputs.

source
Exosphere.effective_relative_speed Function
julia
effective_relative_speed(plasma::PlasmaState, neutral::NeutralState, m_n; kB = 1)

Effective relative ion–neutral interaction speed combining bulk drift and thermal motions (Pauls et al. 1995):

source
Exosphere.Photoionization Type
julia
Photoionization(nu_photo; E_excess = nothing) <: AbstractInteractionChannel

Photoionization channel     with unattenuated ionization frequency nu_photo and optional photoelectron excess energy E_excess added to the plasma energy.

source
Exosphere.ElectronImpactIonization Type
julia
ElectronImpactIonization(k_imp; E_ion = nothing) <: AbstractInteractionChannel

Electron-impact ionization channel     with rate coefficient k_imp (either a constant scalar or a callable k_imp(T_e)) and optional ionization energy loss E_ion deducted from the plasma energy.

source
Exosphere.ResonantChargeExchange Type
julia
ResonantChargeExchange(sigma_cx) <: AbstractInteractionChannel

Resonant charge-exchange channel     with cross section sigma_cx (scalar or callable sigma_cx(v_eff)). Conserves number (dn = 0), momentum, and total energy exactly between plasma and neutral species.

source
Exosphere.NonResonantChargeExchange Type
julia
NonResonantChargeExchange(sigma_cx; E_defect = nothing) <: AbstractInteractionChannel

Non-resonant charge-exchange channel     with cross section sigma_cx (scalar or callable sigma_cx(v_eff)) and optional energy defect E_defect.

source
Exosphere.NonResonantExchange Type
julia
NonResonantExchange(ion_loss, ion_gain, neutral_loss, neutral_gain)

Four-species conservation-law source bundle for    :

  • ion_loss: loss from reactant ion

  • ion_gain: production of product ion

  • neutral_loss: loss from reactant neutral

  • neutral_gain: production of product neutral

source
Exosphere.ElasticCollision Type
julia
ElasticCollision(coeff; is_cross_section = true) <: AbstractInteractionChannel

Elastic ion–neutral momentum- and energy-transfer collision channel (Schunk & Nagy 2009) for arbitrary ion/neutral mass ratio :

  • is_cross_section = true: coeff is the momentum-transfer cross section (scalar or callable coeff(v_eff)), with symmetric rate factor  .

  • is_cross_section = false: coeff is a collision-frequency coefficient (scalar or callable coeff(T_eff) such that   and  ).

source
Exosphere.Recombination Type
julia
Recombination(alpha_rec; E_rad = nothing) <: AbstractInteractionChannel

Ion–electron recombination channel     with recombination rate coefficient alpha_rec (scalar or callable alpha_rec(T_e)) and optional radiated energy loss E_rad.

source
Exosphere.compute_exchange Function
julia
compute_exchange(channel, plasma::PlasmaState, neutral::NeutralState, m_n;
                 atten = 1, n_e = plasma.n, T_e = plasma.T, kB = 1) -> CoupledExchange

Evaluate paired conservative plasma and neutral volumetric MomentSource terms for one AbstractInteractionChannel or a Tuple of channels.

source
Exosphere.compute_nonresonant_exchange Function
julia
compute_nonresonant_exchange(ch::NonResonantChargeExchange, plasma::PlasmaState,
                             neutral::NeutralState, m_n; kB = 1) -> NonResonantExchange

Compute the four-species conservative source terms for    .

source
Exosphere.couple_point! Function
julia
couple_point!(model::AbstractNeutralModel, loc, channels, plasma::PlasmaState;
              x = loc, t = nothing, species = 1, n_e = plasma.n, T_e = plasma.T,
              kB = 1) -> MomentSource

Query model at location loc (spatial 3-vector or grid CartesianIndex), evaluate channels (one AbstractInteractionChannel or a Tuple of channels), deposit the conservative neutral feedback into model when coupling_mode(model) === TwoWayCoupling(), and return the plasma MomentSource.

For OneWayCoupling models, feedback deposition compiles away completely (zero extra instructions and zero heap allocations), and EUV attenuation is skipped at compile time when channels contains no Photoionization.

source
Exosphere.LindsayStebbingsCX Type
julia
LindsayStebbingsCX{FT<:AbstractFloat}
LindsayStebbingsCX(a1, a2, a3; E_per_v2, area_scale = 1.0e-20, E_min = 1.0e-4, FT = Float64)

Lindsay & Stebbings (2005) analytic charge-exchange cross-section fit callable on v_eff:     , where    [keV].

source
Exosphere.lindsay_stebbings_cx Function
julia
lindsay_stebbings_cx(pair::Symbol; scale = nothing, FT = Float64) -> LindsayStebbingsCX{FT}

Construct a Lindsay & Stebbings (2005) charge-exchange cross-section fit for resonant or planetary pairs (:H_H, :O_O, :He_He, :H_O). Returns SI m^2 vs m/s when scale === nothing, or dimensionless code units when scale isa UnitScale.

source
Exosphere.VoronovIonization Type
julia
VoronovIonization{FT<:AbstractFloat}
VoronovIonization(A, P, dE, X, K; T_to_eV = KB_SI / E_SI, rate_scale = 1.0e-6, FT = Float64)

Voronov (1997) electron-impact ionization rate coefficient fit callable on electron temperature T_e:   , where   .

source
Exosphere.voronov_ionization Function
julia
voronov_ionization(species::Symbol; scale = nothing, FT = Float64) -> VoronovIonization{FT}

Construct a Voronov (1997) / space-physics electron-impact ionization rate coefficient for :H, :He, :O, :N, :CO2, or :H2O. Inputs use Kelvin (m^3/s output) when scale === nothing, or code units when scale isa UnitScale.

source
Exosphere.SchunkNagyMomentumTransfer Type
julia
SchunkNagyMomentumTransfer{FT<:AbstractFloat}
SchunkNagyMomentumTransfer(C_in, exponent; T_ref = 1.0, T_scale = 1.0, rate_scale = 1.0, FT = Float64)

Schunk & Nagy (2009) temperature-dependent ion-neutral momentum-transfer collision rate coefficient callable on effective temperature T_eff:     .

source
Exosphere.schunk_nagy_momentum_transfer Function
julia
schunk_nagy_momentum_transfer(pair::Symbol; scale = nothing, FT = Float64)

Construct a Schunk & Nagy (2009) ion-neutral momentum-transfer collision coefficient for :O_O, :H_H, :O2_O2, or :CO2_CO2 (resonant/symmetric pairs with T_ref = 1000 K).

source
Exosphere.collision_probability Function
julia
collision_probability(rate::Number, dt::Number)

Exact Poisson collision probability     evaluated accurately via -expm1(-(rate * dt)).

source
Exosphere.particle_charge_exchange_rate Function
julia
particle_charge_exchange_rate(sigma_cx, neutral_n::Number, v_rel::Number)

Per-ion charge-exchange frequency  . sigma_cx may be a scalar cross section or a speed-dependent callable sigma_cx(v_rel).

source
Exosphere.photoionization_creation_weight Function
julia
photoionization_creation_weight(nu_photo, neutral_n, atten, cell_vol, dt)

Total number of real photoions created inside a cell of volume cell_vol over timestep dt:  .

source
Exosphere.charge_exchange_collision Function
julia
charge_exchange_collision(pos, v_ion, m_ion, weight, v_neutral, species_id = Int32(1))

Perform a single resonant macroparticle charge-exchange event    . Returns a named tuple (ion_vel, ena, neutral_delta) containing:

  • ion_vel::SVector{3}: replacement ion velocity (v_neutral)

  • ena::NeutralParticle: emitted energetic neutral atom carrying the incident ion velocity

  • neutral_delta::MomentSource: exact integrated momentum and kinetic-energy delta transferred to the neutral population (dn = 0, exact conservation with the ion change).

source
Exosphere.sputtering_flux Function
julia
sputtering_flux(ion_flux::Number, yield::Number)

Sputtered neutral surface flux    produced by precipitating ion flux ion_flux with sputtering yield yield.

source

Structured Grids & Two-Way Dynamic Neutral Fields ​

Exosphere.CartesianNeutralGrid Type
julia
CartesianNeutralGrid{D, FT<:AbstractFloat} <: AbstractNeutralGrid
CartesianNeutralGrid(origin, dx, dims; FT = Float64)

Uniform rectilinear D-dimensional (D ∈ {1, 2, 3}) neutral grid parameterized by the center of cell (1, ..., 1) (origin), cell spacing dx, and grid size dims.

source
Exosphere.SphericalNeutralGrid Type
julia
SphericalNeutralGrid{FT<:AbstractFloat, VR<:AbstractVector{FT}} <: AbstractNeutralGrid
SphericalNeutralGrid(r; ntheta = 1, nphi = 1, center = (0.0, 0.0, 0.0),
                     polar_axis = (1.0, 0.0, 0.0))

Structured spherical planetary neutral grid with sorted (uniform or stretched) radial centers r, polar count ntheta, and azimuthal count nphi about polar_axis (defaults to +x so polar angle equals solar zenith angle in 2D axisymmetric models):

  • ntheta == 1 && nphi == 1: 1D radial grid (nr,)

  • ntheta > 1 && nphi == 1: 2D axisymmetric (nr, ntheta) grid

  • ntheta > 1 && nphi > 1: 3D spherical (nr, ntheta, nphi) grid

source
Exosphere.cell_center Function
julia
cell_center(grid::AbstractNeutralGrid, idx::CartesianIndex) -> SVector{3}

Return the 3D spatial coordinates of the center of cell idx in grid.

source
Exosphere.cell_volume Function
julia
cell_volume(grid::AbstractNeutralGrid[, idx])

Return the cell volume (or 1D length / 2D area for lower-dimensional Cartesian grids) at idx.

source
Exosphere.NeutralSourceBuffer Type
julia
NeutralSourceBuffer{AN, AM, AE}
NeutralSourceBuffer(FT, dims, nspecies)

Mutable Structure-of-Arrays (SoA) Eulerian source-rate accumulator storing scalar arrays (dn, dmom_x, dmom_y, dmom_z, dE) over shape (dims..., nspecies) for thread-safe and GPU atomic two-way charge–neutral coupling. Accessing .dmom returns a zero-allocation view of SVector{3} vectors for backwards compatibility.

source
Exosphere.NeutralParticleBuffer Type
julia
NeutralParticleBuffer{FT<:AbstractFloat, VP<:AbstractVector{NeutralParticle{FT}}}
NeutralParticleBuffer(FT = Float64, capacity = 1024; resizable = true)

Pre-allocated buffer for discrete neutral macroparticles (ENAs, sputtered neutrals) deposited during a kinetic/Hybrid-PIC coupling step.

source
Exosphere.merge_sources! Function
julia
merge_sources!(dst::NeutralSourceBuffer, src::NeutralSourceBuffer)

Accumulate src into dst in place (for multi-threaded per-thread source reduction).

source
Exosphere.active_particles Function
julia
active_particles(buf::NeutralParticleBuffer)

Return a zero-allocation @view of all neutral macroparticles deposited since the last reset_sources!.

source
Exosphere.GriddedNeutralField Type
julia
GriddedNeutralField{G, AN, AU, AT, M, Src, PB, Atten, BG, FT} <: AbstractNeutralModel
GriddedNeutralField(grid::AbstractNeutralGrid, nspecies::Integer;
                    masses = ones(FT, nspecies), two_way = false,
                    particle_capacity = 0, attenuation = NoAttenuation(),
                    background = nothing, planet_radius = 0.0, FT = Float64)

Structured-grid neutral atmosphere container supporting both read-only tabulated 3D backgrounds (two_way = false -> OneWayCoupling) and live two-way coupled simulations (two_way = true or particle_capacity > 0 -> TwoWayCoupling).

Supports:

  • Direct @inbounds cell indexing via CartesianIndex (matched plasma/neutral grids)

  • Zero-allocation linear/bilinear/trilinear interpolation at continuous 3D positions x

  • Conservative adjoint CIC deposition onto sources at continuous 3D positions x

  • Optional far-field background::AbstractNeutralModel outside the neutral grid domain

  • GPU array migration via ExosphereAdaptExt (Adapt.adapt(CuArray, field)).

source
Exosphere.sample_to_grid! Function
julia
sample_to_grid!(field::GriddedNeutralField, model::AbstractNeutralModel;
                t = nothing, kB = 1) -> GriddedNeutralField

Populate field.n, field.u, and field.T at every cell center from model, enabling a seamless transition from a static one-way exosphere to a two-way dynamic grid.

source

Adaptive Box Quadrature ​

Exosphere.integrate_exosphere_box! Function
julia
integrate_exosphere_box!(sumN, sumNA, exo::AbstractNeutralModel, c::SVector{3, FT},
                         h::SVector{3, FT}, depth::Int, rcut::FT;
                         t = nothing) -> FT

Adaptively accumulate per-component neutral density (sumN) and EUV-attenuated neutral density (sumNA) in place over an axis-aligned box centered at c (relative to the planet center) with side widths h, excluding the interior sphere r < rcut. Pass depth = 0 at the top level; set h[d] <= 0 for collapsed 2D axes. Non-straddling cells apply the analytic finite-cell correction along each axis. Returns the integrated exterior volume (or area when one axis is collapsed).

source

Planetary & Cometary Presets ​

Exosphere.mars_exosphere Function
julia
mars_exosphere(; scale = nothing, solar_dir = (1.0, 0.0, 0.0),
                 center = (0.0, 0.0, 0.0), FT = Float64) -> ExosphereModel

Construct a multi-component Martian exosphere preset containing hot oxygen (O, composite exponential corona) and atomic hydrogen (H, Chamberlain envelope) with EUV Chapman optical-depth attenuation (R_M = 3390 km). Uses SI units unless scale::UnitScale is provided.

source
Exosphere.venus_exosphere Function
julia
venus_exosphere(; scale = nothing, solar_dir = (1.0, 0.0, 0.0),
                  center = (0.0, 0.0, 0.0), FT = Float64) -> ExosphereModel

Construct a Venusian exosphere preset (CO2 thermal thermosphere + hot O corona, R_V = 6052 km) with EUV optical-depth attenuation.

source
Exosphere.earth_exosphere Function
julia
earth_exosphere(; scale = nothing, solar_dir = (1.0, 0.0, 0.0),
                  center = (0.0, 0.0, 0.0), FT = Float64) -> ExosphereModel

Construct an Earth geocorona preset (Day-Night modulated Chamberlain H exosphere + O thermosphere, R_E = 6371 km) with planetary shadow cylinder.

source
Exosphere.comet_exosphere Function
julia
comet_exosphere(; Q = 1.0e28, u_out = 800.0, scale_length = 1.0e8, r_nucleus = 2.0e3,
                  scale = nothing, center = (0.0, 0.0, 0.0), FT = Float64) -> ExosphereModel

Construct an expanding Haser-law cometary coma preset (H2O neutrals with radial outflow u_out, 1 / r^2 geometric dilution, and photolytic scale length scale_length):  .

source
Exosphere.ganymede_exosphere Function
julia
ganymede_exosphere(; scale = nothing, solar_dir = (1.0, 0.0, 0.0),
                     center = (0.0, 0.0, 0.0), FT = Float64) -> ExosphereModel

Construct a Ganymede sputtered O2 + dayside-modulated H2O exosphere preset (R_G = 2634 km) with moon shadow cylinder.

source

Public Constants & Low-Level Hooks ​

Exosphere.U_SI Constant
julia
U_SI

Unified atomic mass unit in kilograms (1.6605390666e-27 kg, CODATA 2018).

source
Exosphere.MP_SI Constant
julia
MP_SI

Proton mass in kilograms (1.67262192369e-27 kg, CODATA 2018).

source
Exosphere.ME_SI Constant
julia
ME_SI

Electron mass in kilograms (9.1093837015e-31 kg, CODATA 2018).

source
Exosphere.KB_SI Constant
julia
KB_SI

Boltzmann constant in J/K (1.380649e-23 J/K, exact SI).

source
Exosphere.E_SI Constant
julia
E_SI

Elementary charge in Coulombs (1.602176634e-19 C, exact SI).

source
Exosphere.si_mass Function
julia
si_mass(x)

Convert x to kilograms when x carries physical units (via ExosphereUnitfulExt), returning bare numbers unchanged.

source
Exosphere.si_length Function
julia
si_length(x)

Convert x to meters when x carries physical units (via ExosphereUnitfulExt), returning bare numbers unchanged.

source
Exosphere.si_number_density Function
julia
si_number_density(x)

Convert x to m^-3 when x carries physical units (via ExosphereUnitfulExt), returning bare numbers unchanged.

source
Exosphere.si_velocity Function
julia
si_velocity(x)

Convert x to m/s when x carries physical units (via ExosphereUnitfulExt), returning bare numbers unchanged.

source
Exosphere.si_temperature Function
julia
si_temperature(x)

Convert x to Kelvin when x carries temperature units (via ExosphereUnitfulExt), returning bare numbers unchanged.

source
Exosphere.si_energy Function
julia
si_energy(x)

Convert x to Joules when x carries energy or temperature units (via ExosphereUnitfulExt), returning bare numbers unchanged.

source
Exosphere.si_cross_section Function
julia
si_cross_section(x)

Convert x to m^2 when x carries area units (via ExosphereUnitfulExt), returning bare numbers unchanged.

source
Exosphere.si_frequency Function
julia
si_frequency(x)

Convert x to s^-1 when x carries frequency units (via ExosphereUnitfulExt), returning bare numbers unchanged.

source
Exosphere.push_particle! Function
julia
push_particle!(buf::NeutralParticleBuffer, p::NeutralParticle) -> Int

Append p to buf without allocating while below capacity (growing automatically when buf.resizable == true) and return the updated active particle count.

source