Skip to content

Commit 6037cd0

Browse files
committed
add ice_model config arg
1 parent db01d63 commit 6037cd0

File tree

3 files changed

+35
-24
lines changed

3 files changed

+35
-24
lines changed

experiments/ClimaEarth/cli_options.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,11 @@ function argparse_settings()
175175
help = "Directory containing ERA5 initial condition files (subseasonal mode). Filenames inferred from start_date [none (default)]. Generated with `https://github.com/CliMA/WeatherQuest`"
176176
arg_type = String
177177
default = nothing
178+
# Ice model specific
179+
"--ice_model"
180+
help = "Sea ice model to use. [`prescribed` (default), `clima_seaice`]"
181+
arg_type = String
182+
default = "prescribed"
178183
end
179184
return s
180185
end

experiments/ClimaEarth/setup_run.jl

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -362,28 +362,24 @@ function CoupledSimulation(config_dict::AbstractDict)
362362

363363
# TODO separate drivers to clean this up
364364
## sea ice model
365-
ice_sim = PrescribedIceSimulation(
366-
FT;
367-
tspan = tspan,
368-
dt = component_dt_dict["dt_seaice"],
369-
saveat = saveat,
370-
space = boundary_space,
371-
thermo_params = thermo_params,
372-
comms_ctx,
373-
start_date,
374-
land_fraction,
375-
sic_path = subseasonal_sic,
376-
)
377-
378-
## ocean model
379-
ice_fraction = Interfacer.get_field(ice_sim, Val(:area_fraction))
380-
ocean_fraction = FT(1) .- ice_fraction .- land_fraction
381-
365+
if ice_model == "prescribed"
366+
ice_sim = PrescribedIceSimulation(
367+
FT;
368+
tspan = tspan,
369+
dt = component_dt_dict["dt_seaice"],
370+
saveat = saveat,
371+
space = boundary_space,
372+
thermo_params = thermo_params,
373+
comms_ctx,
374+
start_date,
375+
land_fraction,
376+
sic_path = subseasonal_sic,
377+
)
378+
ice_fraction = Interfacer.get_field(ice_sim, Val(:area_fraction))
379+
elseif ice_model == "clima_seaice"
380+
@assert sim_mode <: CMIPMode
382381

383-
if sim_mode <: CMIPMode
384-
########### TODO CLEAN UP ############
385382
# TODO how should we initialize ocean fraction when using ClimaSeaIce?
386-
# Set up prescribed sea ice concentration object
387383
sic_data = try
388384
joinpath(
389385
@clima_artifact("historical_sst_sic", comms_ctx),
@@ -409,10 +405,14 @@ function CoupledSimulation(config_dict::AbstractDict)
409405
# Get initial SIC values and use them to calculate ice fraction
410406
ice_fraction = CC.Fields.zeros(space)
411407
evaluate!(ice_fraction, SIC_timevaryinginput, tspan[1])
412-
########### TODO CLEAN UP ############
408+
else
409+
error("Invalid ice model specified: $(ice_model)")
410+
end
413411

414-
ocean_fraction = FT(1) .- ice_fraction .- land_fraction
412+
## ocean model
413+
ocean_fraction = FT(1) .- ice_fraction .- land_fraction
415414

415+
if sim_mode <: CMIPMode
416416
stop_date = date(tspan[end] - tspan[begin])
417417
ocean_sim = OceananigansSimulation(
418418
ocean_fraction,
@@ -422,8 +422,9 @@ function CoupledSimulation(config_dict::AbstractDict)
422422
comms_ctx,
423423
)
424424

425-
ice_sim = ClimaSeaIceSimulation(ice_fraction, ocean_sim; output_dir)
426-
425+
if ice_model == "clima_seaice"
426+
ice_sim = ClimaSeaIceSimulation(ice_fraction, ocean_sim; output_dir)
427+
end
427428
else
428429
ocean_sim = PrescribedOceanSimulation(
429430
FT,

experiments/ClimaEarth/user_io/arg_parsing.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,12 @@ function get_coupler_args(config_dict::Dict)
170170
bucket_albedo_type = config_dict["bucket_albedo_type"]
171171
bucket_initial_condition = config_dict["bucket_initial_condition"]
172172

173+
# Initial condition setting
173174
era5_initial_condition_dir = config_dict["era5_initial_condition_dir"]
174175

176+
# Ice model-specific information
177+
ice_model = config_dict["ice_model"]
178+
175179
return (;
176180
job_id,
177181
sim_mode,
@@ -203,6 +207,7 @@ function get_coupler_args(config_dict::Dict)
203207
bucket_initial_condition,
204208
parameter_files,
205209
era5_initial_condition_dir,
210+
ice_model,
206211
)
207212
end
208213

0 commit comments

Comments
 (0)