Skip to content

Commit 41a831b

Browse files
authored
Merge pull request #1153 from CliMA/js/simmode
use `sim_mode` only in init
2 parents ea8e62f + 327c2bb commit 41a831b

21 files changed

+82
-147
lines changed

NEWS.md

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

77
### ClimaCoupler features
88

9+
#### Postprocessing no longer uses `sim_mode` PR[#1153](https://github.com/CliMA/ClimaCoupler.jl/pull/1153)
10+
Postprocessing now consists of a single function that's used for all simulation
11+
modes. Note that now all available diagnostics will be plotted at the end of
12+
the simulation, where before we specified a subset to plot based on the
13+
simulation type.
14+
This PR also removes the `plot_diagnostics` config option. `use_coupler_diagnostics`
15+
should be used instead.
16+
917
#### PrescribedOceanSimulation added, includes SST update PR[#1144](https://github.com/CliMA/ClimaCoupler.jl/pull/1144)
1018
This PR is similar to #1141 below, but applies to SST rather than SIC.
1119
SST is now updated within `PrescribedOceanSimulation` methods, rather

config/ci_configs/slabplanet_atmos_diags.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
apply_limiter: false
2-
plot_diagnostics: true
32
dt: "200secs"
43
dt_cpl: "200secs"
54
dt_save_to_sol: "9days"

docs/src/diagnostics.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Once we have created a `ScheduledDiagnostic` for each variable we're interested
3939
we collect them in a vector and pass this to our `DiagnosticsHandler` object.
4040

4141
An example of this process for the variable `F_turb_energy` can be found in
42-
`experiments/ClimaEarth/user_io/amip_diagnostics.jl`.
42+
`experiments/ClimaEarth/user_io/coupler_diagnostics.jl`.
4343

4444
For more information about this process, please see the
4545
ClimaDiagnostics.jl [documentation](https://clima.github.io/ClimaDiagnostics.jl/dev/).

experiments/ClimaEarth/cli_options.jl

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,6 @@ function argparse_settings()
119119
help = "Directory to save output files. Note that TempestRemap fails if interactive and paths are too long. [\"experiments/ClimaEarth/output\" (default)]"
120120
arg_type = String
121121
default = "experiments/ClimaEarth/output"
122-
"--plot_diagnostics"
123-
help = "Boolean flag indicating whether to make plot diagnostics [`false` (default), `true`]"
124-
arg_type = Bool
125-
default = false
126122
# ClimaAtmos specific
127123
"--surface_setup"
128124
help = "Triggers ClimaAtmos into the coupled mode [`PrescribedSurface` (default), `DefaultMoninObukhov`]" # retained here for standalone Atmos benchmarks

experiments/ClimaEarth/run_amip.jl

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ add_extra_diagnostics!(config_dict)
131131
energy_check,
132132
conservation_softfail,
133133
output_dir_root,
134-
plot_diagnostics,
135134
) = get_coupler_args(config_dict)
136135

137136
#=
@@ -280,7 +279,6 @@ if sim_mode <: AMIPMode
280279
ocean_fraction = FT(1) .- ice_fraction .- land_fraction
281280
ocean_sim = PrescribedOceanSimulation(FT, boundary_space, date0, t_start, ocean_fraction, thermo_params, comms_ctx)
282281

283-
mode_specifics = (; type = sim_mode)
284282
Utilities.show_memory_usage()
285283

286284
elseif (sim_mode <: AbstractSlabplanetSimulationMode) && !(sim_mode <: SlabplanetEisenmanMode)
@@ -335,7 +333,6 @@ elseif (sim_mode <: AbstractSlabplanetSimulationMode) && !(sim_mode <: Slabplane
335333
thermo_params = thermo_params,
336334
))
337335

338-
mode_specifics = (; type = sim_mode)
339336
Utilities.show_memory_usage()
340337

341338
elseif sim_mode <: SlabplanetEisenmanMode
@@ -382,7 +379,6 @@ elseif sim_mode <: SlabplanetEisenmanMode
382379
thermo_params = thermo_params,
383380
)
384381

385-
mode_specifics = (; type = sim_mode)
386382
Utilities.show_memory_usage()
387383
end
388384

@@ -487,14 +483,14 @@ end
487483
#= Set up default AMIP diagnostics
488484
Use ClimaDiagnostics for default AMIP diagnostics, which currently include turbulent energy fluxes.
489485
=#
490-
if sim_mode <: AMIPMode && use_coupler_diagnostics
491-
include("user_io/amip_diagnostics.jl")
486+
if use_coupler_diagnostics
487+
@info "Using default coupler diagnostics"
488+
include("user_io/coupler_diagnostics.jl")
492489
coupler_diags_path = joinpath(dir_paths.output, "coupler")
493490
isdir(coupler_diags_path) || mkpath(coupler_diags_path)
494-
amip_diags_handler =
495-
amip_diagnostics_setup(coupler_fields, coupler_diags_path, dates.date0[1], tspan[1], calendar_dt)
491+
diags_handler = coupler_diagnostics_setup(coupler_fields, coupler_diags_path, dates.date0[1], tspan[1], calendar_dt)
496492
else
497-
amip_diags_handler = nothing
493+
diags_handler = nothing
498494
end
499495

