Allocates the fields for the surface (return) properties of the ocean model. Unused fields are unallocated.
303 type(ocean_grid_type),
intent(in) :: G
304 type(surface),
intent(inout) :: sfc_state
305 logical,
optional,
intent(in) :: use_temperature
306 logical,
optional,
intent(in) :: do_integrals
308 type(coupler_1d_bc_type), &
309 optional,
intent(in) :: gas_fields_ocn
314 logical,
optional,
intent(in) :: use_meltpot
317 logical :: use_temp, alloc_integ, use_melt_potential
318 integer :: is, ie, js, je, isd, ied, jsd, jed
319 integer :: isdB, iedB, jsdB, jedB
321 is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec
322 isd = g%isd ; ied = g%ied ; jsd = g%jsd ; jed = g%jed
323 isdb = g%isdB ; iedb = g%iedB; jsdb = g%jsdB ; jedb = g%jedB
325 use_temp = .true. ;
if (
present(use_temperature)) use_temp = use_temperature
326 alloc_integ = .true. ;
if (
present(do_integrals)) alloc_integ = do_integrals
327 use_melt_potential = .false. ;
if (
present(use_meltpot)) use_melt_potential = use_meltpot
329 if (sfc_state%arrays_allocated)
return
332 allocate(sfc_state%SST(isd:ied,jsd:jed)) ; sfc_state%SST(:,:) = 0.0
333 allocate(sfc_state%SSS(isd:ied,jsd:jed)) ; sfc_state%SSS(:,:) = 0.0
335 allocate(sfc_state%sfc_density(isd:ied,jsd:jed)) ; sfc_state%sfc_density(:,:) = 0.0
337 allocate(sfc_state%sea_lev(isd:ied,jsd:jed)) ; sfc_state%sea_lev(:,:) = 0.0
338 allocate(sfc_state%Hml(isd:ied,jsd:jed)) ; sfc_state%Hml(:,:) = 0.0
339 allocate(sfc_state%u(isdb:iedb,jsd:jed)) ; sfc_state%u(:,:) = 0.0
340 allocate(sfc_state%v(isd:ied,jsdb:jedb)) ; sfc_state%v(:,:) = 0.0
342 if (use_melt_potential)
then
343 allocate(sfc_state%melt_potential(isd:ied,jsd:jed)) ; sfc_state%melt_potential(:,:) = 0.0
346 if (alloc_integ)
then
348 allocate(sfc_state%ocean_mass(isd:ied,jsd:jed)) ; sfc_state%ocean_mass(:,:) = 0.0
350 allocate(sfc_state%ocean_heat(isd:ied,jsd:jed)) ; sfc_state%ocean_heat(:,:) = 0.0
351 allocate(sfc_state%ocean_salt(isd:ied,jsd:jed)) ; sfc_state%ocean_salt(:,:) = 0.0
353 allocate(sfc_state%salt_deficit(isd:ied,jsd:jed)) ; sfc_state%salt_deficit(:,:) = 0.0
356 if (
present(gas_fields_ocn)) &
357 call coupler_type_spawn(gas_fields_ocn, sfc_state%tr_fields, &
358 (/is,is,ie,ie/), (/js,js,je,je/), as_needed=.true.)
360 sfc_state%arrays_allocated = .true.