diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index b73f2b7700..90e5ae88c0 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -251,6 +251,17 @@ steps: slurm_ntasks: 1 slurm_mem: 20GB + - label: "AMIP - modular Float64 + monthly checkpoint + co2" + key: "coarse_single_modular_ft64_monthly_checkpoints_co2" + command: "julia --color=yes --project=experiments/AMIP/modular/ experiments/AMIP/modular/coupler_driver_modular.jl --config_file $CONFIG_PATH/coarse_single_modular_ft64_monthly_checkpoints_co2.yml" + artifact_paths: "experiments/AMIP/modular/output/amip/coarse_single_modular_ft64_monthly_checkpoints_co2_artifacts/*" + env: + FLAME_PLOT: "" + BUILD_HISTORY_HANDLE: "" + agents: + slurm_ntasks: 1 + slurm_mem: 20GB + - label: "AMIP - modular, Float64 test" command: "julia --color=yes --project=experiments/AMIP/modular/ experiments/AMIP/modular/coupler_driver_modular.jl --config_file $CONFIG_PATH/coarse_single_modular_ft64.yml" artifact_paths: "experiments/AMIP/modular/output/amip/coarse_single_modular_ft64_artifacts/*" diff --git a/artifacts/Artifacts.toml b/artifacts/Artifacts.toml index 3b83c4abe9..21dbee67cd 100644 --- a/artifacts/Artifacts.toml +++ b/artifacts/Artifacts.toml @@ -1,3 +1,6 @@ +[co2] +git-tree-sha1 = "0c6039bfcc39f6c6cb20fb331a71f6a381d93f24" + [land_mask] git-tree-sha1 = "e41bc8c44124f867b64a9d70f1599515ae27f38a" diff --git a/artifacts/artifact_funcs.jl b/artifacts/artifact_funcs.jl index d95989b8f2..9d5d3d58f4 100644 --- a/artifacts/artifact_funcs.jl +++ b/artifacts/artifact_funcs.jl @@ -24,6 +24,18 @@ function sic_dataset_path() return AW.get_data_folder(sic_dataset) end +function co2_dataset_path() + co2_dataset = AW.ArtifactWrapper( + @__DIR__, + "co2", + AW.ArtifactFile[AW.ArtifactFile( + url = "https://caltech.box.com/shared/static/xg028wnsn57wam6euwrh98fe43ibei8g.nc", + filename = "mauna_loa_co2.nc", + ),], + ) + return AW.get_data_folder(co2_dataset) +end + function mask_dataset_path() mask_dataset = AW.ArtifactWrapper( @__DIR__, diff --git a/artifacts/download_artifacts.jl b/artifacts/download_artifacts.jl index ef83a52314..aa69917cc5 100644 --- a/artifacts/download_artifacts.jl +++ b/artifacts/download_artifacts.jl @@ -4,6 +4,7 @@ include(joinpath(@__DIR__, "artifact_funcs.jl")) function trigger_download() @info "sst dataset path: `$(sst_dataset_path())`" @info "sic dataset path: `$(sic_dataset_path())`" + @info "co2 dataset path: `$(co2_dataset_path())`" @info "mask dataset path: `$(mask_dataset_path())`" return nothing end diff --git a/config/model_configs/coarse_single_modular_ft64_monthly_checkpoints_co2.yml b/config/model_configs/coarse_single_modular_ft64_monthly_checkpoints_co2.yml new file mode 100644 index 0000000000..dd5270a4d5 --- /dev/null +++ b/config/model_configs/coarse_single_modular_ft64_monthly_checkpoints_co2.yml @@ -0,0 +1,18 @@ +run_name: "coarse_single_modular_ft64_monthly_checkpoints_co2" +monthly_checkpoint: true +moist: "equil" +vert_diff: "true" +rad: "allskywithclear" +energy_check: false +mode_name: "amip" +anim: true +t_end: "32days" +dt_save_to_sol: "1days" +dt_cpl: 400 +dt: "400secs" +mono_surface: false +h_elem: 6 +dt_save_restart: "10days" +precip_model: "0M" +apply_limiter: false +job_id: "coarse_single_modular_ft64_monthly_checkpoints_co2" diff --git a/config/model_configs/interactive_debug.yml b/config/model_configs/interactive_debug.yml index bd2d4df0e4..fd4761e497 100644 --- a/config/model_configs/interactive_debug.yml +++ b/config/model_configs/interactive_debug.yml @@ -1,6 +1,6 @@ moist: "equil" vert_diff: "true" -rad: "gray" +rad: "allskywithclear" energy_check: true mode_name: "slabplanet" t_end: "10days" diff --git a/experiments/AMIP/modular/components/atmosphere/climaatmos_init.jl b/experiments/AMIP/modular/components/atmosphere/climaatmos_init.jl index 967176e957..08768a8dab 100644 --- a/experiments/AMIP/modular/components/atmosphere/climaatmos_init.jl +++ b/experiments/AMIP/modular/components/atmosphere/climaatmos_init.jl @@ -107,6 +107,14 @@ get_field(sim::ClimaAtmosSimulation, ::Val{:gas_constant_air}) = get_surface_params(sim::ClimaAtmosSimulation) = CAP.surface_fluxes_params(sim.integrator.p.params) +function update_field!(atmos_sim::ClimaAtmosSimulation, ::Val{:co2_gm}, field) + if atmos_sim.integrator.p.radiation_model.radiation_mode isa CA.RRTMGPI.GrayRadiation + @warn "Gray radiation model initialized, skipping CO2 update" + return + else + atmos_sim.integrator.p.radiation_model.volume_mixing_ratio_co2 .= parent(field)[1] + end +end # extensions required by the Interfacer function update_field!(sim::ClimaAtmosSimulation, ::Val{:surface_temperature}, csf) sim.integrator.p.radiation_model.surface_temperature .= RRTMGPI.field2array(csf.T_S) diff --git a/experiments/AMIP/modular/coupler_driver_modular.jl b/experiments/AMIP/modular/coupler_driver_modular.jl index b9363dae88..b1774adeca 100644 --- a/experiments/AMIP/modular/coupler_driver_modular.jl +++ b/experiments/AMIP/modular/coupler_driver_modular.jl @@ -181,6 +181,7 @@ config_dict["print_config_dict"] ? @info(config_dict) : nothing include(joinpath(pkgdir(ClimaCoupler), "artifacts", "artifact_funcs.jl")) sst_data = joinpath(sst_dataset_path(), "sst.nc") sic_data = joinpath(sic_dataset_path(), "sic.nc") +co2_data = joinpath(co2_dataset_path(), "mauna_loa_co2.nc") land_mask_data = joinpath(mask_dataset_path(), "seamask.nc") #= @@ -293,7 +294,26 @@ if mode_name == "amip" area_fraction = ice_fraction, thermo_params = thermo_params, ) - mode_specifics = (; name = mode_name, SST_info = SST_info, SIC_info = SIC_info) + + ## CO2 concentration + CO2_info = bcfile_info_init( + FT, + REGRID_DIR, + co2_data, + "co2", + boundary_space, + comms_ctx, + interpolate_daily = true, + land_fraction = ones(boundary_space), + date0 = date0, + mono = mono_surface, + ) + + update_midmonth_data!(date0, CO2_info) + CO2_init = interpolate_midmonth_to_daily(date0, CO2_info) + update_field!(atmos_sim, Val(:co2_gm), CO2_init) + + mode_specifics = (; name = mode_name, SST_info = SST_info, SIC_info = SIC_info, CO2_info = CO2_info) elseif mode_name == "slabplanet" ## ocean @@ -518,7 +538,7 @@ function solve_coupler!(cs) if cs.mode.name == "amip" - ## monthly read of boundary condition data for SST and SIC + ## monthly read of boundary condition data for SST and SIC and CO2 if cs.dates.date[1] >= next_date_in_file(cs.mode.SST_info) update_midmonth_data!(cs.dates.date[1], cs.mode.SST_info) end @@ -532,6 +552,12 @@ function solve_coupler!(cs) get_ice_fraction.(interpolate_midmonth_to_daily(cs.dates.date[1], cs.mode.SIC_info), mono_surface) update_field!(ice_sim, Val(:area_fraction), SIC_current) + if cs.dates.date[1] >= next_date_in_file(cs.mode.CO2_info) + update_midmonth_data!(cs.dates.date[1], cs.mode.CO2_info) + end + CO2_current = interpolate_midmonth_to_daily(date0, CO2_info) + update_field!(atmos_sim, Val(:co2_gm), CO2_current) + ## calculate and accumulate diagnostics at each timestep ClimaComms.barrier(comms_ctx) accumulate_diagnostics!(cs)