Closed markmbaum closed 2 months ago
Thanks for the interest in this package ππΌ Which version do you use? I cannot reproduce this blowup. In general, if a simulation blows up the most helpful way to report this is
v0.9.0
Warning: NaN or Inf detected at time step 1
On the first time step usually means you already started with NaNs somewhere in the initial conditions. Can you
model.implicit
and one more but that's resolved in #main) meaning no NaN could propagate into it.On the 2nd point maybe this helps https://github.com/SpeedyWeather/SpeedyWeather.jl/issues/350
@markmbaum did this get resolved?
It seems to be working now although I really can't explain why. Previously, I just copied that example snippet into a repl and it produced NaNs. Nevermind then!
The docs are generally extremely helpful, but it could be useful to have more indication of which model components are default and/or required. Relatedly, I'm getting an error when trying to use the tree
function to look into simulations
julia> using SpeedyWeather
julia> SpeedyWeather.tree
ERROR: UndefVarError: `tree` not defined
Stacktrace:
[1] getproperty(x::Module, f::Symbol)
@ Base ./Base.jl:31
[2] top-level scope
@ REPL[3]:1
No idea why this is happening, as I can see the export clearly in the source and I'm using the latest version.
tree
was only introduced after the latest release, so is only in the main branch not in v0.9 it works there
julia> using SpeedyWeather
julia> spectral_grid = SpectralGrid(trunc=31, nlev=1);
julia> model = ShallowWaterModel(;spectral_grid);
julia> simulation = initialize!(model);
julia> tree(simulation)
Simulation{ShallowWaterModel}
ββprognostic_variables
ββ trunc
ββ nlat_half
ββ nlev
ββ n_steps
βββlayers
ββββtimesteps
...
The docs are generally extremely helpful, but it could be useful to have more indication of which model components are default and/or required
none are required except for spectral_grid
(not even that in v0.9, we made it only mandatory with #519) the defaults are usually best seen in the show of model
julia> model
ShallowWaterModel <: ShallowWater
β spectral_grid: SpectralGrid
β device_setup: SpeedyWeather.DeviceSetup{SpeedyWeather.CPUDevice, DataType}
β geometry: Geometry{Float32}
β planet: Earth{Float32}
β atmosphere: EarthAtmosphere{Float32}
β coriolis: Coriolis{Float32}
β orography: EarthOrography{Float32, OctahedralGaussianGrid{Float32}}
β forcing: NoForcing
β drag: NoDrag
β particle_advection: NoParticleAdvection
β initial_conditions: InitialConditions{ZonalJet, ZeroInitially, ZeroInitially, ZeroInitially}
β time_stepping: Leapfrog{Float32}
β spectral_transform: SpectralTransform{Float32}
β implicit: ImplicitShallowWater{Float32}
β horizontal_diffusion: HyperDiffusion{Float32}
β output: OutputWriter{Float32, ShallowWater}
β callbacks: Dict{Symbol, SpeedyWeather.AbstractCallback}
β feedback: Feedback
which shows all fields and their respective types that tell you what defaults are. You can then further inspect each of these, e.g.
julia> model.time_stepping
Leapfrog{Float32} <: SpeedyWeather.AbstractTimeStepper
β trunc::Int64 = 31
β Ξt_at_T31::Second = 1800 seconds
β radius::Float32 = 6.371e6
β adjust_with_output::Bool = true
β robert_filter::Float32 = 0.05
β williams_filter::Float32 = 0.53
β Ξt_millisec::Dates.Millisecond = 1800000 milliseconds
β Ξt_sec::Float32 = 1800.0
β Ξt::Float32 = 0.0002825302
For more information always check the docstring (with ?
) of the respective type (every model component is an instance of its own (struct
) type), e.g.
help?> Leapfrog
search: Leapfrog
Leapfrog time stepping defined by the following fields
β’ trunc::Int64: spectral resolution (max degree of spherical harmonics)
β’ Ξt_at_T31::Second: time step in minutes for T31, scale linearly to trunc
β’ radius::AbstractFloat: radius of sphere [m], used for scaling
β’ adjust_with_output::Bool: adjust ΞtatT31 with the outputdt to reach outputdt exactly
in integer time steps
β’ robert_filter::AbstractFloat: Robert (1966) time filter coefficeint to suppress
comput. mode
β’ williams_filter::AbstractFloat: Williams time filter (Amezcua 2011) coefficient for
3rd order acc
β’ Ξt_millisec::Dates.Millisecond: time step Ξt [ms] at specified resolution
β’ Ξt_sec::AbstractFloat: time step Ξt [s] at specified resolution
β’ Ξt::AbstractFloat: time step Ξt [s/m] at specified resolution, scaled by 1/radius
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Leapfrog(spectral_grid::SpectralGrid; kwargs...) -> Leapfrog
Generator function for a Leapfrog struct using spectral_grid for the resolution information.
Ok thank you!
tree was only introduced after the latest release, so is only in the main branch not in v0.9 it works there
Have you thought about a patch release when the docs get updated with things that are not yet in the latest version? Meaning 0.9.1
. I could submit a PR.
Well that's why there are several version of the docs, /dev
for the main branch, and then the various versions. I do agree we are due another release but I want to merge a few pull requests for that first!
Ah I see, that was my confusion as well. I thought I was on the stable docs.
I tried running the example in the readme:
and it produces NaNs: