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