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