Skip to content

Commit

Permalink
Remove CO2 from AMIP driver
Browse files Browse the repository at this point in the history
CO2 is read in Atmos: CliMA/ClimaAtmos.jl#3522
  • Loading branch information
Sbozzolo committed Jan 30, 2025
1 parent 6754103 commit ad27a88
Show file tree
Hide file tree
Showing 20 changed files with 19 additions and 24 deletions.
1 change: 1 addition & 0 deletions config/amip_configs/amip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ FLOAT_TYPE: "Float32"
albedo_model: "CouplerAlbedo"
atmos_config_file: "config/longrun_configs/amip_target_diagedmf.yml"
checkpoint_dt: "720hours"
co2: "maunaloa"
coupler_toml: ["toml/amip.toml"]
dt: "120secs"
dt_cpl: "120secs"
Expand Down
1 change: 1 addition & 0 deletions config/benchmark_configs/amip_diagedmf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ FLOAT_TYPE: "Float32"
aerosol_radiation: true
atmos_config_file: "config/benchmark_configs/climaatmos_diagedmf.yml"
atmos_config_repo: "ClimaCoupler"
co2: "maunaloa"
dt: "120secs"
dt_cpl: "120secs"
dt_save_state_to_disk: "Inf"
Expand Down
1 change: 1 addition & 0 deletions config/benchmark_configs/amip_diagedmf_io.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ FLOAT_TYPE: "Float32"
aerosol_radiation: true
atmos_config_file: "config/benchmark_configs/climaatmos_diagedmf_io.yml"
atmos_config_repo: "ClimaCoupler"
co2: "maunaloa"
dt: "120secs"
dt_cpl: "120secs"
dt_save_state_to_disk: "12hours"
Expand Down
1 change: 1 addition & 0 deletions config/benchmark_configs/climaatmos.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
FLOAT_TYPE: "Float32"
aerosol_radiation: true
approximate_linear_solve_iters: 2
co2: "maunaloa"
dt: 120secs
dt_cloud_fraction: 1hours
dt_rad: 1hours
Expand Down
1 change: 1 addition & 0 deletions config/benchmark_configs/climaatmos_diagedmf.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
FLOAT_TYPE: "Float32"
aerosol_radiation: true
approximate_linear_solve_iters: 2
co2: "maunaloa"
dt: 120secs
dt_cloud_fraction: 1hours
dt_rad: 1hours
Expand Down
1 change: 1 addition & 0 deletions config/benchmark_configs/climaatmos_diagedmf_io.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
FLOAT_TYPE: "Float32"
approximate_linear_solve_iters: 2
co2: "maunaloa"
dt: 120secs
dt_cloud_fraction: 1hours
dt_rad: 1hours
Expand Down
1 change: 1 addition & 0 deletions config/ci_configs/amip_albedo_temporal_map.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
apply_limiter: false
co2: "maunaloa"
dt: "150secs"
dt_cpl: "150secs"
dt_rad: "1hours"
Expand Down
1 change: 1 addition & 0 deletions config/ci_configs/amip_albedo_temporal_map_1M.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
apply_limiter: false
co2: "maunaloa"
dt: "150secs"
dt_cpl: "150secs"
dt_rad: "1hours"
Expand Down
1 change: 1 addition & 0 deletions config/ci_configs/amip_bucket_ic.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
apply_limiter: false
co2: "maunaloa"
dt: "150secs"
dt_cpl: "150secs"
dt_rad: "1hours"
Expand Down
1 change: 1 addition & 0 deletions config/ci_configs/amip_coarse_ft32.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
FLOAT_TYPE: "Float32"
apply_limiter: false
co2: "maunaloa"
dt_save_to_sol: "100days"
energy_check: false
h_elem: 6
Expand Down
1 change: 1 addition & 0 deletions config/ci_configs/amip_coarse_ft64_hourly_checkpoints.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
apply_limiter: false
co2: "maunaloa"
dt_save_to_sol: "1days"
energy_check: false
h_elem: 6
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
apply_limiter: false
co2: "maunaloa"
checkpoint_dt: "1hours"
dt_save_restart: "10days"
dt_save_to_sol: "1days"
Expand Down
1 change: 1 addition & 0 deletions config/ci_configs/amip_coarse_mpi.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
apply_limiter: false
co2: "maunaloa"
dt_save_to_sol: "1days"
energy_check: false
h_elem: 6
Expand Down
1 change: 1 addition & 0 deletions config/ci_configs/amip_component_dts.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
apply_limiter: false
co2: "maunaloa"
dt_atmos: "150secs"
dt_cpl: "150secs"
dt_land: "50secs"
Expand Down
1 change: 1 addition & 0 deletions config/ci_configs/amip_default.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
apply_limiter: false
co2: "maunaloa"
dt: "150secs"
dt_cpl: "150secs"
dt_rad: "1hours"
Expand Down
1 change: 1 addition & 0 deletions config/ci_configs/amip_n1_shortrun.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
apply_limiter: false
co2: "maunaloa"
dt: "150secs"
dt_cpl: "150secs"
dt_rad: "1hours"
Expand Down
1 change: 1 addition & 0 deletions config/ci_configs/amip_target_topo_diagedmf_shortrun.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
FLOAT_TYPE: "Float32"
apply_limiter: false
atmos_config_file: "config/longrun_configs/longrun_aquaplanet_allsky_diagedmf_0M.yml"
co2: "maunaloa"
dt: "100secs"
dt_cloud_fraction: "1hours"
dt_cpl: "100secs"
Expand Down
1 change: 1 addition & 0 deletions config/longrun_configs/amip_target.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
FLOAT_TYPE: "Float32"
aerosol_radiation: true
atmos_config_file: "config/longrun_configs/longrun_aquaplanet_allsky_0M.yml"
co2: "maunaloa"
dt: "120secs"
dt_cloud_fraction: "1hours"
dt_cpl: "120secs"
Expand Down
1 change: 1 addition & 0 deletions config/longrun_configs/amip_target_topo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ FLOAT_TYPE: "Float32"
aerosol_radiation: true
albedo_model: "CouplerAlbedo"
atmos_config_file: "config/longrun_configs/longrun_aquaplanet_allsky_0M_earth.yml"
co2: "maunaloa"
dt: "120secs"
dt_cloud_fraction: "1hours"
dt_cpl: "120secs"
Expand Down
24 changes: 0 additions & 24 deletions experiments/ClimaEarth/run_amip.jl
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ tspan = (t_start, t_end)
#=
## Data File Paths
=#
co2_data = joinpath(@clima_artifact("co2_dataset", comms_ctx), "co2_mm_mlo.txt")
land_mask_data = joinpath(@clima_artifact("landsea_mask_60arcseconds", comms_ctx), "landsea_mask.nc")

