API Reference
Package Overview
Exosphere Module
ExosphereStandalone, 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.
Core Interfaces, Coupling Traits & State Containers
Exosphere.AbstractNeutralModel Type
AbstractNeutralModelAbstract supertype for single- or multi-species neutral exosphere/atmosphere models (static analytic ExosphereModel, tabulated or two-way mutable GriddedNeutralField, or external neutral solver adapters).
Exosphere.AbstractNeutralProfile Type
AbstractNeutralProfileAbstract supertype for scalar neutral number density profiles (1D radial, 3D asymmetric, composite, tabulated, or time-dependent).
sourceExosphere.AbstractNeutralVDF Type
AbstractNeutralVDFAbstract supertype for neutral particle velocity distribution functions normalized to
Exosphere.AbstractVelocityModel Type
AbstractVelocityModelAbstract supertype for spatial/temporal neutral bulk velocity models
Exosphere.AbstractTemperatureModel Type
AbstractTemperatureModelAbstract supertype for spatial/temporal neutral temperature models
Exosphere.AbstractAttenuation Type
AbstractAttenuationAbstract supertype for solar EUV radiative attenuation models returning a transmission factor in
Exosphere.AbstractInteractionChannel Type
AbstractInteractionChannelAbstract supertype for charge–neutral reaction channels (photoionization, electron-impact ionization, charge exchange, elastic collisions, recombination).
sourceExosphere.AbstractNeutralGrid Type
AbstractNeutralGridAbstract supertype for structured neutral spatial grids (CartesianNeutralGrid, SphericalNeutralGrid).
Exosphere.AbstractCouplingMode Type
AbstractCouplingModeTrait supertype distinguishing read-only one-way neutral backgrounds (OneWayCoupling) from mutable two-way coupled neutral models (TwoWayCoupling).
Exosphere.OneWayCoupling Type
OneWayCoupling <: AbstractCouplingModeCompile-time trait for read-only/static neutral models where plasma-to-neutral feedback deposition compiles away to a zero-cost no-op.
sourceExosphere.TwoWayCoupling Type
TwoWayCoupling <: AbstractCouplingModeCompile-time trait for dynamic neutral models that accumulate plasma-to-neutral mass, momentum, energy, or particle feedback.
sourceExosphere.coupling_mode Function
coupling_mode(model::AbstractNeutralModel) -> AbstractCouplingModeReturn OneWayCoupling() (default) or TwoWayCoupling() for model.
Exosphere.NeutralState Type
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).
Exosphere.PlasmaState Type
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.
Exosphere.MomentSource Type
MomentSource(dn, dmom, dE)Volumetric conservation-law source rates (or integrated deltas) for one species:
dn: number density ratedmom::SVector{3}: momentum density ratedE: total energy density rate, where .
Exosphere.CoupledExchange Type
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.
Exosphere.NeutralParticle Type
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.
Exosphere.neutral_state Function
neutral_state(model::AbstractNeutralModel, loc; t = nothing, species = 1) -> NeutralStateEvaluate the local macroscopic neutral state (n, u, T) of species at spatial position or grid index loc and optional time t.
Exosphere.local_vdf Function
local_vdf(model, loc; t = nothing, species = 1, kB = 1) -> AbstractNeutralVDFReturn the local velocity distribution function of species at position or grid index loc and optional time t.
Exosphere.species_mass Function
species_mass(model, c = 1)Return the particle mass of neutral component c.
Exosphere.deposit_neutral_source! Function
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.
Exosphere.deposit_neutral_particle! Function
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.
Exosphere.reset_sources! Function
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.
reset_sources!(buf::NeutralSourceBuffer)Zero all accumulated Eulerian source arrays in place.
sourceExosphere.neutral_sources Function
neutral_sources(model::AbstractNeutralModel)Return the Eulerian source accumulator buffer of model, or nothing for static models.
Exosphere.neutral_particles Function
neutral_particles(model::AbstractNeutralModel)Return the kinetic neutral particle buffer of model, or nothing when absent.
Exosphere.UnitScale Type
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 energyk_B * T[J] (defaults tom0 * v0^2)
Exosphere.to_code_units Function
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.
Exosphere.from_code_units Function
from_code_units(scale::UnitScale, val, quantity::Symbol)Convert a dimensionless code-unit value val of kind quantity back to SI units using scale.
Exosphere.strip_units Function
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.
Neutral Species & Velocity Distribution Functions
Exosphere.NeutralSpecies Type
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 numericmas given (code units or SI kg) and convertsUnitful.Quantityinputs to kilograms whenUnitfulis 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), matchingPlasmaPopulations.Particle(formula, 0).NeutralSpecies(scale, formula)converts the parsed molecular mass directly into code unitsm / scale.m0.NeutralSpecies{T}(s)converts precision (e.g.,NeutralSpecies{Float32}(s)).
Exosphere.atomic_mass Function
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.
Exosphere.ColdNeutral Type
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
Exosphere.Maxwellian Type
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:
Exosphere.BiMaxwellianNeutral Type
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
Exosphere.pdf Function
pdf(vdf::AbstractNeutralVDF, v)
pdf(vdf::AbstractNeutralVDF)Evaluate the normalized 3D velocity probability density v, or return a callable v -> pdf(vdf, v).
Exosphere.thermal_speed Function
thermal_speed(species::NeutralSpecies, T; kB = 1)
thermal_speed(vdf::AbstractNeutralVDF)Compute the most probable thermal speed species at temperature T, or extract the thermal speed of a velocity distribution vdf (matching the PlasmaPopulations.jl convention
Exosphere.vdf_temperature Function
vdf_temperature(species::NeutralSpecies, vdf::AbstractNeutralVDF; kB = 1)Return the isotropic (or effective scalar vdf for species using
Exosphere.temperature_perp_para Function
temperature_perp_para(species::NeutralSpecies, vdf::AbstractNeutralVDF; kB = 1)Return (T_perp, T_para) for species with velocity distribution vdf.
Neutral Density Profiles, Kinematics & Populations
Exosphere.ExponentialProfile Type
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.
Exosphere.PowerLawProfile Type
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.
Exosphere.ChamberlainProfile Type
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.
Exosphere.KineticChamberlainProfile Type
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
When normalize_exobase = true, densities are scaled by neutral_density(p, r_c) == n_c.
Exosphere.chamberlain_partition Function
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
zeta_bal: ballistic fractionzeta_sat: trapped satellite-orbit fraction (0wheninclude_satellite = false)zeta_esc: escaping fraction (unidirectional outward hemisphere)
Exosphere.jeans_escape_flux Function
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:
Exosphere.ExosphereProfile Type
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.
Exosphere.exosphere_profile Function
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 exospheren0 * exp(-max(r - r0, 0) / H).power = 2,H = Inf: cometary1 / r^2Haser-limit coma.
Exosphere.neutral_density Function
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.
Exosphere.local_scale_height Function
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 p or neutral model (H for ExponentialProfile, r / k for PowerLawProfile, r^2 / H for ChamberlainProfile; returns 0 when degenerate or r <= 0).
Exosphere.DayNightProfile Type
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 solar_dir.
Exosphere.PlumeProfile Type
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 0 behind the vent plane), where
Exosphere.CompositeProfile Type
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.
Exosphere.TabulatedRadialProfile Type
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.
Exosphere.TimeDependentProfile Type
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)).
Exosphere.ZeroVelocity Type
ZeroVelocity() <: AbstractVelocityModelStatic zero-velocity neutral background
Exosphere.ConstantVelocity Type
ConstantVelocity(u) <: AbstractVelocityModelSpatially uniform neutral drift velocity
Exosphere.CorotationVelocity Type
CorotationVelocity(omega; center = (0.0, 0.0, 0.0), FT = Float64) <: AbstractVelocityModelRigid planetary/moon atmospheric corotation velocity
Exosphere.RadialOutflowVelocity Type
RadialOutflowVelocity(v_out; center = (0.0, 0.0, 0.0), FT = Float64) <: AbstractVelocityModelSpherically radial outflow velocity center (e.g., cometary coma or escaping atmosphere; returns zero at r == 0).
Exosphere.ConstantTemperature Type
ConstantTemperature(T0) <: AbstractTemperatureModelIsothermal neutral background
Exosphere.DayNightTemperature Type
DayNightTemperature(; T_day, T_night, solar_dir = (1.0, 0.0, 0.0),
center = (0.0, 0.0, 0.0), FT = Float64) <: AbstractTemperatureModelSolar-zenith-angle dependent exobase temperature smoothly varying between T_day (subsolar) and T_night (antisolar):
Exosphere.neutral_velocity Function
neutral_velocity(v::AbstractVelocityModel, x; t = nothing) -> SVector{3}Evaluate the local neutral bulk velocity
Exosphere.neutral_temperature Function
neutral_temperature(temp::AbstractTemperatureModel, x; t = nothing)Evaluate the local neutral temperature
Exosphere.NeutralPopulation Type
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.
Exosphere.NeutralComponentCode Type
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.
Multi-Component Exosphere & EUV Attenuation
Exosphere.NoAttenuation Type
NoAttenuation() <: AbstractAttenuationUnattenuated EUV transmission model returning 1 everywhere with zero branching.
Exosphere.ShadowCylinder Type
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).
Exosphere.OpticalDepth Type
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 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.
Exosphere.RayOpticalDepth Type
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 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.
Exosphere.ExosphereModel Type
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.
Exosphere.build_exosphere_model Function
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) -> ExosphereModelConstruct 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).
Exosphere.in_shadow Function
in_shadow(sc::ShadowCylinder, x::SVector{3}) -> BoolReturn true when relative position x lies inside the shadow cylinder behind the body.
Exosphere.shadow_factor Function
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.
Exosphere.n_components Function
n_components(exo::AbstractNeutralModel) -> IntReturn the number of neutral components (species/populations) in exo.
Exosphere.exo_component_density Function
exo_component_density(exo::ExosphereModel, r::Real, c::Integer)Number density of neutral component c at radius r (zero inside exo.Rp).
Exosphere.exo_density Function
exo_density(exo::ExosphereModel, r::Real)Total neutral number density (sum over all components) at radius r.
Exosphere.exo_scale_height Function
exo_scale_height(exo::ExosphereModel, r::Real, c::Integer)Local scale height c (or explicit optical-depth scale height); returns 0 when undefined.
Exosphere.chapman_function Function
chapman_function(Xp::Real, cos_sza::Real)Smith & Smith (1972) Chapman grazing-incidence function for a curved atmosphere with Float32, Float64, and ForwardDiff.Dual inputs.
Exosphere.photo_attenuation Function
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.
Ion–Neutral Source Rates & Conservative Interactions
Exosphere.photoionization_rate Function
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.
Exosphere.charge_exchange_rate Function
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.
Exosphere.effective_relative_speed Function
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):
Exosphere.Photoionization Type
Photoionization(nu_photo; E_excess = nothing) <: AbstractInteractionChannelPhotoionization channel nu_photo and optional photoelectron excess energy E_excess added to the plasma energy.
Exosphere.ElectronImpactIonization Type
ElectronImpactIonization(k_imp; E_ion = nothing) <: AbstractInteractionChannelElectron-impact ionization channel 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.
Exosphere.ResonantChargeExchange Type
ResonantChargeExchange(sigma_cx) <: AbstractInteractionChannelResonant charge-exchange channel sigma_cx (scalar or callable sigma_cx(v_eff)). Conserves number (dn = 0), momentum, and total energy exactly between plasma and neutral species.
Exosphere.NonResonantChargeExchange Type
NonResonantChargeExchange(sigma_cx; E_defect = nothing) <: AbstractInteractionChannelNon-resonant charge-exchange channel sigma_cx (scalar or callable sigma_cx(v_eff)) and optional energy defect E_defect.
Exosphere.NonResonantExchange Type
NonResonantExchange(ion_loss, ion_gain, neutral_loss, neutral_gain)Four-species conservation-law source bundle for
ion_loss: loss from reactant ionion_gain: production of product ionneutral_loss: loss from reactant neutralneutral_gain: production of product neutral
Exosphere.ElasticCollision Type
ElasticCollision(coeff; is_cross_section = true) <: AbstractInteractionChannelElastic ion–neutral momentum- and energy-transfer collision channel (Schunk & Nagy 2009) for arbitrary ion/neutral mass ratio
is_cross_section = true:coeffis the momentum-transfer cross section(scalar or callable coeff(v_eff)), with symmetric rate factor .is_cross_section = false:coeffis a collision-frequency coefficient(scalar or callable coeff(T_eff)such that and ).
Exosphere.Recombination Type
Recombination(alpha_rec; E_rad = nothing) <: AbstractInteractionChannelIon–electron recombination channel alpha_rec (scalar or callable alpha_rec(T_e)) and optional radiated energy loss E_rad.
Exosphere.compute_exchange Function
compute_exchange(channel, plasma::PlasmaState, neutral::NeutralState, m_n;
atten = 1, n_e = plasma.n, T_e = plasma.T, kB = 1) -> CoupledExchangeEvaluate paired conservative plasma and neutral volumetric MomentSource terms for one AbstractInteractionChannel or a Tuple of channels.
Exosphere.compute_nonresonant_exchange Function
compute_nonresonant_exchange(ch::NonResonantChargeExchange, plasma::PlasmaState,
neutral::NeutralState, m_n; kB = 1) -> NonResonantExchangeCompute the four-species conservative source terms for
Exosphere.couple_point! Function
couple_point!(model::AbstractNeutralModel, loc, channels, plasma::PlasmaState;
x = loc, t = nothing, species = 1, n_e = plasma.n, T_e = plasma.T,
kB = 1) -> MomentSourceQuery 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.
Exosphere.LindsayStebbingsCX Type
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:
Exosphere.lindsay_stebbings_cx Function
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.
Exosphere.VoronovIonization Type
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:
Exosphere.voronov_ionization Function
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.
Exosphere.SchunkNagyMomentumTransfer Type
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:
Exosphere.schunk_nagy_momentum_transfer Function
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).
Exosphere.collision_probability Function
collision_probability(rate::Number, dt::Number)Exact Poisson collision probability -expm1(-(rate * dt)).
Exosphere.particle_charge_exchange_rate Function
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).
Exosphere.photoionization_creation_weight Function
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:
Exosphere.charge_exchange_collision Function
charge_exchange_collision(pos, v_ion, m_ion, weight, v_neutral, species_id = Int32(1))Perform a single resonant macroparticle charge-exchange event (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 velocityneutral_delta::MomentSource: exact integrated momentum and kinetic-energy delta transferred to the neutral population (dn = 0, exact conservation with the ion change).
Exosphere.sputtering_flux Function
sputtering_flux(ion_flux::Number, yield::Number)Sputtered neutral surface flux ion_flux with sputtering yield yield.
Structured Grids & Two-Way Dynamic Neutral Fields
Exosphere.CartesianNeutralGrid Type
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.
Exosphere.SphericalNeutralGrid Type
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
ntheta == 1 && nphi == 1: 1D radial grid(nr,)ntheta > 1 && nphi == 1: 2D axisymmetric(nr, ntheta)gridntheta > 1 && nphi > 1: 3D spherical(nr, ntheta, nphi)grid
Exosphere.cell_center Function
cell_center(grid::AbstractNeutralGrid, idx::CartesianIndex) -> SVector{3}Return the 3D spatial coordinates of the center of cell idx in grid.
Exosphere.cell_volume Function
cell_volume(grid::AbstractNeutralGrid[, idx])Return the cell volume (or 1D length / 2D area for lower-dimensional Cartesian grids) at idx.
Exosphere.NeutralSourceBuffer Type
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.
Exosphere.NeutralParticleBuffer Type
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.
sourceExosphere.merge_sources! Function
merge_sources!(dst::NeutralSourceBuffer, src::NeutralSourceBuffer)Accumulate src into dst in place (for multi-threaded per-thread source reduction).
Exosphere.active_particles Function
active_particles(buf::NeutralParticleBuffer)Return a zero-allocation @view of all neutral macroparticles deposited since the last reset_sources!.
Exosphere.GriddedNeutralField Type
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
@inboundscell indexing viaCartesianIndex(matched plasma/neutral grids)Zero-allocation linear/bilinear/trilinear interpolation at continuous 3D positions
xConservative adjoint CIC deposition onto
sourcesat continuous 3D positionsxOptional far-field
background::AbstractNeutralModeloutside the neutral grid domainGPU array migration via
ExosphereAdaptExt(Adapt.adapt(CuArray, field)).
Exosphere.sample_to_grid! Function
sample_to_grid!(field::GriddedNeutralField, model::AbstractNeutralModel;
t = nothing, kB = 1) -> GriddedNeutralFieldPopulate 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.
Adaptive Box Quadrature
Exosphere.integrate_exosphere_box! Function
integrate_exosphere_box!(sumN, sumNA, exo::AbstractNeutralModel, c::SVector{3, FT},
h::SVector{3, FT}, depth::Int, rcut::FT;
t = nothing) -> FTAdaptively 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
Planetary & Cometary Presets
Exosphere.mars_exosphere Function
mars_exosphere(; scale = nothing, solar_dir = (1.0, 0.0, 0.0),
center = (0.0, 0.0, 0.0), FT = Float64) -> ExosphereModelConstruct 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.
Exosphere.venus_exosphere Function
venus_exosphere(; scale = nothing, solar_dir = (1.0, 0.0, 0.0),
center = (0.0, 0.0, 0.0), FT = Float64) -> ExosphereModelConstruct a Venusian exosphere preset (CO2 thermal thermosphere + hot O corona, R_V = 6052 km) with EUV optical-depth attenuation.
Exosphere.earth_exosphere Function
earth_exosphere(; scale = nothing, solar_dir = (1.0, 0.0, 0.0),
center = (0.0, 0.0, 0.0), FT = Float64) -> ExosphereModelConstruct an Earth geocorona preset (Day-Night modulated Chamberlain H exosphere + O thermosphere, R_E = 6371 km) with planetary shadow cylinder.
Exosphere.comet_exosphere Function
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) -> ExosphereModelConstruct 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):
Exosphere.ganymede_exosphere Function
ganymede_exosphere(; scale = nothing, solar_dir = (1.0, 0.0, 0.0),
center = (0.0, 0.0, 0.0), FT = Float64) -> ExosphereModelConstruct a Ganymede sputtered O2 + dayside-modulated H2O exosphere preset (R_G = 2634 km) with moon shadow cylinder.
Public Constants & Low-Level Hooks
Exosphere.U_SI Constant
U_SIUnified atomic mass unit in kilograms (1.6605390666e-27 kg, CODATA 2018).
Exosphere.MP_SI Constant
MP_SIProton mass in kilograms (1.67262192369e-27 kg, CODATA 2018).
Exosphere.ME_SI Constant
ME_SIElectron mass in kilograms (9.1093837015e-31 kg, CODATA 2018).
Exosphere.si_mass Function
si_mass(x)Convert x to kilograms when x carries physical units (via ExosphereUnitfulExt), returning bare numbers unchanged.
Exosphere.si_length Function
si_length(x)Convert x to meters when x carries physical units (via ExosphereUnitfulExt), returning bare numbers unchanged.
Exosphere.si_number_density Function
si_number_density(x)Convert x to m^-3 when x carries physical units (via ExosphereUnitfulExt), returning bare numbers unchanged.
Exosphere.si_velocity Function
si_velocity(x)Convert x to m/s when x carries physical units (via ExosphereUnitfulExt), returning bare numbers unchanged.
Exosphere.si_temperature Function
si_temperature(x)Convert x to Kelvin when x carries temperature units (via ExosphereUnitfulExt), returning bare numbers unchanged.
Exosphere.si_energy Function
si_energy(x)Convert x to Joules when x carries energy or temperature units (via ExosphereUnitfulExt), returning bare numbers unchanged.
Exosphere.si_cross_section Function
si_cross_section(x)Convert x to m^2 when x carries area units (via ExosphereUnitfulExt), returning bare numbers unchanged.
Exosphere.si_frequency Function
si_frequency(x)Convert x to s^-1 when x carries frequency units (via ExosphereUnitfulExt), returning bare numbers unchanged.
Exosphere.push_particle! Function
push_particle!(buf::NeutralParticleBuffer, p::NeutralParticle) -> IntAppend p to buf without allocating while below capacity (growing automatically when buf.resizable == true) and return the updated active particle count.