source: codes/icosagcm/trunk/src/dcmip2016_kessler_physic.f90 @ 385

Last change on this file since 385 was 381, checked in by ymipsl, 8 years ago

Add DCMIP2016 physics

(first guess)

YM

File size: 6.7 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!     rainnc - accumulated precip beneath the grid column (mm)
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, rainnc) &
69  BIND(c, name = "kessler")
70
71  IMPLICIT NONE
72
73  !------------------------------------------------
74  !   Input / output parameters
75  !------------------------------------------------
76
77  REAL(8), DIMENSION(nz), INTENT(INOUT) :: &
78            theta   ,     & ! Potential temperature (K)
79            qv      ,     & ! Water vapor mixing ratio (gm/gm)
80            qc      ,     & ! Cloud water mixing ratio (gm/gm)
81            qr      ,     & ! Rain  water mixing ratio (gm/gm)
82            rho             ! Dry air density (not mean state as in KW) (kg/m^3)
83
84  REAL(8), INTENT(INOUT) :: &
85            rainnc          ! Accumulated precip beneath the grid column (mm)
86
87  REAL(8), DIMENSION(nz), INTENT(IN) :: &
88            z       ,     & ! Heights of thermo. levels in the grid column (m)
89            pk              ! Exner function (p/p0)**(R/cp)
90
91  REAL(8), INTENT(IN) :: & 
92            dt              ! Time step (s)
93
94  INTEGER, INTENT(IN) :: nz ! Number of thermodynamic levels in the column
95
96  !------------------------------------------------
97  !   Local variables
98  !------------------------------------------------
99  REAL, DIMENSION(nz) :: r, rhalf, velqr, sed, pc
100
101  REAL(8) :: f5, f2x, xk, ern, qrprod, prod, qvs, psl, rhoqr, dt_max, dt0
102
103  INTEGER :: k, rainsplit, nt
104
105  !------------------------------------------------
106  !   Begin calculation
107  !------------------------------------------------
108  f2x = 17.27d0
109  f5 = 237.3d0 * f2x * 2500000.d0 / 1003.d0
110  xk = .2875d0      !  kappa (r/cp)
111  psl    = 1000.d0  !  pressure at sea level (mb)
112  rhoqr  = 1000.d0  !  density of liquid water (kg/m^3)
113
114  do k=1,nz
115    r(k)     = 0.001d0*rho(k)
116    rhalf(k) = sqrt(rho(1)/rho(k))
117    pc(k)    = 3.8d0/(pk(k)**(1./xk)*psl)
118
119    ! Liquid water terminal velocity (m/s) following KW eq. 2.15
120    velqr(k)  = 36.34d0*(qr(k)*r(k))**0.1364*rhalf(k)
121
122  end do
123
124  ! Maximum time step size in accordance with CFL condition
125  dt_max = dt
126  do k=1,nz-1
127    if (velqr(k) .ne. 0.d0) then
128      dt_max = min(dt_max, 0.8d0*(z(k+1)-z(k))/velqr(k))
129    end if
130  end do
131
132  ! Number of subcycles
133  rainsplit = ceiling(dt / dt_max)
134  dt0 = dt / real(rainsplit,8)
135
136  ! Subcycle through rain process
137  do nt=1,rainsplit
138
139    ! Precipitation accumulated beneath the column (mm rain)
140    rainnc = rainnc + 1000.d0*rho(1)*qr(1)*velqr(1)*dt0/rhoqr
141
142    ! Sedimentation term using upstream differencing
143    do k=1,nz-1
144      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)))
145    end do
146    sed(nz)  = -dt0*qr(nz)*velqr(nz)/(.5*(z(nz)-z(nz-1)))
147
148    ! Adjustment terms
149    do k=1,nz
150
151      ! Autoconversion and accretion rates following KW eq. 2.13a,b
152      qrprod = qc(k) - (qc(k)-dt0*amax1(.001*(qc(k)-.001d0),0.))/(1.d0+dt0*2.2d0*qr(k)**.875)
153      qc(k) = amax1(qc(k)-qrprod,0.)
154      qr(k) = amax1(qr(k)+qrprod+sed(k),0.)
155
156      ! Saturation vapor mixing ratio (gm/gm) following KW eq. 2.11
157      qvs = pc(k)*exp(f2x*(pk(k)*theta(k)-273.d0)   &
158             /(pk(k)*theta(k)- 36.d0))
159      prod = (qv(k)-qvs)/(1.d0+qvs*f5/(pk(k)*theta(k)-36.d0)**2)
160
161      ! Evaporation rate following KW eq. 2.14a,b
162      ern = amin1(dt0*(((1.6d0+124.9d0*(r(k)*qr(k))**.2046)  &
163            *(r(k)*qr(k))**.525)/(2550000d0*pc(k)            &
164            /(3.8d0 *qvs)+540000d0))*(dim(qvs,qv(k))         &
165            /(r(k)*qvs)),amax1(-prod-qc(k),0.),qr(k))
166
167      ! Saturation adjustment following KW eq. 3.10
168      theta(k)= theta(k) + 2500000d0/(1003.d0*pk(k))*(amax1( prod,-qc(k))-ern)
169      qv(k) = amax1(qv(k)-max(prod,-qc(k))+ern,0.)
170      qc(k) = qc(k)+max(prod,-qc(k))
171      qr(k) = qr(k)-ern
172    end do
173
174    ! Recalculate liquid water terminal velocity
175    if (nt .ne. rainsplit) then
176      do k=1,nz
177        velqr(k)  = 36.34d0*(qr(k)*r(k))**0.1364*rhalf(k)
178      end do
179    end if
180  end do
181
182END SUBROUTINE KESSLER
183
184!=======================================================================
185
186END MODULE dcmip2016_kessler_physic_mod
Note: See TracBrowser for help on using the repository browser.