phys_convec_clouds.F90 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. module Phys_Convec_Clouds
  2. implicit none
  3. ! --- in/out ----------------------------------
  4. private
  5. public :: ConvCloudDim
  6. ! --- const ----------------------------------------
  7. character(len=*), parameter :: mname = 'module Phys_Convec_Clouds'
  8. contains
  9. ! ==============================================================
  10. ! ===
  11. ! === convective clouds
  12. ! ===
  13. ! ==============================================================
  14. !
  15. ! updo : level order
  16. ! 'u' : upwards : 1=surface, .., n=top
  17. ! 'd' : downwards : 1=top, ..., n=surface
  18. !
  19. subroutine ConvCloudDim( updo, lm, detu, entd, &
  20. iclbas, ictop, icllfs, &
  21. status )
  22. ! --- in/out ------------------------
  23. character(len=1), intent(in) :: updo
  24. integer, intent(in) :: lm
  25. real, intent(in) :: detu(lm)
  26. real, intent(in) :: entd(lm)
  27. ! cloud base, top, level of free sinking
  28. integer, intent(out) :: iclbas
  29. integer, intent(out) :: ictop
  30. integer, intent(out) :: icllfs
  31. integer, intent(out) :: status
  32. ! --- const ----------------------------------------
  33. character(len=*), parameter :: rname = mname//', ConvCloudDim'
  34. ! --- local ----------------------------------------
  35. integer :: l
  36. integer :: bot, top, one
  37. ! --- begin -----------------------------------------
  38. select case ( updo )
  39. case ( 'u', 'U' )
  40. bot = 1
  41. top = lm
  42. one = +1
  43. case ( 'd', 'D' )
  44. bot = lm
  45. top = 1
  46. one = -1
  47. case default
  48. write (*,'("ERROR - updo should be `u` or `d` ...")')
  49. write (*,'("ERROR in ",a)') rname; status=1; return
  50. end select
  51. ! check ...
  52. if ( size(entd) /= lm ) then
  53. write (*,'("ERROR - input arrays should have save size:")')
  54. write (*,'("ERROR - size(detu) : ",i3)') size(detu)
  55. write (*,'("ERROR - size(entd) : ",i3)') size(entd)
  56. write (*,'("ERROR in ",a)') rname; status=1; return
  57. end if
  58. ! determine cloud top level
  59. ! (cloud top level is the highest TM model level where detrainment
  60. ! is greater than 0)
  61. ! no cloud top present by default:
  62. ictop = 0
  63. do l = top, bot, -one
  64. if ( detu(l) > 0.0 ) then
  65. ictop = l
  66. exit
  67. end if
  68. end do
  69. ! determine cloud base level
  70. ! (cloud base level is the lowest TM model level where detrainment
  71. ! is greater than 0)
  72. ! no cloud base present by default:
  73. iclbas = 0
  74. do l = bot, top, one
  75. if ( detu(l) > 0.0 ) then
  76. iclbas = l
  77. exit
  78. end if
  79. end do
  80. ! determine level of free sinking (start of cumulus downdraft)
  81. ! (level of free sinking is the highest TM model level where
  82. ! entrainment (downdraft) is greater than 0)
  83. ! no cumulus downdraft present by default
  84. icllfs = 0
  85. do l = top, bot, -one
  86. if ( entd(l) > 0.0 ) then
  87. icllfs = l
  88. exit
  89. end if
  90. end do
  91. ! ok
  92. status = 0
  93. end subroutine ConvCloudDim
  94. end module Phys_Convec_Clouds