[5186] | 1 | MODULE lmdz_leapfrog |
---|
[5099] | 2 | |
---|
[5186] | 3 | IMPLICIT NONE; PRIVATE |
---|
| 4 | PUBLIC leapfrog |
---|
[5159] | 5 | |
---|
[5186] | 6 | CONTAINS |
---|
[5159] | 7 | |
---|
[5186] | 8 | SUBROUTINE leapfrog(ucov, vcov, teta, ps, masse, phis, q, time_0) |
---|
[524] | 9 | |
---|
[5186] | 10 | !IM : pour sortir les param. du modele dans un fis. netcdf 110106 |
---|
| 11 | USE IOIPSL |
---|
| 12 | USE lmdz_infotrac, ONLY: nqtot, isoCheck |
---|
| 13 | USE guide_mod, ONLY: guide_main |
---|
| 14 | USE lmdz_write_field, ONLY: writefield |
---|
| 15 | USE control_mod, ONLY: nday, day_step, planet_type, offline, & |
---|
| 16 | iconser, iphysiq, iperiod, dissip_period, & |
---|
| 17 | iecri, ip_ebil_dyn, ok_dynzon, ok_dyn_ins, & |
---|
| 18 | periodav, ok_dyn_ave, output_grads_dyn |
---|
| 19 | USE exner_hyb_m, ONLY: exner_hyb |
---|
| 20 | USE exner_milieu_m, ONLY: exner_milieu |
---|
| 21 | USE comvert_mod, ONLY: ap, bp, pressure_exner, presnivs |
---|
| 22 | USE comconst_mod, ONLY: cpp, dtphys, dtvr, pi, ihf |
---|
| 23 | USE logic_mod, ONLY: iflag_phys, ok_guide, forward, leapf, apphys, & |
---|
| 24 | statcl, conser, apdiss, purmats, ok_strato |
---|
| 25 | USE temps_mod, ONLY: jD_ref, jH_ref, itaufin, day_ini, day_ref, & |
---|
| 26 | start_time, dt |
---|
| 27 | USE lmdz_strings, ONLY: msg |
---|
| 28 | USE lmdz_cppkeys_wrapper, ONLY: CPPKEY_PHYS |
---|
| 29 | USE lmdz_description, ONLY: descript |
---|
| 30 | USE lmdz_iniprint, ONLY: lunout, prt_level |
---|
| 31 | USE lmdz_ssum_scopy, ONLY: scopy, ssum |
---|
| 32 | USE lmdz_academic, ONLY: tetarappel, knewt_t, kfrict, knewt_g, clat4 |
---|
| 33 | USE lmdz_comdissnew, ONLY: lstardis, nitergdiv, nitergrot, niterh, tetagdiv, & |
---|
| 34 | tetagrot, tetatemp, coefdis, vert_prof_dissip |
---|
| 35 | USE lmdz_comgeom |
---|
[524] | 36 | |
---|
[5186] | 37 | USE lmdz_dimensions, ONLY: iim, jjm, llm, ndm |
---|
| 38 | USE lmdz_paramet |
---|
| 39 | USE lmdz_addfi, ONLY: addfi |
---|
| 40 | USE lmdz_caldyn, ONLY: caldyn |
---|
| 41 | USE lmdz_caladvtrac, ONLY: caladvtrac |
---|
| 42 | USE lmdz_bilan_dyn, ONLY: bilan_dyn |
---|
| 43 | USE lmdz_check_isotopes, ONLY: check_isotopes_seq |
---|
| 44 | USE lmdz_writedynav, ONLY: writedynav |
---|
| 45 | USE lmdz_writehist, ONLY: writehist |
---|
| 46 | USE lmdz_dissip, ONLY: dissip |
---|
| 47 | USE lmdz_dynredem, ONLY: dynredem1 |
---|
[2021] | 48 | |
---|
[5186] | 49 | IMPLICIT NONE |
---|
[524] | 50 | |
---|
[5186] | 51 | ! ...... Version du 10/01/98 .......... |
---|
[524] | 52 | |
---|
[5186] | 53 | ! avec coordonnees verticales hybrides |
---|
| 54 | ! avec nouveaux operat. dissipation * ( gradiv2,divgrad2,nxgraro2 ) |
---|
[524] | 55 | |
---|
[5186] | 56 | !======================================================================= |
---|
[5159] | 57 | |
---|
[5186] | 58 | ! Auteur: P. Le Van /L. Fairhead/F.Hourdin |
---|
| 59 | ! ------- |
---|
[5159] | 60 | |
---|
[5186] | 61 | ! Objet: |
---|
| 62 | ! ------ |
---|
[5159] | 63 | |
---|
[5186] | 64 | ! GCM LMD nouvelle grille |
---|
[5159] | 65 | |
---|
[5186] | 66 | !======================================================================= |
---|
[5159] | 67 | |
---|
[5186] | 68 | ! ... Dans inigeom , nouveaux calculs pour les elongations cu , cv |
---|
| 69 | ! et possibilite d'appeler une fonction f(y) a derivee tangente |
---|
| 70 | ! hyperbolique a la place de la fonction a derivee sinusoidale. |
---|
[524] | 71 | |
---|
[5186] | 72 | ! ... Possibilite de choisir le shema pour l'advection de |
---|
| 73 | ! q , en modifiant iadv dans traceur.def (10/02) . |
---|
[5159] | 74 | |
---|
[5186] | 75 | ! Pour Van-Leer + Vapeur d'eau saturee, iadv(1)=4. (F.Codron,10/99) |
---|
| 76 | ! Pour Van-Leer iadv=10 |
---|
[5159] | 77 | |
---|
[5186] | 78 | !----------------------------------------------------------------------- |
---|
| 79 | ! Declarations: |
---|
| 80 | ! ------------- |
---|
[524] | 81 | |
---|
[5186] | 82 | REAL, INTENT(IN) :: time_0 ! not used |
---|
[524] | 83 | |
---|
[5186] | 84 | ! dynamical variables: |
---|
| 85 | REAL, INTENT(INOUT) :: ucov(ip1jmp1, llm) ! zonal covariant wind |
---|
| 86 | REAL, INTENT(INOUT) :: vcov(ip1jm, llm) ! meridional covariant wind |
---|
| 87 | REAL, INTENT(INOUT) :: teta(ip1jmp1, llm) ! potential temperature |
---|
| 88 | REAL, INTENT(INOUT) :: ps(ip1jmp1) ! surface pressure (Pa) |
---|
| 89 | REAL, INTENT(INOUT) :: masse(ip1jmp1, llm) ! air mass |
---|
| 90 | REAL, INTENT(INOUT) :: phis(ip1jmp1) ! geopotentiat at the surface |
---|
| 91 | REAL, INTENT(INOUT) :: q(ip1jmp1, llm, nqtot) ! advected tracers |
---|
[5159] | 92 | |
---|
[5186] | 93 | REAL :: p (ip1jmp1, llmp1) ! interlayer pressure |
---|
| 94 | REAL :: pks(ip1jmp1) ! exner at the surface |
---|
| 95 | REAL :: pk(ip1jmp1, llm) ! exner at mid-layer |
---|
| 96 | REAL :: pkf(ip1jmp1, llm) ! filtered exner at mid-layer |
---|
| 97 | REAL :: phi(ip1jmp1, llm) ! geopotential |
---|
| 98 | REAL :: w(ip1jmp1, llm) ! vertical velocity |
---|
[5159] | 99 | |
---|
[5186] | 100 | REAL :: zqmin, zqmax |
---|
[524] | 101 | |
---|
[5186] | 102 | ! variables dynamiques intermediaire pour le transport |
---|
| 103 | REAL :: pbaru(ip1jmp1, llm), pbarv(ip1jm, llm) !flux de masse |
---|
[1987] | 104 | |
---|
[5186] | 105 | ! variables dynamiques au pas -1 |
---|
| 106 | REAL :: vcovm1(ip1jm, llm), ucovm1(ip1jmp1, llm) |
---|
| 107 | REAL :: tetam1(ip1jmp1, llm), psm1(ip1jmp1) |
---|
| 108 | REAL :: massem1(ip1jmp1, llm) |
---|
[1987] | 109 | |
---|
[5186] | 110 | ! tendances dynamiques |
---|
| 111 | REAL :: dv(ip1jm, llm), du(ip1jmp1, llm) |
---|
| 112 | REAL :: dteta(ip1jmp1, llm), dq(ip1jmp1, llm, nqtot), dp(ip1jmp1) |
---|
[524] | 113 | |
---|
[5186] | 114 | ! tendances de la dissipation |
---|
| 115 | REAL :: dvdis(ip1jm, llm), dudis(ip1jmp1, llm) |
---|
| 116 | REAL :: dtetadis(ip1jmp1, llm) |
---|
[524] | 117 | |
---|
[5186] | 118 | ! tendances physiques |
---|
| 119 | REAL :: dvfi(ip1jm, llm), dufi(ip1jmp1, llm) |
---|
| 120 | REAL :: dtetafi(ip1jmp1, llm), dqfi(ip1jmp1, llm, nqtot), dpfi(ip1jmp1) |
---|
[524] | 121 | |
---|
[5186] | 122 | ! variables pour le fichier histoire |
---|
| 123 | REAL :: dtav ! intervalle de temps elementaire |
---|
[524] | 124 | |
---|
[5186] | 125 | REAL :: tppn(iim), tpps(iim), tpn, tps |
---|
[524] | 126 | |
---|
[5186] | 127 | INTEGER :: itau, itaufinp1, iav |
---|
| 128 | ! INTEGER iday ! jour julien |
---|
| 129 | REAL :: time |
---|
[524] | 130 | |
---|
[5186] | 131 | ! REAL finvmaold(ip1jmp1,llm) |
---|
[524] | 132 | |
---|
[5186] | 133 | !ym LOGICAL lafin |
---|
| 134 | LOGICAL :: lafin = .FALSE. |
---|
| 135 | INTEGER :: ij, iq, l |
---|
| 136 | INTEGER :: ik |
---|
[5159] | 137 | |
---|
[5186] | 138 | REAL :: time_step, t_wrt, t_ops |
---|
[524] | 139 | |
---|
[5186] | 140 | ! REAL rdayvrai,rdaym_ini |
---|
| 141 | ! jD_cur: jour julien courant |
---|
| 142 | ! jH_cur: heure julienne courante |
---|
| 143 | REAL :: jD_cur, jH_cur |
---|
| 144 | INTEGER :: an, mois, jour |
---|
| 145 | REAL :: secondes |
---|
[524] | 146 | |
---|
[5186] | 147 | LOGICAL :: first, callinigrads |
---|
| 148 | !IM : pour sortir les param. du modele dans un fis. netcdf 110106 |
---|
| 149 | save first |
---|
| 150 | data first/.TRUE./ |
---|
| 151 | REAL :: dt_cum |
---|
| 152 | CHARACTER(LEN = 10) :: infile |
---|
| 153 | INTEGER :: zan, tau0, thoriid |
---|
| 154 | INTEGER :: nid_ctesGCM |
---|
| 155 | save nid_ctesGCM |
---|
| 156 | REAL :: degres |
---|
| 157 | REAL :: rlong(iip1), rlatg(jjp1) |
---|
| 158 | REAL :: zx_tmp_2d(iip1, jjp1) |
---|
| 159 | INTEGER :: ndex2d(iip1 * jjp1) |
---|
| 160 | LOGICAL :: ok_sync |
---|
| 161 | parameter (ok_sync = .TRUE.) |
---|
| 162 | LOGICAL :: physic |
---|
[524] | 163 | |
---|
[5186] | 164 | data callinigrads/.TRUE./ |
---|
| 165 | CHARACTER(LEN = 10) :: string10 |
---|
[524] | 166 | |
---|
[5186] | 167 | REAL :: flxw(ip1jmp1, llm) ! flux de masse verticale |
---|
[1279] | 168 | |
---|
[5186] | 169 | !+jld variables test conservation energie |
---|
| 170 | REAL :: ecin(ip1jmp1, llm), ecin0(ip1jmp1, llm) |
---|
| 171 | ! Tendance de la temp. potentiel d (theta)/ d t due a la |
---|
| 172 | ! tansformation d'energie cinetique en energie thermique |
---|
| 173 | ! cree par la dissipation |
---|
| 174 | REAL :: dtetaecdt(ip1jmp1, llm) |
---|
| 175 | REAL :: vcont(ip1jm, llm), ucont(ip1jmp1, llm) |
---|
| 176 | REAL :: vnat(ip1jm, llm), unat(ip1jmp1, llm) |
---|
| 177 | REAL :: d_h_vcol, d_qt, d_qw, d_ql, d_ec |
---|
| 178 | CHARACTER(len = 15) :: ztit |
---|
| 179 | !IM INTEGER ip_ebil_dyn ! PRINT level for energy conserv. diag. |
---|
| 180 | !IM SAVE ip_ebil_dyn |
---|
| 181 | !IM DATA ip_ebil_dyn/0/ |
---|
| 182 | !-jld |
---|
[524] | 183 | |
---|
[5186] | 184 | CHARACTER(LEN = 80) :: dynhist_file, dynhistave_file |
---|
| 185 | CHARACTER(LEN = *), parameter :: modname = "leapfrog" |
---|
| 186 | CHARACTER(LEN = 80) :: abort_message |
---|
[524] | 187 | |
---|
[5186] | 188 | LOGICAL :: dissip_conservative |
---|
| 189 | save dissip_conservative |
---|
| 190 | data dissip_conservative/.TRUE./ |
---|
[524] | 191 | |
---|
[5186] | 192 | LOGICAL :: prem |
---|
| 193 | save prem |
---|
| 194 | DATA prem/.TRUE./ |
---|
| 195 | INTEGER :: testita |
---|
| 196 | PARAMETER (testita = 9) |
---|
[524] | 197 | |
---|
[5186] | 198 | logical, parameter :: flag_verif = .FALSE. |
---|
[524] | 199 | |
---|
[5186] | 200 | INTEGER :: itau_w ! pas de temps ecriture = itap + itau_phy |
---|
[524] | 201 | |
---|
[5186] | 202 | IF (nday>=0) THEN |
---|
| 203 | itaufin = nday * day_step |
---|
| 204 | else |
---|
| 205 | itaufin = -nday |
---|
| 206 | ENDIF |
---|
| 207 | itaufinp1 = itaufin + 1 |
---|
| 208 | itau = 0 |
---|
| 209 | physic = .TRUE. |
---|
| 210 | IF (iflag_phys==0.OR.iflag_phys==2) physic = .FALSE. |
---|
[524] | 211 | |
---|
[5186] | 212 | ! iday = day_ini+itau/day_step |
---|
| 213 | ! time = REAL(itau-(iday-day_ini)*day_step)/day_step+time_0 |
---|
| 214 | ! IF(time.GT.1.) THEN |
---|
| 215 | ! time = time-1. |
---|
| 216 | ! iday = iday+1 |
---|
| 217 | ! ENDIF |
---|
[999] | 218 | |
---|
[825] | 219 | |
---|
[5186] | 220 | !----------------------------------------------------------------------- |
---|
| 221 | ! On initialise la pression et la fonction d'Exner : |
---|
| 222 | ! -------------------------------------------------- |
---|
[825] | 223 | |
---|
[5186] | 224 | dq(:, :, :) = 0. |
---|
| 225 | CALL pression (ip1jmp1, ap, bp, ps, p) |
---|
| 226 | IF (pressure_exner) THEN |
---|
| 227 | CALL exner_hyb(ip1jmp1, ps, p, pks, pk, pkf) |
---|
| 228 | else |
---|
| 229 | CALL exner_milieu(ip1jmp1, ps, p, pks, pk, pkf) |
---|
| 230 | ENDIF |
---|
[524] | 231 | |
---|
[5186] | 232 | !----------------------------------------------------------------------- |
---|
| 233 | ! Debut de l'integration temporelle: |
---|
| 234 | ! ---------------------------------- |
---|
[524] | 235 | |
---|
[5186] | 236 | 1 CONTINUE ! Matsuno Forward step begins here |
---|
[524] | 237 | |
---|
[5186] | 238 | ! date: (NB: date remains unchanged for Backward step) |
---|
| 239 | ! ----- |
---|
[524] | 240 | |
---|
[5103] | 241 | jD_cur = jD_ref + day_ini - day_ref + & |
---|
| 242 | (itau + 1) / day_step |
---|
| 243 | jH_cur = jH_ref + start_time + & |
---|
| 244 | mod(itau + 1, day_step) / float(day_step) |
---|
| 245 | jD_cur = jD_cur + int(jH_cur) |
---|
| 246 | jH_cur = jH_cur - int(jH_cur) |
---|
[524] | 247 | |
---|
[5186] | 248 | CALL check_isotopes_seq(q, ip1jmp1, 'leapfrog 321') |
---|
[524] | 249 | |
---|
[5186] | 250 | IF (ok_guide) THEN |
---|
| 251 | CALL guide_main(itau, ucov, vcov, teta, q, masse, ps) |
---|
| 252 | ENDIF |
---|
[5159] | 253 | |
---|
[2375] | 254 | |
---|
[524] | 255 | |
---|
[5186] | 256 | ! IF( MOD( itau, 10* day_step ).EQ.0 ) THEN |
---|
| 257 | ! CALL test_period ( ucov,vcov,teta,q,p,phis ) |
---|
| 258 | ! PRINT *,' ---- Test_period apres continue OK ! -----', itau |
---|
| 259 | ! ENDIF |
---|
| 260 | ! |
---|
[524] | 261 | |
---|
[5186] | 262 | ! Save fields obtained at previous time step as '...m1' |
---|
| 263 | CALL SCOPY(ijmllm, vcov, 1, vcovm1, 1) |
---|
| 264 | CALL SCOPY(ijp1llm, ucov, 1, ucovm1, 1) |
---|
| 265 | CALL SCOPY(ijp1llm, teta, 1, tetam1, 1) |
---|
| 266 | CALL SCOPY(ijp1llm, masse, 1, massem1, 1) |
---|
| 267 | CALL SCOPY(ip1jmp1, ps, 1, psm1, 1) |
---|
[524] | 268 | |
---|
[5186] | 269 | forward = .TRUE. |
---|
| 270 | leapf = .FALSE. |
---|
| 271 | dt = dtvr |
---|
[1403] | 272 | |
---|
[5186] | 273 | ! ... P.Le Van .26/04/94 .... |
---|
| 274 | ! Ehouarn: finvmaold is actually not used |
---|
| 275 | ! CALL SCOPY ( ijp1llm, masse, 1, finvmaold, 1 ) |
---|
| 276 | ! CALL filtreg ( finvmaold ,jjp1, llm, -2,2, .TRUE., 1 ) |
---|
[2270] | 277 | |
---|
[5186] | 278 | CALL check_isotopes_seq(q, ip1jmp1, 'leapfrog 400') |
---|
[2270] | 279 | |
---|
[5186] | 280 | 2 CONTINUE ! Matsuno backward or leapfrog step begins here |
---|
[524] | 281 | |
---|
[5186] | 282 | !----------------------------------------------------------------------- |
---|
[524] | 283 | |
---|
[5186] | 284 | ! date: (NB: only leapfrog step requires recomputing date) |
---|
| 285 | ! ----- |
---|
[524] | 286 | |
---|
[5186] | 287 | IF (leapf) THEN |
---|
| 288 | jD_cur = jD_ref + day_ini - day_ref + & |
---|
| 289 | (itau + 1) / day_step |
---|
| 290 | jH_cur = jH_ref + start_time + & |
---|
| 291 | mod(itau + 1, day_step) / float(day_step) |
---|
| 292 | jD_cur = jD_cur + int(jH_cur) |
---|
| 293 | jH_cur = jH_cur - int(jH_cur) |
---|
| 294 | ENDIF |
---|
[1279] | 295 | |
---|
[524] | 296 | |
---|
[5186] | 297 | ! gestion des appels de la physique et des dissipations: |
---|
| 298 | ! ------------------------------------------------------ |
---|
[2270] | 299 | |
---|
[5186] | 300 | ! ... P.Le Van ( 6/02/95 ) .... |
---|
[2270] | 301 | |
---|
[5186] | 302 | apphys = .FALSE. |
---|
| 303 | statcl = .FALSE. |
---|
| 304 | conser = .FALSE. |
---|
| 305 | apdiss = .FALSE. |
---|
[5159] | 306 | |
---|
[5186] | 307 | IF(purmats) THEN |
---|
| 308 | ! Purely Matsuno time stepping |
---|
| 309 | IF(MOD(itau, iconser) ==0.AND. forward) conser = .TRUE. |
---|
| 310 | IF(MOD(itau, dissip_period)==0.AND..NOT.forward) & |
---|
| 311 | apdiss = .TRUE. |
---|
| 312 | IF(MOD(itau, iphysiq)==0.AND..NOT.forward & |
---|
| 313 | .AND. physic) apphys = .TRUE. |
---|
| 314 | ELSE |
---|
| 315 | ! Leapfrog/Matsuno time stepping |
---|
| 316 | IF(MOD(itau, iconser) == 0) conser = .TRUE. |
---|
| 317 | IF(MOD(itau + 1, dissip_period)==0 .AND. .NOT. forward) & |
---|
| 318 | apdiss = .TRUE. |
---|
| 319 | IF(MOD(itau + 1, iphysiq)==0.AND.physic) apphys = .TRUE. |
---|
| 320 | END IF |
---|
[524] | 321 | |
---|
[5186] | 322 | ! Ehouarn: for Shallow Water case (ie: 1 vertical layer), |
---|
| 323 | ! supress dissipation step |
---|
| 324 | IF (llm==1) THEN |
---|
| 325 | apdiss = .FALSE. |
---|
| 326 | ENDIF |
---|
[524] | 327 | |
---|
[5186] | 328 | CALL check_isotopes_seq(q, ip1jmp1, 'leapfrog 589') |
---|
[524] | 329 | |
---|
[5186] | 330 | !----------------------------------------------------------------------- |
---|
| 331 | ! calcul des tendances dynamiques: |
---|
| 332 | ! -------------------------------- |
---|
[524] | 333 | |
---|
[5186] | 334 | ! compute geopotential phi() |
---|
| 335 | CALL geopot (ip1jmp1, teta, pk, pks, phis, phi) |
---|
[524] | 336 | |
---|
[5186] | 337 | time = jD_cur + jH_cur |
---|
| 338 | CALL caldyn & |
---|
| 339 | (itau, ucov, vcov, teta, ps, masse, pk, pkf, phis, & |
---|
| 340 | phi, conser, du, dv, dteta, dp, w, pbaru, pbarv, time) |
---|
[524] | 341 | |
---|
[5159] | 342 | |
---|
[5186] | 343 | !----------------------------------------------------------------------- |
---|
| 344 | ! calcul des tendances advection des traceurs (dont l'humidite) |
---|
| 345 | ! ------------------------------------------------------------- |
---|
[5159] | 346 | |
---|
[5186] | 347 | CALL check_isotopes_seq(q, ip1jmp1, & |
---|
| 348 | 'leapfrog 686: avant caladvtrac') |
---|
[5159] | 349 | |
---|
[5186] | 350 | IF(forward .OR. leapf) THEN |
---|
| 351 | ! Ehouarn: NB: fields sent to advtrac are those at the beginning of the time step |
---|
| 352 | CALL caladvtrac(q, pbaru, pbarv, & |
---|
| 353 | p, masse, dq, teta, & |
---|
| 354 | flxw, pk) |
---|
| 355 | !WRITE(*,*) 'caladvtrac 346' |
---|
[5159] | 356 | |
---|
[5186] | 357 | IF (offline) THEN |
---|
| 358 | !maf stokage du flux de masse pour traceurs OFF-LINE |
---|
[5159] | 359 | |
---|
[5186] | 360 | CALL fluxstokenc(pbaru, pbarv, masse, teta, phi, phis, & |
---|
| 361 | dtvr, itau) |
---|
[524] | 362 | |
---|
[5186] | 363 | ENDIF ! of IF (offline) |
---|
[524] | 364 | |
---|
[5186] | 365 | ENDIF ! of IF( forward .OR. leapf ) |
---|
[524] | 366 | |
---|
[2039] | 367 | |
---|
[5186] | 368 | !----------------------------------------------------------------------- |
---|
| 369 | ! integrations dynamique et traceurs: |
---|
| 370 | ! ---------------------------------- |
---|
[1676] | 371 | |
---|
[5186] | 372 | CALL msg('720', modname, isoCheck) |
---|
| 373 | CALL check_isotopes_seq(q, ip1jmp1, 'leapfrog 756') |
---|
[1676] | 374 | |
---|
[5186] | 375 | CALL integrd (nqtot, vcovm1, ucovm1, tetam1, psm1, massem1, & |
---|
| 376 | dv, du, dteta, dq, dp, vcov, ucov, teta, q, ps, masse, phis) |
---|
| 377 | ! $ finvmaold ) |
---|
[524] | 378 | |
---|
[5186] | 379 | CALL msg('724', modname, isoCheck) |
---|
| 380 | CALL check_isotopes_seq(q, ip1jmp1, 'leapfrog 762') |
---|
[524] | 381 | |
---|
[5186] | 382 | ! .P.Le Van (26/04/94 ajout de finvpold dans l'appel d'integrd) |
---|
[524] | 383 | |
---|
[5186] | 384 | !----------------------------------------------------------------------- |
---|
| 385 | ! calcul des tendances physiques: |
---|
| 386 | ! ------------------------------- |
---|
| 387 | ! ######## P.Le Van ( Modif le 6/02/95 ) ########### |
---|
[524] | 388 | |
---|
[5186] | 389 | IF(purmats) THEN |
---|
| 390 | IF(itau==itaufin.AND..NOT.forward) lafin = .TRUE. |
---|
| 391 | ELSE |
---|
| 392 | IF(itau + 1 == itaufin) lafin = .TRUE. |
---|
[5103] | 393 | ENDIF |
---|
[1793] | 394 | |
---|
[5186] | 395 | IF(apphys) THEN |
---|
[5159] | 396 | |
---|
[5186] | 397 | ! ....... Ajout P.Le Van ( 17/04/96 ) ........... |
---|
| 398 | ! |
---|
[1146] | 399 | |
---|
[5186] | 400 | CALL pression (ip1jmp1, ap, bp, ps, p) |
---|
| 401 | IF (pressure_exner) THEN |
---|
| 402 | CALL exner_hyb(ip1jmp1, ps, p, pks, pk, pkf) |
---|
| 403 | else |
---|
| 404 | CALL exner_milieu(ip1jmp1, ps, p, pks, pk, pkf) |
---|
| 405 | endif |
---|
[524] | 406 | |
---|
[5186] | 407 | ! Appel a geopot ajoute le 2014/05/08 pour garantir la convergence numerique |
---|
| 408 | ! avec dyn3dmem |
---|
| 409 | CALL geopot (ip1jmp1, teta, pk, pks, phis, phi) |
---|
[1505] | 410 | |
---|
[5186] | 411 | ! rdaym_ini = itau * dtvr / daysec |
---|
| 412 | ! rdayvrai = rdaym_ini + day_ini |
---|
| 413 | ! jD_cur = jD_ref + day_ini - day_ref |
---|
| 414 | ! $ + int (itau * dtvr / daysec) |
---|
| 415 | ! jH_cur = jH_ref + & |
---|
| 416 | ! & (itau * dtvr / daysec - int(itau * dtvr / daysec)) |
---|
| 417 | jD_cur = jD_ref + day_ini - day_ref + & |
---|
| 418 | (itau + 1) / day_step |
---|
[524] | 419 | |
---|
[5186] | 420 | IF (planet_type =="generic") THEN |
---|
| 421 | ! AS: we make jD_cur to be pday |
---|
| 422 | jD_cur = int(day_ini + itau / day_step) |
---|
| 423 | ENDIF |
---|
[524] | 424 | |
---|
[5186] | 425 | jH_cur = jH_ref + start_time + & |
---|
| 426 | mod(itau + 1, day_step) / float(day_step) |
---|
| 427 | jD_cur = jD_cur + int(jH_cur) |
---|
| 428 | jH_cur = jH_cur - int(jH_cur) |
---|
| 429 | ! WRITE(lunout,*)'itau, jD_cur = ', itau, jD_cur, jH_cur |
---|
| 430 | ! CALL ju2ymds(jD_cur+jH_cur, an, mois, jour, secondes) |
---|
| 431 | ! WRITE(lunout,*)'current date = ',an, mois, jour, secondes |
---|
[524] | 432 | |
---|
[5186] | 433 | ! rajout debug |
---|
| 434 | ! lafin = .TRUE. |
---|
[524] | 435 | |
---|
| 436 | |
---|
[5186] | 437 | ! Inbterface avec les routines de phylmd (phymars ... ) |
---|
| 438 | ! ----------------------------------------------------- |
---|
[524] | 439 | |
---|
[5186] | 440 | !+jld |
---|
[524] | 441 | |
---|
[5186] | 442 | ! Diagnostique de conservation de l'energie : initialisation |
---|
| 443 | IF (ip_ebil_dyn>=1) THEN |
---|
| 444 | ztit = 'bil dyn' |
---|
| 445 | ! Ehouarn: be careful, diagedyn is Earth-specific! |
---|
| 446 | IF (planet_type=="earth") THEN |
---|
| 447 | CALL diagedyn(ztit, 2, 1, 1, dtphys & |
---|
| 448 | , ucov, vcov, ps, p, pk, teta, q(:, :, 1), q(:, :, 2)) |
---|
| 449 | ENDIF |
---|
| 450 | ENDIF ! of IF (ip_ebil_dyn.ge.1 ) |
---|
| 451 | IF (CPPKEY_PHYS) THEN |
---|
| 452 | CALL calfis(lafin, jD_cur, jH_cur, & |
---|
| 453 | ucov, vcov, teta, q, masse, ps, p, pk, phis, phi, & |
---|
| 454 | du, dv, dteta, dq, & |
---|
| 455 | flxw, dufi, dvfi, dtetafi, dqfi, dpfi) |
---|
| 456 | END IF |
---|
| 457 | ! ajout des tendances physiques: |
---|
| 458 | ! ------------------------------ |
---|
| 459 | CALL addfi(dtphys, leapf, forward, & |
---|
| 460 | ucov, vcov, teta, q, ps, & |
---|
| 461 | dufi, dvfi, dtetafi, dqfi, dpfi) |
---|
| 462 | ! since addfi updates ps(), also update p(), masse() and pk() |
---|
| 463 | CALL pression (ip1jmp1, ap, bp, ps, p) |
---|
| 464 | CALL massdair(p, masse) |
---|
| 465 | IF (pressure_exner) THEN |
---|
| 466 | CALL exner_hyb(ip1jmp1, ps, p, pks, pk, pkf) |
---|
| 467 | else |
---|
| 468 | CALL exner_milieu(ip1jmp1, ps, p, pks, pk, pkf) |
---|
| 469 | endif |
---|
[524] | 470 | |
---|
[5186] | 471 | IF (ok_strato) THEN |
---|
| 472 | CALL top_bound(vcov, ucov, teta, masse, dtphys) |
---|
| 473 | ENDIF |
---|
[524] | 474 | |
---|
| 475 | |
---|
[5186] | 476 | ! Diagnostique de conservation de l'energie : difference |
---|
| 477 | IF (ip_ebil_dyn>=1) THEN |
---|
| 478 | ztit = 'bil phys' |
---|
| 479 | IF (planet_type=="earth") THEN |
---|
| 480 | CALL diagedyn(ztit, 2, 1, 1, dtphys & |
---|
| 481 | , ucov, vcov, ps, p, pk, teta, q(:, :, 1), q(:, :, 2)) |
---|
| 482 | ENDIF |
---|
| 483 | ENDIF ! of IF (ip_ebil_dyn.ge.1 ) |
---|
[524] | 484 | |
---|
[5186] | 485 | ENDIF ! of IF( apphys ) |
---|
[524] | 486 | |
---|
[5186] | 487 | IF(iflag_phys==2) THEN ! "Newtonian" case |
---|
| 488 | ! Academic case : Simple friction and Newtonan relaxation |
---|
| 489 | ! ------------------------------------------------------- |
---|
| 490 | DO l = 1, llm |
---|
| 491 | DO ij = 1, ip1jmp1 |
---|
| 492 | teta(ij, l) = teta(ij, l) - dtvr * & |
---|
| 493 | (teta(ij, l) - tetarappel(ij, l)) * (knewt_g + knewt_t(l) * clat4(ij)) |
---|
| 494 | ENDDO |
---|
| 495 | ENDDO ! of DO l=1,llm |
---|
[524] | 496 | |
---|
[5186] | 497 | IF (planet_type=="giant") THEN |
---|
| 498 | ! add an intrinsic heat flux at the base of the atmosphere |
---|
| 499 | teta(:, 1) = teta(:, 1) + dtvr * aire(:) * ihf / cpp / masse(:, 1) |
---|
| 500 | endif |
---|
[524] | 501 | |
---|
[5186] | 502 | CALL friction(ucov, vcov, dtvr) |
---|
[524] | 503 | |
---|
[5186] | 504 | ! Sponge layer (if any) |
---|
| 505 | IF (ok_strato) THEN |
---|
| 506 | ! dufi(:,:)=0. |
---|
| 507 | ! dvfi(:,:)=0. |
---|
| 508 | ! dtetafi(:,:)=0. |
---|
| 509 | ! dqfi(:,:,:)=0. |
---|
| 510 | ! dpfi(:)=0. |
---|
| 511 | ! CALL top_bound(vcov,ucov,teta,masse,dufi,dvfi,dtetafi) |
---|
| 512 | CALL top_bound(vcov, ucov, teta, masse, dtvr) |
---|
| 513 | ! CALL addfi( dtvr, leapf, forward , |
---|
| 514 | ! $ ucov, vcov, teta , q ,ps , |
---|
| 515 | ! $ dufi, dvfi, dtetafi , dqfi ,dpfi ) |
---|
| 516 | ENDIF ! of IF (ok_strato) |
---|
| 517 | ENDIF ! of IF (iflag_phys.EQ.2) |
---|
[524] | 518 | |
---|
| 519 | |
---|
[5186] | 520 | !-jld |
---|
[524] | 521 | |
---|
[5186] | 522 | CALL pression (ip1jmp1, ap, bp, ps, p) |
---|
| 523 | IF (pressure_exner) THEN |
---|
| 524 | CALL exner_hyb(ip1jmp1, ps, p, pks, pk, pkf) |
---|
| 525 | else |
---|
| 526 | CALL exner_milieu(ip1jmp1, ps, p, pks, pk, pkf) |
---|
[5103] | 527 | ENDIF |
---|
[5186] | 528 | CALL massdair(p, masse) |
---|
[524] | 529 | |
---|
[5186] | 530 | CALL check_isotopes_seq(q, ip1jmp1, 'leapfrog 1196') |
---|
[524] | 531 | |
---|
[5103] | 532 | !----------------------------------------------------------------------- |
---|
[5186] | 533 | ! dissipation horizontale et verticale des petites echelles: |
---|
| 534 | ! ---------------------------------------------------------- |
---|
[524] | 535 | |
---|
[5186] | 536 | IF(apdiss) THEN |
---|
[524] | 537 | |
---|
[2270] | 538 | |
---|
[5186] | 539 | ! calcul de l'energie cinetique avant dissipation |
---|
| 540 | CALL covcont(llm, ucov, vcov, ucont, vcont) |
---|
| 541 | CALL enercin(vcov, ucov, vcont, ucont, ecin0) |
---|
[524] | 542 | |
---|
[5186] | 543 | ! dissipation |
---|
| 544 | CALL dissip(vcov, ucov, teta, p, dvdis, dudis, dtetadis) |
---|
| 545 | ucov = ucov + dudis |
---|
| 546 | vcov = vcov + dvdis |
---|
| 547 | ! teta=teta+dtetadis |
---|
[524] | 548 | |
---|
| 549 | |
---|
[5186] | 550 | !------------------------------------------------------------------------ |
---|
| 551 | IF (dissip_conservative) THEN |
---|
| 552 | ! On rajoute la tendance due a la transform. Ec -> E therm. cree |
---|
| 553 | ! lors de la dissipation |
---|
| 554 | CALL covcont(llm, ucov, vcov, ucont, vcont) |
---|
| 555 | CALL enercin(vcov, ucov, vcont, ucont, ecin) |
---|
| 556 | dtetaecdt = (ecin0 - ecin) / pk |
---|
| 557 | ! teta=teta+dtetaecdt |
---|
| 558 | dtetadis = dtetadis + dtetaecdt |
---|
[5103] | 559 | endif |
---|
[5186] | 560 | teta = teta + dtetadis |
---|
| 561 | !------------------------------------------------------------------------ |
---|
[524] | 562 | |
---|
| 563 | |
---|
[5186] | 564 | ! ....... P. Le Van ( ajout le 17/04/96 ) ........... |
---|
| 565 | ! ... Calcul de la valeur moyenne, unique de h aux poles ..... |
---|
| 566 | ! |
---|
[524] | 567 | |
---|
[5186] | 568 | DO l = 1, llm |
---|
| 569 | DO ij = 1, iim |
---|
| 570 | tppn(ij) = aire(ij) * teta(ij, l) |
---|
| 571 | tpps(ij) = aire(ij + ip1jm) * teta(ij + ip1jm, l) |
---|
| 572 | ENDDO |
---|
| 573 | tpn = SSUM(iim, tppn, 1) / apoln |
---|
| 574 | tps = SSUM(iim, tpps, 1) / apols |
---|
[524] | 575 | |
---|
[5186] | 576 | DO ij = 1, iip1 |
---|
| 577 | teta(ij, l) = tpn |
---|
| 578 | teta(ij + ip1jm, l) = tps |
---|
| 579 | ENDDO |
---|
| 580 | ENDDO |
---|
[524] | 581 | |
---|
[5186] | 582 | IF (1 == 0) THEN |
---|
| 583 | !!! Ehouarn: lines here 1) kill 1+1=2 in the dynamics |
---|
| 584 | !!! 2) should probably not be here anyway |
---|
| 585 | !!! but are kept for those who would want to revert to previous behaviour |
---|
| 586 | DO ij = 1, iim |
---|
| 587 | tppn(ij) = aire(ij) * ps (ij) |
---|
| 588 | tpps(ij) = aire(ij + ip1jm) * ps (ij + ip1jm) |
---|
| 589 | ENDDO |
---|
| 590 | tpn = SSUM(iim, tppn, 1) / apoln |
---|
| 591 | tps = SSUM(iim, tpps, 1) / apols |
---|
[524] | 592 | |
---|
[5186] | 593 | DO ij = 1, iip1 |
---|
| 594 | ps(ij) = tpn |
---|
| 595 | ps(ij + ip1jm) = tps |
---|
| 596 | ENDDO |
---|
| 597 | endif ! of if (1 == 0) |
---|
[524] | 598 | |
---|
[5186] | 599 | END IF ! of IF(apdiss) |
---|
[2270] | 600 | |
---|
[5186] | 601 | ! ajout debug |
---|
| 602 | ! IF( lafin ) THEN |
---|
| 603 | ! abort_message = 'Simulation finished' |
---|
| 604 | ! CALL abort_gcm(modname,abort_message,0) |
---|
| 605 | ! ENDIF |
---|
[524] | 606 | |
---|
[5186] | 607 | ! ******************************************************************** |
---|
| 608 | ! ******************************************************************** |
---|
| 609 | ! .... fin de l'integration dynamique et physique pour le pas itau .. |
---|
| 610 | ! ******************************************************************** |
---|
| 611 | ! ******************************************************************** |
---|
[524] | 612 | |
---|
[5186] | 613 | ! preparation du pas d'integration suivant ...... |
---|
[524] | 614 | |
---|
[5186] | 615 | CALL check_isotopes_seq(q, ip1jmp1, 'leapfrog 1509') |
---|
[524] | 616 | |
---|
[5186] | 617 | IF (.NOT.purmats) THEN |
---|
| 618 | ! ........................................................ |
---|
| 619 | ! .............. schema matsuno + leapfrog .............. |
---|
| 620 | ! ........................................................ |
---|
[5159] | 621 | |
---|
[5186] | 622 | IF(forward .OR. leapf) THEN |
---|
| 623 | itau = itau + 1 |
---|
| 624 | ! iday= day_ini+itau/day_step |
---|
| 625 | ! time= REAL(itau-(iday-day_ini)*day_step)/day_step+time_0 |
---|
| 626 | ! IF(time.GT.1.) THEN |
---|
| 627 | ! time = time-1. |
---|
| 628 | ! iday = iday+1 |
---|
| 629 | ! ENDIF |
---|
| 630 | ENDIF |
---|
[1146] | 631 | |
---|
[5116] | 632 | IF(itau == itaufinp1) THEN |
---|
[5186] | 633 | IF (flag_verif) THEN |
---|
| 634 | WRITE(79, *) 'ucov', ucov |
---|
| 635 | WRITE(80, *) 'vcov', vcov |
---|
| 636 | WRITE(81, *) 'teta', teta |
---|
| 637 | WRITE(82, *) 'ps', ps |
---|
| 638 | WRITE(83, *) 'q', q |
---|
| 639 | WRITE(85, *) 'q1 = ', q(:, :, 1) |
---|
| 640 | WRITE(86, *) 'q3 = ', q(:, :, 3) |
---|
| 641 | endif |
---|
| 642 | |
---|
[5103] | 643 | abort_message = 'Simulation finished' |
---|
[5186] | 644 | |
---|
[5103] | 645 | CALL abort_gcm(modname, abort_message, 0) |
---|
| 646 | ENDIF |
---|
[5186] | 647 | !----------------------------------------------------------------------- |
---|
| 648 | ! ecriture du fichier histoire moyenne: |
---|
| 649 | ! ------------------------------------- |
---|
[2475] | 650 | |
---|
[5103] | 651 | IF(MOD(itau, iperiod)==0 .OR. itau==itaufin) THEN |
---|
| 652 | IF(itau==itaufin) THEN |
---|
| 653 | iav = 1 |
---|
| 654 | ELSE |
---|
| 655 | iav = 0 |
---|
| 656 | ENDIF |
---|
[524] | 657 | |
---|
[5186] | 658 | ! Ehouarn: re-compute geopotential for outputs |
---|
[5103] | 659 | CALL geopot(ip1jmp1, teta, pk, pks, phis, phi) |
---|
[524] | 660 | |
---|
[5103] | 661 | IF (ok_dynzon) THEN |
---|
[5118] | 662 | CALL bilan_dyn(2, dtvr * iperiod, dtvr * day_step * periodav, & |
---|
| 663 | ps, masse, pk, pbaru, pbarv, teta, phi, ucov, vcov, q) |
---|
[5186] | 664 | END IF |
---|
[5103] | 665 | IF (ok_dyn_ave) THEN |
---|
[5118] | 666 | CALL writedynav(itau, vcov, & |
---|
| 667 | ucov, teta, pk, phi, q, masse, ps, phis) |
---|
[5103] | 668 | ENDIF |
---|
[524] | 669 | |
---|
[5186] | 670 | ENDIF ! of IF((MOD(itau,iperiod).EQ.0).OR.(itau.EQ.itaufin)) |
---|
[524] | 671 | |
---|
[5186] | 672 | CALL check_isotopes_seq(q, ip1jmp1, 'leapfrog 1584') |
---|
| 673 | |
---|
| 674 | !----------------------------------------------------------------------- |
---|
| 675 | ! ecriture de la bande histoire: |
---|
| 676 | ! ------------------------------ |
---|
| 677 | |
---|
[5103] | 678 | IF(MOD(itau, iecri)==0) THEN |
---|
[5186] | 679 | ! ! Ehouarn: output only during LF or Backward Matsuno |
---|
| 680 | IF (leapf.OR.(.NOT.leapf.AND.(.NOT.forward))) THEN |
---|
| 681 | CALL geopot(ip1jmp1, teta, pk, pks, phis, phi) |
---|
| 682 | unat = 0. |
---|
| 683 | DO l = 1, llm |
---|
| 684 | unat(iip2:ip1jm, l) = ucov(iip2:ip1jm, l) / cu(iip2:ip1jm) |
---|
| 685 | vnat(:, l) = vcov(:, l) / cv(:) |
---|
| 686 | enddo |
---|
| 687 | IF (ok_dyn_ins) THEN |
---|
| 688 | ! WRITE(lunout,*) "leapfrog: CALL writehist, itau=",itau |
---|
| 689 | CALL writehist(itau, vcov, ucov, teta, phi, q, masse, ps, phis) |
---|
| 690 | ! CALL WriteField('ucov',reshape(ucov,(/iip1,jmp1,llm/))) |
---|
| 691 | ! CALL WriteField('vcov',reshape(vcov,(/iip1,jjm,llm/))) |
---|
| 692 | ! CALL WriteField('teta',reshape(teta,(/iip1,jmp1,llm/))) |
---|
| 693 | ! CALL WriteField('ps',reshape(ps,(/iip1,jmp1/))) |
---|
| 694 | ! CALL WriteField('masse',reshape(masse,(/iip1,jmp1,llm/))) |
---|
| 695 | endif ! of if (ok_dyn_ins) |
---|
| 696 | ! For some Grads outputs of fields |
---|
| 697 | IF (output_grads_dyn) THEN |
---|
| 698 | INCLUDE "write_grads_dyn.h" |
---|
| 699 | endif |
---|
| 700 | endif ! of if (leapf.OR.(.NOT.leapf.AND.(.NOT.forward))) |
---|
| 701 | ENDIF ! of IF(MOD(itau,iecri).EQ.0) |
---|
[524] | 702 | |
---|
[5186] | 703 | IF(itau==itaufin) THEN |
---|
[524] | 704 | |
---|
[5186] | 705 | |
---|
[5117] | 706 | ! if (planet_type.EQ."earth") THEN |
---|
[5186] | 707 | ! Write an Earth-format restart file |
---|
[5103] | 708 | CALL dynredem1("restart.nc", start_time, & |
---|
| 709 | vcov, ucov, teta, q, masse, ps) |
---|
[5117] | 710 | ! END IF ! of if (planet_type.EQ."earth") |
---|
[5186] | 711 | |
---|
| 712 | CLOSE(99) |
---|
[5117] | 713 | IF (ok_guide) THEN |
---|
[5103] | 714 | ! ! set ok_guide to false to avoid extra output |
---|
| 715 | ! ! in following forward step |
---|
| 716 | ok_guide = .FALSE. |
---|
| 717 | endif |
---|
[5186] | 718 | ! !!! Ehouarn: Why not stop here and now? |
---|
| 719 | ENDIF ! of IF (itau.EQ.itaufin) |
---|
[5103] | 720 | |
---|
[5186] | 721 | !----------------------------------------------------------------------- |
---|
| 722 | ! gestion de l'integration temporelle: |
---|
| 723 | ! ------------------------------------ |
---|
[5103] | 724 | |
---|
[5186] | 725 | IF(MOD(itau, iperiod)==0) THEN |
---|
| 726 | GO TO 1 |
---|
| 727 | ELSE IF (MOD(itau - 1, iperiod) == 0) THEN |
---|
[5103] | 728 | |
---|
[5186] | 729 | IF(forward) THEN |
---|
| 730 | ! fin du pas forward et debut du pas backward |
---|
[5103] | 731 | |
---|
[5186] | 732 | forward = .FALSE. |
---|
| 733 | leapf = .FALSE. |
---|
| 734 | GO TO 2 |
---|
| 735 | |
---|
| 736 | ELSE |
---|
| 737 | ! fin du pas backward et debut du premier pas leapfrog |
---|
| 738 | |
---|
| 739 | leapf = .TRUE. |
---|
| 740 | dt = 2. * dtvr |
---|
| 741 | GO TO 2 |
---|
| 742 | END IF ! of IF (forward) |
---|
| 743 | ELSE |
---|
| 744 | |
---|
| 745 | ! ...... pas leapfrog ..... |
---|
| 746 | |
---|
| 747 | leapf = .TRUE. |
---|
| 748 | dt = 2. * dtvr |
---|
| 749 | GO TO 2 |
---|
| 750 | END IF ! of IF (MOD(itau,iperiod).EQ.0) |
---|
| 751 | ! ! ELSEIF (MOD(itau-1,iperiod).EQ.0) |
---|
| 752 | |
---|
| 753 | ELSE ! of IF (.NOT.purmats) |
---|
| 754 | |
---|
| 755 | CALL check_isotopes_seq(q, ip1jmp1, 'leapfrog 1664') |
---|
| 756 | |
---|
| 757 | ! ........................................................ |
---|
| 758 | ! .............. schema matsuno ............... |
---|
| 759 | ! ........................................................ |
---|
| 760 | IF(forward) THEN |
---|
| 761 | |
---|
| 762 | itau = itau + 1 |
---|
| 763 | ! iday = day_ini+itau/day_step |
---|
| 764 | ! time = REAL(itau-(iday-day_ini)*day_step)/day_step+time_0 |
---|
| 765 | |
---|
| 766 | ! IF(time.GT.1.) THEN |
---|
| 767 | ! time = time-1. |
---|
| 768 | ! iday = iday+1 |
---|
| 769 | ! ENDIF |
---|
| 770 | |
---|
| 771 | forward = .FALSE. |
---|
| 772 | IF(itau == itaufinp1) THEN |
---|
| 773 | abort_message = 'Simulation finished' |
---|
| 774 | CALL abort_gcm(modname, abort_message, 0) |
---|
| 775 | ENDIF |
---|
| 776 | GO TO 2 |
---|
| 777 | |
---|
| 778 | ELSE ! of IF(forward) i.e. backward step |
---|
| 779 | |
---|
| 780 | CALL check_isotopes_seq(q, ip1jmp1, 'leapfrog 1698') |
---|
| 781 | |
---|
| 782 | IF(MOD(itau, iperiod)==0 .OR. itau==itaufin) THEN |
---|
| 783 | IF(itau==itaufin) THEN |
---|
| 784 | iav = 1 |
---|
| 785 | ELSE |
---|
| 786 | iav = 0 |
---|
| 787 | ENDIF |
---|
| 788 | |
---|
| 789 | ! ! Ehouarn: re-compute geopotential for outputs |
---|
| 790 | CALL geopot(ip1jmp1, teta, pk, pks, phis, phi) |
---|
| 791 | |
---|
| 792 | IF (ok_dynzon) THEN |
---|
| 793 | CALL bilan_dyn(2, dtvr * iperiod, dtvr * day_step * periodav, & |
---|
| 794 | ps, masse, pk, pbaru, pbarv, teta, phi, ucov, vcov, q) |
---|
| 795 | ENDIF |
---|
| 796 | IF (ok_dyn_ave) THEN |
---|
| 797 | CALL writedynav(itau, vcov, & |
---|
| 798 | ucov, teta, pk, phi, q, masse, ps, phis) |
---|
| 799 | ENDIF |
---|
| 800 | |
---|
| 801 | ENDIF ! of IF(MOD(itau,iperiod).EQ.0 .OR. itau.EQ.itaufin) |
---|
| 802 | |
---|
| 803 | IF(MOD(itau, iecri)==0) THEN |
---|
| 804 | ! IF(MOD(itau,iecri*day_step).EQ.0) THEN |
---|
| 805 | CALL geopot(ip1jmp1, teta, pk, pks, phis, phi) |
---|
| 806 | unat = 0. |
---|
| 807 | DO l = 1, llm |
---|
| 808 | unat(iip2:ip1jm, l) = ucov(iip2:ip1jm, l) / cu(iip2:ip1jm) |
---|
| 809 | vnat(:, l) = vcov(:, l) / cv(:) |
---|
| 810 | enddo |
---|
| 811 | IF (ok_dyn_ins) THEN |
---|
| 812 | ! WRITE(lunout,*) "leapfrog: CALL writehist (b)", |
---|
| 813 | ! & itau,iecri |
---|
| 814 | CALL writehist(itau, vcov, ucov, teta, phi, q, masse, ps, phis) |
---|
| 815 | endif ! of if (ok_dyn_ins) |
---|
| 816 | ! For some Grads outputs |
---|
| 817 | IF (output_grads_dyn) THEN |
---|
| 818 | INCLUDE "write_grads_dyn.h" |
---|
| 819 | endif |
---|
| 820 | |
---|
| 821 | ENDIF ! of IF(MOD(itau,iecri ).EQ.0) |
---|
| 822 | |
---|
| 823 | IF(itau==itaufin) THEN |
---|
| 824 | ! if (planet_type.EQ."earth") THEN |
---|
| 825 | CALL dynredem1("restart.nc", start_time, & |
---|
| 826 | vcov, ucov, teta, q, masse, ps) |
---|
| 827 | ! END IF ! of if (planet_type.EQ."earth") |
---|
| 828 | IF (ok_guide) THEN |
---|
| 829 | ! ! set ok_guide to false to avoid extra output |
---|
| 830 | ! ! in following forward step |
---|
| 831 | ok_guide = .FALSE. |
---|
| 832 | endif |
---|
| 833 | ENDIF ! of IF(itau.EQ.itaufin) |
---|
| 834 | |
---|
| 835 | forward = .TRUE. |
---|
| 836 | GO TO 1 |
---|
| 837 | |
---|
| 838 | ENDIF ! of IF (forward) |
---|
| 839 | |
---|
| 840 | END IF ! of IF(.NOT.purmats) |
---|
| 841 | |
---|
| 842 | END SUBROUTINE leapfrog |
---|
| 843 | |
---|
| 844 | END MODULE lmdz_leapfrog |
---|