@@ -307,16 +307,6 @@ function CoupledSimulation(config_dict::AbstractDict)
307307 # Determine whether to use a shared surface space
308308 shared_surface_space = share_surface_space ? boundary_space : nothing
309309 if land_model == " bucket"
310-
311- # TODO move this into resolve_area_fractions and call after init, think about restarts
312- polar_mask = CC. Fields. zeros (boundary_space)
313- lat = CC. Fields. coordinate_field (boundary_space). lat
314- polar_mask .= abs .(lat) .>= FT (80 )
315-
316- # Set land fraction to 1 where polar_mask is 1
317- @. land_fraction = ifelse .(polar_mask == FT (1 ), FT (1 ), land_fraction)
318-
319-
320310 land_sim = BucketSimulation (
321311 FT;
322312 dt = component_dt_dict[" dt_land" ],
@@ -355,97 +345,51 @@ function CoupledSimulation(config_dict::AbstractDict)
355345 error (" Invalid land model specified: $(land_model) " )
356346 end
357347
358- # TODO separate drivers to clean this up
359- # # sea ice model
360- if ice_model == " prescribed"
361- ice_sim = PrescribedIceSimulation (
362- FT;
363- tspan = tspan,
364- dt = component_dt_dict[" dt_seaice" ],
365- saveat = saveat,
366- space = boundary_space,
367- thermo_params = thermo_params,
368- comms_ctx,
369- start_date,
370- land_fraction,
371- sic_path = subseasonal_sic,
372- )
373- ice_fraction = Interfacer. get_field (ice_sim, Val (:area_fraction ))
374- elseif ice_model == " clima_seaice"
375- @assert sim_mode <: CMIPMode
376-
377- # TODO how should we initialize ocean fraction when using ClimaSeaIce?
378- # TODO init everything with AF=1, then resolve after getting sea ice
379- sic_data = try
380- joinpath (
381- @clima_artifact (" historical_sst_sic" , comms_ctx),
382- " MODEL.ICE.HAD187001-198110.OI198111-202206.nc" ,
383- )
384- catch error
385- @warn " Using lowres SIC. If you want the higher resolution version, you have to obtain it from ClimaArtifacts"
386- joinpath (
387- @clima_artifact (" historical_sst_sic_lowres" , comms_ctx),
388- " MODEL.ICE.HAD187001-198110.OI198111-202206_lowres.nc" ,
389- )
390- end
391- @info " Using initial condition prescribed SIC file: " sic_data
392-
393- SIC_timevaryinginput = TimeVaryingInput (
394- sic_data,
395- " SEAICE" ,
396- boundary_space,
397- reference_date = start_date,
398- file_reader_kwargs = (; preprocess_func = (data) -> data / 100 ,), # # convert to fraction
399- )
400-
401- # Get initial SIC values and use them to calculate ice fraction
402- ice_fraction = CC. Fields. zeros (boundary_space)
403- evaluate! (ice_fraction, SIC_timevaryinginput, tspan[1 ])
404- else
405- error (" Invalid ice model specified: $(ice_model) " )
406- end
407-
408- # # ocean model using prescribed data
409- ice_fraction = Interfacer. get_field (ice_sim, Val (:area_fraction ))
410- ocean_fraction = FT (1 ) .- ice_fraction .- land_fraction
411-
348+ # # ocean model
412349 if sim_mode <: CMIPMode
413350 stop_date = date (tspan[end ] - tspan[begin ])
414351 ocean_sim = OceananigansSimulation (
415- ocean_fraction ,
352+ boundary_space ,
416353 start_date,
417354 stop_date;
418355 output_dir = dir_paths. ocean_output_dir,
419356 comms_ctx,
420357 )
421-
422- if ice_model == " clima_seaice"
423- ice_sim = ClimaSeaIceSimulation (
424- ice_fraction,
425- ocean_sim;
426- output_dir = dir_paths. ice_output_dir,
427- start_date,
428- )
429- # TODO don't need to initialize ocean fraction correctly if we do this
430- # TODO can rename to `resolve_area_fractions!` and also make land_fraction cover poles here instead of in driver
431- FieldExchanger. resolve_ocean_ice_fractions! (
432- ocean_sim,
433- ice_sim,
434- land_fraction,
435- )
436- end
437358 else
438359 ocean_sim = PrescribedOceanSimulation (
439360 FT,
440361 boundary_space,
441362 start_date,
442363 t_start,
443- ocean_fraction,
444364 thermo_params,
445365 comms_ctx;
446366 sst_path = subseasonal_sst,
447367 )
448368 end
369+ # # sea ice model
370+ if ice_model == " clima_seaice"
371+ ice_sim = ClimaSeaIceSimulation (
372+ ice_fraction,
373+ ocean_sim;
374+ output_dir = dir_paths. ice_output_dir,
375+ start_date,
376+ )
377+ elseif ice_model == " prescribed"
378+ ice_sim = PrescribedIceSimulation (
379+ FT;
380+ tspan = tspan,
381+ dt = component_dt_dict[" dt_seaice" ],
382+ saveat = saveat,
383+ space = boundary_space,
384+ thermo_params = thermo_params,
385+ comms_ctx,
386+ start_date,
387+ land_fraction,
388+ sic_path = subseasonal_sic,
389+ )
390+ else
391+ error (" Invalid ice model specified: $(ice_model) " )
392+ end
449393
450394 elseif (sim_mode <: AbstractSlabplanetSimulationMode )
451395
@@ -477,7 +421,6 @@ function CoupledSimulation(config_dict::AbstractDict)
477421 dt = component_dt_dict[" dt_ocean" ],
478422 space = boundary_space,
479423 saveat = saveat,
480- area_fraction = (FT (1 ) .- land_fraction), # # NB: this ocean fraction includes areas covered by sea ice (unlike the one contained in the cs)
481424 thermo_params = thermo_params,
482425 evolving = evolving_ocean,
483426 )
@@ -598,8 +541,8 @@ function CoupledSimulation(config_dict::AbstractDict)
598541
599542 The concrete steps for proper initialization are:
600543 =#
601-
602544 # 1. Make sure surface model area fractions sum to 1 everywhere.
545+ # Note that ocean and ice fractions are not accurate until after this call.
603546 FieldExchanger. update_surface_fractions! (cs)
604547
605548 # 2. Import atmospheric and surface fields into the coupler fields,
0 commit comments