source: codes/icosagcm/trunk/src/dcmip/dcmip2016_kessler_physic.f90 @ 705

Last change on this file since 705 was 548, checked in by dubos, 7 years ago

trunk : reorganize source tree

File size: 6.8 KB
Line 
1MODULE dcmip2016_kessler_physic_mod
2
3
4
5CONTAINS
6!-----------------------------------------------------------------------
7!
8!  Version:  2.0
9!
10!  Date:  January 22nd, 2015
11!
12!  Change log:
13!  v2 - Added sub-cycling of rain sedimentation so as not to violate
14!       CFL condition.
15!
16!  The KESSLER subroutine implements the Kessler (1969) microphysics
17!  parameterization as described by Soong and Ogura (1973) and Klemp
18!  and Wilhelmson (1978, KW). KESSLER is called at the end of each
19!  time step and makes the final adjustments to the potential
20!  temperature and moisture variables due to microphysical processes
21!  occurring during that time step. KESSLER is called once for each
22!  vertical column of grid cells. Increments are computed and added
23!  into the respective variables. The Kessler scheme contains three
24!  moisture categories: water vapor, cloud water (liquid water that
25!  moves with the flow), and rain water (liquid water that falls
26!  relative to the surrounding air). There  are no ice categories.
27!  Variables in the column are ordered from the surface to the top.
28!
29!  SUBROUTINE KESSLER(theta, qv, qc, qr, rho, pk, dt, z, nz, rainnc)
30!
31!  Input variables:
32!     theta  - potential temperature (K)
33!     qv     - water vapor mixing ratio (gm/gm)
34!     qc     - cloud water mixing ratio (gm/gm)
35!     qr     - rain  water mixing ratio (gm/gm)
36!     rho    - dry air density (not mean state as in KW) (kg/m^3)
37!     pk     - Exner function  (not mean state as in KW) (p/p0)**(R/cp)
38!     dt     - time step (s)
39!     z      - heights of thermodynamic levels in the grid column (m)
40!     nz     - number of thermodynamic levels in the column
41!     precl  - Precipitation rate (m_water/s)
42!
43! Output variables:
44!     Increments are added into t, qv, qc, qr, and rainnc which are
45!     returned to the routine from which KESSLER was called. To obtain
46!     the total precip qt, after calling the KESSLER routine, compute:
47!
48!       qt = sum over surface grid cells of (rainnc * cell area)  (kg)
49!       [here, the conversion to kg uses (10^3 kg/m^3)*(10^-3 m/mm) = 1]
50!
51!
52!  Authors: Paul Ullrich
53!           University of California, Davis
54!           Email: paullrich@ucdavis.edu
55!
56!           Based on a code by Joseph Klemp
57!           (National Center for Atmospheric Research)
58!
59!  Reference:
60!
61!    Klemp, J. B., W. C. Skamarock, W. C., and S.-H. Park, 2015:
62!    Idealized Global Nonhydrostatic Atmospheric Test Cases on a Reduced
63!    Radius Sphere. Journal of Advances in Modeling Earth Systems.
64!    doi:10.1002/2015MS000435
65!
66!=======================================================================
67
68SUBROUTINE KESSLER(theta, qv, qc, qr, rho, pk, dt, z, nz, precl)
69
70  IMPLICIT NONE
71
72  !------------------------------------------------
73  !   Input / output parameters
74  !------------------------------------------------
75
76  REAL(8), DIMENSION(nz), INTENT(INOUT) :: &
77            theta   ,     & ! Potential temperature (K)
78            qv      ,     & ! Water vapor mixing ratio (gm/gm)
79            qc      ,     & ! Cloud water mixing ratio (gm/gm)
80            qr              ! Rain  water mixing ratio (gm/gm)
81
82  REAL(8), DIMENSION(nz), INTENT(IN) :: &
83            rho             ! Dry air density (not mean state as in KW) (kg/m^3)
84
85  REAL(8), INTENT(OUT) :: &
86            precl          ! Precipitation rate (m_water / s)
87
88  REAL(8), DIMENSION(nz), INTENT(IN) :: &
89            z       ,     & ! Heights of thermo. levels in the grid column (m)
90            pk              ! Exner function (p/p0)**(R/cp)
91
92  REAL(8), INTENT(IN) :: & 
93            dt              ! Time step (s)
94
95  INTEGER, INTENT(IN) :: nz ! Number of thermodynamic levels in the column
96
97  !------------------------------------------------
98  !   Local variables
99  !------------------------------------------------
100  REAL, DIMENSION(nz) :: r, rhalf, velqr, sed, pc
101
102  REAL(8) :: f5, f2x, xk, ern, qrprod, prod, qvs, psl, rhoqr, dt_max, dt0
103
104  INTEGER :: k, rainsplit, nt
105
106  !------------------------------------------------
107  !   Begin calculation
108  !------------------------------------------------
109  f2x = 17.27d0
110  f5 = 237.3d0 * f2x * 2500000.d0 / 1003.d0
111  xk = .2875d0      !  kappa (r/cp)
112  psl    = 1000.d0  !  pressure at sea level (mb)
113  rhoqr  = 1000.d0  !  density of liquid water (kg/m^3)
114
115  do k=1,nz
116    r(k)     = 0.001d0*rho(k)
117    rhalf(k) = sqrt(rho(1)/rho(k))
118    pc(k)    = 3.8d0/(pk(k)**(1./xk)*psl)
119
120    ! Liquid water terminal velocity (m/s) following KW eq. 2.15
121    velqr(k)  = 36.34d0*(qr(k)*r(k))**0.1364*rhalf(k)
122
123  end do
124
125  ! Maximum time step size in accordance with CFL condition
126  if (dt .le. 0.d0) then
127    write(*,*) 'kessler.f90 called with nonpositive dt'
128    stop
129  end if
130
131  dt_max = dt
132  do k=1,nz-1
133    if (velqr(k) .ne. 0.d0) then
134      dt_max = min(dt_max, 0.8d0*(z(k+1)-z(k))/velqr(k))
135    end if
136  end do
137
138  ! Number of subcycles
139  rainsplit = ceiling(dt / dt_max)
140  dt0 = dt / real(rainsplit,8)
141
142  ! Subcycle through rain process
143  precl = 0.d0
144
145  do nt=1,rainsplit
146
147    ! Precipitation rate (m/s)
148    precl = precl + rho(1) * qr(1) * velqr(1) / rhoqr
149
150    ! Sedimentation term using upstream differencing
151    do k=1,nz-1
152      sed(k) = dt0*(r(k+1)*qr(k+1)*velqr(k+1)-r(k)*qr(k)*velqr(k))/(r(k)*(z(k+1)-z(k)))
153    end do
154    sed(nz)  = -dt0*qr(nz)*velqr(nz)/(.5*(z(nz)-z(nz-1)))
155
156    ! Adjustment terms
157    do k=1,nz
158
159      ! Autoconversion and accretion rates following KW eq. 2.13a,b
160      qrprod = qc(k) - (qc(k)-dt0*amax1(.001*(qc(k)-.001d0),0.))/(1.d0+dt0*2.2d0*qr(k)**.875)
161      qc(k) = amax1(qc(k)-qrprod,0.)
162      qr(k) = amax1(qr(k)+qrprod+sed(k),0.)
163
164      ! Saturation vapor mixing ratio (gm/gm) following KW eq. 2.11
165      qvs = pc(k)*exp(f2x*(pk(k)*theta(k)-273.d0)   &
166             /(pk(k)*theta(k)- 36.d0))
167      prod = (qv(k)-qvs)/(1.d0+qvs*f5/(pk(k)*theta(k)-36.d0)**2)
168
169      ! Evaporation rate following KW eq. 2.14a,b
170      ern = amin1(dt0*(((1.6d0+124.9d0*(r(k)*qr(k))**.2046)  &
171            *(r(k)*qr(k))**.525)/(2550000d0*pc(k)            &
172            /(3.8d0 *qvs)+540000d0))*(dim(qvs,qv(k))         &
173            /(r(k)*qvs)),amax1(-prod-qc(k),0.),qr(k))
174
175      ! Saturation adjustment following KW eq. 3.10
176      theta(k)= theta(k) + 2500000d0/(1003.d0*pk(k))*(amax1( prod,-qc(k))-ern)
177      qv(k) = amax1(qv(k)-max(prod,-qc(k))+ern,0.)
178      qc(k) = qc(k)+max(prod,-qc(k))
179      qr(k) = qr(k)-ern
180    end do
181
182    ! Recalculate liquid water terminal velocity
183    if (nt .ne. rainsplit) then
184      do k=1,nz
185        velqr(k)  = 36.34d0*(qr(k)*r(k))**0.1364*rhalf(k)
186      end do
187    end if
188  end do
189
190  precl = precl / dble(rainsplit)
191
192END SUBROUTINE KESSLER
193
194!=======================================================================
195
196
197
198END MODULE dcmip2016_kessler_physic_mod
Note: See TracBrowser for help on using the repository browser.