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