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