@@ -324,16 +324,6 @@ function CoupledSimulation(config_dict::AbstractDict)
324324 # Determine whether to use a shared surface space
325325 shared_surface_space = share_surface_space ? boundary_space : nothing
326326 if land_model == " bucket"
327-
328- # TODO move this into resolve_area_fractions and call after init, think about restarts
329- polar_mask = CC. Fields. zeros (boundary_space)
330- lat = CC. Fields. coordinate_field (boundary_space). lat
331- polar_mask .= abs .(lat) .>= FT (80 )
332-
333- # Set land fraction to 1 where polar_mask is 1
334- @. land_fraction = ifelse .(polar_mask == FT (1 ), FT (1 ), land_fraction)
335-
336-
337327 land_sim = BucketSimulation (
338328 FT;
339329 dt = component_dt_dict[" dt_land" ],
@@ -372,97 +362,51 @@ function CoupledSimulation(config_dict::AbstractDict)
372362 error (" Invalid land model specified: $(land_model) " )
373363 end
374364
375- # TODO separate drivers to clean this up
376- # # sea ice model
377- if 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- ice_fraction = Interfacer. get_field (ice_sim, Val (:area_fraction ))
391- elseif ice_model == " clima_seaice"
392- @assert sim_mode <: CMIPMode
393-
394- # TODO how should we initialize ocean fraction when using ClimaSeaIce?
395- # TODO init everything with AF=1, then resolve after getting sea ice
396- sic_data = try
397- joinpath (
398- @clima_artifact (" historical_sst_sic" , comms_ctx),
399- " MODEL.ICE.HAD187001-198110.OI198111-202206.nc" ,
400- )
401- catch error
402- @warn " Using lowres SIC. If you want the higher resolution version, you have to obtain it from ClimaArtifacts"
403- joinpath (
404- @clima_artifact (" historical_sst_sic_lowres" , comms_ctx),
405- " MODEL.ICE.HAD187001-198110.OI198111-202206_lowres.nc" ,
406- )
407- end
408- @info " Using initial condition prescribed SIC file: " sic_data
409-
410- SIC_timevaryinginput = TimeVaryingInput (
411- sic_data,
412- " SEAICE" ,
413- boundary_space,
414- reference_date = start_date,
415- file_reader_kwargs = (; preprocess_func = (data) -> data / 100 ,), # # convert to fraction
416- )
417-
418- # Get initial SIC values and use them to calculate ice fraction
419- ice_fraction = CC. Fields. zeros (boundary_space)
420- evaluate! (ice_fraction, SIC_timevaryinginput, tspan[1 ])
421- else
422- error (" Invalid ice model specified: $(ice_model) " )
423- end
424-
425- ice_fraction = ifelse .(ice_fraction .> FT (0.5 ), FT (1 ), FT (0 ))
426365 # # ocean model
427- ocean_fraction = FT (1 ) .- ice_fraction .- land_fraction
428-
429366 if sim_mode <: CMIPMode
430367 stop_date = date (tspan[end ] - tspan[begin ])
431368 ocean_sim = OceananigansSimulation (
432- ocean_fraction ,
369+ boundary_space ,
433370 start_date,
434371 stop_date;
435372 output_dir = ocean_output_dir,
436373 comms_ctx,
437374 )
438-
439- if ice_model == " clima_seaice"
440- ice_sim = ClimaSeaIceSimulation (
441- ice_fraction,
442- ocean_sim;
443- output_dir = ice_output_dir,
444- start_date,
445- )
446- # TODO don't need to initialize ocean fraction correctly if we do this
447- # TODO can rename to `resolve_area_fractions!` and also make land_fraction cover poles here instead of in driver
448- FieldExchanger. resolve_ocean_ice_fractions! (
449- ocean_sim,
450- ice_sim,
451- land_fraction,
452- )
453- end
454375 else
455376 ocean_sim = PrescribedOceanSimulation (
456377 FT,
457378 boundary_space,
458379 start_date,
459380 t_start,
460- ocean_fraction,
461381 thermo_params,
462382 comms_ctx;
463383 sst_path = subseasonal_sst,
464384 )
465385 end
386+ # # sea ice model
387+ if ice_model == " clima_seaice"
388+ ice_sim = ClimaSeaIceSimulation (
389+ ice_fraction,
390+ ocean_sim;
391+ output_dir = ice_output_dir,
392+ start_date,
393+ )
394+ elseif ice_model == " prescribed"
395+ ice_sim = PrescribedIceSimulation (
396+ FT;
397+ tspan = tspan,
398+ dt = component_dt_dict[" dt_seaice" ],
399+ saveat = saveat,
400+ space = boundary_space,
401+ thermo_params = thermo_params,
402+ comms_ctx,
403+ start_date,
404+ land_fraction,
405+ sic_path = subseasonal_sic,
406+ )
407+ else
408+ error (" Invalid ice model specified: $(ice_model) " )
409+ end
466410
467411 elseif (sim_mode <: AbstractSlabplanetSimulationMode )
468412
@@ -494,7 +438,6 @@ function CoupledSimulation(config_dict::AbstractDict)
494438 dt = component_dt_dict[" dt_ocean" ],
495439 space = boundary_space,
496440 saveat = saveat,
497- area_fraction = (FT (1 ) .- land_fraction), # # NB: this ocean fraction includes areas covered by sea ice (unlike the one contained in the cs)
498441 thermo_params = thermo_params,
499442 evolving = evolving_ocean,
500443 )
@@ -618,8 +561,8 @@ function CoupledSimulation(config_dict::AbstractDict)
618561
619562 The concrete steps for proper initialization are:
620563 =#
621-
622564 # 1. Make sure surface model area fractions sum to 1 everywhere.
565+ # Note that ocean and ice fractions are not accurate until after this call.
623566 FieldExchanger. update_surface_fractions! (cs)
624567
625568 # 2. Import atmospheric and surface fields into the coupler fields,
0 commit comments