FV3 Bundle
blsimp.F90
Go to the documentation of this file.
1 MODULE blsimp
2 
3 !This subroutine takes the model prognostic variables as its inputs and produces
4 !the three components of the tri-diagonal matrix used to compute BL diffusion.
5 !The same diffussivity Kh is applied to all model variables above the surface.
6 !Diffusion coefficient is computed using a simplified Louis type approximation.
7 
8 IMPLICIT NONE
9 
10 PRIVATE
11 PUBLIC bl_simp
12 
13 CONTAINS
14 
15 subroutine bl_simp( IM, JM, LM, DT, UT, VT, PTT, QVT, QLT, QIT, PET, PKT, FROCEAN, &
16  MAPL_GRAV, MAPL_VIREPS, MAPL_KAPPA, MAPL_CP, MAPL_RGAS, &
17  AKQ, AKS, AKV, BKQ, BKS, BKV, CKQ, CKS, CKV &
18  )
19 
20 IMPLICIT NONE
21 
22 
23 !INPUTS
24 INTEGER, INTENT(IN) :: im, jm, lm
25 REAL, INTENT(IN) :: dt
26 REAL, INTENT(IN), DIMENSION(IM,JM,LM) :: ut, vt, ptt, qvt, qlt, qit
27 REAL, INTENT(IN), DIMENSION(IM,JM,0:LM) :: pet
28 REAL, INTENT(IN), DIMENSION(IM,JM,LM) :: pkt
29 REAL, INTENT(IN), DIMENSION(IM,JM) :: frocean
30 
31 REAL, INTENT(IN) :: mapl_grav, mapl_vireps, mapl_kappa, mapl_cp, mapl_rgas
32 
33 !OUTPUTS
34 REAL, INTENT(OUT), DIMENSION(IM,JM,LM) :: akq, aks, akv, bkq, bks, bkv, ckq, cks, ckv
35 
36 !LOCALS
37 INTEGER :: i, j, l
38 REAL :: ws, ri, rin
39 REAL :: ell2, cdrag_land, cdrag_sea, cdrag, tcoef
40 REAL :: dmi, pkh, dz, ckx, tvb, tve, tvt
41 
42 REAL, DIMENSION(IM,JM) :: bksq, bksv, bkst
43 REAL, DIMENSION(LM) :: kh
44 
45  !Initialize outputs
46  aks = 0.0
47  bks = 0.0
48  cks = 0.0
49  akq = 0.0
50  bkq = 0.0
51  ckq = 0.0
52  akv = 0.0
53  bkv = 0.0
54  ckv = 0.0
55 
56  !These two are not used
57  aks(:,:,1) = 0.0
58  cks(:,:,lm) = 0.0
59 
60  ell2 = 30.*30.
61  cdrag_land = 0.002
62  cdrag_sea = 0.0015
63 
64  ! the following lines solves ------------------------------------
65  ! dQ/dT=-G/dP*Rho*CDrag*WS*Q, Q_(t+dt)=Q_t+dt/(Rho_t*dZ_t)*dTAU
66  ! dTAU=TAU_(z) - TAU_(z-1),
67  ! TAU_(z)= Rho_t*CDrag*WS*Q_(t+dt),
68  ! TAU_(z-1)=Rho_t*K_(z-1)/dZ*dQ_(t+dt)
69  ! dZ=RT*dP/(P*G), DMI=(G*dt)/dP
70  ! ----------------------------------------------------------------
71 
72  do j=1,jm
73  do i=1,im
74 
75  dmi = (mapl_grav*dt)/(pet(i,j,1)-pet(i,j,0))
76  tvt = ptt(i,j,1)*pkt(i,j,1) &
77  * (1.0 + mapl_vireps *qvt(i,j,1) - qlt(i,j,1) - qit(i,j,1) )
78  do l=2,lm
79  pkh = pet(i,j,l)**mapl_kappa
80  dz = mapl_cp*(ptt(i,j,l-1)*(pkh-pkt(i,j,l-1)) + ptt(i,j,l )*(pkt(i,j,l )-pkh))
81  ws = (ut(i,j,l-1)-ut(i,j,l))**2+(vt(i,j,l-1)-vt(i,j,l))**2 + 0.01
82  ri = mapl_grav*((ptt(i,j,l-1)-ptt(i,j,l)) / (0.5*(ptt(i,j,l-1)+ptt(i,j,l))))*dz/ws
83  rin = ell2*sqrt(ws)/dz
84  IF (ri < 0.) THEN
85  kh(l) = max(0.01, rin*sqrt(1.-18.*ri))
86  ELSE
87  kh(l) = max(0.01, rin/(1.+10.*ri*(1.+8.*ri)))
88  ENDIF
89 
90  tvb = ptt(i,j,l)*pkt(i,j,l)*(1.0 + mapl_vireps *qvt(i,j,l) - qlt(i,j,l) - qit(i,j,l))
91  tve = 0.5*(tvt+tvb)
92 
93  tvt = tvb
94  ckx = -kh(l)*pet(i,j,l)/( mapl_rgas * tve )/dz
95  cks(i,j,l-1) = ckx * dmi
96  dmi = (mapl_grav*dt)/(pet(i,j,l)-pet(i,j,l-1))
97  aks(i,j,l) = ckx * dmi
98  bks(i,j,l-1) = 1.0 - (aks(i,j,l-1)+cks(i,j,l-1))
99 
100  if (l==lm) then
101  bks(i,j,l) = 1.0 - (aks(i,j,l)+cks(i,j,l))
102  bksq(i,j) = bks(i,j,l)
103  ws = sqrt(ut(i,j,l)**2 + vt(i,j,l)**2 + 1.0)
104  IF (frocean(i,j).eq.1.0) then
105  cdrag=cdrag_sea
106  tcoef=1.! CDRAG ! assume sea surface T unperturbed
107  else
108  cdrag=cdrag_land
109  tcoef=0. ! assume land surface T same as air T
110  endif
111  kh(l) = -cdrag*dmi*ws*pet(i,j,l)/(mapl_rgas*tvb)
112  bksv(i,j) = 1.0 - (aks(i,j,l)+cks(i,j,l)+kh(l))
113  bkst(i,j) = 1.0 - (aks(i,j,l)+cks(i,j,l)+kh(l)*tcoef)
114  endif
115 
116  end do
117 
118  end do
119  end do
120 
121  !Make copy for wind and tracers as not doing differently for this
122  !simplified boundary layer.
123  akv = aks
124  bkv = bks
125  ckv = cks
126  akq = aks
127  bkq = bks
128  ckq = cks
129 
130  !Apply surface layer diffusivities
131  bkv(:,:,lm) = bksv(:,:)
132  bks(:,:,lm) = bkst(:,:)
133  bkq(:,:,lm) = bksq(:,:)
134 
135 endsubroutine bl_simp
136 
137 
138 ENDMODULE blsimp
subroutine, public bl_simp(IM, JM, LM, DT, UT, VT, PTT, QVT, QLT, QIT, PET, PKT, FROCEAN, MAPL_GRAV, MAPL_VIREPS, MAPL_KAPPA, MAPL_CP, MAPL_RGAS, AKQ, AKS, AKV, BKQ, BKS, BKV, CKQ, CKS, CKV)
Definition: blsimp.F90:19
Definition: blsimp.F90:1
#define max(a, b)
Definition: mosaic_util.h:33