Skip to content

Commit

Permalink
update ocean, sea ice every 1 day
Browse files Browse the repository at this point in the history
  • Loading branch information
juliasloan25 committed Mar 6, 2025
1 parent d2f3956 commit 780433c
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 23 deletions.
16 changes: 16 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,22 @@ ClimaCoupler.jl Release Notes

### ClimaCoupler features

#### Shared component `dt` can be overwritten for individual components
Previously, we required that the user either specify a shared `dt` to be
used by all component models, or specify values for all component models
(`dt_atmos`, `dt_ocean`, `dt_seaice`, `dt_land`). If fewer than 4
model-specific timesteps were provided, they would be discarded and
`dt` would be used uniformly instead. After this PR, if a user provides
fewer than 4 model-specific timesteps, they will be used for those models,
and the generic `dt` will be used for any models that don't have a more
specific timestep.
This makes choosing the timesteps simpler and allows us to easily set
specific `dt`s only for the models we're interested in.

This PR also sets the default timesteps for the ocean and sea ice models
to 1 day; these values will be used unless `dt_ocean` or `dt_seaice` are
otherwise specified.

#### Add default `get_field` methods for surface models PR[#1210](https://github.com/CliMA/ClimaCoupler.jl/pull/1210)
Add default methods for `get_field` methods that are commonly
not extended for surface models. These return reasonable default
Expand Down
2 changes: 1 addition & 1 deletion config/ci_configs/amip_component_dts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ co2: "maunaloa"
dt_atmos: "150secs"
dt_cpl: "150secs"
dt_land: "50secs"
dt_ocean: "30secs"
dt_ocean: "300secs"
dt_rad: "1hours"
dt_save_to_sol: "1days"
dt_seaice: "37.5secs"
Expand Down
10 changes: 6 additions & 4 deletions experiments/ClimaEarth/cli_options.jl
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ function argparse_settings()
arg_type = String
default = "20000101"
"--dt_cpl"
help = "Coupling time step in seconds [400 (default); allowed formats: \"Nsecs\", \"Nmins\", \"Nhours\", \"Ndays\", \"Inf\"]"
help = "Coupling time step in seconds [400secs (default); allowed formats: \"Nsecs\", \"Nmins\", \"Nhours\", \"Ndays\", \"Inf\"]"
arg_type = String
default = "400secs"
"--dt"
help = "Component model time step [allowed formats: \"Nsecs\", \"Nmins\", \"Nhours\", \"Ndays\", \"Inf\"]"
help = "Component model time step [400secs (default); allowed formats: \"Nsecs\", \"Nmins\", \"Nhours\", \"Ndays\", \"Inf\"]"
arg_type = String
default = "400secs"
"--dt_atmos"
Expand All @@ -65,11 +65,13 @@ function argparse_settings()
help = "Land simulation time step (alternative to `dt`; no default) [allowed formats: \"Nsecs\", \"Nmins\", \"Nhours\", \"Ndays\", \"Inf\"]"
arg_type = String
"--dt_ocean"
help = "Ocean simulation time step (alternative to `dt`; no default) [allowed formats: \"Nsecs\", \"Nmins\", \"Nhours\", \"Ndays\", \"Inf\"]"
help = "Ocean simulation time step [alternative to `dt`; 1days (default); allowed formats: \"Nsecs\", \"Nmins\", \"Nhours\", \"Ndays\", \"Inf\"]"
arg_type = String
default = "1days"
"--dt_seaice"
help = "Sea ice simulation time step (alternative to `dt`; no default) [allowed formats: \"Nsecs\", \"Nmins\", \"Nhours\", \"Ndays\", \"Inf\"]"
help = "Sea ice simulation time step [alternative to `dt`; 1days (default); allowed formats: \"Nsecs\", \"Nmins\", \"Nhours\", \"Ndays\", \"Inf\"]"
arg_type = String
default = "1days"
"--dt_save_to_sol"
help = "Time interval for saving output [\"10days\" (default); allowed formats: \"Nsecs\", \"Nmins\", \"Nhours\", \"Ndays\", \"Inf\"]"
arg_type = String
Expand Down
30 changes: 12 additions & 18 deletions experiments/ClimaEarth/user_io/arg_parsing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -232,27 +232,21 @@ function parse_component_dts!(config_dict)
# Specify component model names
component_dt_names = ["dt_atmos", "dt_land", "dt_ocean", "dt_seaice"]
component_dt_dict = Dict{String, typeof(Δt_cpl)}()
# check if all component dt's are specified
if all(key -> !isnothing(config_dict[key]), component_dt_names)
# when all component dt's are specified, ignore the dt field
if haskey(config_dict, "dt")
@warn "Removing dt in favor of individual component dt's"
delete!(config_dict, "dt")
end
for key in component_dt_names


@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"

for key in component_dt_names
if haskey(config_dict, key)
# Check if the component timestep is specified
component_dt = Float64(Utilities.time_to_seconds(config_dict[key]))
@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"
component_dt_dict[key] = component_dt
end
else
# when not all component dt's are specified, use the dt field
@assert haskey(config_dict, "dt") "dt or (dt_atmos, dt_land, dt_ocean, and dt_seaice) must be specified"
for key in component_dt_names
if !isnothing(config_dict[key])
@warn "Removing $key from config in favor of dt because not all component dt's are specified"
end
delete!(config_dict, key)
component_dt_dict[key] = Float64(Utilities.time_to_seconds(config_dict["dt"]))
else
# If the component timestep is not specified, use the generic timestep
dt = Float64(Utilities.time_to_seconds(config_dict["dt"]))
@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"
component_dt_dict[key] = dt
end
end
config_dict["component_dt_dict"] = component_dt_dict
Expand Down

0 comments on commit 780433c

Please sign in to comment.