Skip to content

Commit 7d444a1

Browse files
committed
update ocean, sea ice every 1 day
1 parent d2f3956 commit 7d444a1

File tree

4 files changed

+34
-23
lines changed

4 files changed

+34
-23
lines changed

NEWS.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,22 @@ ClimaCoupler.jl Release Notes
66

77
### ClimaCoupler features
88

9+
#### Shared component `dt` can be overwritten for individual components
10+
Previously, we required that the user either specify a shared `dt` to be
11+
used by all component models, or specify values for all component models
12+
(`dt_atmos`, `dt_ocean`, `dt_seaice`, `dt_land`). If fewer than 4
13+
model-specific timesteps were provided, they would be discarded and
14+
`dt` would be used uniformly instead. After this PR, if a user provides
15+
fewer than 4 model-specific timesteps, they will be used for those models,
16+
and the generic `dt` will be used for any models that don't have a more
17+
specific timestep.
18+
This makes choosing the timesteps simpler and allows us to easily set
19+
specific `dt`s only for the models we're interested in.
20+
21+
This PR also sets the default timesteps for the ocean and sea ice models
22+
to 1 day; these values will be used unless `dt_ocean` or `dt_seaice` are
23+
otherwise specified.
24+
925
#### Add default `get_field` methods for surface models PR[#1210](https://github.com/CliMA/ClimaCoupler.jl/pull/1210)
1026
Add default methods for `get_field` methods that are commonly
1127
not extended for surface models. These return reasonable default

config/ci_configs/amip_component_dts.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ co2: "maunaloa"
33
dt_atmos: "150secs"
44
dt_cpl: "150secs"
55
dt_land: "50secs"
6-
dt_ocean: "30secs"
6+
dt_ocean: "300secs"
77
dt_rad: "1hours"
88
dt_save_to_sol: "1days"
99
dt_seaice: "37.5secs"

experiments/ClimaEarth/cli_options.jl

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@ function argparse_settings()
5151
arg_type = String
5252
default = "20000101"
5353
"--dt_cpl"
54-
help = "Coupling time step in seconds [400 (default); allowed formats: \"Nsecs\", \"Nmins\", \"Nhours\", \"Ndays\", \"Inf\"]"
54+
help = "Coupling time step in seconds [400secs (default); allowed formats: \"Nsecs\", \"Nmins\", \"Nhours\", \"Ndays\", \"Inf\"]"
5555
arg_type = String
5656
default = "400secs"
5757
"--dt"
58-
help = "Component model time step [allowed formats: \"Nsecs\", \"Nmins\", \"Nhours\", \"Ndays\", \"Inf\"]"
58+
help = "Component model time step [400secs (default); allowed formats: \"Nsecs\", \"Nmins\", \"Nhours\", \"Ndays\", \"Inf\"]"
5959
arg_type = String
6060
default = "400secs"
6161
"--dt_atmos"
@@ -65,11 +65,13 @@ function argparse_settings()
6565
help = "Land simulation time step (alternative to `dt`; no default) [allowed formats: \"Nsecs\", \"Nmins\", \"Nhours\", \"Ndays\", \"Inf\"]"
6666
arg_type = String
6767
"--dt_ocean"
68-
help = "Ocean simulation time step (alternative to `dt`; no default) [allowed formats: \"Nsecs\", \"Nmins\", \"Nhours\", \"Ndays\", \"Inf\"]"
68+
help = "Ocean simulation time step [alternative to `dt`; 1days (default); allowed formats: \"Nsecs\", \"Nmins\", \"Nhours\", \"Ndays\", \"Inf\"]"
6969
arg_type = String
70+
default = "1days"
7071
"--dt_seaice"
71-
help = "Sea ice simulation time step (alternative to `dt`; no default) [allowed formats: \"Nsecs\", \"Nmins\", \"Nhours\", \"Ndays\", \"Inf\"]"
72+
help = "Sea ice simulation time step [alternative to `dt`; 1days (default); allowed formats: \"Nsecs\", \"Nmins\", \"Nhours\", \"Ndays\", \"Inf\"]"
7273
arg_type = String
74+
default = "1days"
7375
"--dt_save_to_sol"
7476
help = "Time interval for saving output [\"10days\" (default); allowed formats: \"Nsecs\", \"Nmins\", \"Nhours\", \"Ndays\", \"Inf\"]"
7577
arg_type = String

experiments/ClimaEarth/user_io/arg_parsing.jl

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -232,27 +232,20 @@ function parse_component_dts!(config_dict)
232232
# Specify component model names
233233
component_dt_names = ["dt_atmos", "dt_land", "dt_ocean", "dt_seaice"]
234234
component_dt_dict = Dict{String, typeof(Δt_cpl)}()
235-
# check if all component dt's are specified
236-
if all(key -> !isnothing(config_dict[key]), component_dt_names)
237-
# when all component dt's are specified, ignore the dt field
238-
if haskey(config_dict, "dt")
239-
@warn "Removing dt in favor of individual component dt's"
240-
delete!(config_dict, "dt")
241-
end
242-
for key in component_dt_names
235+
236+
@assert all(key -> !isnothing(config_dict[key]), component_dt_names) || haskey(config_dict, "dt") "all model-specific timesteps (dt_atmos, dt_land, dt_ocean, and dt_seaice) or a generic timestep (dt) must be specified"
237+
238+
for key in component_dt_names
239+
if haskey(config_dict, key)
240+
# Check if the component timestep is specified
243241
component_dt = Float64(Utilities.time_to_seconds(config_dict[key]))
244242
@assert isapprox(Δt_cpl % component_dt, 0.0) "Coupler dt must be divisible by all component dt's\n dt_cpl = $Δt_cpl\n $key = $component_dt"
245243
component_dt_dict[key] = component_dt
246-
end
247-
else
248-
# when not all component dt's are specified, use the dt field
249-
@assert haskey(config_dict, "dt") "dt or (dt_atmos, dt_land, dt_ocean, and dt_seaice) must be specified"
250-
for key in component_dt_names
251-
if !isnothing(config_dict[key])
252-
@warn "Removing $key from config in favor of dt because not all component dt's are specified"
253-
end
254-
delete!(config_dict, key)
255-
component_dt_dict[key] = Float64(Utilities.time_to_seconds(config_dict["dt"]))
244+
else
245+
# If the component timestep is not specified, use the generic timestep
246+
dt = Float64(Utilities.time_to_seconds(config_dict["dt"]))
247+
@assert isapprox(Δt_cpl % dt, 0.0) "Coupler dt must be divisible by all component dt's\n dt_cpl = $Δt_cpl\n dt = $dt"
248+
component_dt_dict[key] = dt
256249
end
257250
end
258251
config_dict["component_dt_dict"] = component_dt_dict

0 commit comments

Comments
 (0)