diff --git a/config/ci_configs/interactive_debug.yml b/config/ci_configs/interactive_debug.yml deleted file mode 100644 index ba37db2dbf..0000000000 --- a/config/ci_configs/interactive_debug.yml +++ /dev/null @@ -1,20 +0,0 @@ -anim: true -apply_limiter: false -coupler_output_dir: "experiments/ClimaEarth/output" -dt: "200secs" -dt_cpl: 200 -dt_save_to_sol: "10days" -energy_check: true -evolving_ocean: true -h_elem: 4 -land_albedo_type: "function" -mode_name: "slabplanet" -moist: "equil" -mono_surface: true -precip_model: "0M" -rad: "gray" -start_date: "20100101" -surface_setup: "PrescribedSurface" -t_end: "20days" -turb_flux_partition: "CombinedStateFluxesMOST" -vert_diff: "true" diff --git a/experiments/ClimaEarth/Manifest.toml b/experiments/ClimaEarth/Manifest.toml index 750c0737df..924953c8ed 100644 --- a/experiments/ClimaEarth/Manifest.toml +++ b/experiments/ClimaEarth/Manifest.toml @@ -2,7 +2,7 @@ julia_version = "1.10.5" manifest_format = "2.0" -project_hash = "3f041ae318abcda7361d1017b4769284277fd054" +project_hash = "068d169322176676d4a2ff1e87cafb47cc58b76b" [[deps.ADTypes]] git-tree-sha1 = "5a5eafb8344b81b8c2237f8a6f6b3602b3f6180e" @@ -334,16 +334,16 @@ uuid = "d934ef94-cdd4-4710-83d6-720549644b70" version = "0.3.17" [[deps.ClimaCoupler]] -deps = ["ClimaComms", "ClimaCore", "ClimaCoreTempestRemap", "Dates", "JLD2", "NCDatasets", "SciMLBase", "StaticArrays", "SurfaceFluxes", "Thermodynamics"] +deps = ["Artifacts", "ClimaComms", "ClimaCore", "ClimaCoreTempestRemap", "Dates", "JLD2", "Logging", "NCDatasets", "SciMLBase", "StaticArrays", "SurfaceFluxes", "Thermodynamics"] path = "../.." uuid = "4ade58fe-a8da-486c-bd89-46df092ec0c7" version = "0.1.1" [[deps.ClimaDiagnostics]] deps = ["Accessors", "ClimaComms", "ClimaCore", "Dates", "NCDatasets", "SciMLBase"] -git-tree-sha1 = "9526b91533254b043e860e17568555d21d1d041e" +git-tree-sha1 = "ae8854e55028856675294f744ca7a6a3a3bd75bc" uuid = "1ecacbb8-0713-4841-9a07-eb5aa8a2d53f" -version = "0.2.6" +version = "0.2.7" [[deps.ClimaLand]] deps = ["ArtifactWrappers", "ClimaComms", "ClimaCore", "ClimaDiagnostics", "ClimaUtilities", "Dates", "DocStringExtensions", "Insolation", "Interpolations", "LazyArtifacts", "LinearAlgebra", "NCDatasets", "SciMLBase", "StaticArrays", "SurfaceFluxes", "Thermodynamics"] diff --git a/experiments/ClimaEarth/Project.toml b/experiments/ClimaEarth/Project.toml index 6bf7bcdaf7..e24d760d42 100644 --- a/experiments/ClimaEarth/Project.toml +++ b/experiments/ClimaEarth/Project.toml @@ -9,6 +9,7 @@ ClimaComms = "3a4d1b5c-c61d-41fd-a00a-5873ba7a1b0d" ClimaCore = "d414da3d-4745-48bb-8d80-42e94e092884" ClimaCorePlots = "cf7c7e5a-b407-4c48-9047-11a94a308626" ClimaCoupler = "4ade58fe-a8da-486c-bd89-46df092ec0c7" +ClimaDiagnostics = "1ecacbb8-0713-4841-9a07-eb5aa8a2d53f" ClimaLand = "08f4d4ce-cf43-44bb-ad95-9d2d5f413532" ClimaParams = "5c42b081-d73a-476f-9059-fd94b934656c" ClimaTimeSteppers = "595c0a79-7f3d-439a-bc5a-b232dc3bde79" diff --git a/experiments/ClimaEarth/components/land/climaland_bucket.jl b/experiments/ClimaEarth/components/land/climaland_bucket.jl index ecb3ceed2e..a82da45dc9 100644 --- a/experiments/ClimaEarth/components/land/climaland_bucket.jl +++ b/experiments/ClimaEarth/components/land/climaland_bucket.jl @@ -7,6 +7,7 @@ import ClimaParams import Thermodynamics as TD import ClimaLand as CL import ClimaLand.Parameters as LP +import ClimaDiagnostics as CD import ClimaCoupler: Checkpointer, FluxCalculator, Interfacer ### @@ -69,6 +70,9 @@ function bucket_init( @assert config == "sphere" end + regrid_dirpath = dir_paths.regrid + artifacts_dir = dir_paths.artifacts + α_snow = FT(0.8) # snow albedo if albedo_type == "map_static" # Read in albedo from static data file (default type) # By default, this uses a file containing bareground albedo without a time component. Snow albedo is specified separately. @@ -136,7 +140,23 @@ function bucket_init( ode_algo = CTS.ExplicitAlgorithm(stepper) bucket_ode_function = CTS.ClimaODEFunction(T_exp! = exp_tendency!, dss! = CL.dss!) prob = SciMLBase.ODEProblem(bucket_ode_function, Y, tspan, p) - integrator = SciMLBase.init(prob, ode_algo; dt = dt, saveat = saveat, adaptive = false) + + # Add diagnostics + netcdf_writer = CD.Writers.NetCDFWriter(space, artifacts_dir) + scheduled_diagnostics = CL.default_diagnostics(model, date_ref, output_writer = netcdf_writer) + + diagnostic_handler = CD.DiagnosticsHandler(scheduled_diagnostics, Y, p, t_start; dt = dt) + diag_cb = CD.DiagnosticsCallback(diagnostic_handler) + # TODO: after CD update, can use `integrator = CD.IntegratorWithDiagnostics(integrator, scheduled_diagnostics, state_name = :Y)` + + integrator = SciMLBase.init( + prob, + ode_algo; + dt = dt, + saveat = saveat, + adaptive = false, + callback = SciMLBase.CallbackSet(diag_cb), + ) sim = BucketSimulation(model, Y, (; domain = domain, soil_depth = d_soil), integrator, area_fraction) diff --git a/experiments/ClimaEarth/run_amip.jl b/experiments/ClimaEarth/run_amip.jl index 209de995cb..0fa3a49885 100644 --- a/experiments/ClimaEarth/run_amip.jl +++ b/experiments/ClimaEarth/run_amip.jl @@ -268,7 +268,7 @@ if mode_name == "amip" config_dict["land_domain_type"], config_dict["land_albedo_type"], config_dict["land_temperature_anomaly"], - dir_paths.regrid; + dir_paths; dt = Δt_cpl, space = boundary_space, saveat = saveat,