From d5980b905399e4b41791873486a9a1bbf2510f38 Mon Sep 17 00:00:00 2001 From: Julia Sloan Date: Mon, 12 Feb 2024 15:57:35 -0800 Subject: [PATCH] save state every dt --- experiments/AMIP/coupler_driver.jl | 51 +++++++++++++++--------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/experiments/AMIP/coupler_driver.jl b/experiments/AMIP/coupler_driver.jl index d8537cf6d6..76fa928836 100644 --- a/experiments/AMIP/coupler_driver.jl +++ b/experiments/AMIP/coupler_driver.jl @@ -607,32 +607,33 @@ function solve_coupler!(cs) ## step in time walltime = @elapsed for t in ((tspan[1] + Δt_cpl):Δt_cpl:tspan[end]) - # save states every day - if t % 86400 == 0 - date = date0 + Dates.Second(t) - - # atmos state - atmos_ρe_tot = cs.model_sims.atmos_sim.integrator.u.c.ρe_tot - atmos_ρq_tot = cs.model_sims.atmos_sim.integrator.u.c.ρq_tot - atmos_ρ = cs.model_sims.atmos_sim.integrator.u.c.ρ - atmos_uₕ = cs.model_sims.atmos_sim.integrator.u.c.uₕ - atmos_u₃ = cs.model_sims.atmos_sim.integrator.u.f.u₃ - Regridder.write_to_hdf5(COUPLER_ARTIFACTS_DIR, "atmos_ρe_tot", date, atmos_ρe_tot, "atmos_ρe_tot", comms_ctx) - Regridder.write_to_hdf5(COUPLER_ARTIFACTS_DIR, "atmos_ρq_tot", date, atmos_ρq_tot, "atmos_ρq_tot", comms_ctx) - - # land state - land_T = cs.model_sims.land_sim.integrator.u.bucket.T - land_W = cs.model_sims.land_sim.integrator.u.bucket.W - land_Ws = cs.model_sims.land_sim.integrator.u.bucket.Ws - land_σS = cs.model_sims.land_sim.integrator.u.bucket.σS - Regridder.write_to_hdf5(COUPLER_ARTIFACTS_DIR, "land_T", date, land_T, "land_T", comms_ctx) - Regridder.write_to_hdf5(COUPLER_ARTIFACTS_DIR, "land_W", date, land_W, "land_W", comms_ctx) - - # ocean state - ocean_T_sfc = cs.model_sims.ocean_sim.integrator.u.T_sfc - Regridder.write_to_hdf5(COUPLER_ARTIFACTS_DIR, "ocean_T_sfc", date, ocean_T_sfc, "ocean_T_sfc", comms_ctx) - end + # # save states every day + # if t % 86400 == 0 + # save state every timestep + date = date0 + Dates.Second(t) + + # atmos state + atmos_ρe_tot = cs.model_sims.atmos_sim.integrator.u.c.ρe_tot + atmos_ρq_tot = cs.model_sims.atmos_sim.integrator.u.c.ρq_tot + atmos_ρ = cs.model_sims.atmos_sim.integrator.u.c.ρ + atmos_uₕ = cs.model_sims.atmos_sim.integrator.u.c.uₕ + atmos_u₃ = cs.model_sims.atmos_sim.integrator.u.f.u₃ + Regridder.write_to_hdf5(COUPLER_ARTIFACTS_DIR, "atmos_ρe_tot", date, atmos_ρe_tot, "atmos_ρe_tot", comms_ctx) + Regridder.write_to_hdf5(COUPLER_ARTIFACTS_DIR, "atmos_ρq_tot", date, atmos_ρq_tot, "atmos_ρq_tot", comms_ctx) + + # land state + land_T = cs.model_sims.land_sim.integrator.u.bucket.T + land_W = cs.model_sims.land_sim.integrator.u.bucket.W + land_Ws = cs.model_sims.land_sim.integrator.u.bucket.Ws + land_σS = cs.model_sims.land_sim.integrator.u.bucket.σS + Regridder.write_to_hdf5(COUPLER_ARTIFACTS_DIR, "land_T", date, land_T, "land_T", comms_ctx) + Regridder.write_to_hdf5(COUPLER_ARTIFACTS_DIR, "land_W", date, land_W, "land_W", comms_ctx) + + # ocean state + ocean_T_sfc = cs.model_sims.ocean_sim.integrator.u.T_sfc + Regridder.write_to_hdf5(COUPLER_ARTIFACTS_DIR, "ocean_T_sfc", date, ocean_T_sfc, "ocean_T_sfc", comms_ctx) + # end cs.dates.date[1] = current_date(cs, t) # if not global, `date` is not updated.