[411] | 1 | MODULE subsidence_mod |
---|
| 2 | |
---|
| 3 | !-----------------------------------------------------------------------------! |
---|
| 4 | ! Current revisions: |
---|
| 5 | ! ----------------- |
---|
| 6 | ! |
---|
| 7 | ! |
---|
| 8 | ! Former revisions: |
---|
| 9 | ! ----------------- |
---|
| 10 | ! $Id: subsidence.f90 464 2010-02-03 08:40:19Z maronga $ |
---|
| 11 | ! |
---|
[464] | 12 | ! Revision 3.7 2009-12-11 14:15:58Z heinze |
---|
| 13 | ! Initial revision |
---|
[411] | 14 | ! |
---|
| 15 | ! Description: |
---|
| 16 | ! ------------ |
---|
| 17 | ! Impact of large-scale subsidence or ascent as tendency term for use |
---|
| 18 | ! in the prognostic equation of potential temperature. This enables the |
---|
| 19 | ! construction of a constant boundary layer height z_i with time. |
---|
| 20 | !-----------------------------------------------------------------------------! |
---|
| 21 | |
---|
| 22 | |
---|
| 23 | IMPLICIT NONE |
---|
| 24 | |
---|
| 25 | PRIVATE |
---|
| 26 | PUBLIC init_w_subsidence, subsidence |
---|
| 27 | |
---|
| 28 | INTERFACE init_w_subsidence |
---|
| 29 | MODULE PROCEDURE init_w_subsidence |
---|
| 30 | END INTERFACE init_w_subsidence |
---|
| 31 | |
---|
| 32 | INTERFACE subsidence |
---|
| 33 | MODULE PROCEDURE subsidence |
---|
| 34 | MODULE PROCEDURE subsidence_ij |
---|
| 35 | END INTERFACE subsidence |
---|
| 36 | |
---|
| 37 | CONTAINS |
---|
| 38 | |
---|
| 39 | SUBROUTINE init_w_subsidence |
---|
| 40 | |
---|
| 41 | USE arrays_3d |
---|
| 42 | USE control_parameters |
---|
| 43 | USE grid_variables |
---|
| 44 | USE indices |
---|
| 45 | USE pegrid |
---|
| 46 | USE statistics |
---|
| 47 | |
---|
| 48 | IMPLICIT NONE |
---|
| 49 | |
---|
| 50 | INTEGER :: i, k |
---|
| 51 | REAL :: gradient, ws_surface |
---|
| 52 | |
---|
| 53 | IF ( .NOT. ALLOCATED( w_subs )) THEN |
---|
| 54 | ALLOCATE( w_subs(nzb:nzt+1) ) |
---|
| 55 | w_subs = 0.0 |
---|
| 56 | ENDIF |
---|
| 57 | |
---|
| 58 | IF ( ocean ) THEN |
---|
| 59 | message_string = 'Applying large scale vertical motion is not ' // & |
---|
| 60 | 'allowed for ocean runs' |
---|
| 61 | CALL message( 'init_w_subsidence', 'PA0324', 2, 2, 0, 6, 0 ) |
---|
| 62 | ENDIF |
---|
| 63 | |
---|
| 64 | ! |
---|
| 65 | !-- Compute the profile of the subsidence/ascent velocity |
---|
| 66 | !-- using the given gradients |
---|
| 67 | i = 1 |
---|
| 68 | gradient = 0.0 |
---|
| 69 | ws_surface = 0.0 |
---|
| 70 | |
---|
| 71 | |
---|
| 72 | ws_vertical_gradient_level_ind(1) = 0 |
---|
| 73 | DO k = 1, nzt+1 |
---|
| 74 | IF ( i < 11 ) THEN |
---|
| 75 | IF ( ws_vertical_gradient_level(i) < zu(k) .AND. & |
---|
| 76 | ws_vertical_gradient_level(i) >= 0.0 ) THEN |
---|
| 77 | gradient = ws_vertical_gradient(i) / 100.0 |
---|
| 78 | ws_vertical_gradient_level_ind(i) = k - 1 |
---|
| 79 | i = i + 1 |
---|
| 80 | ENDIF |
---|
| 81 | ENDIF |
---|
| 82 | IF ( gradient /= 0.0 ) THEN |
---|
| 83 | IF ( k /= 1 ) THEN |
---|
| 84 | w_subs(k) = w_subs(k-1) + dzu(k) * gradient |
---|
| 85 | ELSE |
---|
| 86 | w_subs(k) = ws_surface + 0.5 * dzu(k) * gradient |
---|
| 87 | ENDIF |
---|
| 88 | ELSE |
---|
| 89 | w_subs(k) = w_subs(k-1) |
---|
| 90 | ENDIF |
---|
| 91 | ENDDO |
---|
| 92 | |
---|
| 93 | ! |
---|
| 94 | !-- In case of no given gradients for the subsidence/ascent velocity, |
---|
| 95 | !-- choose zero gradient |
---|
| 96 | IF ( ws_vertical_gradient_level(1) == -9999999.9 ) THEN |
---|
| 97 | ws_vertical_gradient_level(1) = 0.0 |
---|
| 98 | ENDIF |
---|
| 99 | |
---|
| 100 | END SUBROUTINE init_w_subsidence |
---|
| 101 | |
---|
| 102 | |
---|
| 103 | SUBROUTINE subsidence( tendency, var, var_init ) |
---|
| 104 | |
---|
| 105 | USE arrays_3d |
---|
| 106 | USE control_parameters |
---|
| 107 | USE grid_variables |
---|
| 108 | USE indices |
---|
| 109 | USE pegrid |
---|
| 110 | USE statistics |
---|
| 111 | |
---|
| 112 | IMPLICIT NONE |
---|
| 113 | |
---|
| 114 | INTEGER :: i, j, k |
---|
| 115 | |
---|
| 116 | REAL :: tmp_grad |
---|
| 117 | |
---|
| 118 | REAL, DIMENSION(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) :: var, tendency |
---|
| 119 | REAL, DIMENSION(nzb:nzt+1) :: var_init, var_mod |
---|
| 120 | |
---|
[464] | 121 | var_mod = var_init |
---|
[411] | 122 | |
---|
| 123 | ! |
---|
| 124 | !-- Influence of w_subsidence on the current tendency term |
---|
| 125 | DO i = nxl, nxr |
---|
| 126 | DO j = nys, nyn |
---|
| 127 | DO k = nzb_s_inner(j,i)+1, nzt |
---|
| 128 | IF ( w_subs(k) < 0.0 ) THEN ! large-scale subsidence |
---|
| 129 | tendency(k,j,i) = tendency(k,j,i) - w_subs(k) * & |
---|
| 130 | ( var(k+1,j,i) - var(k,j,i) ) * ddzu(k+1) |
---|
| 131 | ELSE ! large-scale ascent |
---|
| 132 | tendency(k,j,i) = tendency(k,j,i) - w_subs(k) * & |
---|
| 133 | ( var(k,j,i) - var(k-1,j,i) ) * ddzu(k) |
---|
| 134 | ENDIF |
---|
| 135 | ENDDO |
---|
| 136 | ENDDO |
---|
| 137 | ENDDO |
---|
| 138 | |
---|
| 139 | ! |
---|
| 140 | !-- Shifting of the initial profile is especially necessary with Rayleigh |
---|
| 141 | !-- damping switched on |
---|
| 142 | |
---|
| 143 | DO k = nzb, nzt |
---|
| 144 | IF ( w_subs(k) < 0.0 ) THEN ! large-scale subsidence |
---|
| 145 | var_mod(k) = var_init(k) - dt_3d * w_subs(k) * & |
---|
| 146 | ( var_init(k+1) - var_init(k) ) * ddzu(k+1) |
---|
| 147 | ENDIF |
---|
| 148 | ENDDO |
---|
| 149 | ! |
---|
| 150 | !-- At the upper boundary, the initial profile is shifted with aid of |
---|
| 151 | !-- the gradient tmp_grad. (This is ok if the gradients are linear.) |
---|
| 152 | IF ( w_subs(nzt) < 0.0 ) THEN |
---|
| 153 | tmp_grad = ( var_init(nzt+1) - var_init(nzt) ) * ddzu(nzt+1) |
---|
| 154 | var_mod(nzt+1) = var_init(nzt+1) - & |
---|
| 155 | dt_3d * w_subs(nzt+1) * tmp_grad |
---|
| 156 | ENDIF |
---|
| 157 | |
---|
| 158 | |
---|
| 159 | DO k = nzt+1, nzb+1, -1 |
---|
| 160 | IF ( w_subs(k) >= 0.0 ) THEN ! large-scale ascent |
---|
| 161 | var_mod(k) = var_init(k) - dt_3d * w_subs(k) * & |
---|
| 162 | ( var_init(k) - var_init(k-1) ) * ddzu(k+1) |
---|
| 163 | ENDIF |
---|
| 164 | ENDDO |
---|
| 165 | ! |
---|
| 166 | !-- At the lower boundary shifting is not necessary because the |
---|
| 167 | !-- subsidence velocity w_subs(nzb) vanishes. |
---|
| 168 | |
---|
| 169 | |
---|
| 170 | IF ( w_subs(nzb+1) >= 0.0 ) THEN |
---|
| 171 | var_mod(nzb) = var_init(nzb) |
---|
| 172 | ENDIF |
---|
| 173 | |
---|
| 174 | var_init = var_mod |
---|
| 175 | |
---|
| 176 | |
---|
| 177 | END SUBROUTINE subsidence |
---|
| 178 | |
---|
| 179 | SUBROUTINE subsidence_ij( i, j, tendency, var, var_init ) |
---|
| 180 | |
---|
| 181 | USE arrays_3d |
---|
| 182 | USE control_parameters |
---|
| 183 | USE grid_variables |
---|
| 184 | USE indices |
---|
| 185 | USE pegrid |
---|
| 186 | USE statistics |
---|
| 187 | |
---|
| 188 | IMPLICIT NONE |
---|
| 189 | |
---|
| 190 | INTEGER :: i, j, k |
---|
| 191 | |
---|
| 192 | REAL :: tmp_grad |
---|
| 193 | |
---|
| 194 | REAL, DIMENSION(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) :: var, tendency |
---|
| 195 | REAL, DIMENSION(nzb:nzt+1) :: var_init, var_mod |
---|
| 196 | |
---|
[464] | 197 | var_mod = var_init |
---|
[411] | 198 | |
---|
| 199 | ! |
---|
| 200 | !-- Influence of w_subsidence on the current tendency term |
---|
| 201 | DO k = nzb_s_inner(j,i)+1, nzt |
---|
| 202 | IF ( w_subs(k) < 0.0 ) THEN ! large-scale subsidence |
---|
| 203 | tendency(k,j,i) = tendency(k,j,i) - w_subs(k) * & |
---|
| 204 | ( var(k+1,j,i) - var(k,j,i) ) * ddzu(k+1) |
---|
| 205 | ELSE ! large-scale ascent |
---|
| 206 | tendency(k,j,i) = tendency(k,j,i) - w_subs(k) * & |
---|
| 207 | ( var(k,j,i) - var(k-1,j,i) ) * ddzu(k) |
---|
| 208 | ENDIF |
---|
| 209 | ENDDO |
---|
| 210 | |
---|
| 211 | |
---|
| 212 | ! |
---|
| 213 | !-- Shifting of the initial profile is especially necessary with Rayleigh |
---|
| 214 | !-- damping switched on |
---|
| 215 | IF ( i == nxl .AND. j == nys ) THEN ! shifting only once per PE |
---|
| 216 | |
---|
| 217 | DO k = nzb, nzt |
---|
| 218 | IF ( w_subs(k) < 0.0 ) THEN ! large-scale subsidence |
---|
| 219 | var_mod(k) = var_init(k) - dt_3d * w_subs(k) * & |
---|
| 220 | ( var_init(k+1) - var_init(k) ) * ddzu(k+1) |
---|
| 221 | ENDIF |
---|
| 222 | ENDDO |
---|
| 223 | ! |
---|
| 224 | !-- At the upper boundary, the initial profile is shifted with aid of |
---|
| 225 | !-- the gradient tmp_grad. (This is ok if the gradients are linear.) |
---|
| 226 | IF ( w_subs(nzt) < 0.0 ) THEN |
---|
| 227 | tmp_grad = ( var_init(nzt+1) - var_init(nzt) ) * ddzu(nzt+1) |
---|
| 228 | var_mod(nzt+1) = var_init(nzt+1) - & |
---|
| 229 | dt_3d * w_subs(nzt+1) * tmp_grad |
---|
| 230 | ENDIF |
---|
| 231 | |
---|
| 232 | |
---|
| 233 | DO k = nzt+1, nzb+1, -1 |
---|
| 234 | IF ( w_subs(k) >= 0.0 ) THEN ! large-scale ascent |
---|
| 235 | var_mod(k) = var_init(k) - dt_3d * w_subs(k) * & |
---|
| 236 | ( var_init(k) - var_init(k-1) ) * ddzu(k+1) |
---|
| 237 | ENDIF |
---|
| 238 | ENDDO |
---|
| 239 | ! |
---|
| 240 | !-- At the lower boundary shifting is not necessary because the |
---|
| 241 | !-- subsidence velocity w_subs(nzb) vanishes. |
---|
| 242 | |
---|
| 243 | |
---|
| 244 | IF ( w_subs(nzb+1) >= 0.0 ) THEN |
---|
| 245 | var_mod(nzb) = var_init(nzb) |
---|
| 246 | ENDIF |
---|
| 247 | |
---|
[464] | 248 | var_init = var_mod |
---|
[411] | 249 | |
---|
| 250 | ENDIF |
---|
| 251 | |
---|
| 252 | END SUBROUTINE subsidence_ij |
---|
| 253 | |
---|
| 254 | |
---|
| 255 | END MODULE subsidence_mod |
---|