phys_cloudcover.F90 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. module phys_cloudcover
  2. implicit none
  3. ! --- in/out ---------------------------
  4. private
  5. public :: cf_overhead
  6. contains
  7. ! ==============================================================
  8. ! ---------------------------------------------------
  9. !
  10. ! Calculate total cloud fraction overhead the base of each layer
  11. ! based on random/maximum overlap assumptions
  12. ! Based on code provided by Rob van Dorland
  13. ! Peter van Velthoven - 22 November 2002
  14. !
  15. ! Optional arguments
  16. ! Arjo Segers - 25 november 2002
  17. !
  18. ! ----------------------------
  19. !
  20. ! input:
  21. ! nlev : number of vertical levels
  22. ! yclfr : cloud fraction (cc) per cell (0-1)
  23. !
  24. ! output:
  25. ! wccro: overhead cloud fraction
  26. !
  27. ! optional arguments:
  28. ! scheme='ecmwf' : 'ecmwf' -> iovln=1
  29. ! 'other' -> iovln=0
  30. ! eps=1.0e-4 : cltres
  31. !
  32. ! parameters:
  33. ! iovln : switch
  34. ! 1 = ecmwf (maximum random overlap assumption) scheme
  35. ! 0 = another scheme
  36. ! cltres : threshold (minimum) cloud fraction used
  37. ! for numerical stability (division by zero
  38. ! and to eliminate small unrealistic cloud fractions
  39. !
  40. ! Notes:
  41. ! - Index=1 of arrays (yclfr) corresponds to model top
  42. ! - The clouds are supposed to be distributed homogeneously
  43. ! in the vertical in each layer.
  44. !
  45. ! ----------------------------------------------------
  46. subroutine cf_overhead( nlev, yclfr, wccro, scheme, eps )
  47. ! --- in/out ------------------------------
  48. integer, intent(in) :: nlev
  49. real, intent(in) :: yclfr(nlev)
  50. real, intent(out) :: wccro(nlev)
  51. character(len=*), intent(in), optional :: scheme
  52. real, intent(in), optional :: eps
  53. ! --- local ------------------------------
  54. real :: clfr0, clfr1, clfr2, ctver
  55. real :: zclear, zcloud
  56. integer :: jk
  57. ! --- settings -----------------------------
  58. !integer :: iovln = 0
  59. integer :: iovln = 1 ! ecmwf; maximum random overlap
  60. real :: cltres = 1.0e-4
  61. ! --- begin -----------------------------
  62. if ( present(scheme) ) then
  63. select case ( scheme )
  64. case ( 'ecmwf' )
  65. iovln = 1
  66. case ( 'other' )
  67. iovln = 0
  68. case default
  69. print *, 'Unsupported scheme "'//scheme//'".'
  70. stop 'FATAL BUG IN cf_overhead'
  71. end select
  72. end if
  73. if ( present(eps) ) cltres = eps
  74. select case ( iovln )
  75. !-----------------------------------------
  76. ! scheme 0: maximum overlap unless there's a
  77. ! clear sky layer in between?
  78. !-----------------------------------------
  79. case ( 0 )
  80. clfr0 = 0.0
  81. clfr2 = 0.0
  82. ctver = 1.0
  83. do jk = 1, nlev
  84. clfr1 = yclfr(jk)
  85. if ( clfr1 < cltres ) then
  86. !----------------
  87. ! random overlap
  88. !----------------
  89. ctver = ctver * ( 1.0 - clfr2 )
  90. clfr2 = 0.0
  91. else
  92. if ( clfr0 < cltres ) then
  93. clfr2 = clfr1
  94. else
  95. !----------------
  96. ! maximum overlap
  97. !----------------
  98. clfr2 = max( clfr1,clfr2 )
  99. end if
  100. end if
  101. clfr0 = clfr1
  102. wccro(jk) = 1.0 - ctver * ( 1.0 - clfr2 )
  103. end do
  104. !ctver=ctver*(1.-clfr2)
  105. !wccro=1.-ctver
  106. !-----------------------------------------
  107. ! ecmwf scheme
  108. !-----------------------------------------
  109. case ( 1 )
  110. zclear = 1.0
  111. zcloud = 0.0
  112. do jk = 1, nlev
  113. zclear = zclear*(1.0-max(yclfr(jk),zcloud))/(1.0-min(zcloud,1.0-cltres))
  114. zcloud = yclfr(jk)
  115. wccro(jk) = 1.0 - zclear
  116. end do
  117. !-----------------------------------------
  118. ! error ...
  119. !-----------------------------------------
  120. case default
  121. print *, 'unknown switch',IOVLN
  122. stop 'FATAL BUG IN cf_overhead'
  123. end select
  124. end subroutine cf_overhead
  125. ! ***
  126. ! ---------------------------------------------------
  127. ! Calculate cloud fraction in joint layers based on maximum overlap
  128. ! which holds only for neighbouring layers !
  129. ! ----------------------------
  130. ! Peter van Velthoven - 22 November 2002
  131. ! ---------------------------------------------------
  132. subroutine join_cc_layers( YCLFR1, YCLFR2, YCLFRJOINED )
  133. ! --- in/out ----------------------------
  134. real, intent(in) :: YCLFR1, YCLFR2
  135. real, intent(out) :: YCLFRJOINED
  136. ! --- begin ----------------------------
  137. YCLFRJOINED = max( YCLFR1, YCLFR2 )
  138. end subroutine join_cc_layers
  139. end module phys_cloudcover