Apply shortwave heating below surface boundary layer.
70 type(verticalgrid_type),
intent(in) :: gv
71 real,
dimension(SZI_(G),SZK_(G)),
intent(in) :: h
73 real,
dimension(:,:,:),
intent(in) :: opacity_band
76 integer,
intent(in) :: nsw
78 integer,
intent(in) :: j
79 real,
intent(in) :: dt
80 real,
intent(in) :: h_limit_fluxes
86 logical,
intent(in) :: adjustabsorptionprofile
92 logical,
intent(in) :: absorballsw
98 real,
dimension(SZI_(G),SZK_(G)),
intent(inout) :: t
100 real,
dimension(:,:),
intent(inout) :: pen_sw_bnd
105 real,
dimension(SZI_(G),SZK_(G)), &
106 optional,
intent(in) :: eps
109 integer,
dimension(SZI_(G),SZK_(G)), &
110 optional,
intent(in) :: ksort
111 real,
dimension(SZI_(G)), &
112 optional,
intent(in) :: htot
113 real,
dimension(SZI_(G)), &
114 optional,
intent(inout) :: ttot
116 real,
dimension(SZI_(G),SZK_(G)), &
117 optional,
intent(in) :: dsv_dt
120 real,
dimension(SZI_(G),SZK_(G)), &
121 optional,
intent(inout) :: tke
159 real,
dimension(SZI_(G),SZK_(G)) :: &
167 real,
dimension(SZI_(G)) :: &
190 real :: min_sw_heating
198 logical :: sw_remains
203 integer :: is, ie, nz, i, k, ks, n
206 min_sw_heating = 2.5e-11
208 h_min_heat = 2.0*gv%Angstrom + gv%H_subroundoff
209 is = g%isc ; ie = g%iec ; nz = g%ke
210 c1_6 = 1.0 / 6.0 ; c1_60 = 1.0 / 60.0
212 tke_calc = (
present(tke) .and.
present(dsv_dt))
213 g_hconv2 = gv%g_Earth * gv%H_to_kg_m2**2
216 if (
present(htot))
then ;
do i=is,ie ; h_heat(i) = htot(i) ;
enddo ;
endif 220 do ks=1,nz ;
do i=is,ie
222 if (
present(ksort))
then 223 if (ksort(i,ks) <= 0) cycle
226 epsilon = 0.0 ;
if (
present(eps)) epsilon = eps(i,k)
228 t_chg_above(i,k) = 0.0
230 if (h(i,k) > 1.5*epsilon)
then 231 do n=1,nsw ;
if (pen_sw_bnd(n,i) > 0.0)
then 233 opt_depth = h(i,k) * opacity_band(n,i,k)
234 exp_od = exp(-opt_depth)
241 if (nsw*pen_sw_bnd(n,i)*sw_trans < &
242 dt*min_sw_heating*min(gv%m_to_H,1e3*h(i,k)) ) sw_trans = 0.0
244 heat_bnd = pen_sw_bnd(n,i) * (1.0 - sw_trans)
245 if (adjustabsorptionprofile .and. (h_heat(i) > 0.0))
then 256 if (opt_depth > 1e-5)
then 257 swa = ((opt_depth + (opt_depth + 2.0)*exp_od) - 2.0) / &
258 ((opt_depth + opacity_band(n,i,k) * h_heat(i)) * &
263 swa = h(i,k) * (opt_depth * (1.0 - opt_depth)) / &
264 ((h_heat(i) + h(i,k)) * (6.0 - 3.0*opt_depth))
267 if (swa*(h_heat(i) + h(i,k)) > h_heat(i))
then 268 coswa_frac = (swa*(h_heat(i) + h(i,k)) - h_heat(i) ) / &
269 (swa*(h_heat(i) + h(i,k)))
270 swa = h_heat(i) / (h_heat(i) + h(i,k))
273 t_chg_above(i,k) = t_chg_above(i,k) + (swa * heat_bnd) / h_heat(i)
274 t(i,k) = t(i,k) + ((1.0 - swa) * heat_bnd) / h(i,k)
277 t(i,k) = t(i,k) + pen_sw_bnd(n,i) * (1.0 - sw_trans) / h(i,k)
281 if (opt_depth > 1e-2)
then 282 tke(i,k) = tke(i,k) - coswa_frac*heat_bnd*dsv_dt(i,k)* &
283 (0.5*h(i,k)*g_hconv2) * &
284 (opt_depth*(1.0+exp_od) - 2.0*(1.0-exp_od)) / (opt_depth*(1.0-exp_od))
288 tke(i,k) = tke(i,k) - coswa_frac*heat_bnd*dsv_dt(i,k)* &
289 (0.5*h(i,k)*g_hconv2) * &
290 (c1_6*opt_depth * (1.0 - c1_60*opt_depth**2))
294 pen_sw_bnd(n,i) = pen_sw_bnd(n,i) * sw_trans
300 if (h(i,k) >= 2.0*h_min_heat)
then 301 h_heat(i) = h_heat(i) + h(i,k)
302 elseif (h(i,k) > h_min_heat)
then 303 h_heat(i) = h_heat(i) + (2.0*h(i,k) - 2.0*h_min_heat)
311 do i=is,ie ; t_chg(i) = 0.0 ;
enddo 313 if (absorballsw)
then 318 pen_sw_rem(i) = pen_sw_bnd(1,i)
319 do n=2,nsw ; pen_sw_rem(i) = pen_sw_rem(i) + pen_sw_bnd(n,i) ;
enddo 321 do i=is,ie ;
if (pen_sw_rem(i) > 0.0) sw_remains = .true. ;
enddo 323 ih_limit = 1.0 / h_limit_fluxes
324 do i=is,ie ;
if ((pen_sw_rem(i) > 0.0) .and. (h_heat(i) > 0.0))
then 325 if (h_heat(i)*ih_limit >= 1.0)
then 326 t_chg(i) = pen_sw_rem(i) / h_heat(i) ; unabsorbed = 0.0
328 t_chg(i) = pen_sw_rem(i) * ih_limit
329 unabsorbed = 1.0 - h_heat(i)*ih_limit
331 do n=1,nsw ; pen_sw_bnd(n,i) = unabsorbed * pen_sw_bnd(n,i) ;
enddo 335 if (absorballsw .or. adjustabsorptionprofile)
then 336 do ks=nz,1,-1 ;
do i=is,ie
338 if (
present(ksort))
then 339 if (ksort(i,ks) <= 0) cycle
343 if (t_chg(i) > 0.0)
then 345 if (h(i,k) >= 2.0*h_min_heat)
then ; t(i,k) = t(i,k) + t_chg(i)
346 elseif (h(i,k) > h_min_heat)
then 347 t(i,k) = t(i,k) + t_chg(i) * (2.0 - 2.0*h_min_heat/h(i,k))
351 t_chg(i) = t_chg(i) + t_chg_above(i,k)
353 if (
present(htot) .and.
present(ttot))
then 354 do i=is,ie ; ttot(i) = ttot(i) + t_chg(i) * htot(i) ;
enddo Ocean grid type. See mom_grid for details.