28 public :: bulkflux_diagnose_scales
29 public :: bulkflux_diagnose_surface
31 interface bulkflux_diagnose_scales
34 end interface bulkflux_diagnose_scales
36 interface bulkflux_diagnose_surface
37 module procedure bulkflux_diagnose_surface_0d
39 end interface bulkflux_diagnose_surface
48 Ustar, Tstar, Qstar, &
50 FracU10, FracT2, FracQ2 )
53 real(RP),
intent(in) :: T1
54 real(RP),
intent(in) :: T0
55 real(RP),
intent(in) :: P1
56 real(RP),
intent(in) :: P0
57 real(RP),
intent(in) :: Q1
58 real(RP),
intent(in) :: Q0
59 real(RP),
intent(in) :: Uabs
60 real(RP),
intent(in) :: Z1
61 real(RP),
intent(in) :: PBL
62 real(RP),
intent(in) :: Z0M
63 real(RP),
intent(in) :: Z0H
64 real(RP),
intent(in) :: Z0E
66 real(RP),
intent(out) :: Ustar
67 real(RP),
intent(out) :: Tstar
68 real(RP),
intent(out) :: Qstar
69 real(RP),
intent(out) :: Wstar
70 real(RP),
intent(out) :: RLmo
71 real(RP),
intent(out) :: Ra
72 real(RP),
intent(out) :: FracU10
73 real(RP),
intent(out) :: FracT2
74 real(RP),
intent(out) :: FracQ2
91 private :: bulkflux_u95
92 private :: bulkflux_b91w01
93 private :: fm_unstable
94 private :: fh_unstable
102 real(
dp),
parameter,
private :: eps = 1.e-16_dp
104 logical,
private :: bulkflux_nk2018 = .true.
106 integer,
private :: bulkflux_itr_sa_max = 5
107 integer,
private :: bulkflux_itr_nr_max = 10
109 real(
rp),
private :: bulkflux_wscf
112 real(
rp),
private :: bulkflux_uabs_min = 1.0e-2_rp
113 real(
rp),
private :: bulkflux_wstar_min = 1.0e-4_rp
116 logical,
private :: bulkflux_surfdiag_neutral = .true.
118 logical,
private :: flag_w01
129 real(
rp),
intent(in) :: dx
131 namelist / param_bulkflux / &
134 bulkflux_itr_sa_max, &
135 bulkflux_itr_nr_max, &
138 bulkflux_wstar_min, &
139 bulkflux_surfdiag_neutral
145 log_info(
"BULKFLUX_setup",*)
'Setup'
149 bulkflux_wscf = 1.2_rp * min(dx*1.e-3_rp, 1.0_rp)
157 log_info(
"BULKFLUX_setup",*)
'Not found namelist. Default used.'
158 elseif( ierr > 0 )
then
159 log_error(
"BULKFLUX_setup",*)
'Not appropriate names in namelist PARAM_BULKFLUX. Check!'
162 log_nml(param_bulkflux)
165 log_info(
"BULKFLUX_setup",*)
'Scheme for surface bulk flux : ', trim(
bulkflux_type)
168 log_info_cont(*)
'=> Uno et al.(1995)'
171 log_info_cont(*)
'=> Beljaars and Holtslag (1991) and Wilson (2001)'
175 log_info_cont(*)
'=> Beljaars and Holtslag (1991)'
179 log_error(
"BULKFLUX_setup",*)
'Unsupported BULKFLUX_type. STOP'
190 IA, IS, IE, JA, JS, JE, &
191 SFLX_MW, SFLX_MU, SFLX_MV, &
193 SFC_DENS, SFC_TEMP, PBL, &
194 Ustar, Tstar, Qstar, &
204 integer,
intent(in) :: IA, IS, IE
205 integer,
intent(in) :: JA, JS, JE
207 real(RP),
intent(in) :: SFLX_MW (IA,JA)
208 real(RP),
intent(in) :: SFLX_MU (IA,JA)
209 real(RP),
intent(in) :: SFLX_MV (IA,JA)
210 real(RP),
intent(in) :: SFLX_SH (IA,JA)
211 real(RP),
intent(in) :: SFLX_QV (IA,JA)
212 real(RP),
intent(in) :: SFC_DENS(IA,JA)
213 real(RP),
intent(in) :: SFC_TEMP(IA,JA)
214 real(RP),
intent(in) :: PBL (IA,JA)
216 real(RP),
intent(out) :: Ustar(IA,JA)
217 real(RP),
intent(out) :: Tstar(IA,JA)
218 real(RP),
intent(out) :: Qstar(IA,JA)
219 real(RP),
intent(out) :: Wstar(IA,JA)
220 real(RP),
intent(out) :: RLmo (IA,JA)
222 logical,
intent(in),
optional :: mask(IA,JA)
226 if (
present(mask) )
then
230 if ( mask(i,j) )
then
232 sflx_sh(i,j), sflx_qv(i,j), &
233 sfc_dens(i,j), sfc_temp(i,j), pbl(i,j), &
234 ustar(i,j), tstar(i,j), qstar(i,j), &
235 wstar(i,j), rlmo(i,j) )
244 sflx_sh(i,j), sflx_qv(i,j), &
245 sfc_dens(i,j), sfc_temp(i,j), pbl(i,j), &
246 ustar(i,j), tstar(i,j), qstar(i,j), &
247 wstar(i,j), rlmo(i,j) )
256 SFLX_MW, SFLX_MU, SFLX_MV, &
258 SFC_DENS, SFC_TEMP, PBL, &
259 Ustar, Tstar, Qstar, &
268 real(RP),
intent(in) :: SFLX_MW
269 real(RP),
intent(in) :: SFLX_MU
270 real(RP),
intent(in) :: SFLX_MV
271 real(RP),
intent(in) :: SFLX_SH
272 real(RP),
intent(in) :: SFLX_QV
273 real(RP),
intent(in) :: SFC_DENS
274 real(RP),
intent(in) :: SFC_TEMP
275 real(RP),
intent(in) :: PBL
277 real(RP),
intent(out) :: Ustar
278 real(RP),
intent(out) :: Tstar
279 real(RP),
intent(out) :: Qstar
280 real(RP),
intent(out) :: Wstar
281 real(RP),
intent(out) :: RLmo
283 real(RP) :: BFLX, tmp, sw
289 ustar = sqrt( sqrt( sflx_mw**2 + sflx_mu**2 + sflx_mv**2 ) / sfc_dens )
290 sw = 0.5_rp - sign( 0.5_rp, ustar - eps )
291 tstar = - sflx_sh / ( sfc_dens * ustar * cpdry + sw ) * ( 1.0_rp - sw )
292 qstar = - sflx_qv / ( sfc_dens * ustar + sw ) * ( 1.0_rp - sw )
293 bflx = - ustar * tstar - epstvap * ustar * qstar * sfc_temp
294 rlmo = - karman * grav * bflx / ( ustar**3 * sfc_temp + sw ) * ( 1.0_rp - sw )
296 tmp = pbl * grav / sfc_temp * bflx
297 sw = 0.5_rp + sign( 0.5_rp, tmp )
298 wstar = ( tmp * sw )**( 1.0_rp / 3.0_rp )
310 IA, IS, IE, JA, JS, JE, &
315 SFC_Z0M, SFC_Z0H, SFC_Z0E, &
318 FracU10, FracT2, FracQ2 )
320 integer,
intent(in) :: IA, IS, IE
321 integer,
intent(in) :: JA, JS, JE
323 real(RP),
intent(in) :: ATM_U (IA,JA)
324 real(RP),
intent(in) :: ATM_V (IA,JA)
325 real(RP),
intent(in) :: ATM_TEMP(IA,JA)
326 real(RP),
intent(in) :: ATM_QV (IA,JA)
327 real(RP),
intent(in) :: SFC_TEMP(IA,JA)
328 real(RP),
intent(in) :: SFC_QV (IA,JA)
329 real(RP),
intent(in) :: ATM_Z1 (IA,JA)
330 real(RP),
intent(in) :: SFC_Z0M (IA,JA)
331 real(RP),
intent(in) :: SFC_Z0H (IA,JA)
332 real(RP),
intent(in) :: SFC_Z0E (IA,JA)
334 real(RP),
intent(out) :: U10(IA,JA)
335 real(RP),
intent(out) :: V10(IA,JA)
336 real(RP),
intent(out) :: T2 (IA,JA)
337 real(RP),
intent(out) :: Q2 (IA,JA)
339 logical,
intent(in),
optional :: mask (IA,JA)
340 real(RP),
intent(in),
optional :: FracU10(IA,JA)
341 real(RP),
intent(in),
optional :: FracT2 (IA,JA)
342 real(RP),
intent(in),
optional :: FracQ2 (IA,JA)
346 if (
present(fracu10) )
then
347 if (
present(mask) )
then
351 if ( mask(i,j) )
then
352 call bulkflux_diagnose_surface_0d( atm_u(i,j), atm_v(i,j), &
353 atm_temp(i,j), atm_qv(i,j), &
354 sfc_temp(i,j), sfc_qv(i,j), &
356 sfc_z0m(i,j), sfc_z0h(i,j), sfc_z0e(i,j), &
357 u10(i,j), v10(i,j), t2(i,j), q2(i,j), &
358 fracu10(i,j), fract2(i,j), fracq2(i,j) )
367 call bulkflux_diagnose_surface_0d( atm_u(i,j), atm_v(i,j), &
368 atm_temp(i,j), atm_qv(i,j), &
369 sfc_temp(i,j), sfc_qv(i,j), &
371 sfc_z0m(i,j), sfc_z0h(i,j), sfc_z0e(i,j), &
372 u10(i,j), v10(i,j), t2(i,j), q2(i,j), &
373 fracu10(i,j), fract2(i,j), fracq2(i,j) )
378 if (
present(mask) )
then
382 if ( mask(i,j) )
then
383 call bulkflux_diagnose_surface_0d( atm_u(i,j), atm_v(i,j), &
384 atm_temp(i,j), atm_qv(i,j), &
385 sfc_temp(i,j), sfc_qv(i,j), &
387 sfc_z0m(i,j), sfc_z0h(i,j), sfc_z0e(i,j), &
388 u10(i,j), v10(i,j), t2(i,j), q2(i,j) )
397 call bulkflux_diagnose_surface_0d( atm_u(i,j), atm_v(i,j), &
398 atm_temp(i,j), atm_qv(i,j), &
399 sfc_temp(i,j), sfc_qv(i,j), &
401 sfc_z0m(i,j), sfc_z0h(i,j), sfc_z0e(i,j), &
402 u10(i,j), v10(i,j), t2(i,j), q2(i,j) )
411 subroutine bulkflux_diagnose_surface_0d( &
416 SFC_Z0M, SFC_Z0H, SFC_Z0E, &
418 FracU10, FracT2, FracQ2 )
420 real(RP),
intent(in) :: ATM_U
421 real(RP),
intent(in) :: ATM_V
422 real(RP),
intent(in) :: ATM_TEMP
423 real(RP),
intent(in) :: ATM_QV
424 real(RP),
intent(in) :: SFC_TEMP
425 real(RP),
intent(in) :: SFC_QV
426 real(RP),
intent(in) :: ATM_Z1
427 real(RP),
intent(in) :: SFC_Z0M
428 real(RP),
intent(in) :: SFC_Z0H
429 real(RP),
intent(in) :: SFC_Z0E
431 real(RP),
intent(out) :: U10
432 real(RP),
intent(out) :: V10
433 real(RP),
intent(out) :: T2
434 real(RP),
intent(out) :: Q2
436 real(RP),
intent(in),
optional :: FracU10
437 real(RP),
intent(in),
optional :: FracT2
438 real(RP),
intent(in),
optional :: FracQ2
440 real(RP) :: f10m, f2h, f2e
442 if ( bulkflux_surfdiag_neutral .or. ( .not.
present(fracu10) ) )
then
444 f10m = log( 10.0_rp / sfc_z0m ) / log( atm_z1 / sfc_z0m )
445 f2h = log( 2.0_rp / sfc_z0h ) / log( atm_z1 / sfc_z0h )
446 f2e = log( 2.0_rp / sfc_z0e ) / log( atm_z1 / sfc_z0e )
455 t2 = sfc_temp + ( atm_temp - sfc_temp ) * f2h
456 q2 = sfc_qv + ( atm_qv - sfc_qv ) * f2e
459 end subroutine bulkflux_diagnose_surface_0d
464 subroutine bulkflux_u95( &
470 Ustar, Tstar, Qstar, &
472 FracU10, FracT2, FracQ2 )
482 real(RP),
parameter :: tPrn = 0.74_rp
483 real(RP),
parameter :: LFb = 9.4_rp
484 real(RP),
parameter :: LFbp = 4.7_rp
485 real(RP),
parameter :: LFdm = 7.4_rp
486 real(RP),
parameter :: LFdh = 5.3_rp
489 real(RP),
intent(in) :: T1
490 real(RP),
intent(in) :: T0
491 real(RP),
intent(in) :: P1
492 real(RP),
intent(in) :: P0
493 real(RP),
intent(in) :: Q1
494 real(RP),
intent(in) :: Q0
495 real(RP),
intent(in) :: Uabs
496 real(RP),
intent(in) :: Z1
497 real(RP),
intent(in) :: PBL
498 real(RP),
intent(in) :: Z0M
499 real(RP),
intent(in) :: Z0H
500 real(RP),
intent(in) :: Z0E
502 real(RP),
intent(out) :: Ustar
503 real(RP),
intent(out) :: Tstar
504 real(RP),
intent(out) :: Qstar
505 real(RP),
intent(out) :: Wstar
506 real(RP),
intent(out) :: RLmo
507 real(RP),
intent(out) :: Ra
508 real(RP),
intent(out) :: FracU10
509 real(RP),
intent(out) :: FracT2
510 real(RP),
intent(out) :: FracQ2
514 real(RP) :: RiB0, RiB
515 real(RP) :: C0Z1, C010, C002
516 real(RP) :: CmZ1, ChZ1, CqZ1, fmZ1, fhZ1, t0thZ1, q0qeZ1
517 real(RP) :: Cm10, fm10
518 real(RP) :: Cm02, Ch02, Cq02, fm02, fh02, t0th02, q0qe02
520 real(RP) :: logZ1Z0M, log10Z0m, log02Z0m
521 real(RP) :: logZ0MZ0E
522 real(RP) :: logZ0MZ0H
525 logz1z0m = log( z1 / z0m )
526 log10z0m = log( 10.0_rp / z0m )
527 log02z0m = log( 2.0_rp / z0m )
529 logz0mz0e = max( log( z0m/z0e ), 1.0_rp )
530 logz0mz0h = max( log( z0m/z0h ), 1.0_rp )
532 uabsw = max( uabs, bulkflux_uabs_min )
533 th1 = t1 * ( p0 / p1 )**( rdry / cpdry )
537 rib0 = grav * z1 * ( th1 - th0 ) / ( th1 * uabsw**2 )
539 c0z1 = ( karman / logz1z0m )**2
540 c010 = ( karman / log10z0m )**2
541 c002 = ( karman / log02z0m )**2
545 if( rib0 > 0.0_rp )
then
547 fmz1 = 1.0_rp / ( 1.0_rp + lfbp * rib )**2
548 fhz1 = 1.0_rp / ( 1.0_rp + lfbp * rib )**2
549 fm10 = 1.0_rp / ( 1.0_rp + lfbp * rib )**2
550 fm02 = 1.0_rp / ( 1.0_rp + lfbp * rib )**2
551 fh02 = 1.0_rp / ( 1.0_rp + lfbp * rib )**2
554 fmz1 = 1.0_rp - lfb * rib / ( 1.0_rp + lfb * lfdm * c0z1 * sqrt( z1 / z0m ) * sqrt( abs( rib ) ) )
555 fhz1 = 1.0_rp - lfb * rib / ( 1.0_rp + lfb * lfdh * c0z1 * sqrt( z1 / z0m ) * sqrt( abs( rib ) ) )
556 fm10 = 1.0_rp - lfb * rib / ( 1.0_rp + lfb * lfdm * c010 * sqrt( 10.0_rp / z0m ) * sqrt( abs( rib ) ) )
557 fm02 = 1.0_rp - lfb * rib / ( 1.0_rp + lfb * lfdm * c002 * sqrt( 2.0_rp / z0m ) * sqrt( abs( rib ) ) )
558 fh02 = 1.0_rp - lfb * rib / ( 1.0_rp + lfb * lfdh * c002 * sqrt( 2.0_rp / z0m ) * sqrt( abs( rib ) ) )
561 t0thz1 = 1.0_rp / ( 1.0_rp + logz0mz0h / logz1z0m / sqrt( fmz1 ) * fhz1 )
562 q0qez1 = 1.0_rp / ( 1.0_rp + logz0mz0e / logz1z0m / sqrt( fmz1 ) * fhz1 )
563 t0th02 = 1.0_rp / ( 1.0_rp + logz0mz0h / log02z0m / sqrt( fm02 ) * fh02 )
564 q0qe02 = 1.0_rp / ( 1.0_rp + logz0mz0e / log02z0m / sqrt( fm02 ) * fh02 )
568 if( rib0 > 0.0_rp )
then
570 fmz1 = 1.0_rp / ( 1.0_rp + lfbp * rib )**2
571 fhz1 = 1.0_rp / ( 1.0_rp + lfbp * rib )**2
572 fm10 = 1.0_rp / ( 1.0_rp + lfbp * rib )**2
573 fm02 = 1.0_rp / ( 1.0_rp + lfbp * rib )**2
574 fh02 = 1.0_rp / ( 1.0_rp + lfbp * rib )**2
577 fmz1 = 1.0_rp - lfb * rib / ( 1.0_rp + lfb * lfdm * c0z1 * sqrt( z1 / z0m ) * sqrt( abs( rib ) ) )
578 fhz1 = 1.0_rp - lfb * rib / ( 1.0_rp + lfb * lfdh * c0z1 * sqrt( z1 / z0m ) * sqrt( abs( rib ) ) )
579 fm10 = 1.0_rp - lfb * rib / ( 1.0_rp + lfb * lfdm * c010 * sqrt( 10.0_rp / z0m ) * sqrt( abs( rib ) ) )
580 fm02 = 1.0_rp - lfb * rib / ( 1.0_rp + lfb * lfdm * c002 * sqrt( 2.0_rp / z0m ) * sqrt( abs( rib ) ) )
581 fh02 = 1.0_rp - lfb * rib / ( 1.0_rp + lfb * lfdh * c002 * sqrt( 2.0_rp / z0m ) * sqrt( abs( rib ) ) )
584 t0thz1 = 1.0_rp / ( 1.0_rp + logz0mz0h / logz1z0m / sqrt( fmz1 ) * fhz1 )
585 q0qez1 = 1.0_rp / ( 1.0_rp + logz0mz0e / logz1z0m / sqrt( fmz1 ) * fhz1 )
586 t0th02 = 1.0_rp / ( 1.0_rp + logz0mz0h / log02z0m / sqrt( fm02 ) * fh02 )
587 q0qe02 = 1.0_rp / ( 1.0_rp + logz0mz0e / log02z0m / sqrt( fm02 ) * fh02 )
590 chz1 = c0z1 * fhz1 * t0thz1 / tprn
591 cqz1 = c0z1 * fhz1 * q0qez1 / tprn
594 ch02 = c002 * fh02 * t0th02 / tprn
595 cq02 = c002 * fh02 * q0qe02 / tprn
597 ustar = sqrt( cmz1 ) * uabsw
598 tstar = chz1 * uabsw / ustar * ( th1 - th0 )
599 qstar = cqz1 * uabsw / ustar * ( q1 - q0 )
602 fracu10 = sqrt( cmz1 / cm10 )
603 fract2 = chz1 / ch02 * sqrt( cm02 / cmz1 )
604 fracq2 = cqz1 / cq02 * sqrt( cm02 / cmz1 )
606 rlmo = rib / z1 * karman * chz1 / ( cmz1 * sqrt( cmz1 ) )
608 ra = 1.0_rp / ( cqz1 * uabsw )
611 end subroutine bulkflux_u95
621 subroutine bulkflux_b91w01( &
627 Ustar, Tstar, Qstar, &
629 FracU10, FracT2, FracQ2 )
642 real(DP),
parameter :: dIL = 1.0e-6_dp
645 real(RP),
intent(in) :: T1
646 real(RP),
intent(in) :: T0
647 real(RP),
intent(in) :: P1
648 real(RP),
intent(in) :: P0
649 real(RP),
intent(in) :: Q1
650 real(RP),
intent(in) :: Q0
651 real(RP),
intent(in) :: Uabs
652 real(RP),
intent(in) :: Z1
653 real(RP),
intent(in) :: PBL
654 real(RP),
intent(in) :: Z0M
655 real(RP),
intent(in) :: Z0H
656 real(RP),
intent(in) :: Z0E
658 real(RP),
intent(out) :: Ustar
659 real(RP),
intent(out) :: Tstar
660 real(RP),
intent(out) :: Qstar
661 real(RP),
intent(out) :: Wstar
662 real(RP),
intent(out) :: RLmo
663 real(RP),
intent(out) :: Ra
664 real(RP),
intent(out) :: FracU10
665 real(RP),
intent(out) :: FracT2
666 real(RP),
intent(out) :: FracQ2
677 real(DP) :: UstarC, dUstarC
678 real(DP) :: TstarC, dTstarC
679 real(DP) :: QstarC, dQstarC
680 real(DP) :: WstarC, dWstar
682 real(DP) :: Rtot, CPtot
688 real(DP) :: BFLX, dBFLX
690 real(DP) :: DP_Z1, DP_Z0M, DP_Z0H, DP_Z0E
691 real(DP) :: log_Z1ovZ0M, log_Z1ovZ0H, log_Z1ovZ0E
693 real(DP) :: RzM, RzH, RzE
697 if ( bulkflux_nk2018 )
then
698 dp_z1 = real( z1*2.0_rp, kind=dp )
700 dp_z1 = real( z1, kind=dp )
702 dp_z0m = real( z0m, kind=dp )
703 dp_z0h = real( z0h, kind=dp )
704 dp_z0e = real( z0e, kind=dp )
706 uabsc = max( uabs, bulkflux_uabs_min )
708 rtot = rdry * ( 1.0_dp - q1 ) + rvap * q1
709 cptot = cpdry * ( 1.0_dp - q1 ) + cpvap * q1
710 th1 = t1 * ( p0 / p1 )**( rtot / cptot )
712 tv1 = th1 * ( 1.0_dp + epstvap * q1 )
713 tv0 = th0 * ( 1.0_dp + epstvap * q0 )
715 rzm = 1.0_dp - dp_z0m / dp_z1
716 rzh = 1.0_dp - dp_z0h / dp_z1
717 rze = 1.0_dp - dp_z0e / dp_z1
720 log_z1ovz0m = log( dp_z1 / dp_z0m )
721 log_z1ovz0h = log( dp_z1 / dp_z0h )
722 log_z1ovz0e = log( dp_z1 / dp_z0e )
726 rib0 = grav * dp_z1 * ( tv1 - tv0 ) / ( tv0 * uabsc**2 )
729 il = rib0 / dp_z1 * log_z1ovz0m**2 / log_z1ovz0h
732 wstarc = bulkflux_wstar_min
735 do n = 1, bulkflux_itr_sa_max
738 il, uabsc, th1, th0, tv0, q1, q0, pbl, &
739 log_z1ovz0m, log_z1ovz0h, log_z1ovz0e, &
740 dp_z1, dp_z0m, dp_z0h, dp_z0e, &
743 ustarc, tstarc, qstarc, bflx )
746 il = - karman * grav * bflx / ( ustarc**3 * tv0 )
750 do n = 1, bulkflux_itr_nr_max
755 il, uabsc, th1, th0, tv0, q1, q0, pbl, &
756 log_z1ovz0m, log_z1ovz0h, log_z1ovz0e, &
757 dp_z1, dp_z0m, dp_z0h, dp_z0e, &
760 ustarc, tstarc, qstarc, bflx )
762 il2 = sign( abs(il) + dil, il )
764 il2, uabsc, th1, th0, tv0, q1, q0, pbl, &
765 log_z1ovz0m, log_z1ovz0h, log_z1ovz0e, &
766 dp_z1, dp_z0m, dp_z0h, dp_z0e, &
769 dustarc, dtstarc, dqstarc, dbflx )
771 res = il + karman * grav * bflx / ( ustarc**3 * tv0 )
774 dres = 1.0_dp + karman * grav / ( tv0 * sign(dil,il) ) * ( dbflx / dustarc**3 - bflx / ustarc**3 )
777 if( abs( dres ) < 1e-20_rp )
exit
780 if( abs( res/dres ) < abs(il * eps) )
exit
783 if( il * ( il - res / dres ) < 0.0_rp )
then
784 if ( abs(il) <= eps )
exit
793 if( .NOT. abs( res/dres ) < abs(il * eps) )
then
796 il, uabsc, th1, th0, tv0, q1, q0, pbl, &
797 log_z1ovz0m, log_z1ovz0h, log_z1ovz0e, &
798 dp_z1, dp_z0m, dp_z0h, dp_z0e, &
801 ustarc, tstarc, qstarc, bflx )
804 il = - karman * grav * bflx / ( ustarc**3 * tv0 )
810 il, uabsc, th1, th0, tv0, q1, q0, pbl, &
811 log_z1ovz0m, log_z1ovz0h, log_z1ovz0e, &
812 dp_z1, dp_z0m, dp_z0h, dp_z0e, &
815 ustarc, tstarc, qstarc, bflx, &
817 fract2 = fract2, fracq2 = fracq2 )
821 ustar = real( ustarc, kind=rp )
822 tstar = real( tstarc, kind=rp )
823 qstar = real( qstarc, kind=rp )
824 wstar = real( wstarc, kind=rp )
826 ra = max( ( q1 - q0 ) / real(ustarc * qstarc + eps,kind=rp), real(eps,kind=rp) )
828 rlmo = real(il, kind=rp)
831 end subroutine bulkflux_b91w01
834 IL, Uabs, TH1, TH0, TV0, Q1, Q0, PBL, &
835 log_Z1ovZ0M, log_Z1ovZ0H, log_Z1ovZ0E, &
836 DP_Z1, DP_Z0M, DP_Z0H, DP_Z0E, &
839 Ustar, Tstar, Qstar, BFLX, &
840 FracU10, FracT2, FracQ2 )
846 real(DP),
intent(in) :: IL
847 real(DP),
intent(in) :: Uabs
848 real(DP),
intent(in) :: TH1
849 real(DP),
intent(in) :: TH0
850 real(DP),
intent(in) :: TV0
851 real(RP),
intent(in) :: Q1
852 real(RP),
intent(in) :: Q0
853 real(RP),
intent(in) :: PBL
854 real(DP),
intent(in) :: log_Z1ovZ0M
855 real(DP),
intent(in) :: log_Z1ovZ0H
856 real(DP),
intent(in) :: log_Z1ovZ0E
857 real(DP),
intent(in) :: DP_Z1
858 real(DP),
intent(in) :: DP_Z0M
859 real(DP),
intent(in) :: DP_Z0H
860 real(DP),
intent(in) :: DP_Z0E
861 real(DP),
intent(in) :: RzM
862 real(DP),
intent(in) :: RzH
863 real(DP),
intent(in) :: RzE
865 real(DP),
intent(inout) :: Wstar
867 real(DP),
intent(out) :: Ustar
868 real(DP),
intent(out) :: Tstar
869 real(DP),
intent(out) :: Qstar
870 real(DP),
intent(out) :: BFLX
872 real(RP),
intent(out),
optional :: FracU10
873 real(RP),
intent(out),
optional :: FracT2
874 real(RP),
intent(out),
optional :: FracQ2
876 real(DP) :: denoM, denoH, denoE
880 if ( il < 0.0_dp )
then
882 if ( bulkflux_nk2018 )
then
883 denom = log_z1ovz0m &
885 + rzm * ( fm_unstable(dp_z0m,il) - 1.0_dp )
886 tmp = fhm_unstable(dp_z1,il)
887 denoh = log_z1ovz0h &
888 - tmp + fhm_unstable(dp_z0h,il) * dp_z0h / dp_z1 &
889 + rzh * ( fh_unstable(dp_z0h,il) - 1.0_dp )
890 denoe = log_z1ovz0e &
891 - tmp + fhm_unstable(dp_z0e,il) * dp_z0e / dp_z1 &
892 + rze * ( fh_unstable(dp_z0e,il) - 1.0_dp )
894 denom = log_z1ovz0m - fm_unstable(dp_z1,il) + fm_unstable(dp_z0m,il)
895 tmp = fh_unstable(dp_z1,il)
896 denoh = log_z1ovz0h - tmp + fh_unstable(dp_z0h,il)
897 denoe = log_z1ovz0e - tmp + fh_unstable(dp_z0e,il)
899 ustar = karman / denom * sqrt( uabs**2 + (bulkflux_wscf*wstar)**2 )
900 tstar = karman / denoh * ( th1 - th0 )
901 qstar = karman / denoe * ( q1 - q0 )
902 if (
present(fracu10) )
then
903 fracu10 = ( log(10.0_dp/dp_z0m) - fm_unstable(10.0_dp,il) + fm_unstable(dp_z0m,il) ) / denom
904 tmp = fm_unstable(2.0_dp,il)
905 fract2 = ( log(2.0_dp/dp_z0h) - tmp + fh_unstable(dp_z0h,il) ) / denoh
906 fracq2 = ( log(2.0_dp/dp_z0e) - tmp + fh_unstable(dp_z0e,il) ) / denoe
911 if ( bulkflux_nk2018 )
then
912 denom = log_z1ovz0m &
913 - fmm_stable(dp_z1,il) + fmm_stable(dp_z0m,il) * dp_z0m / dp_z1 &
914 + rzm * ( fm_stable(dp_z0m,il) - 1.0_dp )
915 tmp = fhm_stable(dp_z1,il)
916 denoh = log_z1ovz0h &
917 - tmp + fhm_stable(dp_z0h,il) * dp_z0h / dp_z1 &
918 + rzh * ( fh_stable(dp_z0h,il) - 1.0_dp )
919 denoe = log_z1ovz0e &
920 - tmp + fhm_stable(dp_z0e,il) * dp_z0e / dp_z1 &
921 + rze * ( fh_stable(dp_z0e,il) - 1.0_dp )
923 denom = log_z1ovz0m - fm_stable(dp_z1,il) + fm_stable(dp_z0m,il)
924 tmp = fh_stable(dp_z1,il)
925 denoh = log_z1ovz0h - tmp + fh_stable(dp_z0h,il)
926 denoe = log_z1ovz0e - tmp + fh_stable(dp_z0e,il)
928 ustar = karman / denom * uabs
929 tstar = karman / denoh * ( th1 - th0 )
930 qstar = karman / denoe * ( q1 - q0 )
931 if (
present(fracu10) )
then
932 fracu10 = ( log(10.0_dp/dp_z0m) - fm_stable(10.0_dp,il) + fm_stable(dp_z0m,il) ) / denom
933 tmp = fh_stable(2.0_dp,il)
934 fract2 = ( log(2.0_dp/dp_z0h) - tmp + fh_stable(dp_z0h,il) ) / denoh
935 fracq2 = ( log(2.0_dp/dp_z0e) - tmp + fh_stable(dp_z0e,il) ) / denoe
941 bflx = - ustar * tstar - epstvap * ustar * qstar * tv0
944 tmp = pbl * grav / tv0 * bflx
945 sw = 0.5_dp + sign( 0.5_dp, tmp )
946 wstar = ( tmp * sw )**( 1.0_dp / 3.0_dp )
949 ustar = sign( max( abs(ustar), eps ), ustar )
956 function fm_unstable( Z, IL )
962 real(DP),
intent(in) :: Z
963 real(DP),
intent(in) :: IL
966 real(DP) :: fm_unstable
969 real(DP),
parameter :: gamma = 3.6_dp
976 r = min( z * il, 0.0_dp )
980 fm_unstable = 3.0_dp * log( ( 1.0_dp + sqrt( 1.0_dp + gamma * (-r)**(2.0_dp/3.0_dp) ) ) * 0.5_dp )
983 r4r = sqrt( sqrt( 1.0_dp - 16.0_dp * r ) )
984 fm_unstable = log( ( 1.0_dp + r4r )**2 * ( 1.0_dp + r4r * r4r ) * 0.125_dp ) - 2.0_dp * atan( r4r ) + pi * 0.5_dp
988 end function fm_unstable
995 real(
dp),
intent(in) :: z
996 real(
dp),
intent(in) :: il
1002 real(
dp),
parameter :: gamma = 3.6_dp
1007 real(
dp) :: r4r, r2r
1010 r = min( z * il, 0.0_dp )
1012 if ( flag_w01 )
then
1014 r3 = (-r)**(1.0_dp/3.0_dp)
1015 if ( r > -eps )
then
1018 f = sqrt( 1.0_dp + gamma * r3**2 )
1019 fmm_unstable = 3.0_dp * log( ( 1.0_dp + f ) * 0.5_dp ) &
1020 + 1.5_dp / ( sqrt(gamma)**3 * r) * asinh( sqrt(gamma) * r3 ) &
1021 + 1.5_dp * f / ( gamma * r3**2 ) &
1026 if ( r > -eps )
then
1029 r2r = sqrt( 1.0_dp - 16.0_dp * r )
1031 fmm_unstable = log( ( 1.0_dp + r4r )**2 * ( 1.0_dp + r2r ) * 0.125_dp ) &
1032 - 2.0_dp * atan( r4r ) &
1033 + ( 1.0_dp - r4r*r2r ) / ( 12.0_dp * r ) &
1034 + pi * 0.5_dp - 1.0_dp
1043 function fh_unstable( Z, IL )
1047 real(
dp),
intent(in) :: z
1048 real(
dp),
intent(in) :: il
1051 real(
dp) :: fh_unstable
1054 real(
dp),
parameter :: pt = 0.95_dp
1055 real(
dp),
parameter :: gamma = 7.9_dp
1061 r = min( z * il, 0.0_dp )
1063 if ( flag_w01 )
then
1065 fh_unstable = 3.0_dp * log( ( 1.0_dp + sqrt( 1.0_dp + gamma * (-r)**(2.0_dp/3.0_dp) ) ) * 0.5_dp ) * pt &
1066 + log( z ) * ( 1.0_dp - pt )
1069 fh_unstable = 2.0_dp * log( ( 1.0_dp + sqrt( 1.0_dp - 16.0_dp * r ) ) * 0.5_dp )
1073 end function fh_unstable
1074 function fhm_unstable( Z, IL )
1078 real(
dp),
intent(in) :: z
1079 real(
dp),
intent(in) :: il
1082 real(
dp) :: fhm_unstable
1085 real(
dp),
parameter :: pt = 0.95_dp
1086 real(
dp),
parameter :: gamma = 7.9_dp
1094 r = min( z * il, 0.0_dp )
1096 if ( flag_w01 )
then
1098 r3 = (-r)**(1.0_dp/3.0_dp)
1099 if ( r > -eps )
then
1100 fhm_unstable = 9.0_dp / 20.0_dp * gamma * r3**2
1102 f = sqrt( 1.0_dp + gamma * r3**2 )
1103 fhm_unstable = 3.0_dp * log( ( 1.0_dp + f ) * 0.5_dp ) &
1104 + 1.5_dp / ( sqrt(gamma)**3 * r) * asinh( sqrt(gamma) * r3 ) &
1105 + 1.5_dp * f / ( gamma * r3**2 ) &
1107 fhm_unstable = fhm_unstable * pt + ( log( z ) - 1.0_dp ) * ( 1.0_dp - pt )
1111 if ( r > -eps )
then
1112 fhm_unstable = - 4.0_dp * r
1114 r2r = sqrt( 1.0_dp - 16.0_dp * r )
1115 fhm_unstable = 2.0_dp * log( ( 1.0_dp + r2r ) * 0.5_dp ) &
1116 + ( 1.0_dp - r2r ) / ( 8.0_dp * r ) &
1122 end function fhm_unstable
1126 function fm_stable( Z, IL )
1130 real(
dp),
intent(in) :: z
1131 real(
dp),
intent(in) :: il
1134 real(
dp) :: fm_stable
1137 real(
dp),
parameter :: a = 1.0_dp
1138 real(
dp),
parameter :: b = 0.667_dp
1139 real(
dp),
parameter :: c = 5.0_dp
1140 real(
dp),
parameter :: d = 0.35_dp
1146 r = max( z * il, 0.0_dp )
1149 #if defined(PGI) || defined(SX)
1150 fm_stable = - a*r - b*( r - c/d )*exp( -min( d*r, 1.e+3_rp ) ) - b*c/d
1152 fm_stable = - a*r - b*( r - c/d )*exp( -d*r ) - b*c/d
1156 end function fm_stable
1157 function fmm_stable( Z, IL )
1161 real(
dp),
intent(in) :: z
1162 real(
dp),
intent(in) :: il
1165 real(
dp) :: fmm_stable
1168 real(
dp),
parameter :: a = 1.0_dp
1169 real(
dp),
parameter :: b = 0.667_dp
1170 real(
dp),
parameter :: c = 5.0_dp
1171 real(
dp),
parameter :: d = 0.35_dp
1177 r = max( z * il, 0.0_dp )
1181 fmm_stable = - 0.5_dp * ( a + b * c + d ) * r
1183 fmm_stable = b * ( d*r - c + 1.0_dp ) / ( d**2 * r ) &
1184 #if defined(PGI) || defined(SX)
1186 * exp( -min( d*r, 1.e+3_dp ) ) &
1191 - b * ( c*d*r - c + 1.0_dp ) / ( d**2 * r )
1195 end function fmm_stable
1199 function fh_stable( Z, IL )
1203 real(
dp),
intent(in) :: z
1204 real(
dp),
intent(in) :: il
1207 real(
dp) :: fh_stable
1210 real(
dp),
parameter :: a = 1.0_dp
1211 real(
dp),
parameter :: b = 0.667_dp
1212 real(
dp),
parameter :: c = 5.0_dp
1213 real(
dp),
parameter :: d = 0.35_dp
1219 r = max( z * il, 0.0_dp )
1222 #if defined(PGI) || defined(SX)
1223 fh_stable = 1.0_dp - ( 1.0_dp + 2.0_dp/3.0_dp * a*r )**1.5_dp - b*( r - c/d )*exp( -min( d*r, 1.e+3_rp ) ) - b*c/d
1225 fh_stable = 1.0_dp - ( 1.0_dp + 2.0_dp/3.0_dp * a*r )**1.5_dp - b*( r - c/d )*exp( -d*r ) - b*c/d
1229 end function fh_stable
1230 function fhm_stable( Z, IL )
1234 real(
dp),
intent(in) :: z
1235 real(
dp),
intent(in) :: il
1238 real(
dp) :: fhm_stable
1241 real(
dp),
parameter :: a = 1.0_dp
1242 real(
dp),
parameter :: b = 0.667_dp
1243 real(
dp),
parameter :: c = 5.0_dp
1244 real(
dp),
parameter :: d = 0.35_dp
1250 r = max( z * il, 0.0_dp )
1254 fhm_stable = - 0.5_dp * ( a + b*c + b ) * r
1256 fhm_stable = b * ( d*r - c + 1.0_dp ) / ( d**2 * r ) &
1257 #if defined(PGI) || defined(SX)
1258 * exp( -min( d*r, 1.e+3_dp) ) &
1262 - 3.0_dp * sqrt( 1.0_dp + 2.0_dp*a*r/3.0_dp )**5 / ( 5.0_dp * a * r ) &
1263 - b * ( c*d*r - c + 1.0_dp ) / ( d**2 * r ) &
1264 + 0.6_rp / ( a * r ) + 1.0_dp
1268 end function fhm_stable