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