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