Improve constructors for various types#4236
Conversation
d9b62bb to
f86415a
Compare
|
Yes, renaming to HyperDiffusion is good. |
@szy21 should the yaml name be updated to edit: It looks a bit strange to set edit 2: How about updating the setting to: hyperdiffusion:
help: |
Fourth-order hyperdiffusion. Options:
- `custom_coefficients` (default): Use custom coefficients for hyperdiffusion:
set these with the `vorticity_hyperdiffusion_coefficient`, `hyperdiffusion_prandtl_number`,
`divergence_damping_factor` config options.
- `CAM_SE` (Lauritzen et al. 2018): Use CAM_SE coefficients for hyperdiffusion
- `~` (no hyperdiffusion): Disable hyperdiffusion
value: "custom_coefficients" |
I think it's fine to keep hyperdiff (or it's consistent with others, e.g. we have vert_diff: VerticalDiffusion, even though it looks a bit strange). You don't need to specify the coefficients - they have default values. |
| AbstractRRTMGPMode | ||
| idealized_h2o::Bool = false | ||
| idealized_clouds::Bool = false | ||
| cloud::ACR = InteractiveCloudInRadiation() |
There was a problem hiding this comment.
@nefrathenrici I set this default to InteractiveCloudInRadiation() instead of nothing as you had done originally, which is consistent with the default_config.yml. Is that fine?
szy21
left a comment
There was a problem hiding this comment.
Looks good, but maybe @nefrathenrici wants to take another look. What's the difference between Base.@kwdef and @kwdef? We are using both at different places in the codebase now.
| "diagnostics" => diagnostics, | ||
| "netcdf_interpolation_num_points" => nothing, | ||
| "netcdf_output_at_levels" => false, | ||
| "output_default_diagnostics" => false, |
There was a problem hiding this comment.
why do we want this to be false here?
There was a problem hiding this comment.
There's some duplicate code for default diagnostics which we'll clean up later. If you look at the signature of this function, the argument use_default_diagnostics is a bool that determines if we add default diagnostics, which are then set in L45 onwards.
We set it to false on L89 to avoid adding these twice.
haakon-e
left a comment
There was a problem hiding this comment.
Adding some comments throughout the changed files to (hopefully) make review easier.
| αₘ(s::RayleighSponge, z, α) = ifelse(z > s.zd, α, zero(α)) | ||
| ζ_rayleigh(s::RayleighSponge, z, zmax) = sinpi((z - s.zd) / (zmax - s.zd) / 2)^2 | ||
| β_rayleigh_uₕ(s::RayleighSponge, z, zmax) = αₘ(s, z, s.α_uₕ) * ζ_rayleigh(s, z, zmax) | ||
| β_rayleigh_u₃(s::RayleighSponge, z, zmax) = αₘ(s, z, s.α_w) * ζ_rayleigh(s, z, zmax) |
There was a problem hiding this comment.
renamed β_rayleigh_w to β_rayleigh_u₃, which seemed more consistent with β_rayleigh_uₕ, but did not update the struct field from α_w.
There was a problem hiding this comment.
reformatting to remove FTs and improve readability
There was a problem hiding this comment.
making use of rayleigh_sponge_tendency_u₃
| integrator::OD | ||
| end | ||
|
|
||
| Base.summary(::AtmosSimulation) = "AtmosSimulation" |
There was a problem hiding this comment.
Base.summary and Base.show is moved to show.jl file
| κ₂::FT | ||
| end | ||
|
|
||
| ViscousSponge(params) = ViscousSponge(; |
There was a problem hiding this comment.
convenience constructor using ClimaParams parameter set.
| end | ||
| Base.broadcastable(x::AtmosNumerics) = tuple(x) | ||
|
|
||
| function Base.summary(io::IO, numerics::AtmosNumerics) |
|
|
||
| Base.broadcastable(x::AtmosModel) = tuple(x) | ||
|
|
||
| function Base.summary(io::IO, atmos::AtmosModel) |
There was a problem hiding this comment.
this file contains two generic methods that attempts to print more helpful information about model structs. These generic methods are then (L100 onwards) applied to the Base.show methods for various model structs. This is by far not complete, and is something we update as needed.
Note that these are largely relevant for interactive sessions, not non-interactive runs.
There was a problem hiding this comment.
updating some formatting and importing the show.jl file.
No difference. Previous versions of Julia didn't export |
6225cbf to
bcda57f
Compare
fdb4d62 to
36ac9a9
Compare
7575ce5 to
89c2432
Compare
- add user-friendly model constructors for:
- tracer nonnegativity methods
- prescribed vertical diffusion models
- eddy viscosity models
- sponge models (+ documentation & defaults)
- radiation models (+ defaults)
- hyperdiffusion
- atmosnumerics
- some formatting updates
- enable passing z_mesh to commongrids
- dont pass call_cloud_diagnostics_per_stage via callback_kwargs
Co-authored-by: Haakon Ludvig Langeland Ervik <45243236+haakon-e@users.noreply.github.com>
c4e9815 to
99da0eb
Compare
99da0eb to
2084b15
Compare
This PR adds defaults and improves constructors for various types to facilitate runscripts for case setups:
ClimaHyperdiffusion), new functioncam_se_hyperdiffusionfor CAM_SE hyperdiffThe PR also:
call_cloud_diagnostics_per_stagefromdefault_model_callbacks(water::AtmosWater,...)since it's configured from the atmos modelshow-methods for various structsThe second commit of this PR adds:
runscripts/rcemipii_box_CRM.jl), providing a configurable setup for running the model with various grid resolutions and diagnostics.