Skip to content

Commit

Permalink
Merge pull request #3534 from CliMA/ne/override_precip_timescale
Browse files Browse the repository at this point in the history
Remove `override_precip_timescale`, modify some TOMLs
  • Loading branch information
nefrathenrici authored Jan 22, 2025
2 parents 4180b7c + a1ec3b5 commit bfe5960
Show file tree
Hide file tree
Showing 19 changed files with 32 additions and 55 deletions.
7 changes: 7 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ Main
CO2 concentration. This is currently only relevant for radiation transfer with
RRTGMP.

### Maintenance

### Remove override_precip_timescale config
![][badge-🔥behavioralΔ] The override_precip_timescale config has been removed.
To recover the previous behavior, set `precipitation_timescale` to `dt` in the
toml. PR [3534](https://github.com/CliMA/ClimaAtmos.jl/pull/3534)

v0.28.2
-------
### Features
Expand Down
3 changes: 0 additions & 3 deletions config/default_configs/default_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -259,9 +259,6 @@ implicit_diffusion:
approximate_linear_solve_iters:
help: "Number of iterations for the approximate linear solve (used when `implicit_diffusion` is true)"
value: 1
override_precip_timescale:
help: "If true, sets τ_precip to dt. Otherwise, τ_precip is set to the value in the toml dictionary"
value: true
output_default_diagnostics:
help: "Output the default diagnostics associated to the selected atmospheric model"
value: true
Expand Down
1 change: 0 additions & 1 deletion config/longrun_configs/amip_target_diagedmf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ dt_save_state_to_disk: "20days"
moist: "equil"
cloud_model: "quadrature_sgs"
precip_model: "0M"
override_precip_timescale: false
rad: "allskywithclear"
dt_rad: "1hours"
dt_cloud_fraction: "1hours"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,4 @@ edmfx_nh_pressure: true
edmfx_sgs_mass_flux: true
edmfx_sgs_diffusive_flux: true
precip_model: "0M"
override_precip_timescale: false
toml: [toml/longrun_aquaplanet_diagedmf.toml]
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,4 @@ edmfx_filter: true
edmfx_sgs_mass_flux: false
edmfx_sgs_diffusive_flux: true
precip_model: "0M"
override_precip_timescale: false
toml: [toml/longrun_aquaplanet_progedmf.toml]
1 change: 1 addition & 0 deletions config/longrun_configs/longrun_moist_baroclinic_wave.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ initial_condition: "MoistBaroclinicWave"
moist: "equil"
precip_model: "0M"
dt_save_state_to_disk: "10days"
toml: [toml/longrun_baroclinic_wave.toml]
diagnostics:
- short_name: [pfull, wa, va, rv, hus, ke]
period: 1days
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ moist: "equil"
precip_model: "0M"
dt_save_state_to_disk: "10days"
netcdf_interpolation_num_points: [360, 180, 2]
toml: [toml/longrun_baroclinic_wave.toml]
diagnostics:
- short_name: [pfull, wa, va, rv, hus, ke]
period: 1days
1 change: 0 additions & 1 deletion config/model_configs/diagnostic_edmfx_trmm_box_0M.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ moist: equil
cloud_model: "quadrature_sgs"
call_cloud_diagnostics_per_stage: true
precip_model: "0M"
override_precip_timescale: false
config: box
x_max: 1e8
y_max: 1e8
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ moist: equil
cloud_model: "quadrature_sgs"
call_cloud_diagnostics_per_stage: true
precip_model: "1M"
override_precip_timescale: false
config: box
x_max: 1e8
y_max: 1e8
Expand Down
1 change: 0 additions & 1 deletion config/model_configs/rcemipii_box_diagnostic_edmfx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ edmfx_sgs_diffusive_flux: true
rayleigh_sponge: true
moist: equil
precip_model: 0M
override_precip_timescale: false
dt: 30secs
t_end: 3600secs
dt_save_state_to_disk: 12hours
Expand Down
1 change: 0 additions & 1 deletion config/model_configs/rcemipii_sphere_diagnostic_edmfx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ edmfx_sgs_diffusive_flux: true
rayleigh_sponge: true
moist: equil
precip_model: 0M
override_precip_timescale: false
dt: 100secs
t_end: 12hours
dt_save_state_to_disk: 12hours
Expand Down
5 changes: 4 additions & 1 deletion reproducibility_tests/ref_counter.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
202
203

# **README**
#
Expand All @@ -20,6 +20,9 @@


#=
203
- Remove `override_precip_timescale`
202
- Slightly changed CO2 prescription
Expand Down
29 changes: 7 additions & 22 deletions src/parameters/create_parameters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,34 +8,19 @@ import CloudMicrophysics as CM
import StaticArrays as SA

"""
ClimaAtmosParameters(FT, dt)
ClimaAtmosParameters(toml_dict, dt)
ClimaAtmosParameters(FT::AbstractFloat)
ClimaAtmosParameters(toml_dict)
ClimaAtmosParameters(config::AtmosConfig)
Construct the parameter set for any ClimaAtmos configuration.
If dt is passed in, it will be used to override the `precipitation_timescale` parameter.
"""
function ClimaAtmosParameters(config::AtmosConfig)
(; toml_dict, parsed_args) = config
FT = CP.float_type(toml_dict)
override_dt =
parsed_args["override_precip_timescale"] ?
FT(CA.time_to_seconds(parsed_args["dt"])) : nothing

return ClimaAtmosParameters(toml_dict, override_dt)
end
ClimaAtmosParameters(config::AtmosConfig) =
ClimaAtmosParameters(config.toml_dict)

ClimaAtmosParameters(::Type{FT}, dt = nothing) where {FT} =
ClimaAtmosParameters(CP.create_toml_dict(FT), dt)
ClimaAtmosParameters(::Type{FT}) where {FT <: AbstractFloat} =
ClimaAtmosParameters(CP.create_toml_dict(FT))

function ClimaAtmosParameters(
toml_dict::TD,
dt = nothing,
) where {TD <: CP.AbstractTOMLDict}
if !isnothing(dt)
toml_dict["precipitation_timescale"]["value"] = dt
end
function ClimaAtmosParameters(toml_dict::TD) where {TD <: CP.AbstractTOMLDict}
FT = CP.float_type(toml_dict)

turbconv_params = TurbulenceConvectionParameters(toml_dict)
Expand Down
22 changes: 0 additions & 22 deletions test/parameters/parameter_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,25 +37,3 @@ end
CA.Parameters.ClimaAtmosParameters
end
end

@testset "Test that `override_precip_timescale` is handled properly" begin
# precipitation_timescale should NOT be overridden by DT
config = CA.AtmosConfig(
Dict("dt" => "1secs", "override_precip_timescale" => false),
)
@test config.parsed_args["override_precip_timescale"] == false
@test config.parsed_args["dt"] == "1secs"
(; precipitation_timescale) =
CP.get_parameter_values(config.toml_dict, "precipitation_timescale")
parameters = CA.ClimaAtmosParameters(config)
@test parameters.microphysics_0m_params.τ_precip == precipitation_timescale

# precipitation_timescale should be overridden by DT
config = CA.AtmosConfig(Dict("dt" => "1secs"))
@test config.parsed_args["override_precip_timescale"] == true
@test config.parsed_args["dt"] == "1secs"
(; precipitation_timescale) =
CP.get_parameter_values(config.toml_dict, "precipitation_timescale")
parameters = CA.ClimaAtmosParameters(config)
@test parameters.microphysics_0m_params.τ_precip == 1.0
end
3 changes: 3 additions & 0 deletions toml/longrun_aquaplanet.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ value = 40000.0

[zd_viscous]
value = 40000.0

[precipitation_timescale]
value = 120
2 changes: 2 additions & 0 deletions toml/longrun_baroclinic_wave.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[precipitation_timescale]
value = 120
3 changes: 3 additions & 0 deletions toml/longrun_held_suarez.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ value = 40000.0

[zd_viscous]
value = 40000.0

[precipitation_timescale]
value = 120
2 changes: 2 additions & 0 deletions toml/sphere_aquaplanet.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ value = 40000.0
[zd_rayleigh]
value = 40000.0

[precipitation_timescale]
value = 400
2 changes: 2 additions & 0 deletions toml/sphere_held_suarez.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ value = 35000.0
[zd_rayleigh]
value = 35000.0

[precipitation_timescale]
value = 400

0 comments on commit bfe5960

Please sign in to comment.