23 subroutine gfs_surface_composites_pre_run (im, lkm, frac_grid, iopt_lake, iopt_lake_clm, &
24 flag_cice, cplflx, cplice, cplwav2atm, lsm, lsm_ruc, &
25 landfrac, lakefrac, lakedepth, oceanfrac, frland, &
26 dry, icy, lake, use_lake_model, wet, hice, cice, zorlo, zorll, zorli, &
27 snowd, snowd_lnd, snowd_ice, tprcp, tprcp_wat, &
28 tprcp_lnd, tprcp_ice, uustar, uustar_wat, uustar_lnd, uustar_ice, &
29 weasd, weasd_lnd, weasd_ice, ep1d_ice, tsfc, tsfco, tsfcl, tsfc_wat, &
30 tisfc, tsurf_wat, tsurf_lnd, tsurf_ice, &
31 gflx_ice, tgice, islmsk, islmsk_cice, slmsk, qss, qss_wat, qss_lnd, qss_ice, &
32 min_lakeice, min_seaice, kdt, huge, errmsg, errflg)
37 integer,
intent(in ) :: im, lkm, kdt, lsm,
lsm_ruc, iopt_lake, iopt_lake_clm
38 logical,
intent(in ) :: cplflx, cplice, cplwav2atm, frac_grid
39 logical,
dimension(:),
intent(inout) :: flag_cice
40 logical,
dimension(:),
intent(inout) :: dry, icy, lake, wet
41 integer,
dimension(:),
intent(in ) :: use_lake_model
42 real(kind=kind_phys),
dimension(:),
intent(in ) :: landfrac, lakefrac, lakedepth, oceanfrac
43 real(kind=kind_phys),
dimension(:),
intent(inout) :: cice, hice
44 real(kind=kind_phys),
dimension(:),
intent( out) :: frland
45 real(kind=kind_phys),
dimension(:),
intent(in ) :: snowd, tprcp, uustar, weasd, qss, tisfc
47 real(kind=kind_phys),
dimension(:),
intent(inout) :: tsfc, tsfco, tsfcl
48 real(kind=kind_phys),
dimension(:),
intent(inout) :: snowd_lnd, snowd_ice, tprcp_wat, &
49 tprcp_lnd, tprcp_ice, tsfc_wat, tsurf_wat,tsurf_lnd, tsurf_ice, &
50 uustar_wat, uustar_lnd, uustar_ice, weasd_lnd, weasd_ice, &
51 qss_wat, qss_lnd, qss_ice, ep1d_ice, gflx_ice
52 real(kind=kind_phys),
intent(in ) :: tgice
53 integer,
dimension(:),
intent(inout) :: islmsk, islmsk_cice
54 real(kind=kind_phys),
dimension(:),
intent(inout) :: slmsk
55 real(kind=kind_phys),
intent(in ) :: min_lakeice, min_seaice, huge
57 real(kind=kind_phys),
dimension(:),
intent(inout) :: zorlo, zorll, zorli
59 real(kind=kind_phys),
parameter :: timin = 173.0_kind_phys
61 real(kind=kind_phys) :: tem
64 character(len=*),
intent(out) :: errmsg
65 integer,
intent(out) :: errflg
76 if(use_lake_model(i) > 0)
then
83 frland(i) = landfrac(i)
84 if (frland(i) > zero) dry(i) = .true.
85 if (frland(i) < one)
then
86 if (oceanfrac(i) > zero)
then
87 if (cice(i) >= min_seaice)
then
94 flag_cice(i) = .false.
100 flag_cice(i) = .false.
105 if (cice(i) < one)
then
107 if (.not. cplflx .and. icy(i)) tsfco(i) = max(tisfc(i), tgice)
110 if (cice(i) >= min_lakeice)
then
119 islmsk_cice(i) = islmsk(i)
120 flag_cice(i) = .false.
121 if (cice(i) < one)
then
123 if (icy(i)) tsfco(i) = max(tisfc(i), tgice)
133 flag_cice(i) = .false.
140 if (islmsk(i) == 1)
then
149 if (oceanfrac(i) > zero)
then
150 if (cice(i) >= min_seaice)
then
159 if (cplice .and. cplflx)
then
161 flag_cice(i) = .true.
164 flag_cice(i) = .false.
170 flag_cice(i) = .false.
175 if (cice(i) < one)
then
178 if (.not. cplflx .and. icy(i)) tsfco(i) = max(tisfc(i), tgice)
180 if (icy(i)) tsfco(i) = max(tisfc(i), tgice)
184 is_clm = lkm>0 .and. iopt_lake==iopt_lake_clm .and. use_lake_model(i)>0
185 if (cice(i) >= min_lakeice)
then
194 islmsk_cice(i) = islmsk(i)
195 flag_cice(i) = .false.
199 tsfco(i) = max(tisfc(i), tgice)
201 else if(cice(i) < one)
then
204 tsfco(i) = max(tisfc(i), tgice)
213 tprcp_wat(i) = tprcp(i)
214 tprcp_lnd(i) = tprcp(i)
215 tprcp_ice(i) = tprcp(i)
218 uustar_wat(i) = uustar(i)
219 tsfc_wat(i) = tsfco(i)
220 tsurf_wat(i) = tsfco(i)
221 zorlo(i) = max(1.0e-5, min(one, zorlo(i)))
228 uustar_lnd(i) = uustar(i)
229 if(lsm /=
lsm_ruc) weasd_lnd(i) = weasd(i)
230 tsurf_lnd(i) = tsfcl(i)
238 if (icy(i) .or. wet(i))
then
239 uustar_ice(i) = uustar(i)
242 is_clm = lkm>0 .and. iopt_lake==iopt_lake_clm .and. use_lake_model(i)>0
243 if(lsm /=
lsm_ruc .and. .not.is_clm)
then
244 weasd_ice(i) = weasd(i)
246 tsurf_ice(i) = tisfc(i)
249 zorli(i) = max(1.0e-5, min(one, zorli(i)))
255 if (nint(slmsk(i)) /= 1) slmsk(i) = islmsk(i)
263 if (kdt == 1 .or. (.not. cplflx .or. lakefrac(i) > zero))
then
264 tem = one / (cice(i)*(one-frland(i)))
265 snowd_ice(i) = max(zero, (snowd(i) - snowd_lnd(i)*frland(i)) * tem)
266 weasd_ice(i) = max(zero, (weasd(i) - weasd_lnd(i)*frland(i)) * tem)
270 if (kdt == 1 .or. (.not. cplflx .or. lakefrac(i) > zero))
then
273 snowd_ice(i) = snowd(i) * tem
275 weasd_ice(i) = weasd(i) * tem
282 if (kdt == 1 .or. (.not. cplflx .or. lakefrac(i) > zero))
then
286 snowd_ice(i) = snowd(i) * tem
287 weasd_ice(i) = weasd(i) * tem