-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
example ✉️Code example for notebooksCode example for notebooks
Description
Script to simulate a volcanic eruption (add a mountain, add a passive tracer around it) @AnnaDSMS
using SpeedyWeather
# define some default model and simulate some days
spectral_grid = SpectralGrid(trunc=63, nlayers=8)
model = PrimitiveWetModel(spectral_grid)
simulation = initialize!(model)
run!(simulation, period=Day(10))
# now mimic a volcanic eruption by adding a mountain
H, λ₀, φ₀, w = 4000, 200, 20, 5 # height, lon, lat position, and width
set!(model, orography=(λ,φ) -> H*exp((-(λ-λ₀)^2 - (φ-φ₀)^2)/2w^2), add=true)
# and add a passive tracer called `:ash` and set it (=define its initial conditions)
add!(simulation, Tracer(:ash))
set!(simulation, ash = (λ, φ, σ) -> σ*exp((-(λ-λ₀)^2 - (φ-φ₀)^2)/2(3w)^2))
# now simulate another 5 days
run!(simulation, period=Day(5))
That tracer spread during those 5 days, e.g. in the upper atmosphere like this
ash = simulation.diagnostic_variables.grid.tracers_grid[:ash][:, 2]
heatmap(ash, title="Ash concentration")
(I may have had a slightly different state when running this so the concentration may not be exactly reproducible ...)
Metadata
Metadata
Assignees
Labels
example ✉️Code example for notebooksCode example for notebooks