1 ! Generated by TAPENADE (INRIA, Tropics team)
2 ! Tapenade 3.7 (r4786) - 21 Feb 2013 15:53
4 ! Differentiation of surface_drag in forward (tangent) mode (with options r8):
5 ! variations of useful results: rublten rvblten
6 ! with respect to varying inputs: v_phy rublten z rvblten u_phy
7 !-------------------------------------------------------------------
8 !WRF:MODEL_LAYER:PHYSICS
9 MODULE g_module_bl_surface_drag
12 SUBROUTINE G_SURFACE_DRAG(rublten, rubltend, rvblten, rvbltend, u_phy, &
13 & u_phyd, v_phy, v_phyd, xland, z, zd, ht, kpbl2d, ids, ide, jds, jde, &
14 & kds, kde, ims, ime, jms, jme, kms, kme, its, ite, jts, jte, kts, kte)
16 INTEGER, INTENT(IN) :: ids, ide, jds, jde, kds, kde, ims, ime, jms, &
17 & jme, kms, kme, its, ite, jts, jte, kts, kte
18 INTEGER, DIMENSION(ims:ime, jms:jme), INTENT(OUT) :: kpbl2d
19 REAL, DIMENSION(ims:ime, kms:kme, jms:jme), INTENT(INOUT) :: rublten, &
21 REAL, DIMENSION(ims:ime, kms:kme, jms:jme), INTENT(INOUT) :: rubltend&
23 REAL, DIMENSION(ims:ime, kms:kme, jms:jme), INTENT(IN) :: u_phy, v_phy&
25 REAL, DIMENSION(ims:ime, kms:kme, jms:jme), INTENT(IN) :: u_phyd, &
27 REAL, DIMENSION(ims:ime, jms:jme), INTENT(IN) :: xland, ht
29 REAL :: v0, tao_xz, tao_yz, cd, zh, zwt
30 REAL :: v0d, tao_xzd, tao_yzd, cdd, zhd, zwtd
31 INTEGER :: i, j, i_start, i_end, i_endu, j_start, j_end, j_endv, k
37 !-----------------------------------------------------------------------
39 IF (ite .GT. ide - 1) THEN
46 IF (jte .GT. jde - 1) THEN
54 arg1d = 2*u_phy(i, kts, j)*u_phyd(i, kts, j) + 2*v_phy(i, kts, j)*&
56 arg1 = u_phy(i, kts, j)**2 + v_phy(i, kts, j)**2
57 IF (arg1 .EQ. 0.0_8) THEN
60 v0d = arg1d/(2.0*SQRT(arg1))
63 IF (xland(i, j) - xland(i-1, j) .GE. 0.) THEN
64 abs0 = xland(i, j) - xland(i-1, j)
66 abs0 = -(xland(i, j)-xland(i-1, j))
68 IF (abs0 .LT. 1.0e-10) THEN
69 IF (xland(i, j) .LT. 1.5) THEN
76 IF (cd .LT. 1.e-4*v0) THEN
83 IF (cd .GT. 0.003) THEN
95 tao_xzd = (cdd*v0+cd*v0d)*u_phy(i, kts, j) + cd*v0*u_phyd(i, kts, &
97 tao_xz = cd*v0*u_phy(i, kts, j)
100 zh = z(i, k, j) - ht(i, j)
101 IF (zh .LT. 1000.) THEN
102 zwtd = (-(2.*zhd))/1000.
103 zwt = 2.*(1000.-zh)/1000.
104 rubltend(i, k, j) = rubltend(i, k, j) - 0.5*(zwtd*tao_xz+zwt*&
106 rublten(i, k, j) = rublten(i, k, j) - zwt*0.5*tao_xz/1000.
115 arg1d = 2*u_phy(i, kts, j)*u_phyd(i, kts, j) + 2*v_phy(i, kts, j)*&
117 arg1 = u_phy(i, kts, j)**2 + v_phy(i, kts, j)**2
118 IF (arg1 .EQ. 0.0_8) THEN
121 v0d = arg1d/(2.0*SQRT(arg1))
124 IF (xland(i, j) - xland(i, j-1) .GE. 0.) THEN
125 abs1 = xland(i, j) - xland(i, j-1)
127 abs1 = -(xland(i, j)-xland(i, j-1))
129 IF (abs1 .LT. 1.0e-10) THEN
130 IF (xland(i, j) .LT. 1.5) THEN
137 IF (cd .LT. 1.e-4*v0) THEN
144 IF (cd .GT. 0.003) THEN
156 tao_yzd = (cdd*v0+cd*v0d)*v_phy(i, kts, j) + cd*v0*v_phyd(i, kts, &
158 tao_yz = cd*v0*v_phy(i, kts, j)
161 zh = z(i, k, j) - ht(i, j)
162 IF (zh .LT. 1000.) THEN
163 zwtd = (-(2.*zhd))/1000.
164 zwt = 2.*(1000.-zh)/1000.
165 rvbltend(i, k, j) = rvbltend(i, k, j) - 0.5*(zwtd*tao_yz+zwt*&
167 rvblten(i, k, j) = rvblten(i, k, j) - zwt*0.5*tao_yz/1000.
172 END SUBROUTINE G_SURFACE_DRAG
174 ! Generated by TAPENADE (INRIA, Tropics team)
175 ! Tapenade 3.6 (r4343) - 10 Feb 2012 10:52
177 ! Differentiation of surface_drag_init in forward (tangent) mode:
178 ! variations of useful results: rublten rqvblten rvblten rthblten
179 ! with respect to varying inputs: rublten rqvblten rvblten rthblten
180 SUBROUTINE SURFACE_DRAG_INIT_D(rublten, rubltend, rvblten, rvbltend, &
181 & rthblten, rthbltend, rqvblten, rqvbltend, restart, ids, ide, jds, jde&
182 & , kds, kde, ims, ime, jms, jme, kms, kme, its, ite, jts, jte, kts, kte&
185 !-------------------------------------------------------------------
186 LOGICAL, INTENT(IN) :: restart
187 INTEGER, INTENT(IN) :: ids, ide, jds, jde, kds, kde, ims, ime, jms, &
188 & jme, kms, kme, its, ite, jts, jte, kts, kte
189 REAL, DIMENSION(ims:ime, kms:kme, jms:jme), INTENT(OUT) :: rublten, &
190 & rvblten, rthblten, rqvblten
191 REAL, DIMENSION(ims:ime, kms:kme, jms:jme), INTENT(OUT) :: rubltend, &
192 & rvbltend, rthbltend, rqvbltend
193 INTEGER :: i, j, k, itf, jtf, ktf
195 IF (jte .GT. jde - 1) THEN
200 IF (kte .GT. kde - 1) THEN
205 IF (ite .GT. ide - 1) THEN
210 IF (.NOT.restart) THEN
214 rubltend(i, k, j) = 0.0
215 rublten(i, k, j) = 0.
216 rvbltend(i, k, j) = 0.0
217 rvblten(i, k, j) = 0.
218 rthbltend(i, k, j) = 0.0
219 rthblten(i, k, j) = 0.
220 rqvbltend(i, k, j) = 0.0
221 rqvblten(i, k, j) = 0.
226 END SUBROUTINE SURFACE_DRAG_INIT_D
228 END MODULE g_module_bl_surface_drag