Allocates the fields for the surface (return) properties of the ocean model. Unused fields are unallocated.
309 type(ocean_grid_type),
intent(in) :: g
310 type(surface),
intent(inout) :: sfc_state
311 logical,
optional,
intent(in) :: use_temperature
312 logical,
optional,
intent(in) :: do_integrals
314 type(coupler_1d_bc_type), &
315 optional,
intent(in) :: gas_fields_ocn
320 logical,
optional,
intent(in) :: use_meltpot
321 logical,
optional,
intent(in) :: use_iceshelves
323 logical,
optional,
intent(in) :: omit_frazil
327 logical :: use_temp, alloc_integ, use_melt_potential, alloc_iceshelves, alloc_frazil
328 integer :: is, ie, js, je, isd, ied, jsd, jed
329 integer :: isdb, iedb, jsdb, jedb
331 is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec
332 isd = g%isd ; ied = g%ied ; jsd = g%jsd ; jed = g%jed
333 isdb = g%isdB ; iedb = g%iedB; jsdb = g%jsdB ; jedb = g%jedB
335 use_temp = .true. ;
if (
present(use_temperature)) use_temp = use_temperature
336 alloc_integ = .true. ;
if (
present(do_integrals)) alloc_integ = do_integrals
337 use_melt_potential = .false. ;
if (
present(use_meltpot)) use_melt_potential = use_meltpot
338 alloc_iceshelves = .false. ;
if (
present(use_iceshelves)) alloc_iceshelves = use_iceshelves
339 alloc_frazil = .true. ;
if (
present(omit_frazil)) alloc_frazil = .not.omit_frazil
341 if (sfc_state%arrays_allocated)
return 344 allocate(sfc_state%SST(isd:ied,jsd:jed)) ; sfc_state%SST(:,:) = 0.0
345 allocate(sfc_state%SSS(isd:ied,jsd:jed)) ; sfc_state%SSS(:,:) = 0.0
347 allocate(sfc_state%sfc_density(isd:ied,jsd:jed)) ; sfc_state%sfc_density(:,:) = 0.0
349 if (use_temp .and. alloc_frazil)
then 350 allocate(sfc_state%frazil(isd:ied,jsd:jed)) ; sfc_state%frazil(:,:) = 0.0
352 allocate(sfc_state%sea_lev(isd:ied,jsd:jed)) ; sfc_state%sea_lev(:,:) = 0.0
353 allocate(sfc_state%Hml(isd:ied,jsd:jed)) ; sfc_state%Hml(:,:) = 0.0
354 allocate(sfc_state%u(isdb:iedb,jsd:jed)) ; sfc_state%u(:,:) = 0.0
355 allocate(sfc_state%v(isd:ied,jsdb:jedb)) ; sfc_state%v(:,:) = 0.0
357 if (use_melt_potential)
then 358 allocate(sfc_state%melt_potential(isd:ied,jsd:jed)) ; sfc_state%melt_potential(:,:) = 0.0
361 if (alloc_integ)
then 363 allocate(sfc_state%ocean_mass(isd:ied,jsd:jed)) ; sfc_state%ocean_mass(:,:) = 0.0
365 allocate(sfc_state%ocean_heat(isd:ied,jsd:jed)) ; sfc_state%ocean_heat(:,:) = 0.0
366 allocate(sfc_state%ocean_salt(isd:ied,jsd:jed)) ; sfc_state%ocean_salt(:,:) = 0.0
367 allocate(sfc_state%TempxPmE(isd:ied,jsd:jed)) ; sfc_state%TempxPmE(:,:) = 0.0
368 allocate(sfc_state%salt_deficit(isd:ied,jsd:jed)) ; sfc_state%salt_deficit(:,:) = 0.0
369 allocate(sfc_state%internal_heat(isd:ied,jsd:jed)) ; sfc_state%internal_heat(:,:) = 0.0
373 if (alloc_iceshelves)
then 374 allocate(sfc_state%taux_shelf(isdb:iedb,jsd:jed)) ; sfc_state%taux_shelf(:,:) = 0.0
375 allocate(sfc_state%tauy_shelf(isd:ied,jsdb:jedb)) ; sfc_state%tauy_shelf(:,:) = 0.0
378 if (
present(gas_fields_ocn)) &
379 call coupler_type_spawn(gas_fields_ocn, sfc_state%tr_fields, &
380 (/is,is,ie,ie/), (/js,js,je,je/), as_needed=.true.)
382 sfc_state%arrays_allocated = .true.