Skip to content

Commit

Permalink
Add unique alias check, update param names for CA
Browse files Browse the repository at this point in the history
  • Loading branch information
nefrathenrici committed Sep 12, 2023
1 parent 514be55 commit e5b290d
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
13 changes: 13 additions & 0 deletions src/file_parsing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)

Check warning on line 203 in src/file_parsing.jl

View check run for this annotation

Codecov / codecov/patch

src/file_parsing.jl#L203

Added line #L203 was not covered by tests
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

Expand Down
23 changes: 14 additions & 9 deletions src/parameters.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit e5b290d

Please sign in to comment.