You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With the new variable structure in #525 we also need to redesign a convenient way of setting the initial conditions of the prognostic variables. I think we want
set!(simulation, vor=f) with a function like f(x,y,z) = ... where x,y,z would be coordinates lon, lat, height (probably lond 0-360˚, latd -90˚ to 90˚, sigma 0 to 1)
set! with a scalar, e.g. set!(simulation, humid=0)
other ideas?
I've drafted that a bit and just throw this in here to collect this
set!(S::AbstractSimulation; kwargs...) =set!(S.prognostic_variables, S.model.geometry; kwargs...)
functionset!(
progn::PrognosticVariables,
geometry::Geometry;
u =nothing,
v =nothing,
vor =nothing,
div =nothing,
temp =nothing,
humid =nothing,
pres =nothing,
lf::Integer=1,
add::Bool=false,
)
isnothing(vor) ||set!(progn.vor[lf], vor, geometry; add)
isnothing(div) ||set!(progn.div[lf], div, geometry; add)
isnothing(temp) ||set!(progn.temp[lf], temp, geometry; add)
isnothing(humid) ||set!(progn.humid[lf], humid, geometry; add)
isnothing(pres) ||set!(progn.pres[lf], pres, geometry; add)
isnothing(u) |isnothing(v) ||set_vordiv!(progn.vor[lf], progn.div[lf], vor, div; add)
endfunctionset!(var::LowerTriangularArray, f::Function, geometry::Geometry, S::SpectralTransform; add)
grid =set!(grid, f, geometry; add)
transform!(var, grid, S)
endfunctionset!(var::AbstractGridArray, f::Function, geometry::Geometry; add)
(; londs, latds, σ_levels_full) = geometry
kernel(a, b) = add ? a+b : b
for k ineachgrid(var)
for ij ineachgridpoint(var)
var[ij, k] =kernel(var[ij, k], f(londs[ij], latds[ij], σ_levels_full[k]))
endendendfunctionset!(var::LowerTriangularArray, f::Real, geometry::Geometry; add)
end
The text was updated successfully, but these errors were encountered:
With the new variable structure in #525 we also need to redesign a convenient way of setting the initial conditions of the prognostic variables. I think we want
set!(simulation, vor=f)
with a function likef(x,y,z) = ...
where x,y,z would be coordinates lon, lat, height (probably lond 0-360˚, latd -90˚ to 90˚, sigma 0 to 1)set!
with a scalar, e.g.set!(simulation, humid=0)
I've drafted that a bit and just throw this in here to collect this
The text was updated successfully, but these errors were encountered: