[135] | 1 | PROGRAM gcm |
---|
| 2 | |
---|
[1216] | 3 | use infotrac, only: iniadvtrac, nqtot, iadv |
---|
[1006] | 4 | use sponge_mod,only: callsponge,mode_sponge,sponge |
---|
[1216] | 5 | use control_mod, only: nday, day_step, iperiod, iphysiq, |
---|
| 6 | & iconser, ecritphy, idissip |
---|
[1395] | 7 | ! use comgeomphy, only: initcomgeomphy |
---|
[1403] | 8 | use filtreg_mod, only: inifilr |
---|
[1422] | 9 | USE comvert_mod, ONLY: ap,bp |
---|
| 10 | USE comconst_mod, ONLY: daysec,dtvr,dtphys,dtdiss,rad,g,r,cpp |
---|
| 11 | USE logic_mod, ONLY: ecripar,forward,leapf,apphys,statcl,conser, |
---|
| 12 | . apdiss,purmats,physic,apphys |
---|
| 13 | USE temps_mod, ONLY: day_ini,day_end,itaufin,dt |
---|
[135] | 14 | IMPLICIT NONE |
---|
| 15 | |
---|
| 16 | c ...... Version du 10/01/98 .......... |
---|
| 17 | |
---|
| 18 | c avec coordonnees verticales hybrides |
---|
| 19 | c avec nouveaux operat. dissipation * ( gradiv2,divgrad2,nxgraro2 ) |
---|
| 20 | |
---|
| 21 | c======================================================================= |
---|
| 22 | c |
---|
| 23 | c Auteur: P. Le Van /L. Fairhead/F.Hourdin |
---|
| 24 | c ------- |
---|
| 25 | c |
---|
| 26 | c Objet: |
---|
| 27 | c ------ |
---|
| 28 | c |
---|
| 29 | c GCM LMD nouvelle grille |
---|
| 30 | c |
---|
| 31 | c======================================================================= |
---|
| 32 | c |
---|
| 33 | c ... Dans inigeom , nouveaux calculs pour les elongations cu , cv |
---|
| 34 | c et possibilite d'appeler une fonction f(y) a derivee tangente |
---|
| 35 | c hyperbolique a la place de la fonction a derivee sinusoidale. |
---|
| 36 | |
---|
| 37 | c ... Possibilite de choisir le shema de Van-leer pour l'advection de |
---|
| 38 | c q , en faisant iadv = 3 dans traceur (29/04/97) . |
---|
| 39 | c |
---|
| 40 | c Pour Van-Leer + Vapeur d'eau saturee, iadv(1)=4. (F.Codron,10/99) |
---|
| 41 | c |
---|
| 42 | c----------------------------------------------------------------------- |
---|
| 43 | c Declarations: |
---|
| 44 | c ------------- |
---|
| 45 | |
---|
| 46 | #include "dimensions.h" |
---|
| 47 | #include "paramet.h" |
---|
| 48 | #include "comdissnew.h" |
---|
| 49 | #include "comgeom.h" |
---|
[1216] | 50 | !#include "control.h" |
---|
[135] | 51 | #include "netcdf.inc" |
---|
| 52 | #include "tracstoke.h" |
---|
[1216] | 53 | !#include"advtrac.h" |
---|
[135] | 54 | |
---|
| 55 | INTEGER*4 iday ! jour julien |
---|
| 56 | REAL time ! Heure de la journee en fraction d''1 jour |
---|
| 57 | REAL zdtvr |
---|
| 58 | |
---|
| 59 | c variables dynamiques |
---|
| 60 | REAL vcov(ip1jm,llm),ucov(ip1jmp1,llm) ! vents covariants |
---|
| 61 | real, dimension(ip1jmp1,llm) :: teta ! temperature potentielle |
---|
[1216] | 62 | REAL,allocatable :: q(:,:,:) ! champs advectes |
---|
[135] | 63 | REAL ps(ip1jmp1) ! pression au sol |
---|
| 64 | REAL pext(ip1jmp1) ! pression extensive |
---|
| 65 | REAL p (ip1jmp1,llmp1 ) ! pression aux interfac.des couches |
---|
| 66 | REAL pks(ip1jmp1) ! exner au sol |
---|
| 67 | REAL pk(ip1jmp1,llm) ! exner au milieu des couches |
---|
| 68 | REAL pkf(ip1jmp1,llm) ! exner filt.au milieu des couches |
---|
| 69 | REAL masse(ip1jmp1,llm) ! masse d''air |
---|
| 70 | REAL phis(ip1jmp1) ! geopotentiel au sol |
---|
| 71 | REAL phi(ip1jmp1,llm) ! geopotentiel |
---|
| 72 | REAL w(ip1jmp1,llm) ! vitesse verticale |
---|
| 73 | |
---|
| 74 | c variables dynamiques intermediaire pour le transport |
---|
| 75 | REAL pbaru(ip1jmp1,llm),pbarv(ip1jm,llm) !flux de masse |
---|
| 76 | |
---|
| 77 | c variables dynamiques au pas -1 |
---|
| 78 | REAL vcovm1(ip1jm,llm),ucovm1(ip1jmp1,llm) |
---|
| 79 | |
---|
| 80 | REAL tetam1(ip1jmp1,llm),psm1(ip1jmp1) |
---|
| 81 | REAL massem1(ip1jmp1,llm) |
---|
| 82 | |
---|
| 83 | c tendances dynamiques |
---|
| 84 | REAL dv(ip1jm,llm),du(ip1jmp1,llm) |
---|
[1216] | 85 | REAL dteta(ip1jmp1,llm),dp(ip1jmp1) |
---|
| 86 | REAL,ALLOCATABLE :: dq(:,:,:) |
---|
[135] | 87 | |
---|
| 88 | c tendances de la dissipation |
---|
| 89 | REAL dvdis(ip1jm,llm),dudis(ip1jmp1,llm) |
---|
| 90 | REAL dhdis(ip1jmp1,llm) |
---|
| 91 | |
---|
| 92 | c tendances physiques |
---|
| 93 | REAL dvfi(ip1jm,llm),dufi(ip1jmp1,llm) |
---|
[1216] | 94 | REAL dhfi(ip1jmp1,llm),dpfi(ip1jmp1) |
---|
| 95 | REAL,ALLOCATABLE :: dqfi(:,:,:) |
---|
[135] | 96 | |
---|
| 97 | c variables pour le fichier histoire |
---|
| 98 | REAL dtav ! intervalle de temps elementaire |
---|
| 99 | |
---|
| 100 | REAL tppn(iim),tpps(iim),tpn,tps |
---|
| 101 | c |
---|
| 102 | ! INTEGER iadv(nqmx) ! indice schema de transport pour le traceur iq |
---|
| 103 | |
---|
| 104 | INTEGER itau,itaufinp1,iav |
---|
| 105 | |
---|
| 106 | |
---|
| 107 | EXTERNAL caldyn, traceur |
---|
[1403] | 108 | EXTERNAL dissip,geopot,iniconst |
---|
[135] | 109 | EXTERNAL integrd,SCOPY |
---|
| 110 | EXTERNAL inigeom |
---|
[993] | 111 | EXTERNAL exner_hyb |
---|
[135] | 112 | EXTERNAL defrun_new, test_period |
---|
| 113 | REAL SSUM |
---|
| 114 | REAL time_0 , finvmaold(ip1jmp1,llm) |
---|
| 115 | |
---|
| 116 | LOGICAL lafin |
---|
| 117 | INTEGER ij,iq,l,ierr,numvanle,iapp_tracvl |
---|
| 118 | |
---|
| 119 | REAL rdayvrai,rdaym_ini,rday_ecri |
---|
| 120 | ! LOGICAL first |
---|
| 121 | REAL beta(ip1jmp1,llm) |
---|
| 122 | |
---|
| 123 | LOGICAL offline ! Controle du stockage ds "fluxmass" |
---|
| 124 | PARAMETER (offline=.false.) |
---|
| 125 | |
---|
| 126 | character*20 modname |
---|
| 127 | character*80 abort_message |
---|
| 128 | |
---|
| 129 | LOGICAL tracer |
---|
| 130 | data tracer/.true./ |
---|
[1216] | 131 | ! INTEGER nq |
---|
[135] | 132 | |
---|
| 133 | C Calendrier |
---|
| 134 | LOGICAL true_calendar |
---|
| 135 | PARAMETER (true_calendar = .false.) |
---|
| 136 | |
---|
| 137 | ! flag to set/remove calls to groupeun |
---|
| 138 | logical callgroupeun |
---|
[253] | 139 | parameter (callgroupeun = .false.) |
---|
[135] | 140 | |
---|
| 141 | ! added by RDW for tests without dynamics |
---|
| 142 | logical calldyn |
---|
| 143 | parameter (calldyn = .true.) |
---|
| 144 | |
---|
[253] | 145 | ! added by RW for test |
---|
| 146 | ! real pmean,airetot |
---|
[135] | 147 | |
---|
[253] | 148 | ! added by FF for dissipation / energy conservation tests |
---|
| 149 | logical dissip_conservative |
---|
| 150 | parameter (dissip_conservative = .false.) |
---|
| 151 | REAL ecin(ip1jmp1,llm),ecin0(ip1jmp1,llm) |
---|
| 152 | ! d (theta)/ d t (pot. temperature) due to the creation |
---|
| 153 | ! of thermal energy by dissipation |
---|
| 154 | REAL dtetaecdt(ip1jmp1,llm) |
---|
| 155 | REAL vcont(ip1jm,llm),ucont(ip1jmp1,llm) |
---|
| 156 | REAL vnat(ip1jm,llm),unat(ip1jmp1,llm) |
---|
| 157 | |
---|
[1216] | 158 | c----------------------------------------------------------------------- |
---|
| 159 | c variables pour l'initialisation de la physique : |
---|
| 160 | c ------------------------------------------------ |
---|
[1395] | 161 | ! INTEGER ngridmx |
---|
| 162 | ! PARAMETER( ngridmx = 2+(jjm-1)*iim - 1/jjm ) |
---|
| 163 | ! REAL zcufi(ngridmx),zcvfi(ngridmx) |
---|
| 164 | ! REAL latfi(ngridmx),lonfi(ngridmx) |
---|
| 165 | ! REAL airefi(ngridmx) |
---|
| 166 | ! SAVE latfi, lonfi, airefi |
---|
| 167 | ! INTEGER i,j |
---|
[253] | 168 | |
---|
[135] | 169 | c----------------------------------------------------------------------- |
---|
| 170 | c Initialisations: |
---|
| 171 | c ---------------- |
---|
| 172 | |
---|
| 173 | modname = 'gcm' |
---|
| 174 | lafin = .FALSE. |
---|
| 175 | |
---|
| 176 | c----------------------------------------------------------------------- |
---|
[1216] | 177 | CALL defrun_new( 99, .TRUE. ) |
---|
[135] | 178 | |
---|
[1216] | 179 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
| 180 | ! FH 2008/05/02 |
---|
| 181 | ! A nettoyer. On ne veut qu'une ou deux routines d'interface |
---|
| 182 | ! dynamique -> physique pour l'initialisation |
---|
| 183 | !#ifdef CPP_PHYS |
---|
| 184 | CALL init_phys_lmdz(iim,jjp1,llm,1,(/(jjm-1)*iim+2/)) |
---|
[1395] | 185 | ! call initcomgeomphy ! now done in iniphysiq |
---|
[1216] | 186 | !#endif |
---|
| 187 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
[253] | 188 | |
---|
[1216] | 189 | ! Initialize tracers |
---|
| 190 | CALL iniadvtrac(nqtot,numvanle) |
---|
| 191 | ! Allocation de la tableau q : champs advectes |
---|
| 192 | allocate(q(ip1jmp1,llm,nqtot)) |
---|
| 193 | allocate(dq(ip1jmp1,llm,nqtot)) |
---|
| 194 | allocate(dqfi(ip1jmp1,llm,nqtot)) |
---|
| 195 | |
---|
[1416] | 196 | CALL dynetat0("start.nc",vcov,ucov, |
---|
[135] | 197 | . teta,q,masse,ps,phis, time_0) |
---|
| 198 | |
---|
| 199 | c on recalcule eventuellement le pas de temps |
---|
| 200 | |
---|
| 201 | IF(MOD(day_step,iperiod).NE.0) |
---|
| 202 | * STOP'Il faut choisir un nb de pas par jour multiple de iperiod' |
---|
| 203 | |
---|
| 204 | IF(MOD(day_step,iphysiq).NE.0) |
---|
| 205 | * STOP'Il faut choisir un nb de pas par jour multiple de iphysiq' |
---|
| 206 | |
---|
| 207 | zdtvr = daysec/FLOAT(day_step) |
---|
| 208 | |
---|
| 209 | IF(dtvr.NE.zdtvr) THEN |
---|
| 210 | PRINT*,'WARNING!!! changement de pas de temps',dtvr,'>',zdtvr |
---|
| 211 | ENDIF |
---|
| 212 | |
---|
| 213 | c nombre d'etats dans les fichiers demarrage et histoire |
---|
| 214 | |
---|
| 215 | dtvr = zdtvr |
---|
| 216 | CALL iniconst |
---|
| 217 | CALL inigeom |
---|
| 218 | CALL inifilr |
---|
| 219 | |
---|
| 220 | c |
---|
| 221 | c ...... P.Le Van ( modif le 29/04/97 ) ......... |
---|
| 222 | c |
---|
| 223 | |
---|
| 224 | CALL inidissip ( lstardis, nitergdiv, nitergrot, niterh , |
---|
| 225 | * tetagdiv, tetagrot , tetatemp ) |
---|
| 226 | c |
---|
| 227 | |
---|
[1216] | 228 | c----------------------------------------------------------------------- |
---|
| 229 | c Initialisation de la physique : |
---|
| 230 | c ------------------------------- |
---|
| 231 | |
---|
| 232 | ! IF (call_iniphys.and.(iflag_phys==1.or.iflag_phys>=100)) THEN |
---|
[1395] | 233 | ! latfi(1)=rlatu(1) |
---|
| 234 | ! lonfi(1)=0. |
---|
| 235 | ! zcufi(1) = cu(1) |
---|
| 236 | ! zcvfi(1) = cv(1) |
---|
| 237 | ! DO j=2,jjm |
---|
| 238 | ! DO i=1,iim |
---|
| 239 | ! latfi((j-2)*iim+1+i)= rlatu(j) |
---|
| 240 | ! lonfi((j-2)*iim+1+i)= rlonv(i) |
---|
| 241 | ! zcufi((j-2)*iim+1+i) = cu((j-1)*iip1+i) |
---|
| 242 | ! zcvfi((j-2)*iim+1+i) = cv((j-1)*iip1+i) |
---|
| 243 | ! ENDDO |
---|
| 244 | ! ENDDO |
---|
| 245 | ! latfi(ngridmx)= rlatu(jjp1) |
---|
| 246 | ! lonfi(ngridmx)= 0. |
---|
| 247 | ! zcufi(ngridmx) = cu(ip1jm+1) |
---|
| 248 | ! zcvfi(ngridmx) = cv(ip1jm-iim) |
---|
| 249 | ! |
---|
| 250 | ! ! build airefi(), mesh area on physics grid |
---|
| 251 | ! CALL gr_dyn_fi(1,iip1,jjp1,ngridmx,aire,airefi) |
---|
| 252 | ! ! Poles are single points on physics grid |
---|
| 253 | ! airefi(1)=airefi(1)*iim |
---|
| 254 | ! airefi(ngridmx)=airefi(ngridmx)*iim |
---|
[1216] | 255 | |
---|
| 256 | ! Initialisation de la physique: pose probleme quand on tourne |
---|
| 257 | ! SANS physique, car iniphysiq.F est dans le repertoire phy[]... |
---|
| 258 | ! Il faut une cle CPP_PHYS |
---|
| 259 | !#ifdef CPP_PHYS |
---|
[1395] | 260 | ! CALL iniphysiq(iim,jjm,llm,daysec,day_ini,dtphys/nsplit_phys, |
---|
| 261 | CALL iniphysiq(iim,jjm,llm,daysec,day_ini,dtphys, |
---|
| 262 | & rlatu,rlonv,aire,cu,cv,rad,g,r,cpp, |
---|
[1216] | 263 | & 1) |
---|
| 264 | ! & iflag_phys) |
---|
| 265 | !#endif |
---|
| 266 | ! call_iniphys=.false. |
---|
| 267 | ! ENDIF ! of IF (call_iniphys.and.(iflag_phys.eq.1)) |
---|
| 268 | |
---|
[135] | 269 | CALL pression ( ip1jmp1, ap, bp, ps, p ) |
---|
| 270 | |
---|
| 271 | call dump2d(iip1,jjp1,ps,'PRESSION SURFACE') |
---|
| 272 | CALL exner_hyb( ip1jmp1, ps, p,beta, pks, pk, pkf ) |
---|
| 273 | |
---|
[253] | 274 | |
---|
[135] | 275 | c numero de stockage pour les fichiers de redemarrage: |
---|
| 276 | |
---|
| 277 | c----------------------------------------------------------------------- |
---|
| 278 | c temps de depart et de fin: |
---|
| 279 | c -------------------------- |
---|
| 280 | |
---|
| 281 | itau = 0 |
---|
| 282 | iday = day_ini+itau/day_step |
---|
| 283 | time = FLOAT(itau-(iday-day_ini)*day_step)/day_step+time_0 |
---|
| 284 | |
---|
| 285 | |
---|
| 286 | IF(time.GT.1.) THEN |
---|
| 287 | time = time-1. |
---|
| 288 | iday = iday+1 |
---|
| 289 | ENDIF |
---|
| 290 | itaufin = nday*day_step |
---|
| 291 | c ******************************** |
---|
| 292 | c itaufin = 120 ! temporaire !! |
---|
| 293 | c ******************************** |
---|
| 294 | itaufinp1 = itaufin +1 |
---|
| 295 | |
---|
| 296 | day_end = day_ini + nday |
---|
| 297 | PRINT 300, itau,itaufin,day_ini,day_end |
---|
| 298 | 300 FORMAT('1'/,15x,'run du pas',i7,2x,'au pas',i7,2x, |
---|
| 299 | . 'c''est a dire du jour',i7,3x,'au jour',i7//) |
---|
| 300 | |
---|
[1416] | 301 | CALL dynredem0("restart.nc",day_end,phis) |
---|
[135] | 302 | |
---|
| 303 | ecripar = .TRUE. |
---|
| 304 | |
---|
| 305 | dtav = iperiod*dtvr/daysec |
---|
| 306 | |
---|
| 307 | |
---|
| 308 | c Quelques initialisations pour les traceurs |
---|
[1216] | 309 | call initial0(ijp1llm*nqtot,dq) |
---|
[135] | 310 | c istdyn=day_step/4 ! stockage toutes les 6h=1jour/4 |
---|
| 311 | c istphy=istdyn/iphysiq |
---|
| 312 | |
---|
| 313 | write(*,*) "gcm: callgroupeun set to:",callgroupeun |
---|
| 314 | c----------------------------------------------------------------------- |
---|
| 315 | c Debut de l'integration temporelle: |
---|
| 316 | c ---------------------------------- |
---|
| 317 | |
---|
| 318 | 1 CONTINUE |
---|
| 319 | c |
---|
| 320 | IF( MOD( itau, 10* day_step ).EQ.0 ) THEN |
---|
| 321 | CALL test_period ( ucov,vcov,teta,q,p,phis ) |
---|
| 322 | PRINT *,' ---- Test_period apres continue OK ! -----', itau |
---|
| 323 | ENDIF |
---|
| 324 | |
---|
| 325 | if (callgroupeun) then |
---|
| 326 | call groupeun(jjp1,llm,ucov,.true.) |
---|
| 327 | call groupeun(jjm,llm,vcov,.true.) |
---|
| 328 | call groupeun(jjp1,llm,teta,.true.) |
---|
| 329 | call groupeun(jjp1,llm,masse,.true.) |
---|
| 330 | call groupeun(jjp1,1,ps,.false.) |
---|
| 331 | endif |
---|
| 332 | |
---|
| 333 | CALL SCOPY( ijmllm ,vcov , 1, vcovm1 , 1 ) |
---|
| 334 | CALL SCOPY( ijp1llm,ucov , 1, ucovm1 , 1 ) |
---|
| 335 | CALL SCOPY( ijp1llm,teta , 1, tetam1 , 1 ) |
---|
| 336 | CALL SCOPY( ijp1llm,masse, 1, massem1, 1 ) |
---|
| 337 | CALL SCOPY( ip1jmp1, ps , 1, psm1 , 1 ) |
---|
| 338 | |
---|
| 339 | forward = .TRUE. |
---|
| 340 | leapf = .FALSE. |
---|
| 341 | dt = dtvr |
---|
| 342 | |
---|
| 343 | c ... P.Le Van .26/04/94 .... |
---|
| 344 | |
---|
| 345 | CALL SCOPY ( ijp1llm, masse, 1, finvmaold, 1 ) |
---|
| 346 | CALL filtreg ( finvmaold ,jjp1, llm, -2,2, .TRUE., 1 ) |
---|
| 347 | |
---|
| 348 | |
---|
| 349 | 2 CONTINUE |
---|
| 350 | |
---|
| 351 | c----------------------------------------------------------------------- |
---|
| 352 | |
---|
| 353 | c date: |
---|
| 354 | c ----- |
---|
| 355 | |
---|
| 356 | ! write(*,*) 'GCM: itau=',itau |
---|
| 357 | |
---|
| 358 | c gestion des appels de la physique et des dissipations: |
---|
| 359 | c ------------------------------------------------------ |
---|
| 360 | c |
---|
| 361 | c ... P.Le Van ( 6/02/95 ) .... |
---|
| 362 | |
---|
| 363 | apphys = .FALSE. |
---|
| 364 | statcl = .FALSE. |
---|
| 365 | conser = .FALSE. |
---|
| 366 | apdiss = .FALSE. |
---|
| 367 | |
---|
| 368 | IF( purmats ) THEN |
---|
| 369 | IF( MOD(itau,iconser) .EQ.0.AND. forward ) conser = .TRUE. |
---|
| 370 | IF( MOD(itau,idissip ).EQ.0.AND..NOT.forward ) apdiss = .TRUE. |
---|
| 371 | IF( MOD(itau,iphysiq ).EQ.0.AND..NOT.forward |
---|
| 372 | $ .AND. physic ) apphys = .TRUE. |
---|
| 373 | ELSE |
---|
| 374 | IF( MOD(itau ,iconser) .EQ. 0 ) conser = .TRUE. |
---|
| 375 | IF( MOD(itau+1,idissip) .EQ. 0 ) apdiss = .TRUE. |
---|
| 376 | IF( MOD(itau+1,iphysiq).EQ.0. AND. physic ) apphys = .TRUE. |
---|
| 377 | END IF |
---|
| 378 | |
---|
| 379 | c----------------------------------------------------------------------- |
---|
| 380 | c calcul des tendances dynamiques: |
---|
| 381 | c -------------------------------- |
---|
| 382 | |
---|
| 383 | CALL geopot ( ip1jmp1, teta , pk , pks, phis , phi ) |
---|
| 384 | |
---|
| 385 | if(calldyn)then |
---|
| 386 | CALL caldyn |
---|
| 387 | $ ( itau,ucov,vcov,teta,ps,masse,pk,pkf,phis , |
---|
| 388 | $ phi,conser,du,dv,dteta,dp,w,pbaru,pbarv,time+iday-day_ini) |
---|
| 389 | endif |
---|
| 390 | |
---|
| 391 | c----------------------------------------------------------------------- |
---|
| 392 | c calcul des tendances advection des traceurs (dont l'humidite) |
---|
| 393 | c ------------------------------------------------------------- |
---|
| 394 | |
---|
[253] | 395 | |
---|
| 396 | |
---|
[135] | 397 | if (tracer) then |
---|
| 398 | IF( forward. OR . leapf ) THEN |
---|
| 399 | |
---|
[1216] | 400 | DO iq = 1, nqtot |
---|
[135] | 401 | c |
---|
| 402 | IF ( iadv(iq).EQ.1.OR.iadv(iq).EQ.2 ) THEN |
---|
| 403 | CALL traceur( iq,iadv,q,teta,pk,w, pbaru, pbarv, dq ) |
---|
| 404 | |
---|
[1216] | 405 | ELSE IF( iq.EQ. nqtot ) THEN |
---|
[135] | 406 | c |
---|
| 407 | iapp_tracvl = 5 |
---|
| 408 | c |
---|
| 409 | cccc iapp_tracvl est la frequence en pas du groupement des flux |
---|
| 410 | cccc de masse pour Van-Leer dans la routine tracvl . |
---|
| 411 | c |
---|
| 412 | |
---|
[1216] | 413 | CALL vanleer(numvanle,iapp_tracvl,nqtot,q,pbaru,pbarv, |
---|
[135] | 414 | * p, masse, dq, iadv(1), teta, pk ) |
---|
| 415 | |
---|
| 416 | c |
---|
| 417 | c ... Modif F.Codron .... |
---|
| 418 | c |
---|
| 419 | ENDIF |
---|
| 420 | c |
---|
| 421 | ENDDO |
---|
| 422 | C |
---|
| 423 | c IF (offline) THEN |
---|
| 424 | C maf stokage du flux de masse pour traceurs OFF-LINE |
---|
| 425 | |
---|
| 426 | c CALL fluxstokenc(pbaru,pbarv,masse,teta,phi,phis, |
---|
| 427 | c . time_step, itau) |
---|
| 428 | |
---|
| 429 | c ENDIF |
---|
| 430 | c |
---|
| 431 | ENDIF |
---|
| 432 | END IF ! tracer |
---|
| 433 | |
---|
| 434 | |
---|
| 435 | c----------------------------------------------------------------------- |
---|
| 436 | c integrations dynamique et traceurs: |
---|
| 437 | c ---------------------------------- |
---|
| 438 | |
---|
| 439 | if(calldyn)then |
---|
| 440 | CALL integrd(2,vcovm1,ucovm1,tetam1,psm1,massem1, |
---|
| 441 | $ dv,du,dteta,dq,dp,vcov,ucov,teta,q,ps,masse,phis, |
---|
| 442 | $ finvmaold) |
---|
[253] | 443 | else |
---|
| 444 | print*,'Currently no dynamics in this GCM...' |
---|
[135] | 445 | endif |
---|
| 446 | |
---|
| 447 | |
---|
| 448 | |
---|
| 449 | |
---|
| 450 | |
---|
| 451 | c .P.Le Van (26/04/94 ajout de finvpold dans l'appel d'integrd) |
---|
| 452 | c |
---|
| 453 | c----------------------------------------------------------------------- |
---|
| 454 | c calcul des tendances physiques: |
---|
| 455 | c ------------------------------- |
---|
| 456 | c ######## P.Le Van ( Modif le 6/02/95 ) ########### |
---|
| 457 | c |
---|
| 458 | IF( purmats ) THEN |
---|
| 459 | IF( itau.EQ.itaufin.AND..NOT.forward ) lafin = .TRUE. |
---|
| 460 | ELSE |
---|
| 461 | IF( itau+1. EQ. itaufin ) lafin = .TRUE. |
---|
| 462 | ENDIF |
---|
| 463 | c |
---|
| 464 | c |
---|
| 465 | IF( apphys ) THEN |
---|
| 466 | c |
---|
| 467 | c ....... Ajout P.Le Van ( 17/04/96 ) ........... |
---|
| 468 | c |
---|
| 469 | |
---|
| 470 | CALL pression ( ip1jmp1, ap, bp, ps, p ) |
---|
| 471 | CALL exner_hyb( ip1jmp1, ps, p,beta,pks, pk, pkf ) |
---|
| 472 | |
---|
| 473 | rdaym_ini = itau * dtvr / daysec |
---|
| 474 | rdayvrai = rdaym_ini + day_ini |
---|
| 475 | |
---|
| 476 | IF ( ecritphy.LT.1. ) THEN |
---|
| 477 | rday_ecri = rdaym_ini |
---|
| 478 | ELSE |
---|
[649] | 479 | rday_ecri = INT(rdaym_ini)+INT(day_ini) |
---|
[135] | 480 | ENDIF |
---|
| 481 | c |
---|
| 482 | |
---|
| 483 | |
---|
| 484 | |
---|
[1216] | 485 | CALL calfis( nqtot, lafin ,rdayvrai,rday_ecri,time , |
---|
[135] | 486 | $ ucov,vcov,teta,q,masse,ps,p,pk,phis,phi , |
---|
| 487 | $ du,dv,dteta,dq,w, dufi,dvfi,dhfi,dqfi,dpfi,tracer) |
---|
| 488 | |
---|
| 489 | |
---|
| 490 | c ajout des tendances physiques: |
---|
| 491 | c ------------------------------ |
---|
[253] | 492 | ! if(1.eq.2)then |
---|
[1216] | 493 | CALL addfi( nqtot, dtphys, leapf, forward , |
---|
[135] | 494 | $ ucov, vcov, teta , q ,ps , masse, |
---|
| 495 | $ dufi, dvfi, dhfi , dqfi ,dpfi ) |
---|
[253] | 496 | ! else |
---|
| 497 | ! print*,'Currently no physics in this GCM...' |
---|
| 498 | ! endif |
---|
[135] | 499 | c |
---|
| 500 | ENDIF |
---|
| 501 | |
---|
| 502 | CALL pression ( ip1jmp1, ap, bp, ps, p ) |
---|
| 503 | |
---|
| 504 | CALL exner_hyb( ip1jmp1, ps, p,beta, pks, pk, pkf ) |
---|
| 505 | c ---------------------------------------------------------- |
---|
| 506 | |
---|
| 507 | c |
---|
| 508 | c |
---|
| 509 | c dissipation horizontale et verticale des petites echelles: |
---|
| 510 | c ---------------------------------------------------------- |
---|
| 511 | |
---|
| 512 | IF(apdiss) THEN |
---|
| 513 | |
---|
| 514 | c Sponge layer |
---|
| 515 | c ~~~~~~~~~~~~ |
---|
[1006] | 516 | |
---|
[135] | 517 | IF (callsponge) THEN |
---|
[1006] | 518 | pext(1:ip1jmp1)=ps(1:ip1jmp1)*aire(1:ip1jmp1) |
---|
| 519 | CALL sponge(ucov,vcov,teta,pext,dtdiss,mode_sponge) |
---|
[135] | 520 | ENDIF |
---|
| 521 | |
---|
| 522 | c Dissipation horizontale |
---|
| 523 | c ~~~~~~~~~~~~~~~~~~~~~~~ |
---|
[253] | 524 | |
---|
| 525 | |
---|
| 526 | if(dissip_conservative) then |
---|
| 527 | ! calculate kinetic energy before dissipation |
---|
| 528 | call covcont(llm,ucov,vcov,ucont,vcont) |
---|
| 529 | call enercin(vcov,ucov,vcont,ucont,ecin0) |
---|
| 530 | end if |
---|
| 531 | |
---|
[135] | 532 | CALL dissip(vcov,ucov,teta,p,dvdis,dudis,dhdis) |
---|
| 533 | |
---|
[993] | 534 | ucov(:,:)=ucov(:,:)+dudis(:,:) |
---|
| 535 | vcov(:,:)=vcov(:,:)+dvdis(:,:) |
---|
[253] | 536 | |
---|
| 537 | |
---|
| 538 | if (dissip_conservative) then |
---|
| 539 | C On rajoute la tendance due a la transform. Ec -> E therm. cree |
---|
| 540 | C lors de la dissipation |
---|
| 541 | call covcont(llm,ucov,vcov,ucont,vcont) |
---|
| 542 | call enercin(vcov,ucov,vcont,ucont,ecin) |
---|
| 543 | dtetaecdt(:,:) = (ecin0(:,:)-ecin(:,:))/ pk(:,:) |
---|
| 544 | dhdis(:,:) = dhdis(:,:) + dtetaecdt(:,:) |
---|
| 545 | endif |
---|
| 546 | |
---|
[993] | 547 | teta(:,:)=teta(:,:)+dhdis(:,:) |
---|
[135] | 548 | |
---|
| 549 | |
---|
| 550 | c ....... P. Le Van ( ajout le 17/04/96 ) ........... |
---|
| 551 | c ... Calcul de la valeur moyenne, unique de h aux poles ..... |
---|
| 552 | c |
---|
| 553 | |
---|
| 554 | DO l = 1, llm |
---|
| 555 | DO ij = 1,iim |
---|
| 556 | tppn(ij) = aire( ij ) * teta( ij ,l) |
---|
| 557 | tpps(ij) = aire(ij+ip1jm) * teta(ij+ip1jm,l) |
---|
| 558 | ENDDO |
---|
| 559 | |
---|
| 560 | tpn = SSUM(iim,tppn,1)/apoln |
---|
| 561 | tps = SSUM(iim,tpps,1)/apols |
---|
| 562 | |
---|
| 563 | DO ij = 1, iip1 |
---|
| 564 | teta( ij ,l) = tpn |
---|
| 565 | teta(ij+ip1jm,l) = tps |
---|
| 566 | ENDDO |
---|
| 567 | ENDDO |
---|
| 568 | |
---|
| 569 | DO ij = 1,iim |
---|
| 570 | tppn(ij) = aire( ij ) * ps ( ij ) |
---|
| 571 | tpps(ij) = aire(ij+ip1jm) * ps (ij+ip1jm) |
---|
| 572 | ENDDO |
---|
| 573 | tpn = SSUM(iim,tppn,1)/apoln |
---|
| 574 | |
---|
| 575 | tps = SSUM(iim,tpps,1)/apols |
---|
| 576 | |
---|
| 577 | DO ij = 1, iip1 |
---|
| 578 | ps( ij ) = tpn |
---|
| 579 | ps(ij+ip1jm) = tps |
---|
| 580 | ENDDO |
---|
| 581 | |
---|
| 582 | |
---|
| 583 | |
---|
| 584 | |
---|
| 585 | |
---|
| 586 | |
---|
| 587 | |
---|
| 588 | END IF |
---|
| 589 | |
---|
| 590 | c ******************************************************************** |
---|
| 591 | c ******************************************************************** |
---|
| 592 | c .... fin de l'integration dynamique et physique pour le pas itau .. |
---|
| 593 | c ******************************************************************** |
---|
| 594 | c ******************************************************************** |
---|
| 595 | |
---|
| 596 | c preparation du pas d'integration suivant ...... |
---|
| 597 | |
---|
| 598 | IF ( .NOT.purmats ) THEN |
---|
| 599 | c ........................................................ |
---|
| 600 | c .............. schema matsuno + leapfrog .............. |
---|
| 601 | c ........................................................ |
---|
| 602 | |
---|
| 603 | IF(forward. OR. leapf) THEN |
---|
| 604 | itau= itau + 1 |
---|
| 605 | iday= day_ini+itau/day_step |
---|
| 606 | time= FLOAT(itau-(iday-day_ini)*day_step)/day_step+time_0 |
---|
| 607 | IF(time.GT.1.) THEN |
---|
| 608 | time = time-1. |
---|
| 609 | iday = iday+1 |
---|
| 610 | ENDIF |
---|
| 611 | ENDIF |
---|
| 612 | |
---|
| 613 | |
---|
| 614 | IF( itau. EQ. itaufinp1 ) then |
---|
| 615 | abort_message = 'Simulation finished' |
---|
| 616 | call abort_gcm(modname,abort_message,0) |
---|
| 617 | ENDIF |
---|
| 618 | c----------------------------------------------------------------------- |
---|
| 619 | c ecriture du fichier histoire moyenne: |
---|
| 620 | c ------------------------------------- |
---|
| 621 | |
---|
| 622 | c IF(MOD(itau,iperiod).EQ.0 .OR. itau.EQ.itaufin) THEN |
---|
| 623 | c IF(itau.EQ.itaufin) THEN |
---|
| 624 | c iav=1 |
---|
| 625 | c ELSE |
---|
| 626 | c iav=0 |
---|
| 627 | c ENDIF |
---|
[1216] | 628 | c CALL writedynav(histaveid, nqtot, itau,vcov , |
---|
[135] | 629 | c , ucov,teta,pk,phi,q,masse,ps,phis) |
---|
| 630 | c ENDIF |
---|
| 631 | |
---|
| 632 | c----------------------------------------------------------------------- |
---|
| 633 | |
---|
| 634 | |
---|
| 635 | IF(itau.EQ.itaufin) THEN |
---|
| 636 | |
---|
| 637 | |
---|
| 638 | PRINT *,' Appel test_period avant redem ', itau |
---|
| 639 | CALL test_period ( ucov,vcov,teta,q,p,phis ) |
---|
| 640 | CALL dynredem1("restart.nc",0.0, |
---|
[1416] | 641 | . vcov,ucov,teta,q,masse,ps) |
---|
[135] | 642 | |
---|
| 643 | CLOSE(99) |
---|
| 644 | ENDIF |
---|
| 645 | |
---|
| 646 | c----------------------------------------------------------------------- |
---|
| 647 | c gestion de l'integration temporelle: |
---|
| 648 | c ------------------------------------ |
---|
| 649 | |
---|
| 650 | IF( MOD(itau,iperiod).EQ.0 ) THEN |
---|
| 651 | GO TO 1 |
---|
| 652 | ELSE IF ( MOD(itau-1,iperiod). EQ. 0 ) THEN |
---|
| 653 | |
---|
| 654 | IF( forward ) THEN |
---|
| 655 | c fin du pas forward et debut du pas backward |
---|
| 656 | |
---|
| 657 | forward = .FALSE. |
---|
| 658 | leapf = .FALSE. |
---|
| 659 | GO TO 2 |
---|
| 660 | |
---|
| 661 | ELSE |
---|
| 662 | c fin du pas backward et debut du premier pas leapfrog |
---|
| 663 | |
---|
| 664 | leapf = .TRUE. |
---|
| 665 | dt = 2.*dtvr |
---|
| 666 | GO TO 2 |
---|
| 667 | END IF |
---|
| 668 | ELSE |
---|
| 669 | |
---|
| 670 | c ...... pas leapfrog ..... |
---|
| 671 | |
---|
| 672 | leapf = .TRUE. |
---|
| 673 | dt = 2.*dtvr |
---|
| 674 | GO TO 2 |
---|
| 675 | END IF |
---|
| 676 | |
---|
| 677 | ELSE |
---|
| 678 | |
---|
| 679 | c ........................................................ |
---|
| 680 | c .............. schema matsuno ............... |
---|
| 681 | c ........................................................ |
---|
| 682 | IF( forward ) THEN |
---|
| 683 | |
---|
| 684 | itau = itau + 1 |
---|
| 685 | iday = day_ini+itau/day_step |
---|
| 686 | time = FLOAT(itau-(iday-day_ini)*day_step)/day_step+time_0 |
---|
| 687 | |
---|
| 688 | IF(time.GT.1.) THEN |
---|
| 689 | time = time-1. |
---|
| 690 | iday = iday+1 |
---|
| 691 | ENDIF |
---|
| 692 | |
---|
| 693 | forward = .FALSE. |
---|
| 694 | IF( itau. EQ. itaufinp1 ) then |
---|
| 695 | abort_message = 'Simulation finished' |
---|
| 696 | call abort_gcm(modname,abort_message,0) |
---|
| 697 | ENDIF |
---|
| 698 | GO TO 2 |
---|
| 699 | |
---|
| 700 | ELSE |
---|
| 701 | |
---|
| 702 | IF(MOD(itau,iperiod).EQ.0 .OR. itau.EQ.itaufin) THEN |
---|
| 703 | IF(itau.EQ.itaufin) THEN |
---|
| 704 | iav=1 |
---|
| 705 | ELSE |
---|
| 706 | iav=0 |
---|
| 707 | ENDIF |
---|
[1216] | 708 | c CALL writedynav(histaveid, nqtot, itau,vcov , |
---|
[135] | 709 | c , ucov,teta,pk,phi,q,masse,ps,phis) |
---|
| 710 | |
---|
| 711 | ENDIF |
---|
| 712 | |
---|
| 713 | |
---|
| 714 | IF(itau.EQ.itaufin) |
---|
| 715 | . CALL dynredem1("restart.nc",0.0, |
---|
[1216] | 716 | . vcov,ucov,teta,q,nqtot,masse,ps) |
---|
[135] | 717 | |
---|
| 718 | forward = .TRUE. |
---|
| 719 | GO TO 1 |
---|
| 720 | |
---|
| 721 | |
---|
| 722 | ENDIF |
---|
| 723 | |
---|
| 724 | END IF |
---|
| 725 | |
---|
| 726 | STOP |
---|
| 727 | END |
---|