[1992] | 1 | |
---|
[1403] | 2 | ! $Id: calwake.F90 4094 2022-03-14 00:45:50Z fhourdin $ |
---|
[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 | |
---|
[4085] | 210 | |
---|
| 211 | |
---|
| 212 | CALL wake(klon,klev,znatsurf, p, ph, pi, dtime, & |
---|
[2635] | 213 | te, qe, omgbe, & |
---|
[3208] | 214 | dtdwn, dqdwn, amdwn, amup, dta, dqa, wgen, & |
---|
| 215 | sigd0, Cin, & |
---|
[4085] | 216 | dtw, dqw, sigmaw, awdens, wdens, & ! state variables |
---|
[2635] | 217 | dth, hw, wape, fip, gfl, & |
---|
| 218 | dtls, dqls, ktopw, omgbdth, dp_omgb, tx, qx, & |
---|
| 219 | dtke, dqke, omg, dp_deltomg, spread, cstar, & |
---|
| 220 | d_deltat_gw, & |
---|
[4085] | 221 | d_deltatw, d_deltaqw, d_sigmaw, d_awdens, d_wdens) ! tendencies |
---|
[879] | 222 | |
---|
[2635] | 223 | ! |
---|
[1992] | 224 | DO l = 1, klev |
---|
| 225 | DO i = 1, klon |
---|
| 226 | IF (ktopw(i)>0) THEN |
---|
| 227 | wake_d_deltat_gw(i, l) = d_deltat_gw(i, l) |
---|
| 228 | wake_omgbdth(i, l) = omgbdth(i, l) |
---|
| 229 | wake_dp_omgb(i, l) = dp_omgb(i, l) |
---|
| 230 | wake_dtke(i, l) = dtke(i, l) |
---|
| 231 | wake_dqke(i, l) = dqke(i, l) |
---|
| 232 | wake_omg(i, l) = omg(i, l) |
---|
| 233 | wake_dp_deltomg(i, l) = dp_deltomg(i, l) |
---|
| 234 | wake_spread(i, l) = spread(i, l) |
---|
| 235 | wake_dth(i, l) = dth(i, l) |
---|
[2635] | 236 | dt_wake(i, l) = dtls(i, l)*dtime ! derivative -> tendency |
---|
| 237 | dq_wake(i, l) = dqls(i, l)*dtime ! derivative -> tendency |
---|
| 238 | t_x(i, l) = tx(i, l) |
---|
| 239 | q_x(i, l) = qx(i, l) |
---|
[1992] | 240 | ELSE |
---|
| 241 | wake_d_deltat_gw(i, l) = 0. |
---|
| 242 | wake_omgbdth(i, l) = 0. |
---|
| 243 | wake_dp_omgb(i, l) = 0. |
---|
| 244 | wake_dtke(i, l) = 0. |
---|
| 245 | wake_dqke(i, l) = 0. |
---|
| 246 | wake_omg(i, l) = 0. |
---|
| 247 | wake_dp_deltomg(i, l) = 0. |
---|
| 248 | wake_spread(i, l) = 0. |
---|
| 249 | wake_dth(i, l) = 0. |
---|
| 250 | dt_wake(i, l) = 0. |
---|
| 251 | dq_wake(i, l) = 0. |
---|
[2635] | 252 | t_x(i, l) = te(i, l) |
---|
| 253 | q_x(i, l) = qe(i, l) |
---|
[1992] | 254 | END IF |
---|
| 255 | END DO |
---|
| 256 | END DO |
---|
[879] | 257 | |
---|
[1992] | 258 | DO i = 1, klon |
---|
| 259 | wake_h(i) = hw(i) |
---|
| 260 | wake_pe(i) = wape(i) |
---|
| 261 | wake_fip(i) = fip(i) |
---|
| 262 | wake_gfl(i) = gfl(i) |
---|
| 263 | wake_k(i) = ktopw(i) |
---|
| 264 | wake_cstar(i) = cstar(i) |
---|
| 265 | END DO |
---|
[879] | 266 | |
---|
[2635] | 267 | ! Tendencies of state variables |
---|
| 268 | DO l = 1, klev |
---|
| 269 | DO i = 1, klon |
---|
| 270 | IF (ktopw(i)>0) THEN |
---|
| 271 | wake_ddeltat(i, l) = d_deltatw(i, l)*dtime |
---|
| 272 | wake_ddeltaq(i, l) = d_deltaqw(i, l)*dtime |
---|
| 273 | ELSE |
---|
| 274 | wake_ddeltat(i, l) = -wake_deltat(i, l) |
---|
| 275 | wake_ddeltaq(i, l) = -wake_deltaq(i, l) |
---|
| 276 | END IF |
---|
| 277 | END DO |
---|
| 278 | END DO |
---|
| 279 | DO i = 1, klon |
---|
| 280 | IF (ktopw(i)>0) THEN |
---|
| 281 | wake_ds(i) = d_sigmaw(i)*dtime |
---|
[3208] | 282 | awake_ddens(i) = d_awdens(i)*dtime |
---|
[2635] | 283 | wake_ddens(i) = d_wdens(i)*dtime |
---|
| 284 | ELSE |
---|
| 285 | wake_ds(i) = -wake_s(i) |
---|
| 286 | wake_ddens(i)= -wake_dens(i) |
---|
| 287 | END IF |
---|
| 288 | END DO |
---|
[2761] | 289 | ! |
---|
[2635] | 290 | |
---|
| 291 | !jyg< |
---|
| 292 | IF (iflag_wake_tend .EQ. 0) THEN |
---|
| 293 | ! Update State variables |
---|
| 294 | DO l = 1, klev |
---|
| 295 | DO i = 1, klon |
---|
| 296 | IF (ktopw(i)>0) THEN |
---|
| 297 | wake_deltat(i, l) = dtw(i, l) |
---|
| 298 | wake_deltaq(i, l) = dqw(i, l) |
---|
| 299 | ELSE |
---|
| 300 | wake_deltat(i, l) = 0. |
---|
| 301 | wake_deltaq(i, l) = 0. |
---|
| 302 | END IF |
---|
| 303 | END DO |
---|
| 304 | END DO |
---|
| 305 | DO i = 1, klon |
---|
| 306 | wake_s(i) = sigmaw(i) |
---|
[3208] | 307 | awake_dens(i) = awdens(i) |
---|
[2635] | 308 | wake_dens(i) = wdens(i) |
---|
| 309 | END DO |
---|
[3000] | 310 | ENDIF ! (iflag_wake_tend .EQ. 0) |
---|
| 311 | ! |
---|
| 312 | IF (first) THEN |
---|
| 313 | DO i = 1,klon |
---|
| 314 | IF (wake_dens(i) < -1.) THEN |
---|
| 315 | wake_dens(i) = wdens(i) |
---|
| 316 | ENDIF |
---|
| 317 | ENDDO |
---|
| 318 | first=.false. |
---|
| 319 | ENDIF ! (first) |
---|
[2635] | 320 | !>jyg |
---|
| 321 | |
---|
[1992] | 322 | RETURN |
---|
| 323 | END SUBROUTINE calwake |
---|
[2635] | 324 | |
---|