[1992] | 1 | |
---|
[1403] | 2 | ! $Id: calwake.F90 3208 2018-02-16 11:42:18Z idelkadi $ |
---|
[879] | 3 | |
---|
[2635] | 4 | SUBROUTINE calwake(iflag_wake_tend, paprs, pplay, dtime, & |
---|
| 5 | t, q, omgb, & |
---|
[3208] | 6 | dt_dwn, dq_dwn, m_dwn, m_up, dt_a, dq_a, wgen, & |
---|
| 7 | sigd, Cin, & |
---|
| 8 | wake_deltat, wake_deltaq, wake_s, awake_dens, wake_dens, & |
---|
[2635] | 9 | wake_dth, wake_h, & |
---|
| 10 | wake_pe, wake_fip, wake_gfl, & |
---|
| 11 | dt_wake, dq_wake, wake_k, t_x, q_x, wake_omgbdth, & |
---|
| 12 | wake_dp_omgb, & |
---|
| 13 | wake_dtke, wake_dqke, & |
---|
| 14 | wake_omg, wake_dp_deltomg, & |
---|
| 15 | wake_spread, wake_cstar, wake_d_deltat_gw, & |
---|
[3208] | 16 | wake_ddeltat, wake_ddeltaq, wake_ds, awake_ddens, wake_ddens) |
---|
[1992] | 17 | ! ************************************************************** |
---|
| 18 | ! * |
---|
| 19 | ! CALWAKE * |
---|
| 20 | ! interface avec le schema de calcul de la poche * |
---|
| 21 | ! froide * |
---|
| 22 | ! * |
---|
| 23 | ! written by : CHERUY Frederique, 13/03/2000, 10.31.05 * |
---|
| 24 | ! modified by : ROEHRIG Romain, 01/30/2007 * |
---|
| 25 | ! ************************************************************** |
---|
[974] | 26 | |
---|
[1992] | 27 | USE dimphy |
---|
[2761] | 28 | USE phys_state_var_mod, ONLY: pctsrf |
---|
| 29 | USE indice_sol_mod, ONLY: is_oce |
---|
| 30 | USE print_control_mod, ONLY: mydebug=>debug , lunout, prt_level |
---|
[1992] | 31 | IMPLICIT NONE |
---|
| 32 | ! ====================================================================== |
---|
| 33 | include "YOMCST.h" |
---|
[974] | 34 | |
---|
[1992] | 35 | ! Arguments |
---|
| 36 | ! ---------- |
---|
[2635] | 37 | ! Input |
---|
| 38 | ! ---- |
---|
| 39 | INTEGER, INTENT (IN) :: iflag_wake_tend |
---|
| 40 | REAL, INTENT (IN) :: dtime |
---|
| 41 | REAL, DIMENSION(klon, klev), INTENT (IN) :: pplay |
---|
| 42 | REAL, DIMENSION(klon, klev+1), INTENT (IN) :: paprs |
---|
| 43 | REAL, DIMENSION(klon, klev), INTENT (IN) :: t, q, omgb |
---|
| 44 | REAL, DIMENSION(klon, klev), INTENT (IN) :: dt_dwn, dq_dwn |
---|
| 45 | REAL, DIMENSION(klon, klev), INTENT (IN) :: m_up, m_dwn |
---|
| 46 | REAL, DIMENSION(klon, klev), INTENT (IN) :: dt_a, dq_a |
---|
[3208] | 47 | REAL, DIMENSION(klon), INTENT (IN) :: wgen |
---|
[2635] | 48 | REAL, DIMENSION(klon), INTENT (IN) :: sigd |
---|
[3208] | 49 | REAL, DIMENSION(klon), INTENT (IN) :: Cin |
---|
[2635] | 50 | ! Input/Output |
---|
| 51 | ! ------------ |
---|
| 52 | REAL, DIMENSION(klon, klev), INTENT (INOUT) :: wake_deltat, wake_deltaq |
---|
| 53 | REAL, DIMENSION(klon), INTENT (INOUT) :: wake_s |
---|
[3208] | 54 | REAL, DIMENSION(klon), INTENT (INOUT) :: awake_dens, wake_dens |
---|
[2635] | 55 | ! Output |
---|
| 56 | ! ------ |
---|
| 57 | REAL, DIMENSION(klon, klev), INTENT (OUT) :: dt_wake, dq_wake |
---|
[2849] | 58 | !!jyg REAL, DIMENSION(klon), INTENT (OUT) :: wake_k |
---|
| 59 | INTEGER, DIMENSION(klon), INTENT (OUT) :: wake_k |
---|
[2635] | 60 | REAL, DIMENSION(klon, klev), INTENT (OUT) :: wake_d_deltat_gw |
---|
| 61 | REAL, DIMENSION(klon), INTENT (OUT) :: wake_h |
---|
| 62 | REAL, DIMENSION(klon, klev), INTENT (OUT) :: wake_dth |
---|
| 63 | REAL, DIMENSION(klon), INTENT (OUT) :: wake_pe, wake_fip, wake_gfl |
---|
| 64 | REAL, DIMENSION(klon, klev), INTENT (OUT) :: t_x, q_x |
---|
| 65 | REAL, DIMENSION(klon, klev), INTENT (OUT) :: wake_omgbdth, wake_dp_omgb |
---|
| 66 | REAL, DIMENSION(klon, klev), INTENT (OUT) :: wake_dtke, wake_dqke |
---|
| 67 | REAL, DIMENSION(klon, klev), INTENT (OUT) :: wake_omg, wake_dp_deltomg |
---|
| 68 | REAL, DIMENSION(klon, klev), INTENT (OUT) :: wake_spread |
---|
| 69 | REAL, DIMENSION(klon), INTENT (OUT) :: wake_cstar |
---|
| 70 | REAL, DIMENSION(klon, klev), INTENT (OUT) :: wake_ddeltat, wake_ddeltaq |
---|
[3208] | 71 | REAL, DIMENSION(klon), INTENT (OUT) :: wake_ds, awake_ddens, wake_ddens |
---|
[974] | 72 | |
---|
| 73 | |
---|
[1992] | 74 | ! Variable internes |
---|
| 75 | ! ----------------- |
---|
[3000] | 76 | LOGICAL, SAVE :: first = .TRUE. |
---|
| 77 | !$OMP THREADPRIVATE(first) |
---|
[2635] | 78 | INTEGER :: i, l |
---|
[2761] | 79 | INTEGER, DIMENSION(klon) :: znatsurf ! 0 if pctsrf(is_oce)>0.1; 1 else. |
---|
[2635] | 80 | REAL :: aire |
---|
| 81 | REAL, DIMENSION(klon, klev) :: p, pi |
---|
[2671] | 82 | REAL, DIMENSION(klon, klev+1) :: ph |
---|
| 83 | REAL, DIMENSION(klon, klev) :: omgbe |
---|
[2635] | 84 | REAL, DIMENSION(klon, klev) :: te, qe |
---|
| 85 | REAL, DIMENSION(klon, klev) :: dtdwn, dqdwn |
---|
| 86 | REAL, DIMENSION(klon, klev) :: dta, dqa |
---|
| 87 | REAL, DIMENSION(klon, klev) :: amdwn, amup |
---|
| 88 | REAL, DIMENSION(klon, klev) :: dtw, dqw, dth |
---|
| 89 | REAL, DIMENSION(klon, klev) :: dtls, dqls |
---|
| 90 | REAL, DIMENSION(klon, klev) :: tx, qx |
---|
| 91 | REAL, DIMENSION(klon) :: hw, wape, fip, gfl |
---|
[3208] | 92 | REAL, DIMENSION(klon) :: sigmaw, awdens, wdens |
---|
[2671] | 93 | REAL, DIMENSION(klon, klev) :: omgbdth |
---|
[2635] | 94 | REAL, DIMENSION(klon, klev) :: dp_omgb |
---|
| 95 | REAL, DIMENSION(klon, klev) :: dtke, dqke |
---|
[2671] | 96 | REAL, DIMENSION(klon, klev) :: omg |
---|
[2635] | 97 | REAL, DIMENSION(klon, klev) :: dp_deltomg, spread |
---|
| 98 | REAL, DIMENSION(klon) :: cstar |
---|
| 99 | REAL, DIMENSION(klon) :: sigd0 |
---|
| 100 | INTEGER, DIMENSION(klon) :: ktopw |
---|
| 101 | REAL, DIMENSION(klon, klev) :: d_deltat_gw |
---|
| 102 | REAL, DIMENSION(klon, klev) :: d_deltatw, d_deltaqw |
---|
[3208] | 103 | REAL, DIMENSION(klon) :: d_sigmaw, d_awdens, d_wdens |
---|
[974] | 104 | |
---|
[2635] | 105 | REAL :: rdcp |
---|
[974] | 106 | |
---|
| 107 | |
---|
[2761] | 108 | IF (prt_level >= 10) THEN |
---|
[3208] | 109 | print *, '-> calwake, wake_s, wgen input ', wake_s(1), wgen(1) |
---|
[2761] | 110 | ENDIF |
---|
[990] | 111 | |
---|
[1992] | 112 | rdcp = 1./3.5 |
---|
[974] | 113 | |
---|
[2761] | 114 | znatsurf(:) = 0 |
---|
| 115 | DO i = 1,klon |
---|
| 116 | IF (pctsrf(i,is_oce) < 0.1) znatsurf(i) = 1 |
---|
| 117 | ENDDO |
---|
[974] | 118 | |
---|
[2761] | 119 | |
---|
[1992] | 120 | ! ----------------------------------------------------------- |
---|
| 121 | ! IM 290108 DO 999 i=1,klon ! a vectoriser |
---|
| 122 | ! ---------------------------------------------------------- |
---|
[974] | 123 | |
---|
| 124 | |
---|
[1992] | 125 | DO l = 1, klev |
---|
| 126 | DO i = 1, klon |
---|
| 127 | p(i, l) = pplay(i, l) |
---|
| 128 | ph(i, l) = paprs(i, l) |
---|
| 129 | pi(i, l) = (pplay(i,l)/100000.)**rdcp |
---|
[990] | 130 | |
---|
[1992] | 131 | te(i, l) = t(i, l) |
---|
| 132 | qe(i, l) = q(i, l) |
---|
| 133 | omgbe(i, l) = omgb(i, l) |
---|
[974] | 134 | |
---|
[1992] | 135 | dtdwn(i, l) = dt_dwn(i, l) |
---|
| 136 | dqdwn(i, l) = dq_dwn(i, l) |
---|
| 137 | dta(i, l) = dt_a(i, l) |
---|
| 138 | dqa(i, l) = dq_a(i, l) |
---|
| 139 | END DO |
---|
| 140 | END DO |
---|
[974] | 141 | |
---|
[2761] | 142 | !---------------------------------------------------------------- |
---|
| 143 | ! Initialize tendencies to zero |
---|
| 144 | !---------------------------------------------------------------- |
---|
| 145 | dtls(:,:) = 0. |
---|
| 146 | dqls(:,:) = 0. |
---|
| 147 | d_deltat_gw(:,:) = 0. |
---|
| 148 | d_deltatw(:,:) = 0. |
---|
| 149 | d_deltaqw(:,:) = 0. |
---|
| 150 | d_sigmaw(:) = 0. |
---|
[3208] | 151 | d_awdens(:) = 0. |
---|
[2761] | 152 | d_wdens(:) = 0. |
---|
| 153 | ! |
---|
| 154 | |
---|
[1992] | 155 | DO i = 1, klon |
---|
| 156 | sigd0(i) = sigd(i) |
---|
| 157 | END DO |
---|
| 158 | ! print*, 'sigd0,sigd', sigd0, sigd(i) |
---|
| 159 | DO i = 1, klon |
---|
| 160 | ph(i, klev+1) = 0. |
---|
| 161 | END DO |
---|
[974] | 162 | |
---|
[2761] | 163 | !!jyg! DO i = 1, klon |
---|
| 164 | !!jyg! ktopw(i) = NINT(wake_k(i)) |
---|
| 165 | !!jyg! END DO |
---|
[974] | 166 | |
---|
[2635] | 167 | DO i = 1, klon |
---|
| 168 | hw(i) = wake_h(i) |
---|
| 169 | END DO |
---|
| 170 | ! |
---|
| 171 | ! Make a copy of state variables |
---|
[1992] | 172 | DO l = 1, klev |
---|
| 173 | DO i = 1, klon |
---|
| 174 | dtw(i, l) = wake_deltat(i, l) |
---|
| 175 | dqw(i, l) = wake_deltaq(i, l) |
---|
| 176 | END DO |
---|
| 177 | END DO |
---|
[974] | 178 | |
---|
[2635] | 179 | DO i = 1, klon |
---|
| 180 | sigmaw(i) = wake_s(i) |
---|
[1992] | 181 | END DO |
---|
[974] | 182 | |
---|
[1992] | 183 | DO i = 1, klon |
---|
[3208] | 184 | awdens(i) = max(0., awake_dens(i)) |
---|
[3000] | 185 | wdens(i) = max(0., wake_dens(i)) |
---|
[1992] | 186 | END DO |
---|
[974] | 187 | |
---|
[1992] | 188 | ! fkc les flux de masses sont evalues aux niveaux et valent 0 a la surface |
---|
| 189 | ! fkc on veut le flux de masse au milieu des couches |
---|
[974] | 190 | |
---|
[1992] | 191 | DO l = 1, klev - 1 |
---|
| 192 | DO i = 1, klon |
---|
| 193 | amdwn(i, l) = 0.5*(m_dwn(i,l)+m_dwn(i,l+1)) |
---|
| 194 | amdwn(i, l) = (m_dwn(i,l+1)) |
---|
| 195 | END DO |
---|
| 196 | END DO |
---|
[1403] | 197 | |
---|
[1992] | 198 | ! au sommet le flux de masse est nul |
---|
[974] | 199 | |
---|
[1992] | 200 | DO i = 1, klon |
---|
| 201 | amdwn(i, klev) = 0.5*m_dwn(i, klev) |
---|
| 202 | END DO |
---|
[879] | 203 | |
---|
[1992] | 204 | DO l = 1, klev |
---|
| 205 | DO i = 1, klon |
---|
| 206 | amup(i, l) = m_up(i, l) |
---|
| 207 | END DO |
---|
| 208 | END DO |
---|
[879] | 209 | |
---|
[2761] | 210 | CALL wake(znatsurf, p, ph, pi, dtime, & |
---|
[2635] | 211 | te, qe, omgbe, & |
---|
[3208] | 212 | dtdwn, dqdwn, amdwn, amup, dta, dqa, wgen, & |
---|
| 213 | sigd0, Cin, & |
---|
| 214 | dtw, dqw, sigmaw, awdens, wdens, & ! state variables |
---|
[2635] | 215 | dth, hw, wape, fip, gfl, & |
---|
| 216 | dtls, dqls, ktopw, omgbdth, dp_omgb, tx, qx, & |
---|
| 217 | dtke, dqke, omg, dp_deltomg, spread, cstar, & |
---|
| 218 | d_deltat_gw, & |
---|
[3208] | 219 | d_deltatw, d_deltaqw, d_sigmaw, d_awdens, d_wdens) ! tendencies |
---|
[879] | 220 | |
---|
[2635] | 221 | ! |
---|
[1992] | 222 | DO l = 1, klev |
---|
| 223 | DO i = 1, klon |
---|
| 224 | IF (ktopw(i)>0) THEN |
---|
| 225 | wake_d_deltat_gw(i, l) = d_deltat_gw(i, l) |
---|
| 226 | wake_omgbdth(i, l) = omgbdth(i, l) |
---|
| 227 | wake_dp_omgb(i, l) = dp_omgb(i, l) |
---|
| 228 | wake_dtke(i, l) = dtke(i, l) |
---|
| 229 | wake_dqke(i, l) = dqke(i, l) |
---|
| 230 | wake_omg(i, l) = omg(i, l) |
---|
| 231 | wake_dp_deltomg(i, l) = dp_deltomg(i, l) |
---|
| 232 | wake_spread(i, l) = spread(i, l) |
---|
| 233 | wake_dth(i, l) = dth(i, l) |
---|
[2635] | 234 | dt_wake(i, l) = dtls(i, l)*dtime ! derivative -> tendency |
---|
| 235 | dq_wake(i, l) = dqls(i, l)*dtime ! derivative -> tendency |
---|
| 236 | t_x(i, l) = tx(i, l) |
---|
| 237 | q_x(i, l) = qx(i, l) |
---|
[1992] | 238 | ELSE |
---|
| 239 | wake_d_deltat_gw(i, l) = 0. |
---|
| 240 | wake_omgbdth(i, l) = 0. |
---|
| 241 | wake_dp_omgb(i, l) = 0. |
---|
| 242 | wake_dtke(i, l) = 0. |
---|
| 243 | wake_dqke(i, l) = 0. |
---|
| 244 | wake_omg(i, l) = 0. |
---|
| 245 | wake_dp_deltomg(i, l) = 0. |
---|
| 246 | wake_spread(i, l) = 0. |
---|
| 247 | wake_dth(i, l) = 0. |
---|
| 248 | dt_wake(i, l) = 0. |
---|
| 249 | dq_wake(i, l) = 0. |
---|
[2635] | 250 | t_x(i, l) = te(i, l) |
---|
| 251 | q_x(i, l) = qe(i, l) |
---|
[1992] | 252 | END IF |
---|
| 253 | END DO |
---|
| 254 | END DO |
---|
[879] | 255 | |
---|
[1992] | 256 | DO i = 1, klon |
---|
| 257 | wake_h(i) = hw(i) |
---|
| 258 | wake_pe(i) = wape(i) |
---|
| 259 | wake_fip(i) = fip(i) |
---|
| 260 | wake_gfl(i) = gfl(i) |
---|
| 261 | wake_k(i) = ktopw(i) |
---|
| 262 | wake_cstar(i) = cstar(i) |
---|
| 263 | END DO |
---|
[879] | 264 | |
---|
[2635] | 265 | ! Tendencies of state variables |
---|
| 266 | DO l = 1, klev |
---|
| 267 | DO i = 1, klon |
---|
| 268 | IF (ktopw(i)>0) THEN |
---|
| 269 | wake_ddeltat(i, l) = d_deltatw(i, l)*dtime |
---|
| 270 | wake_ddeltaq(i, l) = d_deltaqw(i, l)*dtime |
---|
| 271 | ELSE |
---|
| 272 | wake_ddeltat(i, l) = -wake_deltat(i, l) |
---|
| 273 | wake_ddeltaq(i, l) = -wake_deltaq(i, l) |
---|
| 274 | END IF |
---|
| 275 | END DO |
---|
| 276 | END DO |
---|
| 277 | DO i = 1, klon |
---|
| 278 | IF (ktopw(i)>0) THEN |
---|
| 279 | wake_ds(i) = d_sigmaw(i)*dtime |
---|
[3208] | 280 | awake_ddens(i) = d_awdens(i)*dtime |
---|
[2635] | 281 | wake_ddens(i) = d_wdens(i)*dtime |
---|
| 282 | ELSE |
---|
| 283 | wake_ds(i) = -wake_s(i) |
---|
| 284 | wake_ddens(i)= -wake_dens(i) |
---|
| 285 | END IF |
---|
| 286 | END DO |
---|
[2761] | 287 | ! |
---|
[2635] | 288 | |
---|
| 289 | !jyg< |
---|
| 290 | IF (iflag_wake_tend .EQ. 0) THEN |
---|
| 291 | ! Update State variables |
---|
| 292 | DO l = 1, klev |
---|
| 293 | DO i = 1, klon |
---|
| 294 | IF (ktopw(i)>0) THEN |
---|
| 295 | wake_deltat(i, l) = dtw(i, l) |
---|
| 296 | wake_deltaq(i, l) = dqw(i, l) |
---|
| 297 | ELSE |
---|
| 298 | wake_deltat(i, l) = 0. |
---|
| 299 | wake_deltaq(i, l) = 0. |
---|
| 300 | END IF |
---|
| 301 | END DO |
---|
| 302 | END DO |
---|
| 303 | DO i = 1, klon |
---|
| 304 | wake_s(i) = sigmaw(i) |
---|
[3208] | 305 | awake_dens(i) = awdens(i) |
---|
[2635] | 306 | wake_dens(i) = wdens(i) |
---|
| 307 | END DO |
---|
[3000] | 308 | ENDIF ! (iflag_wake_tend .EQ. 0) |
---|
| 309 | ! |
---|
| 310 | IF (first) THEN |
---|
| 311 | DO i = 1,klon |
---|
| 312 | IF (wake_dens(i) < -1.) THEN |
---|
| 313 | wake_dens(i) = wdens(i) |
---|
| 314 | ENDIF |
---|
| 315 | ENDDO |
---|
| 316 | first=.false. |
---|
| 317 | ENDIF ! (first) |
---|
[2635] | 318 | !>jyg |
---|
| 319 | |
---|
[1992] | 320 | RETURN |
---|
| 321 | END SUBROUTINE calwake |
---|
[2635] | 322 | |
---|