55 real(RP),
intent(out) :: ustar
56 real(RP),
intent(out) :: tstar
57 real(RP),
intent(out) :: qstar
58 real(RP),
intent(out) :: uabs
59 real(RP),
intent(out) :: ra
60 real(RP),
intent(out) :: fracu10
61 real(RP),
intent(out) :: fract2
62 real(RP),
intent(out) :: fracq2
64 real(RP),
intent(in) :: t1
65 real(RP),
intent(in) :: t0
66 real(RP),
intent(in) :: p1
67 real(RP),
intent(in) :: p0
68 real(RP),
intent(in) :: q1
69 real(RP),
intent(in) :: q0
70 real(RP),
intent(in) :: u1
71 real(RP),
intent(in) :: v1
72 real(RP),
intent(in) :: z1
73 real(RP),
intent(in) :: pbl
74 real(RP),
intent(in) :: z0m
75 real(RP),
intent(in) :: z0h
76 real(RP),
intent(in) :: z0e
91 private :: bulkflux_u95
92 private :: bulkflux_b91w01
93 private :: fm_unstable
94 private :: fh_unstable
102 character(len=H_SHORT),
private :: bulkflux_type =
'B91W01' 104 logical,
private :: bulkflux_use_mean = .true.
106 integer,
private :: bulkflux_itr_sa_max = 5
107 integer,
private :: bulkflux_itr_nr_max = 10
109 real(RP),
private :: bulkflux_err_min = 1.0e-3_rp
111 real(RP),
private :: bulkflux_wscf
114 real(RP),
private :: bulkflux_uabs_min = 1.0e-2_rp
115 real(RP),
private :: bulkflux_wstar_min = 1.0e-4_rp
117 logical,
private :: flag_w01
128 real(RP),
intent(in) :: dx
130 namelist / param_bulkflux / &
133 bulkflux_itr_sa_max, &
134 bulkflux_itr_nr_max, &
144 log_info(
"BULKFLUX_setup",*)
'Setup' 148 bulkflux_wscf = 1.2_rp * min(dx*1.e-3_rp, 1.0_rp)
156 log_info(
"BULKFLUX_setup",*)
'Not found namelist. Default used.' 157 elseif( ierr > 0 )
then 158 log_error(
"BULKFLUX_setup",*)
'Not appropriate names in namelist PARAM_BULKFLUX. Check!' 161 log_nml(param_bulkflux)
164 log_info(
"BULKFLUX_setup",*)
'Scheme for surface bulk flux : ', trim(bulkflux_type)
165 select case(bulkflux_type)
167 log_info_cont(*)
'=> Uno et al.(1995)' 170 log_info_cont(*)
'=> Beljaars (1991) and Wilson (2001)' 174 log_info_cont(*)
'=> Beljaars (1994)' 178 log_error(
"BULKFLUX_setup",*)
'Unsupported BULKFLUX_type. STOP' 188 subroutine bulkflux_u95( &
219 real(RP),
parameter :: tPrn = 0.74_rp
220 real(RP),
parameter :: LFb = 9.4_rp
221 real(RP),
parameter :: LFbp = 4.7_rp
222 real(RP),
parameter :: LFdm = 7.4_rp
223 real(RP),
parameter :: LFdh = 5.3_rp
226 real(RP),
intent(out) :: Ustar
227 real(RP),
intent(out) :: Tstar
228 real(RP),
intent(out) :: Qstar
229 real(RP),
intent(out) :: Uabs
230 real(RP),
intent(out) :: Ra
231 real(RP),
intent(out) :: FracU10
232 real(RP),
intent(out) :: FracT2
233 real(RP),
intent(out) :: FracQ2
235 real(RP),
intent(in) :: T1
236 real(RP),
intent(in) :: T0
237 real(RP),
intent(in) :: P1
238 real(RP),
intent(in) :: P0
239 real(RP),
intent(in) :: Q1
240 real(RP),
intent(in) :: Q0
241 real(RP),
intent(in) :: U1
242 real(RP),
intent(in) :: V1
243 real(RP),
intent(in) :: Z1
244 real(RP),
intent(in) :: PBL
245 real(RP),
intent(in) :: Z0M
246 real(RP),
intent(in) :: Z0H
247 real(RP),
intent(in) :: Z0E
250 real(RP) :: RiB0, RiB
251 real(RP) :: C0Z1, C010, C002
252 real(RP) :: CmZ1, ChZ1, CqZ1, fmZ1, fhZ1, t0thZ1, q0qeZ1
253 real(RP) :: Cm10, fm10
254 real(RP) :: Cm02, Ch02, Cq02, fm02, fh02, t0th02, q0qe02
256 real(RP) :: logZ1Z0M, log10Z0m, log02Z0m
257 real(RP) :: logZ0MZ0E
258 real(RP) :: logZ0MZ0H
261 logz1z0m = log( z1 / z0m )
262 log10z0m = log( 10.0_rp / z0m )
263 log02z0m = log( 2.0_rp / z0m )
265 logz0mz0e = max( log( z0m/z0e ), 1.0_rp )
266 logz0mz0h = max( log( z0m/z0h ), 1.0_rp )
268 uabs = max( sqrt( u1**2 + v1**2 ), bulkflux_uabs_min )
269 th1 = t1 * ( p0 / p1 )**( rdry / cpdry )
273 rib0 = grav * z1 * ( th1 - th0 ) / ( th1 * uabs**2 )
275 c0z1 = ( karman / logz1z0m )**2
276 c010 = ( karman / log10z0m )**2
277 c002 = ( karman / log02z0m )**2
281 if( rib0 > 0.0_rp )
then 283 fmz1 = 1.0_rp / ( 1.0_rp + lfbp * rib )**2
284 fhz1 = 1.0_rp / ( 1.0_rp + lfbp * rib )**2
285 fm10 = 1.0_rp / ( 1.0_rp + lfbp * rib )**2
286 fm02 = 1.0_rp / ( 1.0_rp + lfbp * rib )**2
287 fh02 = 1.0_rp / ( 1.0_rp + lfbp * rib )**2
290 fmz1 = 1.0_rp - lfb * rib / ( 1.0_rp + lfb * lfdm * c0z1 * sqrt( z1 / z0m ) * sqrt( abs( rib ) ) )
291 fhz1 = 1.0_rp - lfb * rib / ( 1.0_rp + lfb * lfdh * c0z1 * sqrt( z1 / z0m ) * sqrt( abs( rib ) ) )
292 fm10 = 1.0_rp - lfb * rib / ( 1.0_rp + lfb * lfdm * c010 * sqrt( 10.0_rp / z0m ) * sqrt( abs( rib ) ) )
293 fm02 = 1.0_rp - lfb * rib / ( 1.0_rp + lfb * lfdm * c002 * sqrt( 2.0_rp / z0m ) * sqrt( abs( rib ) ) )
294 fh02 = 1.0_rp - lfb * rib / ( 1.0_rp + lfb * lfdh * c002 * sqrt( 2.0_rp / z0m ) * sqrt( abs( rib ) ) )
297 t0thz1 = 1.0_rp / ( 1.0_rp + logz0mz0h / logz1z0m / sqrt( fmz1 ) * fhz1 )
298 q0qez1 = 1.0_rp / ( 1.0_rp + logz0mz0e / logz1z0m / sqrt( fmz1 ) * fhz1 )
299 t0th02 = 1.0_rp / ( 1.0_rp + logz0mz0h / log02z0m / sqrt( fm02 ) * fh02 )
300 q0qe02 = 1.0_rp / ( 1.0_rp + logz0mz0e / log02z0m / sqrt( fm02 ) * fh02 )
304 if( rib0 > 0.0_rp )
then 306 fmz1 = 1.0_rp / ( 1.0_rp + lfbp * rib )**2
307 fhz1 = 1.0_rp / ( 1.0_rp + lfbp * rib )**2
308 fm10 = 1.0_rp / ( 1.0_rp + lfbp * rib )**2
309 fm02 = 1.0_rp / ( 1.0_rp + lfbp * rib )**2
310 fh02 = 1.0_rp / ( 1.0_rp + lfbp * rib )**2
313 fmz1 = 1.0_rp - lfb * rib / ( 1.0_rp + lfb * lfdm * c0z1 * sqrt( z1 / z0m ) * sqrt( abs( rib ) ) )
314 fhz1 = 1.0_rp - lfb * rib / ( 1.0_rp + lfb * lfdh * c0z1 * sqrt( z1 / z0m ) * sqrt( abs( rib ) ) )
315 fm10 = 1.0_rp - lfb * rib / ( 1.0_rp + lfb * lfdm * c010 * sqrt( 10.0_rp / z0m ) * sqrt( abs( rib ) ) )
316 fm02 = 1.0_rp - lfb * rib / ( 1.0_rp + lfb * lfdm * c002 * sqrt( 2.0_rp / z0m ) * sqrt( abs( rib ) ) )
317 fh02 = 1.0_rp - lfb * rib / ( 1.0_rp + lfb * lfdh * c002 * sqrt( 2.0_rp / z0m ) * sqrt( abs( rib ) ) )
320 t0thz1 = 1.0_rp / ( 1.0_rp + logz0mz0h / logz1z0m / sqrt( fmz1 ) * fhz1 )
321 q0qez1 = 1.0_rp / ( 1.0_rp + logz0mz0e / logz1z0m / sqrt( fmz1 ) * fhz1 )
322 t0th02 = 1.0_rp / ( 1.0_rp + logz0mz0h / log02z0m / sqrt( fm02 ) * fh02 )
323 q0qe02 = 1.0_rp / ( 1.0_rp + logz0mz0e / log02z0m / sqrt( fm02 ) * fh02 )
326 chz1 = c0z1 * fhz1 * t0thz1 / tprn
327 cqz1 = c0z1 * fhz1 * q0qez1 / tprn
330 ch02 = c002 * fh02 * t0th02 / tprn
331 cq02 = c002 * fh02 * q0qe02 / tprn
333 ustar = sqrt( cmz1 ) * uabs
334 tstar = chz1 * uabs / ustar * ( th1 - th0 )
335 qstar = cqz1 * uabs / ustar * ( q1 - q0 )
337 fracu10 = sqrt( cmz1 / cm10 )
338 fract2 = chz1 / ch02 * sqrt( cm02 / cmz1 )
339 fracq2 = cqz1 / cq02 * sqrt( cm02 / cmz1 )
341 ra = 1.0_rp / ( cqz1 * uabs )
344 end subroutine bulkflux_u95
357 subroutine bulkflux_b91w01( &
390 real(DP),
parameter :: dIL = 1.0e-6_dp
393 real(RP),
intent(out) :: Ustar
394 real(RP),
intent(out) :: Tstar
395 real(RP),
intent(out) :: Qstar
396 real(RP),
intent(out) :: Uabs
397 real(RP),
intent(out) :: Ra
398 real(RP),
intent(out) :: FracU10
399 real(RP),
intent(out) :: FracT2
400 real(RP),
intent(out) :: FracQ2
402 real(RP),
intent(in) :: T1
403 real(RP),
intent(in) :: T0
404 real(RP),
intent(in) :: P1
405 real(RP),
intent(in) :: P0
406 real(RP),
intent(in) :: Q1
407 real(RP),
intent(in) :: Q0
408 real(RP),
intent(in) :: U1
409 real(RP),
intent(in) :: V1
410 real(RP),
intent(in) :: Z1
411 real(RP),
intent(in) :: PBL
412 real(RP),
intent(in) :: Z0M
413 real(RP),
intent(in) :: Z0H
414 real(RP),
intent(in) :: Z0E
424 real(DP) :: Wstar, dWstar
426 real(DP) :: UabsUS, UabsS, UabsC
427 real(DP) :: dUabsUS, dUabsS
429 real(DP) :: UstarUS, UstarS, UstarC
430 real(DP) :: TstarUS, TstarS, TstarC
431 real(DP) :: QstarUS, QstarS, QstarC
433 real(DP) :: dUstarUS, dUstarS, dUstarC
434 real(DP) :: dTstarUS, dTstarS, dTstarC
435 real(DP) :: dQstarUS, dQstarS, dQstarC
437 real(DP) :: FracU10US, FracU10S, FracU10C
438 real(DP) :: FracT2US, FracT2S, FracT2C
439 real(DP) :: FracQ2US, FracQ2S, FracQ2C
441 real(DP) :: TH1, TH0, THM
442 real(DP) :: TV1, TV0, TVM
446 real(DP) :: BFLX, dBFLX
448 real(DP) :: DP_Z1, DP_Z0M, DP_Z0H, DP_Z0E
449 real(DP) :: log_Z1ovZ0M, log_Z1ovZ0H, log_Z1ovZ0E
450 real(DP) :: log_10ovZ0M, log_02ovZ0H, log_02ovZ0E
452 real(DP) :: denoM, denoH, denoE
453 real(DP) :: RzM, RzH, RzE
457 if ( bulkflux_use_mean )
then 458 dp_z1 =
real( z1*2.0_rp, kind=
dp )
460 dp_z1 =
real( z1, kind=
dp )
462 dp_z0m =
real( z0m, kind=
dp )
463 dp_z0h =
real( z0h, kind=
dp )
464 dp_z0e =
real( z0e, kind=
dp )
466 uabsc = max( sqrt( u1**2 + v1**2 ), bulkflux_uabs_min )
468 th1 = t1 * ( p0 / p1 )**( rdry / cpdry )
470 thm = ( th1 + th0 ) * 0.5_rp
471 qm = ( q1 + q0 ) * 0.5_rp
472 tv1 = th1 * ( 1.0_dp + epstvap * q1 )
473 tv0 = th0 * ( 1.0_dp + epstvap * q0 )
474 tvm = ( tv1 + tv0 ) * 0.5_rp
476 rzm = 1.0_dp - dp_z0m / dp_z1
477 rzh = 1.0_dp - dp_z0h / dp_z1
478 rze = 1.0_dp - dp_z0e / dp_z1
481 log_z1ovz0m = log( dp_z1 / dp_z0m )
482 log_z1ovz0h = log( dp_z1 / dp_z0h )
483 log_z1ovz0e = log( dp_z1 / dp_z0e )
485 log_10ovz0m = log( 10.0_dp / dp_z0m )
486 log_02ovz0h = log( 2.0_dp / dp_z0h )
487 log_02ovz0e = log( 2.0_dp / dp_z0e )
490 rib0 = grav * dp_z1 * ( tv1 - tv0 ) / ( tvm * uabsc**2 )
493 il = rib0 / dp_z1 * log_z1ovz0m**2 / log_z1ovz0h
496 wstar = bulkflux_wstar_min
497 dwstar = bulkflux_wstar_min
500 do n = 1, bulkflux_itr_sa_max
501 if ( bulkflux_use_mean )
then 502 denom = log_z1ovz0m &
504 + rzm * ( fm_unstable(dp_z0m,il) - 1.0_dp )
505 denoh = log_z1ovz0h &
506 - fhm_unstable(dp_z1,il) + fhm_unstable(dp_z0h,il) * dp_z0h / dp_z1 &
507 + rzh * ( fh_unstable(dp_z0h,il) - 1.0_dp )
508 denoe = log_z1ovz0e &
509 - fhm_unstable(dp_z1,il) + fhm_unstable(dp_z0e,il) * dp_z0e / dp_z1 &
510 + rze * ( fh_unstable(dp_z0e,il) - 1.0_dp )
512 denom = log_z1ovz0m - fm_unstable(dp_z1,il) + fm_unstable(dp_z0m,il)
513 denoh = log_z1ovz0h - fh_unstable(dp_z1,il) + fh_unstable(dp_z0h,il)
514 denoe = log_z1ovz0e - fh_unstable(dp_z1,il) + fh_unstable(dp_z0e,il)
517 uabsus = max( sqrt( u1**2 + v1**2 + (bulkflux_wscf*wstar)**2 ),
real( BULKFLUX_Uabs_min, kind=DP ) )
518 ustarus = karman / denom * uabsus
519 tstarus = karman / denoh * ( th1 - th0 )
520 qstarus = karman / denoe * ( q1 - q0 )
526 if ( bulkflux_use_mean )
then 527 denom = log_z1ovz0m &
528 - fmm_stable(dp_z1,il) + fmm_stable(dp_z0m,il) * dp_z0m / dp_z1 &
529 + rzm * ( fm_stable(dp_z0m,il) - 1.0_dp )
530 denoh = log_z1ovz0h &
531 - fhm_stable(dp_z1,il) + fhm_stable(dp_z0h,il) * dp_z0h / dp_z1 &
532 + rzh * ( fh_stable(dp_z0h,il) - 1.0_dp )
533 denoe = log_z1ovz0e &
534 - fhm_stable(dp_z1,il) + fhm_stable(dp_z0e,il) * dp_z0e / dp_z1 &
535 + rze * ( fh_stable(dp_z0e,il) - 1.0_dp )
537 denom = log_z1ovz0m - fm_stable(dp_z1,il) + fm_stable(dp_z0m,il)
538 denoh = log_z1ovz0h - fh_stable(dp_z1,il) + fh_stable(dp_z0h,il)
539 denoe = log_z1ovz0e - fh_stable(dp_z1,il) + fh_stable(dp_z0e,il)
541 uabss = max( sqrt( u1**2 + v1**2 ), bulkflux_uabs_min )
542 ustars = karman / denom * uabss
543 tstars = karman / denoh * ( th1 - th0 )
544 qstars = karman / denoe * ( q1 - q0 )
549 sw = 0.5_dp - sign( 0.5_dp, il )
551 ustarc = ( sw ) * ustarus + ( 1.0_dp-sw ) * ustars
552 tstarc = ( sw ) * tstarus + ( 1.0_dp-sw ) * tstars
553 qstarc = ( sw ) * qstarus + ( 1.0_dp-sw ) * qstars
556 bflx = - ustarc * tstarc * ( 1.0_rp + epstvap * qm ) - epstvap * ustarc * qstarc * thm
559 tmp = pbl * grav / t1 * bflx
560 sw = 0.5_dp + sign( 0.5_dp, tmp )
562 wstar = ( tmp * sw )**( 1.0_dp / 3.0_dp )
565 sw = 0.5_dp + sign( 0.5_dp, abs( ustarc ) - eps )
567 ustarc = ( sw ) * ustarc + ( 1.0_dp-sw ) * eps
570 il = - karman * grav * bflx / ( ustarc**3 * thm )
575 do n = 1, bulkflux_itr_nr_max
577 if ( bulkflux_use_mean )
then 578 denom = log_z1ovz0m &
580 + rzm * ( fm_unstable(dp_z0m,il) - 1.0_dp )
581 denoh = log_z1ovz0h &
582 - fhm_unstable(dp_z1,il) + fhm_unstable(dp_z0h,il) * dp_z0h / dp_z1 &
583 + rzh * ( fh_unstable(dp_z0h,il) - 1.0_dp )
584 denoe = log_z1ovz0e &
585 - fhm_unstable(dp_z1,il) + fhm_unstable(dp_z0e,il) * dp_z0e / dp_z1 &
586 + rze * ( fh_unstable(dp_z0e,il) - 1.0_dp )
588 denom = log_z1ovz0m - fm_unstable(dp_z1,il) + fm_unstable(dp_z0m,il)
589 denoh = log_z1ovz0h - fh_unstable(dp_z1,il) + fh_unstable(dp_z0h,il)
590 denoe = log_z1ovz0e - fh_unstable(dp_z1,il) + fh_unstable(dp_z0e,il)
592 uabsus = max( sqrt( u1**2 + v1**2 + (bulkflux_wscf*wstar)**2 ),
real( BULKFLUX_Uabs_min, kind=DP ) )
593 ustarus = karman / denom * uabsus
594 tstarus = karman / denoh * ( th1 - th0 )
595 qstarus = karman / denoe * ( q1 - q0 )
601 if ( bulkflux_use_mean )
then 602 denom = log_z1ovz0m &
603 - fmm_stable(dp_z1,il) + fmm_stable(dp_z0m,il) * dp_z0m / dp_z1 &
604 + rzm * ( fm_stable(dp_z0m,il) - 1.0_dp )
605 denoh = log_z1ovz0h &
606 - fhm_stable(dp_z1,il) + fhm_stable(dp_z0h,il) * dp_z0h / dp_z1 &
607 + rzh * ( fh_stable(dp_z0h,il) - 1.0_dp )
608 denoe = log_z1ovz0e &
609 - fhm_stable(dp_z1,il) + fhm_stable(dp_z0e,il) * dp_z0e / dp_z1 &
610 + rze * ( fh_stable(dp_z0e,il) - 1.0_dp )
612 denom = log_z1ovz0m - fm_stable(dp_z1,il) + fm_stable(dp_z0m,il)
613 denoh = log_z1ovz0h - fh_stable(dp_z1,il) + fh_stable(dp_z0h,il)
614 denoe = log_z1ovz0e - fh_stable(dp_z1,il) + fh_stable(dp_z0e,il)
616 uabss = max( sqrt( u1**2 + v1**2 ), bulkflux_uabs_min )
617 ustars = karman / denom * uabss
618 tstars = karman / denoh * ( th1 - th0 )
619 qstars = karman / denoe * ( q1 - q0 )
624 sw = 0.5_dp - sign( 0.5_dp, il )
626 ustarc = ( sw ) * ustarus + ( 1.0_dp-sw ) * ustars
627 tstarc = ( sw ) * tstarus + ( 1.0_dp-sw ) * tstars
628 qstarc = ( sw ) * qstarus + ( 1.0_dp-sw ) * qstars
631 bflx = - ustarc * tstarc * ( 1.0_rp + epstvap * qm ) - epstvap * ustarc * qstarc * thm
634 tmp = pbl * grav / t1 * bflx
635 sw = 0.5_dp + sign( 0.5_dp, tmp )
637 wstar = ( tmp * sw )**( 1.0_dp / 3.0_dp )
640 sw = 0.5_dp + sign( 0.5_dp, abs( ustarc ) - eps )
642 ustarc = ( sw ) * ustarc + ( 1.0_dp-sw ) * eps
645 res = il + karman * grav * bflx / ( ustarc**3 * thm )
648 if ( bulkflux_use_mean )
then 649 denom = log_z1ovz0m &
651 + rzm * ( fm_unstable(dp_z0m,il+dil) - 1.0_dp )
652 denoh = log_z1ovz0h &
653 - fhm_unstable(dp_z1,il+dil) + fhm_unstable(dp_z0h,il+dil) * dp_z0h / dp_z1 &
654 + rzh * ( fh_unstable(dp_z0h,il+dil) - 1.0_dp )
655 denoe = log_z1ovz0e &
656 - fhm_unstable(dp_z1,il+dil) + fhm_unstable(dp_z0e,il+dil) * dp_z0e / dp_z1 &
657 + rze * ( fh_unstable(dp_z0e,il+dil) - 1.0_dp )
659 denom = log_z1ovz0m - fm_unstable(dp_z1,il+dil) + fm_unstable(dp_z0m,il+dil)
660 denoh = log_z1ovz0h - fh_unstable(dp_z1,il+dil) + fh_unstable(dp_z0h,il+dil)
661 denoe = log_z1ovz0e - fh_unstable(dp_z1,il+dil) + fh_unstable(dp_z0e,il+dil)
663 duabsus = max( sqrt( u1**2 + v1**2 + (bulkflux_wscf*wstar)**2 ),
real( BULKFLUX_Uabs_min, kind=DP ) )
664 dustarus = karman / denom * uabsus
665 dtstarus = karman / denoh * ( th1 - th0 )
666 dqstarus = karman / denoe * ( q1 - q0 )
672 if ( bulkflux_use_mean )
then 673 denom = log_z1ovz0m &
674 - fmm_stable(dp_z1,il+dil) + fmm_stable(dp_z0m,il+dil) * dp_z0m / dp_z1 &
675 + rzm * ( fm_stable(dp_z0m,il+dil) - 1.0_dp )
676 denoh = log_z1ovz0h &
677 - fhm_stable(dp_z1,il+dil) + fhm_stable(dp_z0h,il+dil) * dp_z0h / dp_z1 &
678 + rzh * ( fh_stable(dp_z0h,il+dil) - 1.0_dp )
679 denoe = log_z1ovz0e &
680 - fhm_stable(dp_z1,il+dil) + fhm_stable(dp_z0e,il+dil) * dp_z0e / dp_z1 &
681 + rze * ( fh_stable(dp_z0e,il+dil) - 1.0_dp )
683 denom = log_z1ovz0m - fm_stable(dp_z1,il+dil) + fm_stable(dp_z0m,il+dil)
684 denoh = log_z1ovz0h - fh_stable(dp_z1,il+dil) + fh_stable(dp_z0h,il+dil)
685 denoe = log_z1ovz0e - fh_stable(dp_z1,il+dil) + fh_stable(dp_z0e,il+dil)
687 duabss = max( sqrt( u1**2 + v1**2 ), bulkflux_uabs_min )
688 dustars = karman / denom * uabss
689 dtstars = karman / denoh * ( th1 - th0 )
690 dqstars = karman / denoe * ( q1 - q0 )
695 sw = 0.5_dp - sign( 0.5_dp, il+dil )
697 dustarc = ( sw ) * dustarus + ( 1.0_dp-sw ) * dustars
698 dtstarc = ( sw ) * dtstarus + ( 1.0_dp-sw ) * dtstars
699 dqstarc = ( sw ) * dqstarus + ( 1.0_dp-sw ) * dqstars
702 dbflx = - dustarc * dtstarc * ( 1.0_rp + epstvap * qm ) - epstvap * dustarc * dqstarc * thm
705 tmp = pbl * grav / t1 * dbflx
706 sw = 0.5_dp + sign( 0.5_dp, tmp )
708 dwstar = ( tmp * sw )**( 1.0_dp / 3.0_dp )
711 sw = 0.5_dp + sign( 0.5_dp, abs( dustarc ) - eps )
713 dustarc = ( sw ) * dustarc + ( 1.0_dp-sw ) * eps
716 dres = 1.0_dp + karman * grav / ( thm * dil ) * ( dbflx / dustarc**3 - bflx / ustarc**3 )
719 if( abs( dres ) < eps )
exit 722 if( abs( res/dres ) < bulkflux_err_min )
exit 725 if( il * ( il - res / dres ) < 0.0_rp )
exit 732 if( .NOT. abs( res/dres ) < bulkflux_err_min )
then 734 if ( bulkflux_use_mean )
then 735 denom = log_z1ovz0m &
737 + rzm * ( fm_unstable(dp_z0m,il) - 1.0_dp )
738 denoh = log_z1ovz0h &
739 - fhm_unstable(dp_z1,il) + fhm_unstable(dp_z0h,il) * dp_z0h / dp_z1 &
740 + rzh * ( fh_unstable(dp_z0h,il) - 1.0_dp )
741 denoe = log_z1ovz0e &
742 - fhm_unstable(dp_z1,il) + fhm_unstable(dp_z0e,il) * dp_z0e / dp_z1 &
743 + rze * ( fh_unstable(dp_z0e,il) - 1.0_dp )
745 denom = log_z1ovz0m - fm_unstable(dp_z1,il) + fm_unstable(dp_z0m,il)
746 denoh = log_z1ovz0h - fh_unstable(dp_z1,il) + fh_unstable(dp_z0h,il)
747 denoe = log_z1ovz0e - fh_unstable(dp_z1,il) + fh_unstable(dp_z0e,il)
749 uabsus = max( sqrt( u1**2 + v1**2 + (bulkflux_wscf*wstar)**2 ),
real( BULKFLUX_Uabs_min, kind=DP ) )
750 ustarus = karman / denom * uabsus
751 tstarus = karman / denoh * ( th1 - th0 )
752 qstarus = karman / denoe * ( q1 - q0 )
758 if ( bulkflux_use_mean )
then 759 denom = log_z1ovz0m &
760 - fmm_stable(dp_z1,il) + fmm_stable(dp_z0m,il) * dp_z0m / dp_z1 &
761 + rzm * ( fm_stable(dp_z0m,il) - 1.0_dp )
762 denoh = log_z1ovz0h &
763 - fhm_stable(dp_z1,il) + fhm_stable(dp_z0h,il) * dp_z0h / dp_z1 &
764 + rzh * ( fh_stable(dp_z0h,il) - 1.0_dp )
765 denoe = log_z1ovz0e &
766 - fhm_stable(dp_z1,il) + fhm_stable(dp_z0e,il) * dp_z0e / dp_z1 &
767 + rze * ( fh_stable(dp_z0e,il) - 1.0_dp )
769 denom = log_z1ovz0m - fm_stable(dp_z1,il) + fm_stable(dp_z0m,il)
770 denoh = log_z1ovz0h - fh_stable(dp_z1,il) + fh_stable(dp_z0h,il)
771 denoe = log_z1ovz0e - fh_stable(dp_z1,il) + fh_stable(dp_z0e,il)
773 uabss = max( sqrt( u1**2 + v1**2 ), bulkflux_uabs_min )
774 ustars = karman / denom * uabss
775 tstars = karman / denoh * ( th1 - th0 )
776 qstars = karman / denoe * ( q1 - q0 )
781 sw = 0.5_dp - sign( 0.5_dp, il )
783 ustarc = ( sw ) * ustarus + ( 1.0_dp-sw ) * ustars
784 tstarc = ( sw ) * tstarus + ( 1.0_dp-sw ) * tstars
785 qstarc = ( sw ) * qstarus + ( 1.0_dp-sw ) * qstars
788 bflx = - ustarc * tstarc * ( 1.0_rp + epstvap * qm ) - epstvap * ustarc * qstarc * thm
791 tmp = pbl * grav / t1 * bflx
792 sw = 0.5_dp + sign( 0.5_dp, tmp )
794 wstar = ( tmp * sw )**( 1.0_dp / 3.0_dp )
797 sw = 0.5_dp + sign( 0.5_dp, abs( ustarc ) - eps )
799 ustarc = ( sw ) * ustarc + ( 1.0_dp-sw ) * eps
802 il = - karman * grav * bflx / ( ustarc**3 * thm )
809 if ( bulkflux_use_mean )
then 810 denom = log_z1ovz0m &
812 + rzm * ( fm_unstable(dp_z0m,il) - 1.0_dp )
813 denoh = log_z1ovz0h &
814 - fhm_unstable(dp_z1,il) + fhm_unstable(dp_z0h,il) * dp_z0h / dp_z1 &
815 + rzh * ( fh_unstable(dp_z0h,il) - 1.0_dp )
816 denoe = log_z1ovz0e &
817 - fhm_unstable(dp_z1,il) + fhm_unstable(dp_z0e,il) * dp_z0e / dp_z1 &
818 + rze * ( fh_unstable(dp_z0e,il) - 1.0_dp )
820 denom = log_z1ovz0m - fm_unstable(dp_z1,il) + fm_unstable(dp_z0m,il)
821 denoh = log_z1ovz0h - fh_unstable(dp_z1,il) + fh_unstable(dp_z0h,il)
822 denoe = log_z1ovz0e - fh_unstable(dp_z1,il) + fh_unstable(dp_z0e,il)
824 uabsus = max( sqrt( u1**2 + v1**2 + (bulkflux_wscf*wstar)**2 ),
real( BULKFLUX_Uabs_min, kind=DP ) )
825 ustarus = karman / denom * uabsus
826 tstarus = karman / denoh * ( th1 - th0 )
827 qstarus = karman / denoe * ( q1 - q0 )
832 fracu10us = ( log_10ovz0m - fm_unstable(10.0_dp,il) + fm_unstable(dp_z0m,il) ) &
833 / ( log_z1ovz0m - fm_unstable( dp_z1,il) + fm_unstable(dp_z0m,il) )
834 fract2us = ( log_02ovz0h - fm_unstable( 2.0_dp,il) + fm_unstable(dp_z0h,il) ) &
835 / ( log_z1ovz0h - fm_unstable( dp_z1,il) + fm_unstable(dp_z0h,il) )
836 fracq2us = ( log_02ovz0e - fm_unstable( 2.0_dp,il) + fm_unstable(dp_z0e,il) ) &
837 / ( log_z1ovz0e - fm_unstable( dp_z1,il) + fm_unstable(dp_z0e,il) )
840 if ( bulkflux_use_mean )
then 841 denom = log_z1ovz0m &
842 - fmm_stable(dp_z1,il) + fmm_stable(dp_z0m,il) * dp_z0m / dp_z1 &
843 + rzm * ( fm_stable(dp_z0m,il) - 1.0_dp )
844 denoh = log_z1ovz0h &
845 - fhm_stable(dp_z1,il) + fhm_stable(dp_z0h,il) * dp_z0h / dp_z1 &
846 + rzh * ( fh_stable(dp_z0h,il) - 1.0_dp )
847 denoe = log_z1ovz0e &
848 - fhm_stable(dp_z1,il) + fhm_stable(dp_z0e,il) * dp_z0e / dp_z1 &
849 + rze * ( fh_stable(dp_z0e,il) - 1.0_dp )
851 denom = log_z1ovz0m - fm_stable(dp_z1,il) + fm_stable(dp_z0m,il)
852 denoh = log_z1ovz0h - fh_stable(dp_z1,il) + fh_stable(dp_z0h,il)
853 denoe = log_z1ovz0e - fh_stable(dp_z1,il) + fh_stable(dp_z0e,il)
855 uabss = max( sqrt( u1**2 + v1**2 ), bulkflux_uabs_min )
856 ustars = karman / denom * uabss
857 tstars = karman / denoh * ( th1 - th0 )
858 qstars = karman / denoe * ( q1 - q0 )
863 fracu10s = ( log_10ovz0m - fm_stable(10.0_dp,il) + fm_stable(dp_z0m,il) ) &
864 / ( log_z1ovz0m - fm_stable( dp_z1,il) + fm_stable(dp_z0m,il) )
865 fract2s = ( log_02ovz0h - fm_stable( 2.0_dp,il) + fm_stable(dp_z0h,il) ) &
866 / ( log_z1ovz0h - fm_stable( dp_z1,il) + fm_stable(dp_z0h,il) )
867 fracq2s = ( log_02ovz0e - fm_stable( 2.0_dp,il) + fm_stable(dp_z0e,il) ) &
868 / ( log_z1ovz0e - fm_stable( dp_z1,il) + fm_stable(dp_z0e,il) )
870 sw = 0.5_dp - sign( 0.5_dp, il )
872 ustarc = ( sw ) * ustarus + ( 1.0_dp-sw ) * ustars
873 tstarc = ( sw ) * tstarus + ( 1.0_dp-sw ) * tstars
874 qstarc = ( sw ) * qstarus + ( 1.0_dp-sw ) * qstars
875 uabsc = ( sw ) * uabsus + ( 1.0_dp-sw ) * uabss
876 fracu10c = ( sw ) * fracu10us + ( 1.0_dp-sw ) * fracu10s
877 fract2c = ( sw ) * fract2us + ( 1.0_dp-sw ) * fract2s
878 fracq2c = ( sw ) * fracq2us + ( 1.0_dp-sw ) * fracq2s
881 ustar =
real( ustarc, kind=
rp )
882 tstar =
real( tstarc, kind=
rp )
883 qstar =
real( qstarc, kind=
rp )
884 uabs =
real( uabsc, kind=
rp )
885 fracu10 =
real( fracu10c, kind=
rp )
886 fract2 =
real( fract2c, kind=
rp )
887 fracq2 =
real( fracq2c, kind=
rp )
889 ra = max( ( q1 - q0 ) /
real(UstarC * QstarC + EPS,kind=RP), eps )
893 end subroutine bulkflux_b91w01
897 function fm_unstable( Z, IL )
903 real(DP),
intent(in) :: Z
904 real(DP),
intent(in) :: IL
907 real(DP) :: fm_unstable
910 real(DP),
parameter :: gamma = 3.6_dp
917 r = min( z * il, 0.0_dp )
921 fm_unstable = 3.0_dp * log( ( 1.0_dp + sqrt( 1.0_dp + gamma * (-r)**(2.0_dp/3.0_dp) ) ) * 0.5_dp )
924 r4r = sqrt( sqrt( 1.0_dp - 16.0_dp * r ) )
925 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
929 end function fm_unstable
937 real(DP),
intent(in) :: Z
938 real(DP),
intent(in) :: IL
941 real(DP) :: fmm_unstable
944 real(DP),
parameter :: gamma = 3.6_dp
952 r = min( z * il, 0.0_dp )
956 r3 = (-r)**(1.0_dp/3.0_dp)
958 fmm_unstable = 9.0_dp / 20.0_dp * gamma * r3**2
960 f = sqrt( 1.0_dp + gamma * r3**2 )
961 fmm_unstable = 3.0_dp * log( ( 1.0_dp + f ) * 0.5_dp ) &
962 + 1.5_dp / ( sqrt(gamma)**3 * r) * asinh( sqrt(gamma) * r3 ) &
963 + 1.5_dp * f / ( gamma * r3**2 ) &
969 fmm_unstable = - 2.0_dp * r
971 r2r = sqrt( 1.0_dp - 16.0_dp * r )
973 fmm_unstable = log( ( 1.0_dp + r4r )**2 * ( 1.0_dp + r2r ) * 0.125_dp ) &
974 - 2.0_dp * atan( r4r ) &
975 + ( 1.0_dp - r4r*r2r ) / ( 12.0_dp * r ) &
976 + pi * 0.5_dp - 1.0_dp
985 function fh_unstable( Z, IL )
989 real(DP),
intent(in) :: Z
990 real(DP),
intent(in) :: IL
993 real(DP) :: fh_unstable
996 real(DP),
parameter :: Pt = 0.95_dp
997 real(DP),
parameter :: gamma = 7.9_dp
1003 r = min( z * il, 0.0_dp )
1005 if ( flag_w01 )
then 1007 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 &
1008 + log( z ) * ( 1.0_dp - pt )
1011 fh_unstable = 2.0_dp * log( ( 1.0_dp + sqrt( 1.0_dp - 16.0_dp * r ) ) * 0.5_dp )
1015 end function fh_unstable
1016 function fhm_unstable( Z, IL )
1022 real(DP),
intent(in) :: Z
1023 real(DP),
intent(in) :: IL
1026 real(DP) :: fhm_unstable
1029 real(DP),
parameter :: Pt = 0.95_dp
1030 real(DP),
parameter :: gamma = 7.9_dp
1038 r = min( z * il, 0.0_dp )
1040 if ( flag_w01 )
then 1042 r3 = (-r)**(1.0_dp/3.0_dp)
1043 if ( r > -eps )
then 1044 fhm_unstable = 9.0_dp / 20.0_dp * gamma * r3**2
1046 f = sqrt( 1.0_dp + gamma * r3**2 )
1047 fhm_unstable = 3.0_dp * log( ( 1.0_dp + f ) * 0.5_dp ) &
1048 + 1.5_dp / ( sqrt(gamma)**3 * r) * asinh( sqrt(gamma) * r3 ) &
1049 + 1.5_dp * f / ( gamma * r3**2 ) &
1051 fhm_unstable = fhm_unstable * pt + ( log( z ) - 1.0_dp ) * ( 1.0_dp - pt )
1055 if ( r > -eps )
then 1056 fhm_unstable = - 4.0_dp * r
1058 r2r = sqrt( 1.0_dp - 16.0_dp * r )
1059 fhm_unstable = 2.0_dp * log( ( 1.0_dp + r2r ) * 0.5_dp ) &
1060 + ( 1.0_dp - r2r ) / ( 8.0_dp * r ) &
1066 end function fhm_unstable
1070 function fm_stable( Z, IL )
1074 real(DP),
intent(in) :: Z
1075 real(DP),
intent(in) :: IL
1078 real(DP) :: fm_stable
1081 real(DP),
parameter :: a = 1.0_dp
1082 real(DP),
parameter :: b = 0.667_dp
1083 real(DP),
parameter :: c = 5.0_dp
1084 real(DP),
parameter :: d = 0.35_dp
1090 r = max( z * il, 0.0_dp )
1093 #if defined(PGI) || defined(SX) 1094 fm_stable = - a*r - b*( r - c/d )*exp( -min( d*r, 1.e+3_rp ) ) - b*c/d
1096 fm_stable = - a*r - b*( r - c/d )*exp( -d*r ) - b*c/d
1100 end function fm_stable
1101 function fmm_stable( Z, IL )
1107 real(DP),
intent(in) :: Z
1108 real(DP),
intent(in) :: IL
1111 real(DP) :: fmm_stable
1114 real(DP),
parameter :: a = 1.0_dp
1115 real(DP),
parameter :: b = 0.667_dp
1116 real(DP),
parameter :: c = 5.0_dp
1117 real(DP),
parameter :: d = 0.35_dp
1123 r = max( z * il, 0.0_dp )
1127 fmm_stable = - 0.5_dp * ( a + b * c + d ) * r
1129 fmm_stable = b * ( d*r - c + 1.0_dp ) / ( d**2 * r ) &
1130 #if defined(__PGI) || defined(__ES2) 1132 * exp( -min( d*r, 1.e+3_dp ) ) &
1137 - b * ( c*d*r - c + 1.0_dp ) / ( d**2 * r )
1141 end function fmm_stable
1145 function fh_stable( Z, IL )
1149 real(DP),
intent(in) :: Z
1150 real(DP),
intent(in) :: IL
1153 real(DP) :: fh_stable
1156 real(DP),
parameter :: a = 1.0_dp
1157 real(DP),
parameter :: b = 0.667_dp
1158 real(DP),
parameter :: c = 5.0_dp
1159 real(DP),
parameter :: d = 0.35_dp
1165 r = max( z * il, 0.0_dp )
1168 #if defined(PGI) || defined(SX) 1169 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
1171 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
1175 end function fh_stable
1176 function fhm_stable( Z, IL )
1182 real(DP),
intent(in) :: Z
1183 real(DP),
intent(in) :: IL
1186 real(DP) :: fhm_stable
1189 real(DP),
parameter :: a = 1.0_dp
1190 real(DP),
parameter :: b = 0.667_dp
1191 real(DP),
parameter :: c = 5.0_dp
1192 real(DP),
parameter :: d = 0.35_dp
1198 r = max( z * il, 0.0_dp )
1202 fhm_stable = - 0.5_dp * ( a + b*c + b ) * r
1204 fhm_stable = b * ( d*r - c + 1.0_dp ) / ( d**2 * r ) &
1205 #if defined(__PGI) || defined(__ES2) 1206 * exp( -min( d*r, 1.e+3_dp) ) &
1210 - 3.0_dp * sqrt( 1.0_dp + 2.0_dp*a*r/3.0_dp )**5 / ( 5.0_dp * a * r ) &
1211 - b * ( c*d*r - c + 1.0_dp ) / ( d**2 * r ) &
1212 + 0.6_rp / ( a * r ) + 1.0_dp
1216 end function fhm_stable
real(rp), public const_cpdry
specific heat (dry air,constant pressure) [J/kg/K]
integer, public io_fid_conf
Config file ID.
real(rp), parameter, public const_karman
von Karman constant
real(rp), public const_rdry
specific gas constant (dry air) [J/kg/K]
real(rp), public const_pre00
pressure reference [Pa]
real(dp) function fmm_unstable(Z, IL)
procedure(bc), pointer, public bulkflux
real(rp), public const_grav
standard acceleration of gravity [m/s2]
real(rp), public const_epstvap
1 / epsilon - 1
subroutine, public prc_abort
Abort Process.
real(rp), public const_eps
small number
real(rp), public const_pi
pi
subroutine, public bulkflux_setup(dx)
integer, parameter, public rp
integer, parameter, public dp