From 4946cfb5b3c547b433a409396ae8483f410b56bb Mon Sep 17 00:00:00 2001 From: nefrathenrici Date: Fri, 25 Aug 2023 11:45:22 -0700 Subject: [PATCH] Test overrides --- config/default_configs/default_config.yml | 3 ++ docs/src/config.md | 2 +- src/parameters/create_parameters.jl | 23 ++++++--------- toml/column_edmf.toml | 4 +++ toml/non_column.toml | 35 +++++++++++++++++++++++ 5 files changed, 52 insertions(+), 15 deletions(-) create mode 100644 toml/column_edmf.toml create mode 100644 toml/non_column.toml diff --git a/config/default_configs/default_config.yml b/config/default_configs/default_config.yml index 68a29152405..1e470bca73c 100644 --- a/config/default_configs/default_config.yml +++ b/config/default_configs/default_config.yml @@ -243,3 +243,6 @@ prognostic_tke: prognostic_surface: help: "Determines if surface temperature is prognostic [`false` (default), , `true`, `PrognosticSurfaceTemperature`, `PrescribedSurfaceTemperature`]" value: "false" +override_τ_precip: + help: "If true, sets τ_precip to dt. Otherwise, τ_precip is set to the value in the toml dictionary" + value: true diff --git a/docs/src/config.md b/docs/src/config.md index d914c22b0de..9cd1c5273ff 100644 --- a/docs/src/config.md +++ b/docs/src/config.md @@ -21,7 +21,7 @@ debugging_tc: true surface_setup: Bomex turbconv_case: Bomex t_end: 6hours -turbconv: "edmf" +turbconv: edmf z_stretch: false config: column subsidence: Bomex diff --git a/src/parameters/create_parameters.jl b/src/parameters/create_parameters.jl index 03e2b668715..106fe590ca4 100644 --- a/src/parameters/create_parameters.jl +++ b/src/parameters/create_parameters.jl @@ -46,6 +46,11 @@ function create_climaatmos_parameter_set( aliases = setdiff(aliases, ["modal_nuc_params"]) pairs = CP.get_parameter_values!(toml_dict, aliases, "CloudMicrophysics") pairs = override_climaatmos_defaults((; pairs...), overrides) + # temporary fix for τ_precip + if parsed_args["override_τ_precip"] + pairs = (; pairs..., τ_precip = FT(CA.time_to_seconds(parsed_args["dt"])) + ) + end microphys_params = CM.Parameters.CloudMicrophysicsParameters{FTD, TP, MNP}(; pairs..., thermo_params, @@ -157,25 +162,15 @@ end # TODO: unify these parameters and refactor this method. function create_parameter_set(config::AtmosConfig) (; toml_dict, parsed_args) = config - FT = eltype(config) - dt = FT(CA.time_to_seconds(parsed_args["dt"])) return if CA.is_column_edmf(parsed_args) - overrides = (; τ_precip = dt) + println("COLUMN EDMF") create_climaatmos_parameter_set(toml_dict, parsed_args, overrides) elseif CA.is_column_without_edmf(parsed_args) - overrides = (; τ_precip = dt) - create_climaatmos_parameter_set(toml_dict, parsed_args, overrides) + println("COLUMN WITHOUT EDMF") else - overrides = (; - R_d = 287.0, - grav = 9.80616, - Omega = 7.29212e-5, - planet_radius = 6.371229e6, - ρ_cloud_liq = 1e3, - τ_precip = dt, - qc_0 = 5e-6, # criterion for removal after supersaturation - ) create_climaatmos_parameter_set(toml_dict, parsed_args, overrides) end + + return create_climaatmos_parameter_set(toml_dict, parsed_args, overrides) end diff --git a/toml/column_edmf.toml b/toml/column_edmf.toml new file mode 100644 index 00000000000..e010945d00a --- /dev/null +++ b/toml/column_edmf.toml @@ -0,0 +1,4 @@ +[mean_sea_level_pressure] +alias = "MSLP" +value = 1.0e5 +type = "float" diff --git a/toml/non_column.toml b/toml/non_column.toml new file mode 100644 index 00000000000..f35f40aed23 --- /dev/null +++ b/toml/non_column.toml @@ -0,0 +1,35 @@ +[R_d] +alias = "R_d" +value = 287.0 +type = "float" + +[MSLP] +alias = "MSLP" +value = 1.0e5 +type = "float" + +[grav] +alias = "grav" +value = 9.80616 +type = "float" + +[Omega] +alias = "Omega" +value = 7.29212e-5 +type = "float" + +[planet_radius] +alias = "planet_radius" +value = 6.371229e6 +type = "float" + +[ρ_cloud_liq] +alias = "ρ_cloud_liq" +value = 1e3 +type = "float" + +[qc_0] +alias = "qc_0" +value = 5e-6 +type = "float" + \ No newline at end of file