Allocates the fields for the surface (return) properties of the ocean model. Unused fields are unallocated.
300 type(ocean_grid_type),
intent(in) :: G
301 type(surface),
intent(inout) :: sfc_state
302 logical,
optional,
intent(in) :: use_temperature
303 logical,
optional,
intent(in) :: do_integrals
305 type(coupler_1d_bc_type), &
306 optional,
intent(in) :: gas_fields_ocn
311 logical,
optional,
intent(in) :: use_meltpot
312 logical,
optional,
intent(in) :: use_iceshelves
314 logical,
optional,
intent(in) :: omit_frazil
318 logical :: use_temp, alloc_integ, use_melt_potential, alloc_iceshelves, alloc_frazil
319 integer :: is, ie, js, je, isd, ied, jsd, jed
320 integer :: isdB, iedB, jsdB, jedB
322 is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec
323 isd = g%isd ; ied = g%ied ; jsd = g%jsd ; jed = g%jed
324 isdb = g%isdB ; iedb = g%iedB; jsdb = g%jsdB ; jedb = g%jedB
326 use_temp = .true. ;
if (
present(use_temperature)) use_temp = use_temperature
327 alloc_integ = .true. ;
if (
present(do_integrals)) alloc_integ = do_integrals
328 use_melt_potential = .false. ;
if (
present(use_meltpot)) use_melt_potential = use_meltpot
329 alloc_iceshelves = .false. ;
if (
present(use_iceshelves)) alloc_iceshelves = use_iceshelves
330 alloc_frazil = .true. ;
if (
present(omit_frazil)) alloc_frazil = .not.omit_frazil
332 if (sfc_state%arrays_allocated)
return
335 allocate(sfc_state%SST(isd:ied,jsd:jed)) ; sfc_state%SST(:,:) = 0.0
336 allocate(sfc_state%SSS(isd:ied,jsd:jed)) ; sfc_state%SSS(:,:) = 0.0
338 allocate(sfc_state%sfc_density(isd:ied,jsd:jed)) ; sfc_state%sfc_density(:,:) = 0.0
340 if (use_temp .and. alloc_frazil)
then
341 allocate(sfc_state%frazil(isd:ied,jsd:jed)) ; sfc_state%frazil(:,:) = 0.0
343 allocate(sfc_state%sea_lev(isd:ied,jsd:jed)) ; sfc_state%sea_lev(:,:) = 0.0
344 allocate(sfc_state%Hml(isd:ied,jsd:jed)) ; sfc_state%Hml(:,:) = 0.0
345 allocate(sfc_state%u(isdb:iedb,jsd:jed)) ; sfc_state%u(:,:) = 0.0
346 allocate(sfc_state%v(isd:ied,jsdb:jedb)) ; sfc_state%v(:,:) = 0.0
348 if (use_melt_potential)
then
349 allocate(sfc_state%melt_potential(isd:ied,jsd:jed)) ; sfc_state%melt_potential(:,:) = 0.0
352 if (alloc_integ)
then
354 allocate(sfc_state%ocean_mass(isd:ied,jsd:jed)) ; sfc_state%ocean_mass(:,:) = 0.0
356 allocate(sfc_state%ocean_heat(isd:ied,jsd:jed)) ; sfc_state%ocean_heat(:,:) = 0.0
357 allocate(sfc_state%ocean_salt(isd:ied,jsd:jed)) ; sfc_state%ocean_salt(:,:) = 0.0
358 allocate(sfc_state%TempxPmE(isd:ied,jsd:jed)) ; sfc_state%TempxPmE(:,:) = 0.0
359 allocate(sfc_state%salt_deficit(isd:ied,jsd:jed)) ; sfc_state%salt_deficit(:,:) = 0.0
360 allocate(sfc_state%internal_heat(isd:ied,jsd:jed)) ; sfc_state%internal_heat(:,:) = 0.0
364 if (alloc_iceshelves)
then
365 allocate(sfc_state%taux_shelf(isdb:iedb,jsd:jed)) ; sfc_state%taux_shelf(:,:) = 0.0
366 allocate(sfc_state%tauy_shelf(isd:ied,jsdb:jedb)) ; sfc_state%tauy_shelf(:,:) = 0.0
369 if (
present(gas_fields_ocn)) &
370 call coupler_type_spawn(gas_fields_ocn, sfc_state%tr_fields, &
371 (/is,is,ie,ie/), (/js,js,je,je/), as_needed=.true.)
373 sfc_state%arrays_allocated = .true.