@@ -140,9 +140,9 @@ parsed_args = parse_commandline(argparse_settings())
140
140
141
141
# # setup coupler and model configurations
142
142
# modify parsed args for fast testing from REPL #hide
143
+ include (" user_io/debug_plots.jl" )
143
144
pkg_dir = pkgdir (ClimaCoupler)
144
145
if isinteractive ()
145
- include (" user_io/debug_plots.jl" )
146
146
parsed_args[" config_file" ] =
147
147
isnothing (parsed_args[" config_file" ]) ? joinpath (pkg_dir, " config/model_configs/interactive_debug.yml" ) :
148
148
parsed_args[" config_file" ]
@@ -165,10 +165,11 @@ run_name = config_dict["run_name"]
165
165
energy_check = config_dict[" energy_check" ]
166
166
const FT = config_dict[" FLOAT_TYPE" ] == " Float64" ? Float64 : Float32
167
167
land_sim_name = " bucket"
168
- t_end = Float64 (time_to_seconds (config_dict[" t_end" ]))
168
+ # t_end = Float64(time_to_seconds(config_dict["t_end"]))
169
169
t_start = 0.0
170
- tspan = (t_start, t_end)
171
170
Δt_cpl = Float64 (config_dict[" dt_cpl" ])
171
+ t_end = Δt_cpl
172
+ tspan = (t_start, t_end)
172
173
saveat = Float64 (time_to_seconds (config_dict[" dt_save_to_sol" ]))
173
174
date0 = date = DateTime (config_dict[" start_date" ], dateformat " yyyymmdd" )
174
175
mono_surface = config_dict[" mono_surface" ]
@@ -194,6 +195,9 @@ isdir(COUPLER_ARTIFACTS_DIR) ? nothing : mkpath(COUPLER_ARTIFACTS_DIR)
194
195
@info COUPLER_OUTPUT_DIR
195
196
config_dict[" print_config_dict" ] ? @info (config_dict) : nothing
196
197
198
+ debug_dir = joinpath (COUPLER_ARTIFACTS_DIR, " debug_output/" )
199
+ isdir (debug_dir) ? nothing : mkpath (debug_dir)
200
+
197
201
# get the paths to the necessary data files: land-sea mask, sst map, sea ice concentration
198
202
include (joinpath (pkgdir (ClimaCoupler), " artifacts" , " artifact_funcs.jl" ))
199
203
sst_data = joinpath (sst_dataset_path (), " sst.nc" )
@@ -534,6 +538,8 @@ cs = CoupledSimulation{FT}(
534
538
dir_paths,
535
539
);
536
540
541
+ debug (cs, debug_dir * " 0_initialized_cs" )
542
+
537
543
#=
538
544
## Restart component model states if specified
539
545
=#
@@ -563,12 +569,16 @@ import_combined_surface_fields!(cs.fields, cs.model_sims, cs.boundary_space, tur
563
569
import_atmos_fields! (cs. fields, cs. model_sims, cs. boundary_space, turbulent_fluxes)
564
570
update_model_sims! (cs. model_sims, cs. fields, turbulent_fluxes)
565
571
572
+ debug (cs, " debug_output/1_init_exchange_cs" )
573
+
566
574
# 2) each surface component model calculates its own vapor specific humidity (q_sfc)
567
575
# TODO : the q_sfc calculation follows the design of the bucket q_sfc, but it would be neater to abstract this from step!
568
576
step! (land_sim, Δt_cpl)
569
577
step! (ocean_sim, Δt_cpl)
570
578
step! (ice_sim, Δt_cpl)
571
579
580
+ debug (cs, " debug_output/2_step_sfc_models" )
581
+
572
582
# 3) coupler re-imports updated surface fields and calculates turbulent fluxes, while updating atmos sfc_conditions
573
583
if turbulent_fluxes isa CombinedStateFluxes
574
584
# calculate fluxes using combined surface states on the atmos grid
@@ -585,16 +595,22 @@ elseif turbulent_fluxes isa PartitionedStateFluxes
585
595
atmos_sim. integrator. p. precomputed. sfc_conditions .= new_p. precomputed. sfc_conditions
586
596
end
587
597
598
+ debug (cs, " debug_output/3_init_flux_calc" )
599
+
588
600
# 4) given the new sfc_conditions, atmos calls the radiative flux callback
589
601
reinit_model_sims! (cs. model_sims) # NB: for atmos this sets a nonzero radiation flux
590
602
603
+ debug (cs, " debug_output/4_reinit" )
604
+
591
605
# 5) coupler re-imports updated atmos fluxes (radiative fluxes for both `turbulent_fluxes` types
592
606
# and also turbulent fluxes if `turbulent_fluxes isa CombinedStateFluxes`,
593
607
# and sends them to the surface component models. If `turbulent_fluxes isa PartitionedStateFluxes`
594
608
# atmos receives the turbulent fluxes from the coupler.
595
609
import_atmos_fields! (cs. fields, cs. model_sims, cs. boundary_space, turbulent_fluxes)
596
610
update_model_sims! (cs. model_sims, cs. fields, turbulent_fluxes)
597
611
612
+ debug (cs, " debug_output/5_import_atmos_fluxes" )
613
+
598
614
#=
599
615
## Coupling Loop
600
616
=#
@@ -720,6 +736,7 @@ end #hide
720
736
# # run the coupled simulation
721
737
solve_coupler! (cs);
722
738
739
+ debug (cs, " debug_output/6_after_solve" )
723
740
#=
724
741
## Postprocessing
725
742
Currently all postprocessing is performed using the root process only.
0 commit comments