[38] | 1 | PROGRAM gcm |
---|
| 2 | |
---|
[1576] | 3 | use ioipsl_getincom, only: getin |
---|
[1036] | 4 | use infotrac, only: iniadvtrac, nqtot, iadv |
---|
[1130] | 5 | use control_mod, only: day_step, iperiod, iphysiq, ndynstep, |
---|
[1594] | 6 | & nday_r, dissip_period, iconser, ecritstart |
---|
[1403] | 7 | use filtreg_mod, only: inifilr |
---|
[1395] | 8 | ! use comgeomphy, only: initcomgeomphy |
---|
[1543] | 9 | USE mod_const_mpi, ONLY: COMM_LMDZ |
---|
[1422] | 10 | USE comvert_mod, ONLY: ap,bp |
---|
[1593] | 11 | use sponge_mod, only: callsponge,mode_sponge,sponge |
---|
[1422] | 12 | USE comconst_mod, ONLY: daysec,dtvr,dtphys,dtdiss,rad,g,r,cpp |
---|
| 13 | USE logic_mod, ONLY: ecripar,forward,leapf,apphys,statcl,conser, |
---|
[1593] | 14 | . apdiss,purmats,iflag_phys,apphys |
---|
[1422] | 15 | USE temps_mod, ONLY: day_ini,day_end,dt,itaufin |
---|
[1523] | 16 | USE iniphysiq_mod, ONLY: iniphysiq |
---|
[38] | 17 | IMPLICIT NONE |
---|
| 18 | |
---|
| 19 | c ...... Version du 10/01/98 .......... |
---|
| 20 | |
---|
| 21 | c avec coordonnees verticales hybrides |
---|
| 22 | c avec nouveaux operat. dissipation * ( gradiv2,divgrad2,nxgraro2 ) |
---|
| 23 | |
---|
| 24 | c======================================================================= |
---|
| 25 | c |
---|
| 26 | c Auteur: P. Le Van /L. Fairhead/F.Hourdin |
---|
| 27 | c ------- |
---|
| 28 | c |
---|
| 29 | c Objet: |
---|
| 30 | c ------ |
---|
| 31 | c |
---|
| 32 | c GCM LMD nouvelle grille |
---|
| 33 | c |
---|
| 34 | c======================================================================= |
---|
| 35 | c |
---|
| 36 | c ... Dans inigeom , nouveaux calculs pour les elongations cu , cv |
---|
| 37 | c et possibilite d'appeler une fonction f(y) a derivee tangente |
---|
| 38 | c hyperbolique a la place de la fonction a derivee sinusoidale. |
---|
| 39 | |
---|
| 40 | c ... Possibilite de choisir le shema de Van-leer pour l'advection de |
---|
| 41 | c q , en faisant iadv = 3 dans traceur (29/04/97) . |
---|
| 42 | c |
---|
| 43 | c Pour Van-Leer + Vapeur d'eau saturee, iadv(1)=4. (F.Codron,10/99) |
---|
| 44 | c |
---|
| 45 | c----------------------------------------------------------------------- |
---|
| 46 | c Declarations: |
---|
| 47 | c ------------- |
---|
| 48 | |
---|
| 49 | #include "dimensions.h" |
---|
| 50 | #include "paramet.h" |
---|
| 51 | #include "comdissnew.h" |
---|
| 52 | #include "comgeom.h" |
---|
[1130] | 53 | !#include "control.h" |
---|
[38] | 54 | #include "netcdf.inc" |
---|
| 55 | #include "tracstoke.h" |
---|
[1036] | 56 | !#include"advtrac.h" |
---|
[38] | 57 | |
---|
| 58 | INTEGER*4 iday ! jour julien |
---|
| 59 | REAL time ! Heure de la journee en fraction d''1 jour |
---|
| 60 | REAL zdtvr |
---|
| 61 | |
---|
| 62 | c variables dynamiques |
---|
| 63 | REAL vcov(ip1jm,llm),ucov(ip1jmp1,llm) ! vents covariants |
---|
| 64 | real, dimension(ip1jmp1,llm) :: teta ! temperature potentielle |
---|
[1036] | 65 | REAL,allocatable :: q(:,:,:) ! champs advectes |
---|
[38] | 66 | REAL ps(ip1jmp1) ! pression au sol |
---|
[1593] | 67 | ! REAL pext(ip1jmp1) ! pression extensive |
---|
[38] | 68 | REAL p (ip1jmp1,llmp1 ) ! pression aux interfac.des couches |
---|
| 69 | REAL pks(ip1jmp1) ! exner au sol |
---|
| 70 | REAL pk(ip1jmp1,llm) ! exner au milieu des couches |
---|
| 71 | REAL pkf(ip1jmp1,llm) ! exner filt.au milieu des couches |
---|
| 72 | REAL masse(ip1jmp1,llm) ! masse d''air |
---|
| 73 | REAL phis(ip1jmp1) ! geopotentiel au sol |
---|
| 74 | REAL phi(ip1jmp1,llm) ! geopotentiel |
---|
| 75 | REAL w(ip1jmp1,llm) ! vitesse verticale |
---|
| 76 | |
---|
| 77 | c variables dynamiques intermediaire pour le transport |
---|
| 78 | REAL pbaru(ip1jmp1,llm),pbarv(ip1jm,llm) !flux de masse |
---|
| 79 | |
---|
| 80 | c variables dynamiques au pas -1 |
---|
| 81 | REAL vcovm1(ip1jm,llm),ucovm1(ip1jmp1,llm) |
---|
| 82 | |
---|
| 83 | REAL tetam1(ip1jmp1,llm),psm1(ip1jmp1) |
---|
| 84 | REAL massem1(ip1jmp1,llm) |
---|
| 85 | |
---|
| 86 | c tendances dynamiques |
---|
| 87 | REAL dv(ip1jm,llm),du(ip1jmp1,llm) |
---|
[1036] | 88 | REAL dteta(ip1jmp1,llm),dp(ip1jmp1) |
---|
| 89 | REAL,ALLOCATABLE :: dq(:,:,:) |
---|
[38] | 90 | |
---|
| 91 | c tendances de la dissipation |
---|
| 92 | REAL dvdis(ip1jm,llm),dudis(ip1jmp1,llm) |
---|
| 93 | REAL dhdis(ip1jmp1,llm) |
---|
| 94 | |
---|
| 95 | c tendances physiques |
---|
| 96 | REAL dvfi(ip1jm,llm),dufi(ip1jmp1,llm) |
---|
[1036] | 97 | REAL dhfi(ip1jmp1,llm),dpfi(ip1jmp1) |
---|
| 98 | REAL,ALLOCATABLE :: dqfi(:,:,:) |
---|
[38] | 99 | |
---|
| 100 | c variables pour le fichier histoire |
---|
| 101 | REAL dtav ! intervalle de temps elementaire |
---|
| 102 | |
---|
| 103 | REAL tppn(iim),tpps(iim),tpn,tps |
---|
| 104 | c |
---|
| 105 | |
---|
| 106 | INTEGER itau,itaufinp1,iav |
---|
| 107 | |
---|
| 108 | |
---|
| 109 | EXTERNAL caldyn, traceur |
---|
[1403] | 110 | EXTERNAL dissip,geopot,iniconst |
---|
[38] | 111 | EXTERNAL integrd,SCOPY |
---|
| 112 | EXTERNAL inigeom |
---|
| 113 | EXTERNAL exner_hyb,addit |
---|
| 114 | EXTERNAL defrun_new, test_period |
---|
| 115 | REAL SSUM |
---|
| 116 | REAL time_0 , finvmaold(ip1jmp1,llm) |
---|
| 117 | |
---|
| 118 | LOGICAL lafin |
---|
| 119 | INTEGER ij,iq,l,ierr,numvanle,iapp_tracvl |
---|
| 120 | |
---|
| 121 | REAL rdayvrai,rdaym_ini,rday_ecri |
---|
| 122 | ! LOGICAL first |
---|
| 123 | REAL beta(ip1jmp1,llm) |
---|
| 124 | |
---|
| 125 | LOGICAL offline ! Controle du stockage ds "fluxmass" |
---|
| 126 | PARAMETER (offline=.false.) |
---|
| 127 | |
---|
| 128 | character*20 modname |
---|
| 129 | character*80 abort_message |
---|
| 130 | |
---|
[1576] | 131 | ! flag to run with or without tracer transport (read from run.def) |
---|
| 132 | logical tracer |
---|
| 133 | |
---|
[38] | 134 | C Calendrier |
---|
| 135 | LOGICAL true_calendar |
---|
| 136 | PARAMETER (true_calendar = .false.) |
---|
| 137 | |
---|
| 138 | ! flag to set/remove calls to groupeun |
---|
| 139 | logical callgroupeun |
---|
| 140 | parameter (callgroupeun = .false.) |
---|
[1130] | 141 | |
---|
[38] | 142 | c----------------------------------------------------------------------- |
---|
[1130] | 143 | c variables pour l'initialisation de la physique : |
---|
| 144 | c ------------------------------------------------ |
---|
[1395] | 145 | ! INTEGER ngridmx |
---|
| 146 | ! PARAMETER( ngridmx = 2+(jjm-1)*iim - 1/jjm ) |
---|
| 147 | ! REAL zcufi(ngridmx),zcvfi(ngridmx) |
---|
| 148 | ! REAL latfi(ngridmx),lonfi(ngridmx) |
---|
| 149 | ! REAL airefi(ngridmx) |
---|
| 150 | ! SAVE latfi, lonfi, airefi |
---|
| 151 | ! INTEGER i,j |
---|
[1130] | 152 | |
---|
| 153 | c----------------------------------------------------------------------- |
---|
[38] | 154 | c Initialisations: |
---|
| 155 | c ---------------- |
---|
| 156 | |
---|
| 157 | modname = 'gcm' |
---|
| 158 | lafin = .FALSE. |
---|
| 159 | |
---|
| 160 | c----------------------------------------------------------------------- |
---|
[999] | 161 | CALL defrun_new( 99, .TRUE. ) |
---|
[1576] | 162 | WRITE(*,*) "" |
---|
| 163 | WRITE(*,*) "Run with or without tracer transport ?" |
---|
| 164 | tracer=.true. ! default value |
---|
| 165 | call getin("tracer",tracer) |
---|
| 166 | WRITE(*,*)" tracer = ",tracer |
---|
[999] | 167 | |
---|
[1036] | 168 | ! Initialize tracers |
---|
| 169 | call iniadvtrac(nqtot,numvanle) |
---|
| 170 | ! Allocation de la tableau q : champs advectes |
---|
| 171 | allocate(q(ip1jmp1,llm,nqtot)) |
---|
| 172 | allocate(dq(ip1jmp1,llm,nqtot)) |
---|
| 173 | allocate(dqfi(ip1jmp1,llm,nqtot)) |
---|
| 174 | |
---|
[1416] | 175 | CALL dynetat0("start.nc",vcov,ucov, |
---|
[999] | 176 | . teta,q,masse,ps,phis,time_0) |
---|
[38] | 177 | |
---|
[795] | 178 | ! in case time_0 (because of roundoffs) is close to zero, |
---|
| 179 | ! set it to zero to avoid roundoff propagation issues |
---|
| 180 | if ((time_0.gt.0.).and.(time_0.lt.(1./day_step))) then |
---|
| 181 | write(*,*)"GCM: In start.nc, time=",time_0 |
---|
| 182 | write(*,*)" but day_step=",day_step |
---|
| 183 | write(*,*)" and 1./day_step=",1./day_step |
---|
| 184 | write(*,*)" fix this drift by setting time=0" |
---|
| 185 | time_0=0. |
---|
| 186 | endif |
---|
[38] | 187 | |
---|
| 188 | |
---|
| 189 | c on recalcule eventuellement le pas de temps |
---|
| 190 | |
---|
| 191 | IF(MOD(day_step,iperiod).NE.0) |
---|
| 192 | * STOP'Il faut choisir un nb de pas par jour multiple de iperiod' |
---|
| 193 | |
---|
| 194 | IF(MOD(day_step,iphysiq).NE.0) |
---|
| 195 | * STOP'Il faut choisir un nb de pas par jour multiple de iphysiq' |
---|
| 196 | |
---|
| 197 | zdtvr = daysec/REAL(day_step) |
---|
| 198 | IF(dtvr.NE.zdtvr) THEN |
---|
| 199 | PRINT*,'WARNING!!! changement de pas de temps',dtvr,'>',zdtvr |
---|
| 200 | ENDIF |
---|
| 201 | |
---|
| 202 | c nombre d'etats dans les fichiers demarrage et histoire |
---|
| 203 | |
---|
| 204 | dtvr = zdtvr |
---|
| 205 | CALL iniconst |
---|
| 206 | CALL inigeom |
---|
| 207 | |
---|
| 208 | CALL inifilr |
---|
| 209 | |
---|
| 210 | c |
---|
| 211 | c ...... P.Le Van ( modif le 29/04/97 ) ......... |
---|
| 212 | c |
---|
| 213 | |
---|
| 214 | CALL inidissip ( lstardis, nitergdiv, nitergrot, niterh , |
---|
| 215 | * tetagdiv, tetagrot , tetatemp ) |
---|
| 216 | c |
---|
| 217 | |
---|
[1130] | 218 | c----------------------------------------------------------------------- |
---|
| 219 | c Initialisation de la physique : |
---|
| 220 | c ------------------------------- |
---|
[38] | 221 | |
---|
[1130] | 222 | ! IF (call_iniphys.and.(iflag_phys==1.or.iflag_phys>=100)) THEN |
---|
[1395] | 223 | ! latfi(1)=rlatu(1) |
---|
| 224 | ! lonfi(1)=0. |
---|
| 225 | ! zcufi(1) = cu(1) |
---|
| 226 | ! zcvfi(1) = cv(1) |
---|
| 227 | ! DO j=2,jjm |
---|
| 228 | ! DO i=1,iim |
---|
| 229 | ! latfi((j-2)*iim+1+i)= rlatu(j) |
---|
| 230 | ! lonfi((j-2)*iim+1+i)= rlonv(i) |
---|
| 231 | ! zcufi((j-2)*iim+1+i) = cu((j-1)*iip1+i) |
---|
| 232 | ! zcvfi((j-2)*iim+1+i) = cv((j-1)*iip1+i) |
---|
| 233 | ! ENDDO |
---|
| 234 | ! ENDDO |
---|
| 235 | ! latfi(ngridmx)= rlatu(jjp1) |
---|
| 236 | ! lonfi(ngridmx)= 0. |
---|
| 237 | ! zcufi(ngridmx) = cu(ip1jm+1) |
---|
| 238 | ! zcvfi(ngridmx) = cv(ip1jm-iim) |
---|
| 239 | ! |
---|
| 240 | ! ! build airefi(), mesh area on physics grid |
---|
| 241 | ! CALL gr_dyn_fi(1,iip1,jjp1,ngridmx,aire,airefi) |
---|
| 242 | ! ! Poles are single points on physics grid |
---|
| 243 | ! airefi(1)=airefi(1)*iim |
---|
| 244 | ! airefi(ngridmx)=airefi(ngridmx)*iim |
---|
[1130] | 245 | |
---|
| 246 | ! Initialisation de la physique: pose probleme quand on tourne |
---|
| 247 | ! SANS physique, car iniphysiq.F est dans le repertoire phy[]... |
---|
| 248 | ! Il faut une cle CPP_PHYS |
---|
| 249 | !#ifdef CPP_PHYS |
---|
[1395] | 250 | ! CALL iniphysiq(iim,jjm,llm,daysec,day_ini,dtphys/nsplit_phys, |
---|
[1543] | 251 | CALL iniphysiq(iim,jjm,llm, |
---|
| 252 | & (jjm-1)*iim+2,comm_lmdz, |
---|
| 253 | & daysec,day_ini,dtphys, |
---|
[1523] | 254 | & rlatu,rlatv,rlonu,rlonv, |
---|
| 255 | & aire,cu,cv,rad,g,r,cpp, |
---|
[1593] | 256 | & iflag_phys) |
---|
[1130] | 257 | !#endif |
---|
| 258 | ! call_iniphys=.false. |
---|
| 259 | ! ENDIF ! of IF (call_iniphys.and.(iflag_phys.eq.1)) |
---|
| 260 | ! call inifis(ngridmx,llm,nqtot,day_ini,daysec,dtphys, |
---|
| 261 | ! . latfi,lonfi,airefi,rad,g,r,cpp) |
---|
| 262 | |
---|
[38] | 263 | call dump2d(iip1,jjp1,ps,'PRESSION SURFACE') |
---|
| 264 | |
---|
| 265 | c |
---|
| 266 | c numero de stockage pour les fichiers de redemarrage: |
---|
| 267 | |
---|
| 268 | c----------------------------------------------------------------------- |
---|
| 269 | c temps de depart et de fin: |
---|
| 270 | c -------------------------- |
---|
| 271 | |
---|
| 272 | itau = 0 |
---|
| 273 | iday = day_ini+itau/day_step |
---|
| 274 | time = REAL(itau-(iday-day_ini)*day_step)/day_step+time_0 |
---|
| 275 | IF(time.GT.1.) THEN |
---|
| 276 | time = time-1. |
---|
| 277 | iday = iday+1 |
---|
| 278 | ENDIF |
---|
[828] | 279 | if (ndynstep .gt. 0) then |
---|
| 280 | itaufin = ndynstep |
---|
| 281 | else |
---|
| 282 | itaufin=nint(nday_r*day_step) ! nint() to avoid problematic roundoffs |
---|
| 283 | endif |
---|
[791] | 284 | ! check that this is compatible with call sequence dyn/phys/dissip |
---|
[1594] | 285 | ! i.e. that itaufin is a multiple of iphysiq and dissip_period |
---|
[791] | 286 | if ((modulo(itaufin,iphysiq).ne.0).or. |
---|
[1594] | 287 | & (modulo(itaufin,dissip_period).ne.0)) then |
---|
[828] | 288 | if (ndynstep .gt. 0) then |
---|
| 289 | write(*,'(A,I5)') |
---|
| 290 | & "gcm: Problem: incompatibility between ndynstep=",ndynstep |
---|
| 291 | else |
---|
| 292 | write(*,'((A,F9.2),2(A,I5))') |
---|
| 293 | & "gcm: Problem: incompatibility between nday=",nday_r, |
---|
[791] | 294 | & " day_step=",day_step," which imply itaufin=",itaufin |
---|
[828] | 295 | endif |
---|
| 296 | write(*,'(2(A,I5))') |
---|
[1594] | 297 | & " whereas iphysiq=",iphysiq," and dissip_period=", |
---|
| 298 | & dissip_period |
---|
[791] | 299 | stop |
---|
| 300 | endif |
---|
| 301 | ! write(*,*)"gcm: itaufin=",itaufin |
---|
[38] | 302 | c ******************************** |
---|
| 303 | c itaufin = 120 ! temporaire !! |
---|
| 304 | c ******************************** |
---|
| 305 | itaufinp1 = itaufin +1 |
---|
| 306 | |
---|
[828] | 307 | if (ndynstep .gt. 0) then |
---|
| 308 | day_end = day_ini |
---|
| 309 | & + floor(float(ndynstep)/float(day_step)+time_0) |
---|
| 310 | else |
---|
| 311 | day_end = day_ini + floor(nday_r+time_0) |
---|
| 312 | endif |
---|
[38] | 313 | PRINT 300, itau,itaufin,day_ini,day_end |
---|
| 314 | 300 FORMAT('1'/,15x,'run du pas',i7,2x,'au pas',i7,2x, |
---|
| 315 | . 'c''est a dire du jour',i7,3x,'au jour',i7//) |
---|
| 316 | |
---|
[1416] | 317 | CALL dynredem0("restart.nc",day_ini,phis) |
---|
[38] | 318 | |
---|
| 319 | ecripar = .TRUE. |
---|
| 320 | |
---|
| 321 | dtav = iperiod*dtvr/daysec |
---|
| 322 | |
---|
| 323 | |
---|
| 324 | c Quelques initialisations pour les traceurs |
---|
[1036] | 325 | dq(:,:,:)=0 |
---|
[38] | 326 | c istdyn=day_step/4 ! stockage toutes les 6h=1jour/4 |
---|
| 327 | c istphy=istdyn/iphysiq |
---|
| 328 | |
---|
| 329 | write(*,*) "gcm: callgroupeun set to:",callgroupeun |
---|
| 330 | c----------------------------------------------------------------------- |
---|
| 331 | c Debut de l'integration temporelle: |
---|
| 332 | c ---------------------------------- |
---|
| 333 | |
---|
| 334 | 1 CONTINUE |
---|
| 335 | c |
---|
[798] | 336 | c TN 09/2012. To ensure "1+1=2" in dynamical core : |
---|
| 337 | c update atmospheric pressure IN the main loop |
---|
| 338 | CALL pression ( ip1jmp1, ap, bp, ps, p ) |
---|
| 339 | CALL exner_hyb( ip1jmp1, ps, p,beta, pks, pk, pkf ) |
---|
| 340 | |
---|
[38] | 341 | IF( MOD( itau, 10* day_step ).EQ.0 ) THEN |
---|
| 342 | CALL test_period ( ucov,vcov,teta,q,p,phis ) |
---|
[791] | 343 | write(*,*)' GCM ---- Test_period apres continue OK ! -----', |
---|
| 344 | & ' itau: ',itau |
---|
[38] | 345 | ENDIF |
---|
| 346 | |
---|
| 347 | if (callgroupeun) then |
---|
| 348 | call groupeun(jjp1,llm,ucov,.true.) |
---|
| 349 | call groupeun(jjm,llm,vcov,.true.) |
---|
| 350 | call groupeun(jjp1,llm,teta,.true.) |
---|
| 351 | call groupeun(jjp1,llm,masse,.true.) |
---|
| 352 | call groupeun(jjp1,1,ps,.false.) |
---|
| 353 | endif |
---|
| 354 | |
---|
| 355 | CALL SCOPY( ijmllm ,vcov , 1, vcovm1 , 1 ) |
---|
| 356 | CALL SCOPY( ijp1llm,ucov , 1, ucovm1 , 1 ) |
---|
| 357 | CALL SCOPY( ijp1llm,teta , 1, tetam1 , 1 ) |
---|
| 358 | CALL SCOPY( ijp1llm,masse, 1, massem1, 1 ) |
---|
| 359 | CALL SCOPY( ip1jmp1, ps , 1, psm1 , 1 ) |
---|
| 360 | |
---|
| 361 | forward = .TRUE. |
---|
| 362 | leapf = .FALSE. |
---|
| 363 | dt = dtvr |
---|
| 364 | |
---|
| 365 | c ... P.Le Van .26/04/94 .... |
---|
| 366 | |
---|
| 367 | CALL SCOPY ( ijp1llm, masse, 1, finvmaold, 1 ) |
---|
| 368 | CALL filtreg ( finvmaold ,jjp1, llm, -2,2, .TRUE., 1 ) |
---|
| 369 | |
---|
| 370 | |
---|
| 371 | 2 CONTINUE |
---|
| 372 | |
---|
| 373 | c----------------------------------------------------------------------- |
---|
| 374 | |
---|
| 375 | c date: |
---|
| 376 | c ----- |
---|
| 377 | |
---|
| 378 | ! write(*,*) 'GCM: itau=',itau |
---|
| 379 | |
---|
| 380 | c gestion des appels de la physique et des dissipations: |
---|
| 381 | c ------------------------------------------------------ |
---|
| 382 | c |
---|
| 383 | c ... P.Le Van ( 6/02/95 ) .... |
---|
| 384 | |
---|
| 385 | apphys = .FALSE. |
---|
| 386 | statcl = .FALSE. |
---|
| 387 | conser = .FALSE. |
---|
| 388 | apdiss = .FALSE. |
---|
| 389 | |
---|
| 390 | IF( purmats ) THEN |
---|
| 391 | IF( MOD(itau,iconser) .EQ.0.AND. forward ) conser = .TRUE. |
---|
[1594] | 392 | IF( MOD(itau,dissip_period ).EQ.0 |
---|
| 393 | & .AND..NOT.forward ) apdiss = .TRUE. |
---|
[38] | 394 | IF( MOD(itau,iphysiq ).EQ.0.AND..NOT.forward |
---|
[1593] | 395 | $ .AND. (iflag_phys.eq.1) ) apphys = .TRUE. |
---|
[38] | 396 | ELSE |
---|
| 397 | IF( MOD(itau ,iconser) .EQ. 0 ) conser = .TRUE. |
---|
[1594] | 398 | IF( MOD(itau+1,dissip_period) .EQ. 0 ) apdiss = .TRUE. |
---|
[1593] | 399 | IF( MOD(itau+1,iphysiq).EQ.0 |
---|
| 400 | & .AND. (iflag_phys.eq.1) ) apphys = .TRUE. |
---|
[38] | 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 |
---|
[1593] | 454 | END IF ! tracer |
---|
[38] | 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 | |
---|
[1593] | 490 | ! Ehouarn: what was this for ?? |
---|
| 491 | ! IF ( ecritphy.LT.1. ) THEN |
---|
| 492 | ! rday_ecri = rdaym_ini |
---|
| 493 | ! ELSE |
---|
[38] | 494 | rday_ecri = INT( rdayvrai ) |
---|
[1593] | 495 | ! ENDIF |
---|
[38] | 496 | c |
---|
[1036] | 497 | CALL calfis( nqtot, lafin ,rdayvrai,rday_ecri,time , |
---|
[38] | 498 | $ ucov,vcov,teta,q,masse,ps,p,pk,phis,phi , |
---|
[1576] | 499 | $ du,dv,dteta,dq,w, dufi,dvfi,dhfi,dqfi,dpfi) |
---|
[38] | 500 | |
---|
| 501 | |
---|
| 502 | c ajout des tendances physiques: |
---|
| 503 | c ------------------------------ |
---|
[1036] | 504 | CALL addfi( nqtot, dtphys, leapf, forward , |
---|
[38] | 505 | $ ucov, vcov, teta , q ,ps , masse, |
---|
| 506 | $ dufi, dvfi, dhfi , dqfi ,dpfi ) |
---|
| 507 | c |
---|
| 508 | ENDIF |
---|
| 509 | |
---|
| 510 | CALL pression ( ip1jmp1, ap, bp, ps, p ) |
---|
| 511 | |
---|
| 512 | CALL exner_hyb( ip1jmp1, ps, p,beta, pks, pk, pkf ) |
---|
| 513 | c ---------------------------------------------------------- |
---|
| 514 | |
---|
| 515 | c |
---|
| 516 | c |
---|
| 517 | c dissipation horizontale et verticale des petites echelles: |
---|
| 518 | c ---------------------------------------------------------- |
---|
| 519 | |
---|
| 520 | |
---|
| 521 | IF(apdiss) THEN |
---|
| 522 | |
---|
| 523 | c Sponge layer |
---|
| 524 | c ~~~~~~~~~~~~ |
---|
| 525 | IF (callsponge) THEN |
---|
[1593] | 526 | CALL sponge(ucov,vcov,teta,ps,dtdiss,mode_sponge) |
---|
[38] | 527 | ENDIF |
---|
| 528 | |
---|
| 529 | c Dissipation horizontale |
---|
| 530 | c ~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 531 | CALL dissip(vcov,ucov,teta,p,dvdis,dudis,dhdis) |
---|
| 532 | |
---|
| 533 | CALL addit( ijp1llm,ucov ,dudis,ucov ) |
---|
| 534 | CALL addit( ijmllm ,vcov ,dvdis,vcov ) |
---|
| 535 | CALL addit( ijp1llm,teta ,dhdis,teta ) |
---|
| 536 | |
---|
| 537 | |
---|
| 538 | c ....... P. Le Van ( ajout le 17/04/96 ) ........... |
---|
| 539 | c ... Calcul de la valeur moyenne, unique de h aux poles ..... |
---|
| 540 | c |
---|
| 541 | |
---|
| 542 | DO l = 1, llm |
---|
| 543 | DO ij = 1,iim |
---|
| 544 | tppn(ij) = aire( ij ) * teta( ij ,l) |
---|
| 545 | tpps(ij) = aire(ij+ip1jm) * teta(ij+ip1jm,l) |
---|
| 546 | ENDDO |
---|
| 547 | |
---|
| 548 | tpn = SSUM(iim,tppn,1)/apoln |
---|
| 549 | tps = SSUM(iim,tpps,1)/apols |
---|
| 550 | |
---|
| 551 | DO ij = 1, iip1 |
---|
| 552 | teta( ij ,l) = tpn |
---|
| 553 | teta(ij+ip1jm,l) = tps |
---|
| 554 | ENDDO |
---|
| 555 | ENDDO |
---|
| 556 | |
---|
| 557 | DO ij = 1,iim |
---|
| 558 | tppn(ij) = aire( ij ) * ps ( ij ) |
---|
| 559 | tpps(ij) = aire(ij+ip1jm) * ps (ij+ip1jm) |
---|
| 560 | ENDDO |
---|
| 561 | tpn = SSUM(iim,tppn,1)/apoln |
---|
| 562 | |
---|
| 563 | tps = SSUM(iim,tpps,1)/apols |
---|
| 564 | |
---|
| 565 | DO ij = 1, iip1 |
---|
| 566 | ps( ij ) = tpn |
---|
| 567 | ps(ij+ip1jm) = tps |
---|
| 568 | ENDDO |
---|
| 569 | |
---|
| 570 | |
---|
| 571 | END IF |
---|
| 572 | |
---|
| 573 | c ******************************************************************** |
---|
| 574 | c ******************************************************************** |
---|
| 575 | c .... fin de l'integration dynamique et physique pour le pas itau .. |
---|
| 576 | c ******************************************************************** |
---|
| 577 | c ******************************************************************** |
---|
| 578 | |
---|
| 579 | c preparation du pas d'integration suivant ...... |
---|
| 580 | |
---|
| 581 | IF ( .NOT.purmats ) THEN |
---|
| 582 | c ........................................................ |
---|
| 583 | c .............. schema matsuno + leapfrog .............. |
---|
| 584 | c ........................................................ |
---|
| 585 | |
---|
| 586 | IF(forward. OR. leapf) THEN |
---|
| 587 | itau= itau + 1 |
---|
| 588 | iday= day_ini+itau/day_step |
---|
| 589 | time= REAL(itau-(iday-day_ini)*day_step)/day_step+time_0 |
---|
[999] | 590 | !IF(time.GT.1.) THEN |
---|
| 591 | IF(time.GE.1.) THEN |
---|
[38] | 592 | time = time-1. |
---|
| 593 | iday = iday+1 |
---|
| 594 | ENDIF |
---|
| 595 | ENDIF |
---|
| 596 | |
---|
| 597 | |
---|
| 598 | IF( itau. EQ. itaufinp1 ) then |
---|
| 599 | abort_message = 'Simulation finished' |
---|
| 600 | call abort_gcm(modname,abort_message,0) |
---|
| 601 | ENDIF |
---|
| 602 | c----------------------------------------------------------------------- |
---|
| 603 | c ecriture du fichier histoire moyenne: |
---|
| 604 | c ------------------------------------- |
---|
| 605 | |
---|
| 606 | c IF(MOD(itau,iperiod).EQ.0 .OR. itau.EQ.itaufin) THEN |
---|
| 607 | c IF(itau.EQ.itaufin) THEN |
---|
| 608 | c iav=1 |
---|
| 609 | c ELSE |
---|
| 610 | c iav=0 |
---|
| 611 | c ENDIF |
---|
[1036] | 612 | c CALL writedynav(histaveid, nqtot, itau,vcov , |
---|
[38] | 613 | c , ucov,teta,pk,phi,q,masse,ps,phis) |
---|
| 614 | c ENDIF |
---|
| 615 | |
---|
| 616 | c----------------------------------------------------------------------- |
---|
| 617 | |
---|
[999] | 618 | IF( (ecritstart.GT.0) .and. (MOD(itau,ecritstart).EQ.0) |
---|
| 619 | . .or. (itau.EQ.itaufin) ) THEN |
---|
| 620 | |
---|
| 621 | !write(*,*)' GCM: Appel test_period avant redem ; itau=',itau |
---|
[38] | 622 | CALL test_period ( ucov,vcov,teta,q,p,phis ) |
---|
[999] | 623 | |
---|
| 624 | write(*,'(A,I7,A,F12.5)') |
---|
| 625 | . 'GCM: Ecriture du fichier restart ; itau= ',itau, |
---|
| 626 | . ' date=',REAL(itau)/REAL(day_step) |
---|
| 627 | CALL dynredem1("restart.nc",REAL(itau)/REAL(day_step), |
---|
[1416] | 628 | . vcov,ucov,teta,q,masse,ps) |
---|
[999] | 629 | |
---|
| 630 | CLOSE(99) |
---|
| 631 | |
---|
[38] | 632 | ENDIF |
---|
| 633 | |
---|
[999] | 634 | |
---|
[38] | 635 | c----------------------------------------------------------------------- |
---|
| 636 | c gestion de l'integration temporelle: |
---|
| 637 | c ------------------------------------ |
---|
| 638 | |
---|
| 639 | IF( MOD(itau,iperiod).EQ.0 ) THEN |
---|
| 640 | GO TO 1 |
---|
| 641 | ELSE IF ( MOD(itau-1,iperiod). EQ. 0 ) THEN |
---|
| 642 | |
---|
| 643 | IF( forward ) THEN |
---|
| 644 | c fin du pas forward et debut du pas backward |
---|
| 645 | |
---|
| 646 | forward = .FALSE. |
---|
| 647 | leapf = .FALSE. |
---|
| 648 | GO TO 2 |
---|
| 649 | |
---|
| 650 | ELSE |
---|
| 651 | c fin du pas backward et debut du premier pas leapfrog |
---|
| 652 | |
---|
| 653 | leapf = .TRUE. |
---|
| 654 | dt = 2.*dtvr |
---|
| 655 | GO TO 2 |
---|
| 656 | END IF |
---|
| 657 | ELSE |
---|
| 658 | |
---|
| 659 | c ...... pas leapfrog ..... |
---|
| 660 | |
---|
| 661 | leapf = .TRUE. |
---|
| 662 | dt = 2.*dtvr |
---|
| 663 | GO TO 2 |
---|
| 664 | END IF |
---|
| 665 | |
---|
| 666 | ELSE |
---|
| 667 | |
---|
| 668 | c ........................................................ |
---|
| 669 | c .............. schema matsuno ............... |
---|
| 670 | c ........................................................ |
---|
| 671 | IF( forward ) THEN |
---|
| 672 | |
---|
| 673 | itau = itau + 1 |
---|
| 674 | iday = day_ini+itau/day_step |
---|
| 675 | time = REAL(itau-(iday-day_ini)*day_step)/day_step+time_0 |
---|
| 676 | |
---|
[999] | 677 | IF(time.GE.1.) THEN |
---|
[38] | 678 | time = time-1. |
---|
| 679 | iday = iday+1 |
---|
| 680 | ENDIF |
---|
| 681 | |
---|
| 682 | forward = .FALSE. |
---|
| 683 | IF( itau. EQ. itaufinp1 ) then |
---|
| 684 | abort_message = 'Simulation finished' |
---|
| 685 | call abort_gcm(modname,abort_message,0) |
---|
| 686 | ENDIF |
---|
| 687 | GO TO 2 |
---|
| 688 | |
---|
| 689 | ELSE |
---|
| 690 | |
---|
| 691 | IF(MOD(itau,iperiod).EQ.0 .OR. itau.EQ.itaufin) THEN |
---|
| 692 | IF(itau.EQ.itaufin) THEN |
---|
| 693 | iav=1 |
---|
| 694 | ELSE |
---|
| 695 | iav=0 |
---|
| 696 | ENDIF |
---|
[1036] | 697 | c CALL writedynav(histaveid, nqtot, itau,vcov , |
---|
[38] | 698 | c , ucov,teta,pk,phi,q,masse,ps,phis) |
---|
| 699 | |
---|
| 700 | ENDIF |
---|
| 701 | |
---|
| 702 | |
---|
[999] | 703 | IF( (ecritstart.GT.0) .and. (MOD(itau,ecritstart).EQ.0) |
---|
| 704 | . .or. (itau.EQ.itaufin) ) THEN |
---|
| 705 | |
---|
| 706 | CALL dynredem1("restart.nc", |
---|
| 707 | . REAL(itau)/REAL(day_step), |
---|
[1416] | 708 | . vcov,ucov,teta,q,masse,ps) |
---|
[999] | 709 | |
---|
| 710 | forward = .TRUE. |
---|
| 711 | GO TO 1 |
---|
| 712 | |
---|
| 713 | ENDIF |
---|
[38] | 714 | |
---|
| 715 | |
---|
| 716 | ENDIF |
---|
| 717 | |
---|
| 718 | END IF |
---|
| 719 | |
---|
| 720 | STOP |
---|
| 721 | END |
---|