#=
Expand Down Expand Up @@ -281,22 +280,6 @@ if sim_mode <: AMIPMode
ocean_fraction = FT(1) .- ice_fraction .- land_fraction
ocean_sim = PrescribedOceanSimulation(FT, boundary_space, date0, t_start, ocean_fraction, thermo_params, comms_ctx)

## CO2 concentration from temporally varying file
CO2_text = DelimitedFiles.readdlm(co2_data, Float64; comments = true)
# The text file only has month and year, so we set the day to 15th of the month
years = CO2_text[:, 1]
months = CO2_text[:, 2]
CO2_dates = Dates.DateTime.(years, months) + Dates.Day(14)
CO2_times = period_to_seconds_float.(CO2_dates .- date0)
# convert from ppm to fraction, data is in fourth column of the text file
CO2_vals = CO2_text[:, 4] .* 10^(-6)
CO2_timevaryinginput = TimeVaryingInput(CO2_times, CO2_vals;)

CO2_init = zeros(boundary_space)
evaluate!(CO2_init, CO2_timevaryinginput, t_start)
CO2_field = Interfacer.update_field!(atmos_sim, Val(:co2), CO2_init)

mode_specifics = (; type = sim_mode, CO2_timevaryinginput = CO2_timevaryinginput)
Utilities.show_memory_usage()

elseif (sim_mode <: AbstractSlabplanetSimulationMode) && !(sim_mode <: SlabplanetEisenmanMode)
Expand Down Expand Up @@ -629,13 +612,6 @@ function solve_coupler!(cs)
# Update date
cs.dates.date[] = TimeManager.current_date(cs, t)

if cs.mode.type <: AMIPMode
# TODO: get_field with :co2 is not implemented, so this is a little awkward
current_CO2 = zeros(boundary_space)
evaluate!(current_CO2, cs.mode.CO2_timevaryinginput, t)
Interfacer.update_field!(atmos_sim, Val(:co2), current_CO2)
end

## compute global energy and water conservation checks
## (only for slabplanet if tracking conservation is enabled)
!isnothing(cs.conservation_checks) && ConservationChecker.check_conservation!(cs)
Expand Down

0 comments on commit ad27a88

Please sign in to comment.