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