[630] | 1 | ! |
---|
[1279] | 2 | ! $Id: gcm.F 2622 2016-09-04 06:12:02Z fairhead $ |
---|
[630] | 3 | ! |
---|
| 4 | c |
---|
| 5 | c |
---|
| 6 | PROGRAM gcm |
---|
| 7 | |
---|
| 8 | #ifdef CPP_IOIPSL |
---|
| 9 | USE IOIPSL |
---|
| 10 | #endif |
---|
[1146] | 11 | |
---|
[1825] | 12 | |
---|
[774] | 13 | USE mod_const_mpi, ONLY: init_const_mpi |
---|
[1823] | 14 | USE parallel_lmdz |
---|
[1146] | 15 | USE infotrac |
---|
[2351] | 16 | !#ifdef CPP_PHYS |
---|
| 17 | ! USE mod_interface_dyn_phys, ONLY: init_interface_dyn_phys |
---|
| 18 | !#endif |
---|
[1146] | 19 | USE mod_hallo |
---|
| 20 | USE Bands |
---|
[1279] | 21 | USE getparam |
---|
[1146] | 22 | USE filtreg_mod |
---|
[1403] | 23 | USE control_mod |
---|
[1146] | 24 | |
---|
[1785] | 25 | #ifdef INCA |
---|
| 26 | ! Only INCA needs these informations (from the Earth's physics) |
---|
| 27 | USE indice_sol_mod |
---|
[2225] | 28 | USE mod_phys_lmdz_omp_data, ONLY: klon_omp |
---|
[1785] | 29 | #endif |
---|
| 30 | |
---|
[1615] | 31 | #ifdef CPP_PHYS |
---|
[2418] | 32 | USE iniphysiq_mod, ONLY: iniphysiq |
---|
[1146] | 33 | #endif |
---|
[2597] | 34 | USE comconst_mod, ONLY: cpp, daysec, dtphys, dtvr, g, r, rad |
---|
[2603] | 35 | USE logic_mod ! all of it, because of copyin clause when calling leapfrog |
---|
[2601] | 36 | USE temps_mod, ONLY: calend,start_time,annee_ref,day_ref, |
---|
| 37 | & itau_dyn,itau_phy,day_ini,jD_ref,jH_ref,day_end, |
---|
| 38 | & dt,hour_ini,itaufin |
---|
[2597] | 39 | |
---|
[630] | 40 | IMPLICIT NONE |
---|
| 41 | |
---|
| 42 | c ...... Version du 10/01/98 .......... |
---|
| 43 | |
---|
| 44 | c avec coordonnees verticales hybrides |
---|
| 45 | c avec nouveaux operat. dissipation * ( gradiv2,divgrad2,nxgraro2 ) |
---|
| 46 | |
---|
| 47 | c======================================================================= |
---|
| 48 | c |
---|
| 49 | c Auteur: P. Le Van /L. Fairhead/F.Hourdin |
---|
| 50 | c ------- |
---|
| 51 | c |
---|
| 52 | c Objet: |
---|
| 53 | c ------ |
---|
| 54 | c |
---|
| 55 | c GCM LMD nouvelle grille |
---|
| 56 | c |
---|
| 57 | c======================================================================= |
---|
| 58 | c |
---|
| 59 | c ... Dans inigeom , nouveaux calculs pour les elongations cu , cv |
---|
| 60 | c et possibilite d'appeler une fonction f(y) a derivee tangente |
---|
| 61 | c hyperbolique a la place de la fonction a derivee sinusoidale. |
---|
| 62 | c ... Possibilite de choisir le schema pour l'advection de |
---|
| 63 | c q , en modifiant iadv dans traceur.def (MAF,10/02) . |
---|
| 64 | c |
---|
| 65 | c Pour Van-Leer + Vapeur d'eau saturee, iadv(1)=4. (F.Codron,10/99) |
---|
| 66 | c Pour Van-Leer iadv=10 |
---|
| 67 | c |
---|
| 68 | c----------------------------------------------------------------------- |
---|
| 69 | c Declarations: |
---|
| 70 | c ------------- |
---|
| 71 | #include "dimensions.h" |
---|
| 72 | #include "paramet.h" |
---|
| 73 | #include "comdissnew.h" |
---|
| 74 | #include "comgeom.h" |
---|
| 75 | #include "description.h" |
---|
[1403] | 76 | !#include "com_io_dyn.h" |
---|
[630] | 77 | #include "iniprint.h" |
---|
| 78 | #include "tracstoke.h" |
---|
[1403] | 79 | |
---|
| 80 | #ifdef INCA |
---|
| 81 | ! Only INCA needs these informations (from the Earth's physics) |
---|
[1785] | 82 | !#include "indicesol.h" |
---|
[1403] | 83 | #endif |
---|
[630] | 84 | |
---|
| 85 | REAL zdtvr |
---|
| 86 | |
---|
| 87 | c variables dynamiques |
---|
| 88 | REAL vcov(ip1jm,llm),ucov(ip1jmp1,llm) ! vents covariants |
---|
| 89 | REAL teta(ip1jmp1,llm) ! temperature potentielle |
---|
[1146] | 90 | REAL, ALLOCATABLE, DIMENSION(:,:,:) :: q ! champs advectes |
---|
[630] | 91 | REAL ps(ip1jmp1) ! pression au sol |
---|
[949] | 92 | c REAL p (ip1jmp1,llmp1 ) ! pression aux interfac.des couches |
---|
[630] | 93 | REAL masse(ip1jmp1,llm) ! masse d'air |
---|
| 94 | REAL phis(ip1jmp1) ! geopotentiel au sol |
---|
[949] | 95 | c REAL phi(ip1jmp1,llm) ! geopotentiel |
---|
| 96 | c REAL w(ip1jmp1,llm) ! vitesse verticale |
---|
[630] | 97 | |
---|
| 98 | c variables dynamiques intermediaire pour le transport |
---|
| 99 | |
---|
| 100 | c variables pour le fichier histoire |
---|
| 101 | REAL dtav ! intervalle de temps elementaire |
---|
| 102 | |
---|
| 103 | REAL time_0 |
---|
| 104 | |
---|
| 105 | LOGICAL lafin |
---|
| 106 | |
---|
| 107 | real time_step, t_wrt, t_ops |
---|
| 108 | |
---|
| 109 | |
---|
| 110 | c+jld variables test conservation energie |
---|
[949] | 111 | c REAL ecin(ip1jmp1,llm),ecin0(ip1jmp1,llm) |
---|
[630] | 112 | C Tendance de la temp. potentiel d (theta)/ d t due a la |
---|
| 113 | C tansformation d'energie cinetique en energie thermique |
---|
| 114 | C cree par la dissipation |
---|
[949] | 115 | c REAL dhecdt(ip1jmp1,llm) |
---|
| 116 | c REAL vcont(ip1jm,llm),ucont(ip1jmp1,llm) |
---|
| 117 | c REAL d_h_vcol, d_qt, d_qw, d_ql, d_ec |
---|
| 118 | c CHARACTER (len=15) :: ztit |
---|
[630] | 119 | c-jld |
---|
| 120 | |
---|
| 121 | |
---|
[949] | 122 | character (len=80) :: dynhist_file, dynhistave_file |
---|
[1279] | 123 | character (len=20) :: modname |
---|
| 124 | character (len=80) :: abort_message |
---|
| 125 | ! locales pour gestion du temps |
---|
| 126 | INTEGER :: an, mois, jour |
---|
| 127 | REAL :: heure |
---|
[630] | 128 | |
---|
| 129 | |
---|
| 130 | c----------------------------------------------------------------------- |
---|
| 131 | c Initialisations: |
---|
| 132 | c ---------------- |
---|
| 133 | |
---|
| 134 | abort_message = 'last timestep reached' |
---|
| 135 | modname = 'gcm' |
---|
| 136 | descript = 'Run GCM LMDZ' |
---|
| 137 | lafin = .FALSE. |
---|
| 138 | dynhist_file = 'dyn_hist' |
---|
| 139 | dynhistave_file = 'dyn_hist_ave' |
---|
| 140 | |
---|
[764] | 141 | |
---|
[630] | 142 | |
---|
| 143 | c---------------------------------------------------------------------- |
---|
| 144 | c lecture des fichiers gcm.def ou run.def |
---|
| 145 | c --------------------------------------- |
---|
| 146 | c |
---|
[2221] | 147 | CALL conf_gcm( 99, .TRUE. ) |
---|
[2151] | 148 | if (mod(iphysiq, iperiod) /= 0) call abort_gcm("conf_gcm", |
---|
| 149 | s "iphysiq must be a multiple of iperiod", 1) |
---|
[630] | 150 | c |
---|
| 151 | c |
---|
| 152 | c------------------------------------ |
---|
| 153 | c Initialisation partie parallele |
---|
| 154 | c------------------------------------ |
---|
[1852] | 155 | |
---|
[807] | 156 | CALL init_const_mpi |
---|
[630] | 157 | call init_parallel |
---|
[1279] | 158 | call ini_getparam("out.def") |
---|
[774] | 159 | call Read_Distrib |
---|
[1615] | 160 | |
---|
[2351] | 161 | !#ifdef CPP_PHYS |
---|
| 162 | ! CALL Init_Phys_lmdz(iim,jjp1,llm,mpi_size,distrib_phys) |
---|
[2225] | 163 | !#endif |
---|
| 164 | ! CALL set_bands |
---|
| 165 | !#ifdef CPP_PHYS |
---|
[2351] | 166 | ! CALL Init_interface_dyn_phys |
---|
| 167 | !#endif |
---|
[1000] | 168 | CALL barrier |
---|
| 169 | |
---|
[2225] | 170 | CALL set_bands |
---|
[630] | 171 | if (mpi_rank==0) call WriteBands |
---|
| 172 | call SetDistrib(jj_Nb_Caldyn) |
---|
[985] | 173 | |
---|
| 174 | c$OMP PARALLEL |
---|
[807] | 175 | call Init_Mod_hallo |
---|
[985] | 176 | c$OMP END PARALLEL |
---|
[807] | 177 | |
---|
[2225] | 178 | !#ifdef CPP_PHYS |
---|
| 179 | !c$OMP PARALLEL |
---|
| 180 | ! call InitComgeomphy ! now done in iniphysiq |
---|
| 181 | !c$OMP END PARALLEL |
---|
| 182 | !#endif |
---|
[960] | 183 | |
---|
[1825] | 184 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
| 185 | ! Initialisation de XIOS |
---|
| 186 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
| 187 | |
---|
| 188 | |
---|
[1279] | 189 | c----------------------------------------------------------------------- |
---|
| 190 | c Choix du calendrier |
---|
| 191 | c ------------------- |
---|
| 192 | |
---|
| 193 | c calend = 'earth_365d' |
---|
| 194 | |
---|
| 195 | #ifdef CPP_IOIPSL |
---|
| 196 | if (calend == 'earth_360d') then |
---|
| 197 | call ioconf_calendar('360d') |
---|
| 198 | write(lunout,*)'CALENDRIER CHOISI: Terrestre a 360 jours/an' |
---|
| 199 | else if (calend == 'earth_365d') then |
---|
| 200 | call ioconf_calendar('noleap') |
---|
| 201 | write(lunout,*)'CALENDRIER CHOISI: Terrestre a 365 jours/an' |
---|
| 202 | else if (calend == 'earth_366d') then |
---|
| 203 | call ioconf_calendar('gregorian') |
---|
| 204 | write(lunout,*)'CALENDRIER CHOISI: Terrestre bissextile' |
---|
| 205 | else |
---|
| 206 | abort_message = 'Mauvais choix de calendrier' |
---|
| 207 | call abort_gcm(modname,abort_message,1) |
---|
| 208 | endif |
---|
| 209 | #endif |
---|
| 210 | |
---|
[1563] | 211 | IF (type_trac == 'inca') THEN |
---|
[630] | 212 | #ifdef INCA |
---|
[1017] | 213 | call init_const_lmdz( |
---|
[1146] | 214 | $ nbtr,anneeref,dayref, |
---|
[1315] | 215 | $ iphysiq,day_step,nday, |
---|
| 216 | $ nbsrf, is_oce,is_sic, |
---|
[2180] | 217 | $ is_ter,is_lic, calend) |
---|
[1017] | 218 | |
---|
| 219 | call init_inca_para( |
---|
[1077] | 220 | $ iim,jjm+1,llm,klon_glo,mpi_size, |
---|
| 221 | $ distrib_phys,COMM_LMDZ) |
---|
[630] | 222 | #endif |
---|
[960] | 223 | END IF |
---|
[630] | 224 | |
---|
| 225 | c----------------------------------------------------------------------- |
---|
| 226 | c Initialisation des traceurs |
---|
| 227 | c --------------------------- |
---|
[1146] | 228 | c Choix du nombre de traceurs et du schema pour l'advection |
---|
| 229 | c dans fichier traceur.def, par default ou via INCA |
---|
| 230 | call infotrac_init |
---|
[630] | 231 | |
---|
[1146] | 232 | c Allocation de la tableau q : champs advectes |
---|
| 233 | ALLOCATE(q(ip1jmp1,llm,nqtot)) |
---|
| 234 | |
---|
[630] | 235 | c----------------------------------------------------------------------- |
---|
| 236 | c Lecture de l'etat initial : |
---|
| 237 | c --------------------------- |
---|
| 238 | |
---|
| 239 | c lecture du fichier start.nc |
---|
| 240 | if (read_start) then |
---|
[1146] | 241 | ! we still need to run iniacademic to initialize some |
---|
[1403] | 242 | ! constants & fields, if we run the 'newtonian' or 'SW' cases: |
---|
| 243 | if (iflag_phys.ne.1) then |
---|
[1146] | 244 | CALL iniacademic(vcov,ucov,teta,q,masse,ps,phis,time_0) |
---|
| 245 | endif |
---|
[1403] | 246 | |
---|
[1454] | 247 | ! if (planet_type.eq."earth") then |
---|
[1146] | 248 | ! Load an Earth-format start file |
---|
| 249 | CALL dynetat0("start.nc",vcov,ucov, |
---|
[1403] | 250 | & teta,q,masse,ps,phis, time_0) |
---|
[1454] | 251 | ! endif ! of if (planet_type.eq."earth") |
---|
| 252 | |
---|
[630] | 253 | c write(73,*) 'ucov',ucov |
---|
| 254 | c write(74,*) 'vcov',vcov |
---|
| 255 | c write(75,*) 'teta',teta |
---|
| 256 | c write(76,*) 'ps',ps |
---|
| 257 | c write(77,*) 'q',q |
---|
| 258 | |
---|
[1146] | 259 | endif ! of if (read_start) |
---|
[630] | 260 | |
---|
| 261 | c le cas echeant, creation d un etat initial |
---|
| 262 | IF (prt_level > 9) WRITE(lunout,*) |
---|
[1146] | 263 | . 'GCM: AVANT iniacademic AVANT AVANT AVANT AVANT' |
---|
[630] | 264 | if (.not.read_start) then |
---|
[1146] | 265 | CALL iniacademic(vcov,ucov,teta,q,masse,ps,phis,time_0) |
---|
[630] | 266 | endif |
---|
| 267 | |
---|
| 268 | c----------------------------------------------------------------------- |
---|
| 269 | c Lecture des parametres de controle pour la simulation : |
---|
| 270 | c ------------------------------------------------------- |
---|
| 271 | c on recalcule eventuellement le pas de temps |
---|
| 272 | |
---|
| 273 | IF(MOD(day_step,iperiod).NE.0) THEN |
---|
| 274 | abort_message = |
---|
| 275 | . 'Il faut choisir un nb de pas par jour multiple de iperiod' |
---|
| 276 | call abort_gcm(modname,abort_message,1) |
---|
| 277 | ENDIF |
---|
| 278 | |
---|
| 279 | IF(MOD(day_step,iphysiq).NE.0) THEN |
---|
| 280 | abort_message = |
---|
| 281 | * 'Il faut choisir un nb de pas par jour multiple de iphysiq' |
---|
| 282 | call abort_gcm(modname,abort_message,1) |
---|
| 283 | ENDIF |
---|
| 284 | |
---|
[1403] | 285 | zdtvr = daysec/REAL(day_step) |
---|
[630] | 286 | IF(dtvr.NE.zdtvr) THEN |
---|
| 287 | WRITE(lunout,*) |
---|
| 288 | . 'WARNING!!! changement de pas de temps',dtvr,'>',zdtvr |
---|
| 289 | ENDIF |
---|
| 290 | |
---|
| 291 | C |
---|
| 292 | C on remet le calendrier à zero si demande |
---|
| 293 | c |
---|
[1577] | 294 | IF (start_time /= starttime) then |
---|
| 295 | WRITE(lunout,*)' GCM: Attention l''heure de depart lue dans le' |
---|
| 296 | &,' fichier restart ne correspond pas à celle lue dans le run.def' |
---|
| 297 | IF (raz_date == 1) then |
---|
| 298 | WRITE(lunout,*)'Je prends l''heure lue dans run.def' |
---|
| 299 | start_time = starttime |
---|
| 300 | ELSE |
---|
[1939] | 301 | call abort_gcm("gcm", "'Je m''arrete'", 1) |
---|
[1577] | 302 | ENDIF |
---|
| 303 | ENDIF |
---|
[1403] | 304 | IF (raz_date == 1) THEN |
---|
| 305 | annee_ref = anneeref |
---|
| 306 | day_ref = dayref |
---|
| 307 | day_ini = dayref |
---|
| 308 | itau_dyn = 0 |
---|
| 309 | itau_phy = 0 |
---|
| 310 | time_0 = 0. |
---|
[630] | 311 | write(lunout,*) |
---|
[1403] | 312 | . 'GCM: On reinitialise a la date lue dans gcm.def' |
---|
| 313 | ELSE IF (annee_ref .ne. anneeref .or. day_ref .ne. dayref) THEN |
---|
| 314 | write(lunout,*) |
---|
[1279] | 315 | . 'GCM: Attention les dates initiales lues dans le fichier' |
---|
[630] | 316 | write(lunout,*) |
---|
| 317 | . ' restart ne correspondent pas a celles lues dans ' |
---|
| 318 | write(lunout,*)' gcm.def' |
---|
[1403] | 319 | write(lunout,*)' annee_ref=',annee_ref," anneeref=",anneeref |
---|
| 320 | write(lunout,*)' day_ref=',day_ref," dayref=",dayref |
---|
| 321 | write(lunout,*)' Pas de remise a zero' |
---|
| 322 | ENDIF |
---|
| 323 | c if (annee_ref .ne. anneeref .or. day_ref .ne. dayref) then |
---|
| 324 | c write(lunout,*) |
---|
| 325 | c . 'GCM: Attention les dates initiales lues dans le fichier' |
---|
| 326 | c write(lunout,*) |
---|
| 327 | c . ' restart ne correspondent pas a celles lues dans ' |
---|
| 328 | c write(lunout,*)' gcm.def' |
---|
| 329 | c write(lunout,*)' annee_ref=',annee_ref," anneeref=",anneeref |
---|
| 330 | c write(lunout,*)' day_ref=',day_ref," dayref=",dayref |
---|
| 331 | c if (raz_date .ne. 1) then |
---|
| 332 | c write(lunout,*) |
---|
| 333 | c . 'GCM: On garde les dates du fichier restart' |
---|
| 334 | c else |
---|
| 335 | c annee_ref = anneeref |
---|
| 336 | c day_ref = dayref |
---|
| 337 | c day_ini = dayref |
---|
| 338 | c itau_dyn = 0 |
---|
| 339 | c itau_phy = 0 |
---|
| 340 | c time_0 = 0. |
---|
| 341 | c write(lunout,*) |
---|
| 342 | c . 'GCM: On reinitialise a la date lue dans gcm.def' |
---|
| 343 | c endif |
---|
| 344 | c ELSE |
---|
| 345 | c raz_date = 0 |
---|
| 346 | c endif |
---|
[1279] | 347 | |
---|
[1147] | 348 | #ifdef CPP_IOIPSL |
---|
[1279] | 349 | mois = 1 |
---|
| 350 | heure = 0. |
---|
| 351 | call ymds2ju(annee_ref, mois, day_ref, heure, jD_ref) |
---|
| 352 | jH_ref = jD_ref - int(jD_ref) |
---|
| 353 | jD_ref = int(jD_ref) |
---|
| 354 | |
---|
| 355 | call ioconf_startdate(INT(jD_ref), jH_ref) |
---|
| 356 | |
---|
| 357 | write(lunout,*)'DEBUG' |
---|
| 358 | write(lunout,*)'annee_ref, mois, day_ref, heure, jD_ref' |
---|
| 359 | write(lunout,*)annee_ref, mois, day_ref, heure, jD_ref |
---|
| 360 | call ju2ymds(jD_ref+jH_ref,an, mois, jour, heure) |
---|
| 361 | write(lunout,*)'jD_ref+jH_ref,an, mois, jour, heure' |
---|
| 362 | write(lunout,*)jD_ref+jH_ref,an, mois, jour, heure |
---|
| 363 | #else |
---|
| 364 | ! Ehouarn: we still need to define JD_ref and JH_ref |
---|
| 365 | ! and since we don't know how many days there are in a year |
---|
| 366 | ! we set JD_ref to 0 (this should be improved ...) |
---|
| 367 | jD_ref=0 |
---|
| 368 | jH_ref=0 |
---|
[1147] | 369 | #endif |
---|
[630] | 370 | |
---|
| 371 | |
---|
[1403] | 372 | if (iflag_phys.eq.1) then |
---|
| 373 | ! these initialisations have already been done (via iniacademic) |
---|
| 374 | ! if running in SW or Newtonian mode |
---|
[630] | 375 | c----------------------------------------------------------------------- |
---|
| 376 | c Initialisation des constantes dynamiques : |
---|
| 377 | c ------------------------------------------ |
---|
[1403] | 378 | dtvr = zdtvr |
---|
| 379 | CALL iniconst |
---|
[630] | 380 | |
---|
| 381 | c----------------------------------------------------------------------- |
---|
| 382 | c Initialisation de la geometrie : |
---|
| 383 | c -------------------------------- |
---|
[1403] | 384 | CALL inigeom |
---|
[630] | 385 | |
---|
| 386 | c----------------------------------------------------------------------- |
---|
| 387 | c Initialisation du filtre : |
---|
| 388 | c -------------------------- |
---|
[1403] | 389 | CALL inifilr |
---|
| 390 | endif ! of if (iflag_phys.eq.1) |
---|
[630] | 391 | c |
---|
| 392 | c----------------------------------------------------------------------- |
---|
| 393 | c Initialisation de la dissipation : |
---|
| 394 | c ---------------------------------- |
---|
| 395 | |
---|
| 396 | CALL inidissip( lstardis, nitergdiv, nitergrot, niterh , |
---|
[1697] | 397 | * tetagdiv, tetagrot , tetatemp, vert_prof_dissip) |
---|
[630] | 398 | |
---|
| 399 | c----------------------------------------------------------------------- |
---|
| 400 | c Initialisation de la physique : |
---|
| 401 | c ------------------------------- |
---|
[2225] | 402 | IF ((iflag_phys==1).or.(iflag_phys>=100)) THEN |
---|
[1615] | 403 | ! Physics: |
---|
| 404 | #ifdef CPP_PHYS |
---|
[2351] | 405 | CALL iniphysiq(iim,jjm,llm, |
---|
| 406 | & distrib_phys(mpi_rank),comm_lmdz, |
---|
| 407 | & daysec,day_ini,dtphys/nsplit_phys, |
---|
[2346] | 408 | & rlatu,rlatv,rlonu,rlonv,aire,cu,cv,rad,g,r,cpp, |
---|
[1671] | 409 | & iflag_phys) |
---|
[1146] | 410 | #endif |
---|
[2225] | 411 | ENDIF ! of IF ((iflag_phys==1).or.(iflag_phys>=100)) |
---|
[807] | 412 | |
---|
[1146] | 413 | |
---|
| 414 | c----------------------------------------------------------------------- |
---|
| 415 | c Initialisation des dimensions d'INCA : |
---|
| 416 | c -------------------------------------- |
---|
[1563] | 417 | IF (type_trac == 'inca') THEN |
---|
[1146] | 418 | !$OMP PARALLEL |
---|
| 419 | #ifdef INCA |
---|
| 420 | CALL init_inca_dim(klon_omp,llm,iim,jjm, |
---|
| 421 | $ rlonu,rlatu,rlonv,rlatv) |
---|
[630] | 422 | #endif |
---|
[1146] | 423 | !$OMP END PARALLEL |
---|
| 424 | END IF |
---|
[630] | 425 | |
---|
| 426 | c----------------------------------------------------------------------- |
---|
| 427 | c Initialisation des I/O : |
---|
| 428 | c ------------------------ |
---|
| 429 | |
---|
| 430 | |
---|
[2038] | 431 | if (nday>=0) then |
---|
| 432 | day_end = day_ini + nday |
---|
| 433 | else |
---|
| 434 | day_end = day_ini - nday/day_step |
---|
| 435 | endif |
---|
| 436 | |
---|
[630] | 437 | WRITE(lunout,300)day_ini,day_end |
---|
[1146] | 438 | 300 FORMAT('1'/,15x,'run du jour',i7,2x,'au jour',i7//) |
---|
[630] | 439 | |
---|
[1279] | 440 | #ifdef CPP_IOIPSL |
---|
| 441 | call ju2ymds(jD_ref + day_ini - day_ref, an, mois, jour, heure) |
---|
| 442 | write (lunout,301)jour, mois, an |
---|
| 443 | call ju2ymds(jD_ref + day_end - day_ref, an, mois, jour, heure) |
---|
| 444 | write (lunout,302)jour, mois, an |
---|
| 445 | 301 FORMAT('1'/,15x,'run du ', i2,'/',i2,'/',i4) |
---|
| 446 | 302 FORMAT('1'/,15x,' au ', i2,'/',i2,'/',i4) |
---|
| 447 | #endif |
---|
| 448 | |
---|
[1454] | 449 | ! if (planet_type.eq."earth") then |
---|
| 450 | ! Write an Earth-format restart file |
---|
[1279] | 451 | CALL dynredem0_p("restart.nc", day_end, phis) |
---|
[1454] | 452 | ! endif |
---|
[630] | 453 | |
---|
| 454 | ecripar = .TRUE. |
---|
| 455 | |
---|
[1146] | 456 | #ifdef CPP_IOIPSL |
---|
[630] | 457 | time_step = zdtvr |
---|
[1403] | 458 | IF (mpi_rank==0) then |
---|
| 459 | if (ok_dyn_ins) then |
---|
| 460 | ! initialize output file for instantaneous outputs |
---|
| 461 | ! t_ops = iecri * daysec ! do operations every t_ops |
---|
| 462 | t_ops =((1.0*iecri)/day_step) * daysec |
---|
| 463 | t_wrt = daysec ! iecri * daysec ! write output every t_wrt |
---|
| 464 | t_wrt = daysec ! iecri * daysec ! write output every t_wrt |
---|
| 465 | CALL inithist(day_ref,annee_ref,time_step, |
---|
| 466 | & t_ops,t_wrt) |
---|
| 467 | endif |
---|
[630] | 468 | |
---|
[1403] | 469 | IF (ok_dyn_ave) THEN |
---|
| 470 | ! initialize output file for averaged outputs |
---|
| 471 | t_ops = iperiod * time_step ! do operations every t_ops |
---|
| 472 | t_wrt = periodav * daysec ! write output every t_wrt |
---|
| 473 | CALL initdynav(day_ref,annee_ref,time_step, |
---|
| 474 | & t_ops,t_wrt) |
---|
[1279] | 475 | ! CALL initdynav_p(dynhistave_file,day_ref,annee_ref,time_step, |
---|
| 476 | ! . t_ops, t_wrt, histaveid) |
---|
[1403] | 477 | END IF |
---|
| 478 | ENDIF |
---|
[630] | 479 | dtav = iperiod*dtvr/daysec |
---|
| 480 | #endif |
---|
[1146] | 481 | ! #endif of #ifdef CPP_IOIPSL |
---|
[630] | 482 | |
---|
| 483 | c Choix des frequences de stokage pour le offline |
---|
| 484 | c istdyn=day_step/4 ! stockage toutes les 6h=1jour/4 |
---|
| 485 | c istdyn=day_step/12 ! stockage toutes les 2h=1jour/12 |
---|
| 486 | istdyn=day_step/4 ! stockage toutes les 6h=1jour/12 |
---|
| 487 | istphy=istdyn/iphysiq |
---|
| 488 | |
---|
| 489 | |
---|
| 490 | c |
---|
| 491 | c----------------------------------------------------------------------- |
---|
| 492 | c Integration temporelle du modele : |
---|
| 493 | c ---------------------------------- |
---|
| 494 | |
---|
| 495 | c write(78,*) 'ucov',ucov |
---|
| 496 | c write(78,*) 'vcov',vcov |
---|
| 497 | c write(78,*) 'teta',teta |
---|
| 498 | c write(78,*) 'ps',ps |
---|
| 499 | c write(78,*) 'q',q |
---|
| 500 | |
---|
[2601] | 501 | !c$OMP PARALLEL DEFAULT(SHARED) COPYIN(/temps/,/logici/,/logicl/) |
---|
[2603] | 502 | c$OMP PARALLEL DEFAULT(SHARED) |
---|
[2601] | 503 | c Copy all threadprivate variables from temps_mod |
---|
| 504 | c$OMP1 COPYIN(dt,jD_ref,jH_ref,start_time,hour_ini,day_ini,day_end) |
---|
| 505 | c$OMP1 COPYIN(annee_ref,day_ref,itau_dyn,itau_phy,itaufin,calend) |
---|
[2603] | 506 | c Copy all threadprivate variables from logic_mod |
---|
| 507 | c$OMP1 COPYIN(purmats,forward,leapf,apphys,statcl,conser,apdiss,apdelq) |
---|
| 508 | c$OMP1 COPYIN(saison,ecripar,fxyhypb,ysinus,read_start,ok_guide) |
---|
| 509 | c$OMP1 COPYIN(ok_strato,ok_gradsfile,ok_limit,ok_etat0) |
---|
| 510 | c$OMP1 COPYIN(iflag_phys,iflag_trac) |
---|
[2221] | 511 | CALL leapfrog_p(ucov,vcov,teta,ps,masse,phis,q,time_0) |
---|
[774] | 512 | c$OMP END PARALLEL |
---|
[630] | 513 | |
---|
| 514 | |
---|
| 515 | END |
---|
| 516 | |
---|