Skip to content

Commit e85cd7b

Browse files
committed
Split setup_and_run in multiple steps
This commit introduces more structure in ClimaEarth. It splits `setup_and_run` in three functions: - `setup`, which produces a `CoupledSimulation` (hence, it was renamed to be `CoupledSimulation`, since it is just a constructor) - `run!`, which runs the simulation. This is supported by the introduction of `step!`, to take one single coupling step. This is particularly useful in debugging - `postprocess`, to make plots The advantage of this separation is that one can now construct a simulation without running it, and step a simulation one step at a time. Both of these are particularly useful in interactive work and debugging. This commit also renames `calendar_dt` to `diag_calendar_dt` to make it clearer that it refers to diagnostics.
1 parent dc25ca2 commit e85cd7b

File tree

6 files changed

+205
-141
lines changed

6 files changed

+205
-141
lines changed

NEWS.md

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

77
### ClimaCoupler features
88

9+
### Split `setup_and_run` in multiple functions. PR[#1251](https://github.com/CliMA/ClimaCoupler.jl/pull/1251)
10+
11+
`setup_and_run` was split into three functions:
12+
- `CoupledSimulation`, which takes a dictionary of a file path and constructs a coupled simulation
13+
- `run!`, which evolves the model
14+
- `postprocess`, which makes plots
15+
16+
In addition to this, `step!` was introduced to take a single step forward with
17+
the coupled simulation.
18+
19+
The function `setup_and_run` is still available.
20+
21+
This change also renames `calendar_dt` to `diagnostics_dt` to make it clearer
22+
that it refers to diagnostics.
23+
924
### Some misc. cleanup PR[#1244](https://github.com/CliMA/ClimaCoupler.jl/pull/1244)
1025
Changes include
1126
- Land simulation constructors no longer take in `domain_type`, which was unused.

experiments/ClimaEarth/run_amip.jl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,10 @@ include("setup_run.jl")
4343
config_file = parse_commandline(argparse_settings())["config_file"]
4444

4545
# Set up and run the coupled simulation
46-
cs = setup_and_run(config_file)
46+
cs = CoupledSimulation(config_file)
47+
run!(cs)
48+
49+
# Postprocessing
50+
# TODO: Remove this option?
51+
conservation_softfail = get_coupler_config_dict(config_file)["conservation_softfail"]
52+
postprocess(cs, conservation_softfail)

0 commit comments

Comments
 (0)