From e5b290db54a16248668f0af88e1696a8b5a30801 Mon Sep 17 00:00:00 2001 From: nefrathenrici Date: Tue, 12 Sep 2023 14:23:15 -0700 Subject: [PATCH] Add unique alias check, update param names for CA --- Project.toml | 2 +- src/file_parsing.jl | 13 +++++++++++++ src/parameters.toml | 23 ++++++++++++++--------- 3 files changed, 28 insertions(+), 10 deletions(-) diff --git a/Project.toml b/Project.toml index f99fdf8a..23e8a35c 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "CLIMAParameters" uuid = "6eacf6c3-8458-43b9-ae03-caf5306d3d53" authors = ["Climate Modeling Alliance"] -version = "0.7.17" +version = "0.7.18" [deps] DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae" diff --git a/src/file_parsing.jl b/src/file_parsing.jl index 34cd1544..840626b1 100644 --- a/src/file_parsing.jl +++ b/src/file_parsing.jl @@ -182,6 +182,7 @@ function get_values(pd::AliasParamDict, aliases::NAMESTYPE) data = pd.data # TODO: use map ret_values = [] + unique_aliases = Dict() for alias in aliases for (key, val) in data alias ≠ val["alias"] && continue @@ -196,6 +197,18 @@ function get_values(pd::AliasParamDict, aliases::NAMESTYPE) push!(ret_values, Pair(Symbol(alias), elem)) end end + # Test that no aliases are duplicated + for (key, val) in data + if haskey(unique_aliases, val["alias"]) + push!(unique_aliases[val["alias"]], key) + else + unique_aliases[val["alias"]] = [key] + end + end + for (alias, params) in unique_aliases + length(params) > 1 && + error("Parameters `$params` have the same alias `$alias`") + end return ret_values end diff --git a/src/parameters.toml b/src/parameters.toml index 60b21b32..f16bf1d4 100644 --- a/src/parameters.toml +++ b/src/parameters.toml @@ -1943,38 +1943,43 @@ alias = "avogad" value = 6.02214076e23 type = "float" -[bulk_transfer_coeff] +[C_E] alias = "C_E" value = 0.0044 type = "float" - +description = "bulk transfer coefficient" # Rayleigh Damping -[rayleigh_sponge_vert_velocity_coeff] +[alpha_rayleigh_w] alias = "alpha_rayleigh_w" value = 1.0 type = "float" +description = "rayleigh sponge vert velocity coeff" -[rayleigh_sponge_horz_velocity_coeff] +[alpha_rayleigh_uh] alias = "alpha_rayleigh_uh" value = 0.0001 type = "float" +description = "rayleigh sponge horizontal velocity coefficient" -[rayleigh_sponge_height] +[zd_rayleigh] alias = "zd_rayleigh" value = 15000.0 type = "float" +description = "rayleigh sponge height" -[viscous_sponge_height] +[zd_viscous] alias = "zd_viscous" value = 15000.0 type = "float" +description = "viscous sponge height" -[viscous_sponge_coeff] +[kappa_2_sponge] alias = "kappa_2_sponge" value = 1.0e6 type = "float" +description = "viscous sponge coefficient" # Held-Suarez @@ -2022,13 +2027,13 @@ description = "Temperature gradient between equator and pole for moist adiabatic # EDMF -[EDMF_entrainment_coefficient] +[entr_coeff] alias = "entr_coeff" value = 1 type = "float" description = "TODO: Remove this. Constant entrainment coefficient used for testing EDMF" -[EDMF_detrainment_coefficient] +[detr_coeff] alias = "detr_coeff" value = 0.001 type = "float"