[1992] | 1 | |
---|
[1403] | 2 | ! $Id: calwake.F90 4727 2023-10-19 14:02:57Z 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 |
---|
[4727] | 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 |
---|
| 54 | REAL, DIMENSION(klon), INTENT (INOUT) :: wake_s |
---|
[3208] | 55 | REAL, DIMENSION(klon), INTENT (INOUT) :: awake_dens, wake_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 |
---|
[3208] | 72 | REAL, DIMENSION(klon), INTENT (OUT) :: wake_ds, awake_ddens, wake_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 |
---|
[3208] | 93 | REAL, DIMENSION(klon) :: sigmaw, awdens, wdens |
---|
[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 |
---|
[3208] | 104 | REAL, DIMENSION(klon) :: d_sigmaw, d_awdens, d_wdens |
---|
[974] | 105 | |
---|
[2635] | 106 | REAL :: rdcp |
---|
[974] | 107 | |
---|
| 108 | |
---|
[2761] | 109 | IF (prt_level >= 10) THEN |
---|
[3208] | 110 | print *, '-> calwake, wake_s, wgen input ', wake_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. |
---|
[3208] | 152 | d_awdens(:) = 0. |
---|
[2761] | 153 | d_wdens(:) = 0. |
---|
| 154 | ! |
---|
| 155 | |
---|
[1992] | 156 | DO i = 1, klon |
---|
| 157 | sigd0(i) = sigd(i) |
---|
| 158 | END DO |
---|
| 159 | ! print*, 'sigd0,sigd', sigd0, sigd(i) |
---|
| 160 | DO i = 1, klon |
---|
| 161 | ph(i, klev+1) = 0. |
---|
| 162 | END DO |
---|
[974] | 163 | |
---|
[2761] | 164 | !!jyg! DO i = 1, klon |
---|
| 165 | !!jyg! ktopw(i) = NINT(wake_k(i)) |
---|
| 166 | !!jyg! END DO |
---|
[974] | 167 | |
---|
[2635] | 168 | DO i = 1, klon |
---|
| 169 | hw(i) = wake_h(i) |
---|
| 170 | END DO |
---|
| 171 | ! |
---|
| 172 | ! Make a copy of state variables |
---|
[1992] | 173 | DO l = 1, klev |
---|
| 174 | DO i = 1, klon |
---|
| 175 | dtw(i, l) = wake_deltat(i, l) |
---|
| 176 | dqw(i, l) = wake_deltaq(i, l) |
---|
| 177 | END DO |
---|
| 178 | END DO |
---|
[974] | 179 | |
---|
[2635] | 180 | DO i = 1, klon |
---|
| 181 | sigmaw(i) = wake_s(i) |
---|
[1992] | 182 | END DO |
---|
[974] | 183 | |
---|
[1992] | 184 | DO i = 1, klon |
---|
[3208] | 185 | awdens(i) = max(0., awake_dens(i)) |
---|
[3000] | 186 | wdens(i) = max(0., wake_dens(i)) |
---|
[1992] | 187 | END DO |
---|
[974] | 188 | |
---|
[1992] | 189 | ! fkc les flux de masses sont evalues aux niveaux et valent 0 a la surface |
---|
| 190 | ! fkc on veut le flux de masse au milieu des couches |
---|
[974] | 191 | |
---|
[1992] | 192 | DO l = 1, klev - 1 |
---|
| 193 | DO i = 1, klon |
---|
| 194 | amdwn(i, l) = 0.5*(m_dwn(i,l)+m_dwn(i,l+1)) |
---|
| 195 | amdwn(i, l) = (m_dwn(i,l+1)) |
---|
| 196 | END DO |
---|
| 197 | END DO |
---|
[1403] | 198 | |
---|
[1992] | 199 | ! au sommet le flux de masse est nul |
---|
[974] | 200 | |
---|
[1992] | 201 | DO i = 1, klon |
---|
| 202 | amdwn(i, klev) = 0.5*m_dwn(i, klev) |
---|
| 203 | END DO |
---|
[879] | 204 | |
---|
[1992] | 205 | DO l = 1, klev |
---|
| 206 | DO i = 1, klon |
---|
| 207 | amup(i, l) = m_up(i, l) |
---|
| 208 | END DO |
---|
| 209 | END DO |
---|
[879] | 210 | |
---|
[4085] | 211 | |
---|
| 212 | |
---|
| 213 | CALL wake(klon,klev,znatsurf, p, ph, pi, dtime, & |
---|
[2635] | 214 | te, qe, omgbe, & |
---|
[3208] | 215 | dtdwn, dqdwn, amdwn, amup, dta, dqa, wgen, & |
---|
| 216 | sigd0, Cin, & |
---|
[4085] | 217 | dtw, dqw, sigmaw, awdens, wdens, & ! state variables |
---|
[2635] | 218 | dth, hw, wape, fip, gfl, & |
---|
| 219 | dtls, dqls, ktopw, omgbdth, dp_omgb, tx, qx, & |
---|
| 220 | dtke, dqke, omg, dp_deltomg, spread, cstar, & |
---|
| 221 | d_deltat_gw, & |
---|
[4085] | 222 | d_deltatw, d_deltaqw, d_sigmaw, d_awdens, d_wdens) ! tendencies |
---|
[879] | 223 | |
---|
[2635] | 224 | ! |
---|
[1992] | 225 | DO l = 1, klev |
---|
| 226 | DO i = 1, klon |
---|
| 227 | IF (ktopw(i)>0) THEN |
---|
| 228 | wake_d_deltat_gw(i, l) = d_deltat_gw(i, l) |
---|
| 229 | wake_omgbdth(i, l) = omgbdth(i, l) |
---|
| 230 | wake_dp_omgb(i, l) = dp_omgb(i, l) |
---|
| 231 | wake_dtke(i, l) = dtke(i, l) |
---|
| 232 | wake_dqke(i, l) = dqke(i, l) |
---|
| 233 | wake_omg(i, l) = omg(i, l) |
---|
| 234 | wake_dp_deltomg(i, l) = dp_deltomg(i, l) |
---|
| 235 | wake_spread(i, l) = spread(i, l) |
---|
| 236 | wake_dth(i, l) = dth(i, l) |
---|
[2635] | 237 | dt_wake(i, l) = dtls(i, l)*dtime ! derivative -> tendency |
---|
| 238 | dq_wake(i, l) = dqls(i, l)*dtime ! derivative -> tendency |
---|
| 239 | t_x(i, l) = tx(i, l) |
---|
| 240 | q_x(i, l) = qx(i, l) |
---|
[1992] | 241 | ELSE |
---|
| 242 | wake_d_deltat_gw(i, l) = 0. |
---|
| 243 | wake_omgbdth(i, l) = 0. |
---|
| 244 | wake_dp_omgb(i, l) = 0. |
---|
| 245 | wake_dtke(i, l) = 0. |
---|
| 246 | wake_dqke(i, l) = 0. |
---|
| 247 | wake_omg(i, l) = 0. |
---|
| 248 | wake_dp_deltomg(i, l) = 0. |
---|
| 249 | wake_spread(i, l) = 0. |
---|
| 250 | wake_dth(i, l) = 0. |
---|
| 251 | dt_wake(i, l) = 0. |
---|
| 252 | dq_wake(i, l) = 0. |
---|
[2635] | 253 | t_x(i, l) = te(i, l) |
---|
| 254 | q_x(i, l) = qe(i, l) |
---|
[1992] | 255 | END IF |
---|
| 256 | END DO |
---|
| 257 | END DO |
---|
[879] | 258 | |
---|
[1992] | 259 | DO i = 1, klon |
---|
| 260 | wake_h(i) = hw(i) |
---|
| 261 | wake_pe(i) = wape(i) |
---|
| 262 | wake_fip(i) = fip(i) |
---|
| 263 | wake_gfl(i) = gfl(i) |
---|
| 264 | wake_k(i) = ktopw(i) |
---|
| 265 | wake_cstar(i) = cstar(i) |
---|
| 266 | END DO |
---|
[879] | 267 | |
---|
[2635] | 268 | ! Tendencies of state variables |
---|
| 269 | DO l = 1, klev |
---|
| 270 | DO i = 1, klon |
---|
| 271 | IF (ktopw(i)>0) THEN |
---|
| 272 | wake_ddeltat(i, l) = d_deltatw(i, l)*dtime |
---|
| 273 | wake_ddeltaq(i, l) = d_deltaqw(i, l)*dtime |
---|
| 274 | ELSE |
---|
| 275 | wake_ddeltat(i, l) = -wake_deltat(i, l) |
---|
| 276 | wake_ddeltaq(i, l) = -wake_deltaq(i, l) |
---|
| 277 | END IF |
---|
| 278 | END DO |
---|
| 279 | END DO |
---|
| 280 | DO i = 1, klon |
---|
| 281 | IF (ktopw(i)>0) THEN |
---|
| 282 | wake_ds(i) = d_sigmaw(i)*dtime |
---|
[3208] | 283 | awake_ddens(i) = d_awdens(i)*dtime |
---|
[2635] | 284 | wake_ddens(i) = d_wdens(i)*dtime |
---|
| 285 | ELSE |
---|
| 286 | wake_ds(i) = -wake_s(i) |
---|
| 287 | wake_ddens(i)= -wake_dens(i) |
---|
| 288 | END IF |
---|
| 289 | END DO |
---|
[2761] | 290 | ! |
---|
[2635] | 291 | |
---|
| 292 | !jyg< |
---|
| 293 | IF (iflag_wake_tend .EQ. 0) THEN |
---|
| 294 | ! Update State variables |
---|
| 295 | DO l = 1, klev |
---|
| 296 | DO i = 1, klon |
---|
| 297 | IF (ktopw(i)>0) THEN |
---|
| 298 | wake_deltat(i, l) = dtw(i, l) |
---|
| 299 | wake_deltaq(i, l) = dqw(i, l) |
---|
| 300 | ELSE |
---|
| 301 | wake_deltat(i, l) = 0. |
---|
| 302 | wake_deltaq(i, l) = 0. |
---|
| 303 | END IF |
---|
| 304 | END DO |
---|
| 305 | END DO |
---|
| 306 | DO i = 1, klon |
---|
| 307 | wake_s(i) = sigmaw(i) |
---|
[3208] | 308 | awake_dens(i) = awdens(i) |
---|
[2635] | 309 | wake_dens(i) = wdens(i) |
---|
| 310 | END DO |
---|
[3000] | 311 | ENDIF ! (iflag_wake_tend .EQ. 0) |
---|
| 312 | ! |
---|
| 313 | IF (first) THEN |
---|
| 314 | DO i = 1,klon |
---|
| 315 | IF (wake_dens(i) < -1.) THEN |
---|
| 316 | wake_dens(i) = wdens(i) |
---|
| 317 | ENDIF |
---|
| 318 | ENDDO |
---|
| 319 | first=.false. |
---|
| 320 | ENDIF ! (first) |
---|
[2635] | 321 | !>jyg |
---|
| 322 | |
---|
[1992] | 323 | RETURN |
---|
| 324 | END SUBROUTINE calwake |
---|
[2635] | 325 | |
---|