500496
#=
@@ -515,12 +511,11 @@ cs = Interfacer.CoupledSimulation{FT}(
515511
[tspan[1], tspan[2]],
516512
Δt_cpl,
517513
model_sims,
518-
mode_specifics,
519514
callbacks,
520515
dir_paths,
521516
turbulent_fluxes,
522517
thermo_params,
523-
amip_diags_handler,
518+
diags_handler,
524519
);
525520
Utilities.show_memory_usage()
526521

@@ -659,8 +654,7 @@ function solve_coupler!(cs)
659654
## compute/output AMIP diagnostics if scheduled for this timestep
660655
## wrap the current CoupledSimulation fields and time in a NamedTuple to match the ClimaDiagnostics interface
661656
cs_nt = (; u = cs.fields, p = nothing, t = t, step = round(t / Δt_cpl))
662-
(cs.mode.type <: AMIPMode && !isnothing(cs.amip_diags_handler)) &&
663-
CD.orchestrate_diagnostics(cs_nt, cs.amip_diags_handler)
657+
!isnothing(cs.diags_handler) && CD.orchestrate_diagnostics(cs_nt, cs.diags_handler)
664658
end
665659
return nothing
666660
end
@@ -737,13 +731,6 @@ The postprocessing includes:
737731
=#
738732

739733
if ClimaComms.iamroot(comms_ctx)
740-
postprocessing_vars = (;
741-
plot_diagnostics,
742-
use_coupler_diagnostics,
743-
output_default_diagnostics,
744-
t_end,
745-
conservation_softfail,
746-
atmos_output_dir,
747-
)
748-
postprocess_sim(cs.mode.type, cs, postprocessing_vars)
734+
postprocessing_vars = (; use_coupler_diagnostics, output_default_diagnostics, t_end, conservation_softfail)
735+
postprocess_sim(cs, postprocessing_vars)
749736
end

experiments/ClimaEarth/run_cloudless_aquaplanet.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,12 +241,11 @@ cs = Interfacer.CoupledSimulation{FT}(
241241
[tspan[1], tspan[2]],
242242
Δt_cpl,
243243
model_sims,
244-
(;), # mode_specifics
245244
callbacks,
246245
dir_paths,
247246
turbulent_fluxes,
248247
thermo_params,
249-
nothing, # amip_diags_handler
248+
nothing, # diags_handler
250249
);
251250

252251
#=

experiments/ClimaEarth/run_cloudy_aquaplanet.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,12 +265,11 @@ cs = Interfacer.CoupledSimulation{FT}(
265265
[tspan[1], tspan[2]],
266266
Δt_cpl,
267267
model_sims,
268-
(;), # mode_specifics
269268
callbacks,
270269
dir_paths,
271270
turbulent_fluxes,
272271
thermo_params,
273-
nothing, # amip_diags_handler
272+
nothing, # diags_handler
274273
);
275274

276275
#=

experiments/ClimaEarth/run_cloudy_slabplanet.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,12 +301,11 @@ cs = Interfacer.CoupledSimulation{FT}(
301301
[tspan[1], tspan[2]],
302302
Δt_cpl,
303303
model_sims,
304-
(;), # mode_specifics
305304
callbacks,
306305
dir_paths,
307306
turbulent_fluxes,
308307
thermo_params,
309-
nothing, # amip_diags_handler
308+
nothing, # diags_handler
310309
);
311310

312311
#=

experiments/ClimaEarth/run_dry_held_suarez.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,12 +189,11 @@ cs = Interfacer.CoupledSimulation{FT}(
189189
[tspan[1], tspan[2]],
190190
Δt_cpl,
191191
model_sims,
192-
(;), # mode_specifics
193192
callbacks,
194193
dir_paths,
195194
nothing, # turbulent_fluxes
196195
thermo_params,
197-
nothing, # amip_diags_handler
196+
nothing, # diags_handler
198197
);
199198

200199
#=

experiments/ClimaEarth/run_moist_held_suarez.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,12 +239,11 @@ cs = Interfacer.CoupledSimulation{FT}(
239239
[tspan[1], tspan[2]],
240240
Δt_cpl,
241241
model_sims,
242-
(;), # mode_specifics
243242
callbacks,
244243
dir_paths,
245244
turbulent_fluxes,
246245
thermo_params,
247-
nothing, # amip_diags_handler
246+
nothing, # diags_handler
248247
);
249248

250249
#=

0 commit comments

Comments
 (0)