Getting Started
Installation
Install Exosphere.jl from the Julia package manager:
using Pkg
Pkg.add("Exosphere")For local development against a checkout:
using Pkg
Pkg.develop(path = "/path/to/Exosphere.jl")Coordinate & Code-Unit Conventions
Exosphere.jl operates in consistent simulation code units (for example, lengths in planetary radii
Planet-centered relative vectors: Functions such as
in_shadow,photo_attenuation, andintegrate_exosphere_box!expect position vectorsrelative to the planet center ( exo.center), while callableExosphereProfileobjects subtractp.centerautomatically.Solar direction (
solar_dir): Normalized internally to a unit vector pointing toward the Sun (+xby default). Points with are on the dayside; points with are on the nightside / downstream wake.Surface clamping: Single-component radial profiles clamp
for , whereasexo_component_densityandexo_densityreturn0.0insideexo.Rp.
Walkthrough
The example below constructs a two-component exosphere (O exponential + H power-law) with curved-atmosphere Chapman EUV attenuation, evaluates local densities and ion–neutral source rates, and integrates the neutral column over an exterior 3D box:
using Exosphere
using StaticArrays
o_comp = NeutralComponentCode(:exponential, 100.0, 0.2, 0.0, 0.01, "O")
h_comp = NeutralComponentCode(:powerlaw, 10.0, 0.0, 2.0, 0.01, "H")
od = OpticalDepth(;
cross_sections = [0.05, 0.01],
solar_dir = (1.0, 0.0, 0.0),
chapman = true,
)
exo = build_exosphere_model(;
planet_radius = 1.0,
components = [o_comp, h_comp],
optical_depth = od,
inner_radius = 1.0,
)
x = SVector(1.5, 0.0, 0.0)
r = 1.5
n_tot = exo_density(exo, r)
atten = photo_attenuation(exo, x, r)
q_photo = photoionization_rate(1.0e-6, n_tot, atten)
q_cx = charge_exchange_rate(2.0e-19, 5.0, n_tot, 4.0e5)
sumN = zeros(n_components(exo))
sumNA = zeros(n_components(exo))
vol = integrate_exosphere_box!(sumN, sumNA, exo, x, SVector(0.2, 0.2, 0.2), 0, 1.0)
println("n_tot = ", round(n_tot; sigdigits = 4))
println("atten = ", round(atten; sigdigits = 4))
println("q_photo = ", round(q_photo; sigdigits = 4))
println("q_cx = ", round(q_cx; sigdigits = 4))
println("vol = ", round(vol; sigdigits = 4))
println("sumN = ", round.(sumN; sigdigits = 4))
println("sumNA = ", round.(sumNA; sigdigits = 4))n_tot = 12.65
atten = 0.9288
q_photo = 1.175e-5
q_cx = 5.061e-12
vol = 0.008
sumN = [0.06844, 0.03566]
sumNA = [0.06356, 0.03312]