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