phys.F90 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. !
  2. !ProTeX: 1.14-AJS
  3. !
  4. !BOI
  5. !
  6. ! !TITLE: Phys - Physics library.
  7. ! !AUTHORS: Arjo Segers
  8. ! !AFFILIATION: KNMI
  9. ! !DATE: 12/08/2004
  10. !
  11. !
  12. ! !INTRODUCTION: Introduction
  13. !
  14. ! The 'phys' library contains subroutines for model physica.
  15. !
  16. !
  17. ! !INTRODUCTION: Geo-potential-height
  18. !
  19. ! \begin{itemize}
  20. !
  21. ! \item Potential height of an air parcel given top and bottom pressure,
  22. ! temperature, and humidity:
  23. ! \bv
  24. ! subroutine PotentialHeight( ptop, pdown, T, Q, dh )
  25. ! real, intent(in) :: ptop, pdown ! pressure bounds (Pa)
  26. ! real, intent(in) :: T ! temperature (K)
  27. ! real, intent(in) :: Q ! specific humidity (kg h2o/kg air)
  28. ! real, intent(out) :: dh ! geo.pot.height bounds (m)
  29. ! end subroutine PotentialHeight
  30. ! \ev
  31. !
  32. ! \item Geo-potential-height at half level boundaries:
  33. ! \bv
  34. ! subroutine GeoPotentialHeightB( lm, pb, T, Q, h0, gphb )
  35. ! integer, intent(in) :: lm ! number of levels
  36. ! real, intent(in) :: pb(lm+1) ! pressure bounds (Pa)
  37. ! real, intent(in) :: T(lm) ! temperature (K)
  38. ! real, intent(in) :: Q(lm) ! specific humidity (kg h2o/kg air)
  39. ! real, intent(in) :: h0 ! initial height (m)
  40. ! real, intent(out) :: gphb(lm+1) ! geo.pot.height bounds (m)
  41. ! \ev
  42. !
  43. ! \item Geo-potential-height at full levels.
  44. ! A full level has a pressure in between the top and bottom pressure of a layer.
  45. ! Temperature and humidity are assumed to be constant in a layer.
  46. ! \bv
  47. ! subroutine GeoPotentialHeight( updo, lm, pb, T, Q, h0, gph )
  48. ! integer, intent(in) :: lm
  49. ! real, intent(in) :: pb(lm+1) ! pressure bounds (Pa)
  50. ! real, intent(in) :: T(lm) ! temperature (K)
  51. ! real, intent(in) :: Q(lm) ! specific humidity (kg h2o/kg air)
  52. ! real, intent(in) :: h0 ! initial height (m)
  53. ! real, intent(out) :: gph(lm) ! geo.pot.height (m)
  54. ! \ev
  55. !
  56. ! \end{itemize}
  57. !
  58. !
  59. ! !INTRODUCTION: Humidity functions
  60. !
  61. ! \begin{itemize}
  62. !
  63. ! \item Saturation specific humidity:
  64. ! \bv
  65. ! real function QSat( T, p )
  66. ! real, intent(in) :: T ! temperature (K)
  67. ! real, intent(in) :: p ! pressure (Pa)
  68. ! end function QSat
  69. ! \ev
  70. !
  71. ! \item Derivative of saturation specific humidity with
  72. ! respect to temperature:
  73. ! \bv
  74. ! real function dQSat_dT( T, p )
  75. ! real, intent(in) :: T ! temperature (K)
  76. ! real, intent(in) :: p ! pressure (Pa)
  77. ! end function dQSat_dT
  78. ! \ev
  79. !
  80. ! \item Specific humidity given relative humidity, temperature, and pressure:
  81. ! \bv
  82. ! real function QH2O( R, T, p )
  83. ! real, intent(in) :: R ! rel. humidity (%)
  84. ! real, intent(in) :: T ! temperature (in K)
  85. ! real, intent(in) :: p ! pressure (Pa)
  86. ! end function QH2O
  87. ! \ev
  88. !
  89. ! \end{itemize}
  90. !
  91. !
  92. ! !INTRODUCTION: Convective clouds
  93. !
  94. ! \bv
  95. ! subroutine ConvCloudDim( updo, lm, detu, entd, &
  96. ! iclbas, ictop, icllfs, &
  97. ! status )
  98. !
  99. ! character(len=1), intent(in) :: updo
  100. ! integer, intent(in) :: lm
  101. !
  102. ! real, intent(in) :: detu(lm)
  103. ! real, intent(in) :: entd(lm)
  104. !
  105. ! character(len=1), intent(in) :: updo
  106. !
  107. ! ! cloud base, top, level of free sinking
  108. ! integer, intent(out) :: iclbas
  109. ! integer, intent(out) :: ictop
  110. ! integer, intent(out) :: icllfs
  111. !
  112. ! integer, intent(out) :: status
  113. !
  114. ! \ev
  115. !
  116. !
  117. ! !INTRODUCTION: Cloud cover
  118. !
  119. ! \bv
  120. ! subroutine cf_overhead( nlev, yclfr, wccro, scheme, eps )
  121. !
  122. ! integer, intent(in) :: nlev
  123. ! real, intent(in) :: yclfr(nlev)
  124. ! real, intent(out) :: wccro(nlev)
  125. ! character(len=*), intent(in), optional :: scheme
  126. ! real, intent(in), optional :: eps
  127. !
  128. ! input:
  129. ! nlev : number of vertical levels
  130. ! yclfr : cloud fraction (cc) per cell (0-1)
  131. !
  132. ! output:
  133. ! wccro: overhead cloud fraction
  134. !
  135. ! optional arguments:
  136. ! scheme='ecmwf' : 'ecmwf' -> iovln=1
  137. ! 'other' -> iovln=0
  138. ! eps=1.0e-4 : cltres
  139. !
  140. ! parameters:
  141. ! iovln : switch
  142. ! 1 = ecmwf (maximum random overlap assumption) scheme
  143. ! 0 = another scheme
  144. ! cltres : threshold (minimum) cloud fraction used
  145. ! for numerical stability (division by zero
  146. ! and to eliminate small unrealistic cloud fractions
  147. !
  148. ! Notes:
  149. ! - Index=1 of arrays (yclfr) corresponds to model top
  150. ! - The clouds are supposed to be distributed homogeneously
  151. ! in the vertical in each layer.
  152. ! \ev
  153. !
  154. !
  155. ! !INTRODUCTION: Virtual temperature
  156. !
  157. ! \begin{itemize}
  158. !
  159. ! \item Convert from real temperature and specific humidity to virtual temperature:
  160. ! \bv
  161. ! elemental function VirtualTemperature( T, Q )
  162. ! real :: VirtualTemperature ! K
  163. ! real, intent(in) :: T ! real temperature (K)
  164. ! real, intent(in) :: Q ! specific humidity (kg H2O / kg air)
  165. ! end function VirtualTemperature
  166. ! \ev
  167. !
  168. ! \item Convert from virtual temperature and specific humidity to temperature:
  169. ! \bv
  170. ! elemental function RealTemperature( Tv, Q )
  171. ! real :: RealTemperature ! K
  172. ! real, intent(in) :: Tv ! virtual temper (K)
  173. ! real, intent(in) :: Q ! specific humidity (kg H2O / kg air)
  174. ! end function RealTemperature
  175. ! \ev
  176. !
  177. ! \end{itemize}
  178. !
  179. !EOI
  180. !
  181. !
  182. ! Physics library.
  183. !
  184. module Phys
  185. use Phys_GPH
  186. use Phys_Humidity
  187. use Phys_Convec
  188. use Phys_CloudCover
  189. use Phys_Tv
  190. use Phys_sza
  191. public
  192. end module Phys