[524] | 1 | ! |
---|
[1279] | 2 | ! $Id: leapfrog.F 2258 2015-04-13 08:21:09Z musat $ |
---|
| 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 |
---|
[1999] | 13 | USE infotrac, ONLY: nqtot |
---|
[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 | |
---|
[1665] | 230 | jD_cur = jD_ref + day_ini - day_ref + & |
---|
| 231 | & itau/day_step |
---|
| 232 | jH_cur = jH_ref + start_time + & |
---|
| 233 | & mod(itau,day_step)/float(day_step) |
---|
| 234 | jD_cur = jD_cur + int(jH_cur) |
---|
| 235 | jH_cur = jH_cur - int(jH_cur) |
---|
[524] | 236 | |
---|
[1279] | 237 | |
---|
[524] | 238 | #ifdef CPP_IOIPSL |
---|
[1279] | 239 | if (ok_guide) then |
---|
| 240 | call guide_main(itau,ucov,vcov,teta,q,masse,ps) |
---|
[524] | 241 | endif |
---|
| 242 | #endif |
---|
[1279] | 243 | |
---|
| 244 | |
---|
[524] | 245 | c |
---|
| 246 | c IF( MOD( itau, 10* day_step ).EQ.0 ) THEN |
---|
| 247 | c CALL test_period ( ucov,vcov,teta,q,p,phis ) |
---|
| 248 | c PRINT *,' ---- Test_period apres continue OK ! -----', itau |
---|
| 249 | c ENDIF |
---|
| 250 | c |
---|
[1146] | 251 | |
---|
| 252 | ! Save fields obtained at previous time step as '...m1' |
---|
[524] | 253 | CALL SCOPY( ijmllm ,vcov , 1, vcovm1 , 1 ) |
---|
| 254 | CALL SCOPY( ijp1llm,ucov , 1, ucovm1 , 1 ) |
---|
| 255 | CALL SCOPY( ijp1llm,teta , 1, tetam1 , 1 ) |
---|
| 256 | CALL SCOPY( ijp1llm,masse, 1, massem1, 1 ) |
---|
| 257 | CALL SCOPY( ip1jmp1, ps , 1, psm1 , 1 ) |
---|
| 258 | |
---|
| 259 | forward = .TRUE. |
---|
| 260 | leapf = .FALSE. |
---|
| 261 | dt = dtvr |
---|
| 262 | |
---|
| 263 | c ... P.Le Van .26/04/94 .... |
---|
[1665] | 264 | ! Ehouarn: finvmaold is actually not used |
---|
| 265 | ! CALL SCOPY ( ijp1llm, masse, 1, finvmaold, 1 ) |
---|
| 266 | ! CALL filtreg ( finvmaold ,jjp1, llm, -2,2, .TRUE., 1 ) |
---|
[524] | 267 | |
---|
[1665] | 268 | 2 CONTINUE ! Matsuno backward or leapfrog step begins here |
---|
[524] | 269 | |
---|
| 270 | c----------------------------------------------------------------------- |
---|
| 271 | |
---|
| 272 | c date: |
---|
| 273 | c ----- |
---|
| 274 | |
---|
| 275 | |
---|
| 276 | c gestion des appels de la physique et des dissipations: |
---|
| 277 | c ------------------------------------------------------ |
---|
| 278 | c |
---|
| 279 | c ... P.Le Van ( 6/02/95 ) .... |
---|
| 280 | |
---|
| 281 | apphys = .FALSE. |
---|
| 282 | statcl = .FALSE. |
---|
| 283 | conser = .FALSE. |
---|
| 284 | apdiss = .FALSE. |
---|
| 285 | |
---|
| 286 | IF( purmats ) THEN |
---|
[1403] | 287 | ! Purely Matsuno time stepping |
---|
[524] | 288 | IF( MOD(itau,iconser) .EQ.0.AND. forward ) conser = .TRUE. |
---|
[1502] | 289 | IF( MOD(itau,dissip_period ).EQ.0.AND..NOT.forward ) |
---|
| 290 | s apdiss = .TRUE. |
---|
[524] | 291 | IF( MOD(itau,iphysiq ).EQ.0.AND..NOT.forward |
---|
[1529] | 292 | s .and. physic ) apphys = .TRUE. |
---|
[524] | 293 | ELSE |
---|
[1403] | 294 | ! Leapfrog/Matsuno time stepping |
---|
[524] | 295 | IF( MOD(itau ,iconser) .EQ. 0 ) conser = .TRUE. |
---|
[1502] | 296 | IF( MOD(itau+1,dissip_period).EQ.0 .AND. .NOT. forward ) |
---|
| 297 | s apdiss = .TRUE. |
---|
[1529] | 298 | IF( MOD(itau+1,iphysiq).EQ.0.AND.physic ) apphys=.TRUE. |
---|
[524] | 299 | END IF |
---|
| 300 | |
---|
[1403] | 301 | ! Ehouarn: for Shallow Water case (ie: 1 vertical layer), |
---|
| 302 | ! supress dissipation step |
---|
| 303 | if (llm.eq.1) then |
---|
| 304 | apdiss=.false. |
---|
| 305 | endif |
---|
| 306 | |
---|
[524] | 307 | c----------------------------------------------------------------------- |
---|
| 308 | c calcul des tendances dynamiques: |
---|
| 309 | c -------------------------------- |
---|
| 310 | |
---|
[1665] | 311 | ! compute geopotential phi() |
---|
[524] | 312 | CALL geopot ( ip1jmp1, teta , pk , pks, phis , phi ) |
---|
| 313 | |
---|
[1279] | 314 | time = jD_cur + jH_cur |
---|
[524] | 315 | CALL caldyn |
---|
| 316 | $ ( itau,ucov,vcov,teta,ps,masse,pk,pkf,phis , |
---|
[1279] | 317 | $ phi,conser,du,dv,dteta,dp,w, pbaru,pbarv, time ) |
---|
[524] | 318 | |
---|
[1279] | 319 | |
---|
[524] | 320 | c----------------------------------------------------------------------- |
---|
| 321 | c calcul des tendances advection des traceurs (dont l'humidite) |
---|
| 322 | c ------------------------------------------------------------- |
---|
| 323 | |
---|
| 324 | IF( forward. OR . leapf ) THEN |
---|
[1999] | 325 | ! Ehouarn: NB: fields sent to advtrac are those at the beginning of the time step |
---|
[960] | 326 | CALL caladvtrac(q,pbaru,pbarv, |
---|
| 327 | * p, masse, dq, teta, |
---|
| 328 | . flxw, pk) |
---|
| 329 | |
---|
[524] | 330 | IF (offline) THEN |
---|
| 331 | Cmaf stokage du flux de masse pour traceurs OFF-LINE |
---|
| 332 | |
---|
| 333 | #ifdef CPP_IOIPSL |
---|
[541] | 334 | CALL fluxstokenc(pbaru,pbarv,masse,teta,phi,phis, |
---|
| 335 | . dtvr, itau) |
---|
[524] | 336 | #endif |
---|
| 337 | |
---|
| 338 | |
---|
[1146] | 339 | ENDIF ! of IF (offline) |
---|
[524] | 340 | c |
---|
[1146] | 341 | ENDIF ! of IF( forward. OR . leapf ) |
---|
[524] | 342 | |
---|
| 343 | |
---|
| 344 | c----------------------------------------------------------------------- |
---|
| 345 | c integrations dynamique et traceurs: |
---|
| 346 | c ---------------------------------- |
---|
| 347 | |
---|
| 348 | |
---|
| 349 | CALL integrd ( 2,vcovm1,ucovm1,tetam1,psm1,massem1 , |
---|
[1665] | 350 | $ dv,du,dteta,dq,dp,vcov,ucov,teta,q,ps,masse,phis ) |
---|
| 351 | ! $ finvmaold ) |
---|
[524] | 352 | |
---|
| 353 | |
---|
| 354 | c .P.Le Van (26/04/94 ajout de finvpold dans l'appel d'integrd) |
---|
| 355 | c |
---|
| 356 | c----------------------------------------------------------------------- |
---|
| 357 | c calcul des tendances physiques: |
---|
| 358 | c ------------------------------- |
---|
| 359 | c ######## P.Le Van ( Modif le 6/02/95 ) ########### |
---|
| 360 | c |
---|
| 361 | IF( purmats ) THEN |
---|
| 362 | IF( itau.EQ.itaufin.AND..NOT.forward ) lafin = .TRUE. |
---|
| 363 | ELSE |
---|
| 364 | IF( itau+1. EQ. itaufin ) lafin = .TRUE. |
---|
| 365 | ENDIF |
---|
| 366 | c |
---|
| 367 | c |
---|
| 368 | IF( apphys ) THEN |
---|
| 369 | c |
---|
| 370 | c ....... Ajout P.Le Van ( 17/04/96 ) ........... |
---|
| 371 | c |
---|
| 372 | |
---|
| 373 | CALL pression ( ip1jmp1, ap, bp, ps, p ) |
---|
[1665] | 374 | if (pressure_exner) then |
---|
[2056] | 375 | CALL exner_hyb( ip1jmp1, ps, p,pks, pk, pkf ) |
---|
[1665] | 376 | else |
---|
[2056] | 377 | CALL exner_milieu( ip1jmp1, ps, p, pks, pk, pkf ) |
---|
[1520] | 378 | endif |
---|
[524] | 379 | |
---|
[2056] | 380 | ! Appel a geopot ajoute le 2014/05/08 pour garantir la convergence numerique |
---|
| 381 | ! avec dyn3dmem |
---|
| 382 | CALL geopot ( ip1jmp1, teta , pk , pks, phis , phi ) |
---|
| 383 | |
---|
[1279] | 384 | ! rdaym_ini = itau * dtvr / daysec |
---|
| 385 | ! rdayvrai = rdaym_ini + day_ini |
---|
[1665] | 386 | ! jD_cur = jD_ref + day_ini - day_ref |
---|
| 387 | ! $ + int (itau * dtvr / daysec) |
---|
| 388 | ! jH_cur = jH_ref + & |
---|
| 389 | ! & (itau * dtvr / daysec - int(itau * dtvr / daysec)) |
---|
| 390 | jD_cur = jD_ref + day_ini - day_ref + & |
---|
| 391 | & itau/day_step |
---|
[1707] | 392 | |
---|
| 393 | IF (planet_type .eq."generic") THEN |
---|
| 394 | ! AS: we make jD_cur to be pday |
---|
| 395 | jD_cur = int(day_ini + itau/day_step) |
---|
| 396 | ENDIF |
---|
| 397 | |
---|
[1665] | 398 | jH_cur = jH_ref + start_time + & |
---|
| 399 | & mod(itau,day_step)/float(day_step) |
---|
| 400 | jD_cur = jD_cur + int(jH_cur) |
---|
| 401 | jH_cur = jH_cur - int(jH_cur) |
---|
[1279] | 402 | ! write(lunout,*)'itau, jD_cur = ', itau, jD_cur, jH_cur |
---|
| 403 | ! call ju2ymds(jD_cur+jH_cur, an, mois, jour, secondes) |
---|
| 404 | ! write(lunout,*)'current date = ',an, mois, jour, secondes |
---|
[524] | 405 | |
---|
| 406 | c rajout debug |
---|
| 407 | c lafin = .true. |
---|
| 408 | |
---|
| 409 | |
---|
| 410 | c Inbterface avec les routines de phylmd (phymars ... ) |
---|
| 411 | c ----------------------------------------------------- |
---|
| 412 | |
---|
| 413 | c+jld |
---|
| 414 | |
---|
| 415 | c Diagnostique de conservation de l'énergie : initialisation |
---|
[1146] | 416 | IF (ip_ebil_dyn.ge.1 ) THEN |
---|
[524] | 417 | ztit='bil dyn' |
---|
[1146] | 418 | ! Ehouarn: be careful, diagedyn is Earth-specific (includes ../phylmd/..)! |
---|
| 419 | IF (planet_type.eq."earth") THEN |
---|
[1665] | 420 | #ifdef CPP_EARTH |
---|
[1146] | 421 | CALL diagedyn(ztit,2,1,1,dtphys |
---|
| 422 | & , ucov , vcov , ps, p ,pk , teta , q(:,:,1), q(:,:,2)) |
---|
[1665] | 423 | #endif |
---|
[1146] | 424 | ENDIF |
---|
| 425 | ENDIF ! of IF (ip_ebil_dyn.ge.1 ) |
---|
[524] | 426 | c-jld |
---|
[1146] | 427 | #ifdef CPP_IOIPSL |
---|
[1669] | 428 | cIM decommenter les 6 lignes suivantes pour sortir quelques parametres dynamiques de LMDZ |
---|
| 429 | cIM uncomment next 6 lines to get some parameters for LMDZ dynamics |
---|
| 430 | c IF (first) THEN |
---|
| 431 | c first=.false. |
---|
| 432 | c#include "ini_paramLMDZ_dyn.h" |
---|
| 433 | c ENDIF |
---|
[692] | 434 | c |
---|
[1669] | 435 | c#include "write_paramLMDZ_dyn.h" |
---|
[692] | 436 | c |
---|
[1146] | 437 | #endif |
---|
| 438 | ! #endif of #ifdef CPP_IOIPSL |
---|
[1279] | 439 | CALL calfis( lafin , jD_cur, jH_cur, |
---|
[524] | 440 | $ ucov,vcov,teta,q,masse,ps,p,pk,phis,phi , |
---|
[960] | 441 | $ du,dv,dteta,dq, |
---|
[2258] | 442 | $ flxw,dufi,dvfi,dtetafi,dqfi,dpfi ) |
---|
[524] | 443 | |
---|
| 444 | c ajout des tendances physiques: |
---|
| 445 | c ------------------------------ |
---|
[1146] | 446 | CALL addfi( dtphys, leapf, forward , |
---|
[524] | 447 | $ ucov, vcov, teta , q ,ps , |
---|
| 448 | $ dufi, dvfi, dtetafi , dqfi ,dpfi ) |
---|
[1999] | 449 | ! since addfi updates ps(), also update p(), masse() and pk() |
---|
| 450 | CALL pression (ip1jmp1,ap,bp,ps,p) |
---|
| 451 | CALL massdair(p,masse) |
---|
| 452 | if (pressure_exner) then |
---|
[2056] | 453 | CALL exner_hyb(ip1jmp1,ps,p,pks,pk,pkf) |
---|
[1999] | 454 | else |
---|
[2056] | 455 | CALL exner_milieu(ip1jmp1,ps,p,pks,pk,pkf) |
---|
[1999] | 456 | endif |
---|
[1795] | 457 | |
---|
| 458 | IF (ok_strato) THEN |
---|
| 459 | CALL top_bound( vcov,ucov,teta,masse,dtphys) |
---|
| 460 | ENDIF |
---|
| 461 | |
---|
[524] | 462 | c |
---|
| 463 | c Diagnostique de conservation de l'énergie : difference |
---|
[1146] | 464 | IF (ip_ebil_dyn.ge.1 ) THEN |
---|
[524] | 465 | ztit='bil phys' |
---|
[1146] | 466 | IF (planet_type.eq."earth") THEN |
---|
| 467 | CALL diagedyn(ztit,2,1,1,dtphys |
---|
| 468 | & , ucov , vcov , ps, p ,pk , teta , q(:,:,1), q(:,:,2)) |
---|
| 469 | ENDIF |
---|
| 470 | ENDIF ! of IF (ip_ebil_dyn.ge.1 ) |
---|
| 471 | |
---|
[1060] | 472 | ENDIF ! of IF( apphys ) |
---|
[524] | 473 | |
---|
[1146] | 474 | IF(iflag_phys.EQ.2) THEN ! "Newtonian" case |
---|
[1454] | 475 | ! Academic case : Simple friction and Newtonan relaxation |
---|
| 476 | ! ------------------------------------------------------- |
---|
| 477 | DO l=1,llm |
---|
| 478 | DO ij=1,ip1jmp1 |
---|
| 479 | teta(ij,l)=teta(ij,l)-dtvr* |
---|
| 480 | & (teta(ij,l)-tetarappel(ij,l))*(knewt_g+knewt_t(l)*clat4(ij)) |
---|
| 481 | ENDDO |
---|
| 482 | ENDDO ! of DO l=1,llm |
---|
| 483 | |
---|
[1505] | 484 | if (planet_type.eq."giant") then |
---|
| 485 | ! add an intrinsic heat flux at the base of the atmosphere |
---|
| 486 | teta(:,1)=teta(:,1)+dtvr*aire(:)*ihf/cpp/masse(:,1) |
---|
| 487 | endif |
---|
| 488 | |
---|
| 489 | call friction(ucov,vcov,dtvr) |
---|
| 490 | |
---|
[1454] | 491 | ! Sponge layer (if any) |
---|
| 492 | IF (ok_strato) THEN |
---|
[1795] | 493 | ! dufi(:,:)=0. |
---|
| 494 | ! dvfi(:,:)=0. |
---|
| 495 | ! dtetafi(:,:)=0. |
---|
| 496 | ! dqfi(:,:,:)=0. |
---|
| 497 | ! dpfi(:)=0. |
---|
| 498 | ! CALL top_bound(vcov,ucov,teta,masse,dufi,dvfi,dtetafi) |
---|
| 499 | CALL top_bound( vcov,ucov,teta,masse,dtvr) |
---|
| 500 | ! CALL addfi( dtvr, leapf, forward , |
---|
| 501 | ! $ ucov, vcov, teta , q ,ps , |
---|
| 502 | ! $ dufi, dvfi, dtetafi , dqfi ,dpfi ) |
---|
[1454] | 503 | ENDIF ! of IF (ok_strato) |
---|
| 504 | ENDIF ! of IF (iflag_phys.EQ.2) |
---|
[524] | 505 | |
---|
| 506 | |
---|
| 507 | c-jld |
---|
| 508 | |
---|
| 509 | CALL pression ( ip1jmp1, ap, bp, ps, p ) |
---|
[1665] | 510 | if (pressure_exner) then |
---|
[2056] | 511 | CALL exner_hyb( ip1jmp1, ps, p, pks, pk, pkf ) |
---|
[1665] | 512 | else |
---|
[2056] | 513 | CALL exner_milieu( ip1jmp1, ps, p, pks, pk, pkf ) |
---|
[1520] | 514 | endif |
---|
[1999] | 515 | CALL massdair(p,masse) |
---|
[524] | 516 | |
---|
| 517 | |
---|
| 518 | c----------------------------------------------------------------------- |
---|
| 519 | c dissipation horizontale et verticale des petites echelles: |
---|
| 520 | c ---------------------------------------------------------- |
---|
| 521 | |
---|
| 522 | IF(apdiss) THEN |
---|
| 523 | |
---|
| 524 | |
---|
| 525 | c calcul de l'energie cinetique avant dissipation |
---|
| 526 | call covcont(llm,ucov,vcov,ucont,vcont) |
---|
| 527 | call enercin(vcov,ucov,vcont,ucont,ecin0) |
---|
| 528 | |
---|
| 529 | c dissipation |
---|
| 530 | CALL dissip(vcov,ucov,teta,p,dvdis,dudis,dtetadis) |
---|
| 531 | ucov=ucov+dudis |
---|
| 532 | vcov=vcov+dvdis |
---|
| 533 | c teta=teta+dtetadis |
---|
| 534 | |
---|
| 535 | |
---|
| 536 | c------------------------------------------------------------------------ |
---|
| 537 | if (dissip_conservative) then |
---|
| 538 | C On rajoute la tendance due a la transform. Ec -> E therm. cree |
---|
| 539 | C lors de la dissipation |
---|
| 540 | call covcont(llm,ucov,vcov,ucont,vcont) |
---|
| 541 | call enercin(vcov,ucov,vcont,ucont,ecin) |
---|
| 542 | dtetaecdt= (ecin0-ecin)/ pk |
---|
| 543 | c teta=teta+dtetaecdt |
---|
| 544 | dtetadis=dtetadis+dtetaecdt |
---|
| 545 | endif |
---|
| 546 | teta=teta+dtetadis |
---|
| 547 | c------------------------------------------------------------------------ |
---|
| 548 | |
---|
| 549 | |
---|
| 550 | c ....... P. Le Van ( ajout le 17/04/96 ) ........... |
---|
| 551 | c ... Calcul de la valeur moyenne, unique de h aux poles ..... |
---|
| 552 | c |
---|
| 553 | |
---|
| 554 | DO l = 1, llm |
---|
| 555 | DO ij = 1,iim |
---|
| 556 | tppn(ij) = aire( ij ) * teta( ij ,l) |
---|
| 557 | tpps(ij) = aire(ij+ip1jm) * teta(ij+ip1jm,l) |
---|
| 558 | ENDDO |
---|
| 559 | tpn = SSUM(iim,tppn,1)/apoln |
---|
| 560 | tps = SSUM(iim,tpps,1)/apols |
---|
| 561 | |
---|
| 562 | DO ij = 1, iip1 |
---|
| 563 | teta( ij ,l) = tpn |
---|
| 564 | teta(ij+ip1jm,l) = tps |
---|
| 565 | ENDDO |
---|
| 566 | ENDDO |
---|
| 567 | |
---|
[1665] | 568 | if (1 == 0) then |
---|
| 569 | !!! Ehouarn: lines here 1) kill 1+1=2 in the dynamics |
---|
| 570 | !!! 2) should probably not be here anyway |
---|
| 571 | !!! but are kept for those who would want to revert to previous behaviour |
---|
| 572 | DO ij = 1,iim |
---|
| 573 | tppn(ij) = aire( ij ) * ps ( ij ) |
---|
| 574 | tpps(ij) = aire(ij+ip1jm) * ps (ij+ip1jm) |
---|
| 575 | ENDDO |
---|
| 576 | tpn = SSUM(iim,tppn,1)/apoln |
---|
| 577 | tps = SSUM(iim,tpps,1)/apols |
---|
[524] | 578 | |
---|
[1665] | 579 | DO ij = 1, iip1 |
---|
| 580 | ps( ij ) = tpn |
---|
| 581 | ps(ij+ip1jm) = tps |
---|
| 582 | ENDDO |
---|
| 583 | endif ! of if (1 == 0) |
---|
[524] | 584 | |
---|
[1146] | 585 | END IF ! of IF(apdiss) |
---|
[524] | 586 | |
---|
| 587 | c ajout debug |
---|
| 588 | c IF( lafin ) then |
---|
| 589 | c abort_message = 'Simulation finished' |
---|
| 590 | c call abort_gcm(modname,abort_message,0) |
---|
| 591 | c ENDIF |
---|
| 592 | |
---|
| 593 | c ******************************************************************** |
---|
| 594 | c ******************************************************************** |
---|
| 595 | c .... fin de l'integration dynamique et physique pour le pas itau .. |
---|
| 596 | c ******************************************************************** |
---|
| 597 | c ******************************************************************** |
---|
| 598 | |
---|
| 599 | c preparation du pas d'integration suivant ...... |
---|
| 600 | |
---|
| 601 | IF ( .NOT.purmats ) THEN |
---|
| 602 | c ........................................................ |
---|
| 603 | c .............. schema matsuno + leapfrog .............. |
---|
| 604 | c ........................................................ |
---|
| 605 | |
---|
| 606 | IF(forward. OR. leapf) THEN |
---|
| 607 | itau= itau + 1 |
---|
[1403] | 608 | c iday= day_ini+itau/day_step |
---|
| 609 | c time= REAL(itau-(iday-day_ini)*day_step)/day_step+time_0 |
---|
| 610 | c IF(time.GT.1.) THEN |
---|
| 611 | c time = time-1. |
---|
| 612 | c iday = iday+1 |
---|
| 613 | c ENDIF |
---|
[524] | 614 | ENDIF |
---|
| 615 | |
---|
| 616 | |
---|
| 617 | IF( itau. EQ. itaufinp1 ) then |
---|
[999] | 618 | if (flag_verif) then |
---|
[1279] | 619 | write(79,*) 'ucov',ucov |
---|
| 620 | write(80,*) 'vcov',vcov |
---|
| 621 | write(81,*) 'teta',teta |
---|
| 622 | write(82,*) 'ps',ps |
---|
| 623 | write(83,*) 'q',q |
---|
[999] | 624 | WRITE(85,*) 'q1 = ',q(:,:,1) |
---|
| 625 | WRITE(86,*) 'q3 = ',q(:,:,3) |
---|
| 626 | endif |
---|
[524] | 627 | |
---|
| 628 | abort_message = 'Simulation finished' |
---|
| 629 | |
---|
| 630 | call abort_gcm(modname,abort_message,0) |
---|
| 631 | ENDIF |
---|
| 632 | c----------------------------------------------------------------------- |
---|
| 633 | c ecriture du fichier histoire moyenne: |
---|
| 634 | c ------------------------------------- |
---|
| 635 | |
---|
| 636 | IF(MOD(itau,iperiod).EQ.0 .OR. itau.EQ.itaufin) THEN |
---|
| 637 | IF(itau.EQ.itaufin) THEN |
---|
| 638 | iav=1 |
---|
| 639 | ELSE |
---|
| 640 | iav=0 |
---|
| 641 | ENDIF |
---|
[1146] | 642 | |
---|
| 643 | IF (ok_dynzon) THEN |
---|
[524] | 644 | #ifdef CPP_IOIPSL |
---|
[1403] | 645 | CALL bilan_dyn(2,dtvr*iperiod,dtvr*day_step*periodav, |
---|
| 646 | & ps,masse,pk,pbaru,pbarv,teta,phi,ucov,vcov,q) |
---|
[524] | 647 | #endif |
---|
[1146] | 648 | END IF |
---|
[1403] | 649 | IF (ok_dyn_ave) THEN |
---|
| 650 | #ifdef CPP_IOIPSL |
---|
| 651 | CALL writedynav(itau,vcov, |
---|
| 652 | & ucov,teta,pk,phi,q,masse,ps,phis) |
---|
| 653 | #endif |
---|
| 654 | ENDIF |
---|
[524] | 655 | |
---|
[1403] | 656 | ENDIF ! of IF((MOD(itau,iperiod).EQ.0).OR.(itau.EQ.itaufin)) |
---|
[524] | 657 | |
---|
| 658 | c----------------------------------------------------------------------- |
---|
| 659 | c ecriture de la bande histoire: |
---|
| 660 | c ------------------------------ |
---|
| 661 | |
---|
[1403] | 662 | IF( MOD(itau,iecri).EQ.0) THEN |
---|
| 663 | ! Ehouarn: output only during LF or Backward Matsuno |
---|
| 664 | if (leapf.or.(.not.leapf.and.(.not.forward))) then |
---|
[1146] | 665 | CALL geopot(ip1jmp1,teta,pk,pks,phis,phi) |
---|
| 666 | unat=0. |
---|
| 667 | do l=1,llm |
---|
| 668 | unat(iip2:ip1jm,l)=ucov(iip2:ip1jm,l)/cu(iip2:ip1jm) |
---|
| 669 | vnat(:,l)=vcov(:,l)/cv(:) |
---|
| 670 | enddo |
---|
[524] | 671 | #ifdef CPP_IOIPSL |
---|
[1403] | 672 | if (ok_dyn_ins) then |
---|
| 673 | ! write(lunout,*) "leapfrog: call writehist, itau=",itau |
---|
| 674 | CALL writehist(itau,vcov,ucov,teta,phi,q,masse,ps,phis) |
---|
| 675 | ! call WriteField('ucov',reshape(ucov,(/iip1,jmp1,llm/))) |
---|
| 676 | ! call WriteField('vcov',reshape(vcov,(/iip1,jjm,llm/))) |
---|
| 677 | ! call WriteField('teta',reshape(teta,(/iip1,jmp1,llm/))) |
---|
| 678 | ! call WriteField('ps',reshape(ps,(/iip1,jmp1/))) |
---|
| 679 | ! call WriteField('masse',reshape(masse,(/iip1,jmp1,llm/))) |
---|
| 680 | endif ! of if (ok_dyn_ins) |
---|
[1146] | 681 | #endif |
---|
| 682 | ! For some Grads outputs of fields |
---|
[1403] | 683 | if (output_grads_dyn) then |
---|
[524] | 684 | #include "write_grads_dyn.h" |
---|
[1403] | 685 | endif |
---|
| 686 | endif ! of if (leapf.or.(.not.leapf.and.(.not.forward))) |
---|
[1146] | 687 | ENDIF ! of IF(MOD(itau,iecri).EQ.0) |
---|
[524] | 688 | |
---|
| 689 | IF(itau.EQ.itaufin) THEN |
---|
| 690 | |
---|
| 691 | |
---|
[1454] | 692 | ! if (planet_type.eq."earth") then |
---|
[1146] | 693 | ! Write an Earth-format restart file |
---|
[1665] | 694 | CALL dynredem1("restart.nc",start_time, |
---|
[1146] | 695 | & vcov,ucov,teta,q,masse,ps) |
---|
[1454] | 696 | ! endif ! of if (planet_type.eq."earth") |
---|
[524] | 697 | |
---|
| 698 | CLOSE(99) |
---|
[1665] | 699 | !!! Ehouarn: Why not stop here and now? |
---|
[1146] | 700 | ENDIF ! of IF (itau.EQ.itaufin) |
---|
[524] | 701 | |
---|
| 702 | c----------------------------------------------------------------------- |
---|
| 703 | c gestion de l'integration temporelle: |
---|
| 704 | c ------------------------------------ |
---|
| 705 | |
---|
| 706 | IF( MOD(itau,iperiod).EQ.0 ) THEN |
---|
| 707 | GO TO 1 |
---|
| 708 | ELSE IF ( MOD(itau-1,iperiod). EQ. 0 ) THEN |
---|
| 709 | |
---|
| 710 | IF( forward ) THEN |
---|
| 711 | c fin du pas forward et debut du pas backward |
---|
| 712 | |
---|
| 713 | forward = .FALSE. |
---|
| 714 | leapf = .FALSE. |
---|
| 715 | GO TO 2 |
---|
| 716 | |
---|
| 717 | ELSE |
---|
| 718 | c fin du pas backward et debut du premier pas leapfrog |
---|
| 719 | |
---|
| 720 | leapf = .TRUE. |
---|
| 721 | dt = 2.*dtvr |
---|
[1146] | 722 | GO TO 2 |
---|
| 723 | END IF ! of IF (forward) |
---|
[524] | 724 | ELSE |
---|
| 725 | |
---|
| 726 | c ...... pas leapfrog ..... |
---|
| 727 | |
---|
| 728 | leapf = .TRUE. |
---|
| 729 | dt = 2.*dtvr |
---|
| 730 | GO TO 2 |
---|
[1146] | 731 | END IF ! of IF (MOD(itau,iperiod).EQ.0) |
---|
| 732 | ! ELSEIF (MOD(itau-1,iperiod).EQ.0) |
---|
[524] | 733 | |
---|
[1146] | 734 | ELSE ! of IF (.not.purmats) |
---|
[524] | 735 | |
---|
| 736 | c ........................................................ |
---|
| 737 | c .............. schema matsuno ............... |
---|
| 738 | c ........................................................ |
---|
| 739 | IF( forward ) THEN |
---|
| 740 | |
---|
| 741 | itau = itau + 1 |
---|
[1403] | 742 | c iday = day_ini+itau/day_step |
---|
| 743 | c time = REAL(itau-(iday-day_ini)*day_step)/day_step+time_0 |
---|
| 744 | c |
---|
| 745 | c IF(time.GT.1.) THEN |
---|
| 746 | c time = time-1. |
---|
| 747 | c iday = iday+1 |
---|
| 748 | c ENDIF |
---|
[524] | 749 | |
---|
| 750 | forward = .FALSE. |
---|
| 751 | IF( itau. EQ. itaufinp1 ) then |
---|
| 752 | abort_message = 'Simulation finished' |
---|
| 753 | call abort_gcm(modname,abort_message,0) |
---|
| 754 | ENDIF |
---|
| 755 | GO TO 2 |
---|
| 756 | |
---|
[1403] | 757 | ELSE ! of IF(forward) i.e. backward step |
---|
[524] | 758 | |
---|
[1146] | 759 | IF(MOD(itau,iperiod).EQ.0 .OR. itau.EQ.itaufin) THEN |
---|
[524] | 760 | IF(itau.EQ.itaufin) THEN |
---|
| 761 | iav=1 |
---|
| 762 | ELSE |
---|
| 763 | iav=0 |
---|
| 764 | ENDIF |
---|
[1146] | 765 | |
---|
| 766 | IF (ok_dynzon) THEN |
---|
[524] | 767 | #ifdef CPP_IOIPSL |
---|
[1403] | 768 | CALL bilan_dyn(2,dtvr*iperiod,dtvr*day_step*periodav, |
---|
| 769 | & ps,masse,pk,pbaru,pbarv,teta,phi,ucov,vcov,q) |
---|
[524] | 770 | #endif |
---|
[1403] | 771 | ENDIF |
---|
| 772 | IF (ok_dyn_ave) THEN |
---|
| 773 | #ifdef CPP_IOIPSL |
---|
| 774 | CALL writedynav(itau,vcov, |
---|
| 775 | & ucov,teta,pk,phi,q,masse,ps,phis) |
---|
| 776 | #endif |
---|
| 777 | ENDIF |
---|
[524] | 778 | |
---|
[1146] | 779 | ENDIF ! of IF(MOD(itau,iperiod).EQ.0 .OR. itau.EQ.itaufin) |
---|
[524] | 780 | |
---|
[1146] | 781 | IF(MOD(itau,iecri ).EQ.0) THEN |
---|
[524] | 782 | c IF(MOD(itau,iecri*day_step).EQ.0) THEN |
---|
[1146] | 783 | CALL geopot(ip1jmp1,teta,pk,pks,phis,phi) |
---|
| 784 | unat=0. |
---|
| 785 | do l=1,llm |
---|
| 786 | unat(iip2:ip1jm,l)=ucov(iip2:ip1jm,l)/cu(iip2:ip1jm) |
---|
| 787 | vnat(:,l)=vcov(:,l)/cv(:) |
---|
| 788 | enddo |
---|
[524] | 789 | #ifdef CPP_IOIPSL |
---|
[1403] | 790 | if (ok_dyn_ins) then |
---|
| 791 | ! write(lunout,*) "leapfrog: call writehist (b)", |
---|
| 792 | ! & itau,iecri |
---|
| 793 | CALL writehist(itau,vcov,ucov,teta,phi,q,masse,ps,phis) |
---|
| 794 | endif ! of if (ok_dyn_ins) |
---|
[1146] | 795 | #endif |
---|
| 796 | ! For some Grads outputs |
---|
| 797 | if (output_grads_dyn) then |
---|
[524] | 798 | #include "write_grads_dyn.h" |
---|
[1146] | 799 | endif |
---|
[524] | 800 | |
---|
[1146] | 801 | ENDIF ! of IF(MOD(itau,iecri ).EQ.0) |
---|
[524] | 802 | |
---|
[1146] | 803 | IF(itau.EQ.itaufin) THEN |
---|
[1454] | 804 | ! if (planet_type.eq."earth") then |
---|
[1665] | 805 | CALL dynredem1("restart.nc",start_time, |
---|
[1146] | 806 | & vcov,ucov,teta,q,masse,ps) |
---|
[1454] | 807 | ! endif ! of if (planet_type.eq."earth") |
---|
[1146] | 808 | ENDIF ! of IF(itau.EQ.itaufin) |
---|
[524] | 809 | |
---|
[1146] | 810 | forward = .TRUE. |
---|
| 811 | GO TO 1 |
---|
[524] | 812 | |
---|
[1146] | 813 | ENDIF ! of IF (forward) |
---|
[524] | 814 | |
---|
[1146] | 815 | END IF ! of IF(.not.purmats) |
---|
[524] | 816 | |
---|
| 817 | STOP |
---|
| 818 | END |
---|