| 1 | ! $Id: gcm.f90 5195 2024-09-16 13:18:00Z evignon $ |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | PROGRAM gcm |
|---|
| 6 | |
|---|
| 7 | USE IOIPSL |
|---|
| 8 | USE lmdz_wxios ! ug Pour les sorties XIOS |
|---|
| 9 | |
|---|
| 10 | USE lmdz_filtreg, ONLY: inifilr |
|---|
| 11 | USE lmdz_infotrac, ONLY: nqtot, init_infotrac |
|---|
| 12 | USE control_mod |
|---|
| 13 | USE mod_const_mpi, ONLY: COMM_LMDZ |
|---|
| 14 | USE temps_mod, ONLY: calend, start_time, annee_ref, day_ref, & |
|---|
| 15 | itau_dyn, itau_phy, day_ini, jD_ref, jH_ref, day_end |
|---|
| 16 | USE comconst_mod, ONLY: cpp, daysec, dtphys, dtvr, g, r, rad |
|---|
| 17 | USE logic_mod, ONLY: ecripar, iflag_phys, read_start |
|---|
| 18 | |
|---|
| 19 | USE lmdz_cppkeys_wrapper, ONLY: CPPKEY_PHYS |
|---|
| 20 | USE lmdz_dynetat0, ONLY: dynetat0 |
|---|
| 21 | |
|---|
| 22 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
|---|
| 23 | ! FH 2008/05/09 On elimine toutes les clefs physiques dans la dynamique |
|---|
| 24 | ! A nettoyer. On ne veut qu'une ou deux routines d'interface |
|---|
| 25 | ! dynamique -> physique pour l'initialisation |
|---|
| 26 | ! AB 2024/07/20: remplace CPP key by fortran logical, but ^ still relevant, see later use of iniphys later on |
|---|
| 27 | USE iniphysiq_mod, ONLY: iniphysiq |
|---|
| 28 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
|---|
| 29 | USE lmdz_iniprint, ONLY: lunout, prt_level |
|---|
| 30 | USE lmdz_comdissnew, ONLY: lstardis, nitergdiv, nitergrot, niterh, tetagdiv, & |
|---|
| 31 | tetagrot, tetatemp, coefdis, vert_prof_dissip |
|---|
| 32 | USE lmdz_comgeom |
|---|
| 33 | USE lmdz_tracstoke |
|---|
| 34 | |
|---|
| 35 | USE lmdz_dimensions, ONLY: iim, jjm, llm, ndm |
|---|
| 36 | USE lmdz_paramet |
|---|
| 37 | USE lmdz_leapfrog, ONLY: leapfrog |
|---|
| 38 | USE lmdz_conf_gcm, ONLY: conf_gcm |
|---|
| 39 | USE lmdz_dynredem, ONLY: dynredem0 |
|---|
| 40 | |
|---|
| 41 | IMPLICIT NONE |
|---|
| 42 | |
|---|
| 43 | ! ...... Version du 10/01/98 .......... |
|---|
| 44 | |
|---|
| 45 | ! avec coordonnees verticales hybrides |
|---|
| 46 | ! avec nouveaux operat. dissipation * ( gradiv2,divgrad2,nxgraro2 ) |
|---|
| 47 | |
|---|
| 48 | !======================================================================= |
|---|
| 49 | |
|---|
| 50 | ! Auteur: P. Le Van /L. Fairhead/F.Hourdin |
|---|
| 51 | ! ------- |
|---|
| 52 | |
|---|
| 53 | ! Objet: |
|---|
| 54 | ! ------ |
|---|
| 55 | |
|---|
| 56 | ! GCM LMD nouvelle grille |
|---|
| 57 | |
|---|
| 58 | !======================================================================= |
|---|
| 59 | |
|---|
| 60 | ! ... Dans inigeom , nouveaux calculs pour les elongations cu , cv |
|---|
| 61 | ! et possibilite d'appeler une fonction f(y) a derivee tangente |
|---|
| 62 | ! hyperbolique a la place de la fonction a derivee sinusoidale. |
|---|
| 63 | ! ... Possibilite de choisir le schema pour l'advection de |
|---|
| 64 | ! q , en modifiant iadv dans traceur.def (MAF,10/02) . |
|---|
| 65 | |
|---|
| 66 | ! Pour Van-Leer + Vapeur d'eau saturee, iadv(1)=4. (F.Codron,10/99) |
|---|
| 67 | ! Pour Van-Leer iadv=10 |
|---|
| 68 | |
|---|
| 69 | !----------------------------------------------------------------------- |
|---|
| 70 | ! Declarations: |
|---|
| 71 | ! ------------- |
|---|
| 72 | |
|---|
| 73 | |
|---|
| 74 | |
|---|
| 75 | |
|---|
| 76 | REAL zdtvr |
|---|
| 77 | |
|---|
| 78 | ! variables dynamiques |
|---|
| 79 | REAL vcov(ip1jm, llm), ucov(ip1jmp1, llm) ! vents covariants |
|---|
| 80 | REAL teta(ip1jmp1, llm) ! temperature potentielle |
|---|
| 81 | REAL, ALLOCATABLE, DIMENSION(:, :, :) :: q! champs advectes |
|---|
| 82 | REAL ps(ip1jmp1) ! pression au sol |
|---|
| 83 | ! REAL p (ip1jmp1,llmp1 ) ! pression aux interfac.des couches |
|---|
| 84 | REAL masse(ip1jmp1, llm) ! masse d'air |
|---|
| 85 | REAL phis(ip1jmp1) ! geopotentiel au sol |
|---|
| 86 | ! REAL phi(ip1jmp1,llm) ! geopotentiel |
|---|
| 87 | ! REAL w(ip1jmp1,llm) ! vitesse verticale |
|---|
| 88 | |
|---|
| 89 | ! variables dynamiques intermediaire pour le transport |
|---|
| 90 | |
|---|
| 91 | ! variables pour le fichier histoire |
|---|
| 92 | REAL dtav ! intervalle de temps elementaire |
|---|
| 93 | |
|---|
| 94 | REAL time_0 |
|---|
| 95 | |
|---|
| 96 | LOGICAL lafin |
|---|
| 97 | |
|---|
| 98 | REAL time_step, t_wrt, t_ops |
|---|
| 99 | |
|---|
| 100 | ! LOGICAL call_iniphys |
|---|
| 101 | ! data call_iniphys/.TRUE./ |
|---|
| 102 | |
|---|
| 103 | !+jld variables test conservation energie |
|---|
| 104 | ! REAL ecin(ip1jmp1,llm),ecin0(ip1jmp1,llm) |
|---|
| 105 | ! Tendance de la temp. potentiel d (theta)/ d t due a la |
|---|
| 106 | ! tansformation d'energie cinetique en energie thermique |
|---|
| 107 | ! cree par la dissipation |
|---|
| 108 | ! REAL dhecdt(ip1jmp1,llm) |
|---|
| 109 | ! REAL vcont(ip1jm,llm),ucont(ip1jmp1,llm) |
|---|
| 110 | ! REAL d_h_vcol, d_qt, d_qw, d_ql, d_ec |
|---|
| 111 | ! CHARACTER (len=15) :: ztit |
|---|
| 112 | !-jld |
|---|
| 113 | |
|---|
| 114 | CHARACTER (LEN = 80) :: dynhist_file, dynhistave_file |
|---|
| 115 | CHARACTER (LEN = 20) :: modname |
|---|
| 116 | CHARACTER (LEN = 80) :: abort_message |
|---|
| 117 | ! locales pour gestion du temps |
|---|
| 118 | INTEGER :: an, mois, jour |
|---|
| 119 | REAL :: heure |
|---|
| 120 | LOGICAL use_filtre_fft |
|---|
| 121 | |
|---|
| 122 | !----------------------------------------------------------------------- |
|---|
| 123 | ! Initialisations: |
|---|
| 124 | ! ---------------- |
|---|
| 125 | |
|---|
| 126 | abort_message = 'last timestep reached' |
|---|
| 127 | modname = 'gcm' |
|---|
| 128 | lafin = .FALSE. |
|---|
| 129 | dynhist_file = 'dyn_hist.nc' |
|---|
| 130 | dynhistave_file = 'dyn_hist_ave.nc' |
|---|
| 131 | |
|---|
| 132 | |
|---|
| 133 | |
|---|
| 134 | !---------------------------------------------------------------------- |
|---|
| 135 | ! lecture des fichiers gcm.def ou run.def |
|---|
| 136 | ! --------------------------------------- |
|---|
| 137 | |
|---|
| 138 | CALL conf_gcm(99, .TRUE.) |
|---|
| 139 | |
|---|
| 140 | IF (mod(iphysiq, iperiod) /= 0) CALL abort_gcm("conf_gcm", & |
|---|
| 141 | "iphysiq must be a multiple of iperiod", 1) |
|---|
| 142 | |
|---|
| 143 | use_filtre_fft = .FALSE. |
|---|
| 144 | CALL getin('use_filtre_fft', use_filtre_fft) |
|---|
| 145 | IF (use_filtre_fft) CALL abort_gcm("gcm", 'FFT filter is not available in ' & |
|---|
| 146 | // 'the sequential version of the dynamics.', 1) |
|---|
| 147 | |
|---|
| 148 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
|---|
| 149 | ! Initialisation de XIOS |
|---|
| 150 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
|---|
| 151 | |
|---|
| 152 | IF (using_xios) THEN |
|---|
| 153 | CALL wxios_init("LMDZ") |
|---|
| 154 | ENDIF |
|---|
| 155 | |
|---|
| 156 | |
|---|
| 157 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
|---|
| 158 | ! FH 2008/05/02 |
|---|
| 159 | ! A nettoyer. On ne veut qu'une ou deux routines d'interface |
|---|
| 160 | ! dynamique -> physique pour l'initialisation |
|---|
| 161 | !#ifdef CPP_PHYS |
|---|
| 162 | ! CALL Init_Phys_lmdz(iim,jjp1,llm,1,(/(jjm-1)*iim+2/)) |
|---|
| 163 | ! ! CALL InitComgeomphy ! now done in iniphysiq |
|---|
| 164 | !#endif |
|---|
| 165 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
|---|
| 166 | !----------------------------------------------------------------------- |
|---|
| 167 | ! Choix du calendrier |
|---|
| 168 | ! ------------------- |
|---|
| 169 | |
|---|
| 170 | ! calend = 'earth_365d' |
|---|
| 171 | |
|---|
| 172 | IF (calend == 'earth_360d') THEN |
|---|
| 173 | CALL ioconf_calendar('360_day') |
|---|
| 174 | WRITE(lunout, *)'CALENDRIER CHOISI: Terrestre a 360 jours/an' |
|---|
| 175 | ELSE IF (calend == 'earth_365d') THEN |
|---|
| 176 | CALL ioconf_calendar('noleap') |
|---|
| 177 | WRITE(lunout, *)'CALENDRIER CHOISI: Terrestre a 365 jours/an' |
|---|
| 178 | ELSE IF (calend == 'gregorian') THEN |
|---|
| 179 | CALL ioconf_calendar('gregorian') |
|---|
| 180 | WRITE(lunout, *)'CALENDRIER CHOISI: Terrestre bissextile' |
|---|
| 181 | else |
|---|
| 182 | abort_message = 'Mauvais choix de calendrier' |
|---|
| 183 | CALL abort_gcm(modname, abort_message, 1) |
|---|
| 184 | ENDIF |
|---|
| 185 | !----------------------------------------------------------------------- |
|---|
| 186 | |
|---|
| 187 | |
|---|
| 188 | !------------------------------------ |
|---|
| 189 | ! Initialisation partie parallele |
|---|
| 190 | !------------------------------------ |
|---|
| 191 | |
|---|
| 192 | |
|---|
| 193 | !----------------------------------------------------------------------- |
|---|
| 194 | ! Initialisation des traceurs |
|---|
| 195 | ! --------------------------- |
|---|
| 196 | ! Choix du nombre de traceurs et du schema pour l'advection |
|---|
| 197 | ! dans fichier traceur.def, par default ou via INCA |
|---|
| 198 | CALL init_infotrac |
|---|
| 199 | |
|---|
| 200 | ! Allocation de la tableau q : champs advectes |
|---|
| 201 | allocate(q(ip1jmp1, llm, nqtot)) |
|---|
| 202 | |
|---|
| 203 | !----------------------------------------------------------------------- |
|---|
| 204 | ! Lecture de l'etat initial : |
|---|
| 205 | ! --------------------------- |
|---|
| 206 | |
|---|
| 207 | ! lecture du fichier start.nc |
|---|
| 208 | IF (read_start) THEN |
|---|
| 209 | ! we still need to run iniacademic to initialize some |
|---|
| 210 | ! constants & fields, if we run the 'newtonian' or 'SW' cases: |
|---|
| 211 | IF (iflag_phys/=1) THEN |
|---|
| 212 | CALL iniacademic(vcov, ucov, teta, q, masse, ps, phis, time_0) |
|---|
| 213 | endif |
|---|
| 214 | |
|---|
| 215 | ! if (planet_type.EQ."earth") THEN |
|---|
| 216 | ! Load an Earth-format start file |
|---|
| 217 | CALL dynetat0("start.nc", vcov, ucov, teta, q, masse, ps, phis, time_0) |
|---|
| 218 | ! endif ! of if (planet_type.EQ."earth") |
|---|
| 219 | |
|---|
| 220 | ! WRITE(73,*) 'ucov',ucov |
|---|
| 221 | ! WRITE(74,*) 'vcov',vcov |
|---|
| 222 | ! WRITE(75,*) 'teta',teta |
|---|
| 223 | ! WRITE(76,*) 'ps',ps |
|---|
| 224 | ! WRITE(77,*) 'q',q |
|---|
| 225 | |
|---|
| 226 | ENDIF ! of if (read_start) |
|---|
| 227 | |
|---|
| 228 | |
|---|
| 229 | ! le cas echeant, creation d un etat initial |
|---|
| 230 | IF (prt_level > 9) WRITE(lunout, *) & |
|---|
| 231 | 'GCM: AVANT iniacademic AVANT AVANT AVANT AVANT' |
|---|
| 232 | IF (.NOT.read_start) THEN |
|---|
| 233 | start_time = 0. |
|---|
| 234 | annee_ref = anneeref |
|---|
| 235 | CALL iniacademic(vcov, ucov, teta, q, masse, ps, phis, time_0) |
|---|
| 236 | ENDIF |
|---|
| 237 | |
|---|
| 238 | |
|---|
| 239 | !----------------------------------------------------------------------- |
|---|
| 240 | ! Lecture des parametres de controle pour la simulation : |
|---|
| 241 | ! ------------------------------------------------------- |
|---|
| 242 | ! on recalcule eventuellement le pas de temps |
|---|
| 243 | |
|---|
| 244 | IF(MOD(day_step, iperiod)/=0) THEN |
|---|
| 245 | abort_message = & |
|---|
| 246 | 'Il faut choisir un nb de pas par jour multiple de iperiod' |
|---|
| 247 | CALL abort_gcm(modname, abort_message, 1) |
|---|
| 248 | ENDIF |
|---|
| 249 | |
|---|
| 250 | IF(MOD(day_step, iphysiq)/=0) THEN |
|---|
| 251 | abort_message = & |
|---|
| 252 | 'Il faut choisir un nb de pas par jour multiple de iphysiq' |
|---|
| 253 | CALL abort_gcm(modname, abort_message, 1) |
|---|
| 254 | ENDIF |
|---|
| 255 | |
|---|
| 256 | zdtvr = daysec / REAL(day_step) |
|---|
| 257 | IF(dtvr/=zdtvr) THEN |
|---|
| 258 | WRITE(lunout, *) & |
|---|
| 259 | 'WARNING!!! changement de pas de temps', dtvr, '>', zdtvr |
|---|
| 260 | ENDIF |
|---|
| 261 | |
|---|
| 262 | ! on remet le calendrier \`a zero si demande |
|---|
| 263 | |
|---|
| 264 | IF (start_time /= starttime) THEN |
|---|
| 265 | WRITE(lunout, *)' GCM: Attention l''heure de depart lue dans le' & |
|---|
| 266 | , ' fichier restart ne correspond pas a celle lue dans le run.def' |
|---|
| 267 | IF (raz_date == 1) THEN |
|---|
| 268 | WRITE(lunout, *)'Je prends l''heure lue dans run.def' |
|---|
| 269 | start_time = starttime |
|---|
| 270 | ELSE |
|---|
| 271 | CALL abort_gcm("gcm", "'Je m''arrete'", 1) |
|---|
| 272 | ENDIF |
|---|
| 273 | ENDIF |
|---|
| 274 | IF (raz_date == 1) THEN |
|---|
| 275 | annee_ref = anneeref |
|---|
| 276 | day_ref = dayref |
|---|
| 277 | day_ini = dayref |
|---|
| 278 | itau_dyn = 0 |
|---|
| 279 | itau_phy = 0 |
|---|
| 280 | time_0 = 0. |
|---|
| 281 | WRITE(lunout, *) & |
|---|
| 282 | 'GCM: On reinitialise a la date lue dans gcm.def' |
|---|
| 283 | ELSE IF (annee_ref /= anneeref .OR. day_ref /= dayref) THEN |
|---|
| 284 | WRITE(lunout, *) & |
|---|
| 285 | 'GCM: Attention les dates initiales lues dans le fichier' |
|---|
| 286 | WRITE(lunout, *) & |
|---|
| 287 | ' restart ne correspondent pas a celles lues dans ' |
|---|
| 288 | WRITE(lunout, *)' gcm.def' |
|---|
| 289 | WRITE(lunout, *)' annee_ref=', annee_ref, " anneeref=", anneeref |
|---|
| 290 | WRITE(lunout, *)' day_ref=', day_ref, " dayref=", dayref |
|---|
| 291 | WRITE(lunout, *)' Pas de remise a zero' |
|---|
| 292 | ENDIF |
|---|
| 293 | |
|---|
| 294 | ! if (annee_ref .NE. anneeref .OR. day_ref .NE. dayref) THEN |
|---|
| 295 | ! WRITE(lunout,*) |
|---|
| 296 | ! . 'GCM: Attention les dates initiales lues dans le fichier' |
|---|
| 297 | ! WRITE(lunout,*) |
|---|
| 298 | ! . ' restart ne correspondent pas a celles lues dans ' |
|---|
| 299 | ! WRITE(lunout,*)' gcm.def' |
|---|
| 300 | ! WRITE(lunout,*)' annee_ref=',annee_ref," anneeref=",anneeref |
|---|
| 301 | ! WRITE(lunout,*)' day_ref=',day_ref," dayref=",dayref |
|---|
| 302 | ! if (raz_date .NE. 1) THEN |
|---|
| 303 | ! WRITE(lunout,*) |
|---|
| 304 | ! . 'GCM: On garde les dates du fichier restart' |
|---|
| 305 | ! else |
|---|
| 306 | ! annee_ref = anneeref |
|---|
| 307 | ! day_ref = dayref |
|---|
| 308 | ! day_ini = dayref |
|---|
| 309 | ! itau_dyn = 0 |
|---|
| 310 | ! itau_phy = 0 |
|---|
| 311 | ! time_0 = 0. |
|---|
| 312 | ! WRITE(lunout,*) |
|---|
| 313 | ! . 'GCM: On reinitialise a la date lue dans gcm.def' |
|---|
| 314 | ! endif |
|---|
| 315 | ! ELSE |
|---|
| 316 | ! raz_date = 0 |
|---|
| 317 | ! endif |
|---|
| 318 | |
|---|
| 319 | mois = 1 |
|---|
| 320 | heure = 0. |
|---|
| 321 | CALL ymds2ju(annee_ref, mois, day_ref, heure, jD_ref) |
|---|
| 322 | jH_ref = jD_ref - int(jD_ref) |
|---|
| 323 | jD_ref = int(jD_ref) |
|---|
| 324 | |
|---|
| 325 | CALL ioconf_startdate(INT(jD_ref), jH_ref) |
|---|
| 326 | |
|---|
| 327 | WRITE(lunout, *)'DEBUG' |
|---|
| 328 | WRITE(lunout, *)'annee_ref, mois, day_ref, heure, jD_ref' |
|---|
| 329 | WRITE(lunout, *)annee_ref, mois, day_ref, heure, jD_ref |
|---|
| 330 | CALL ju2ymds(jD_ref + jH_ref, an, mois, jour, heure) |
|---|
| 331 | WRITE(lunout, *)'jD_ref+jH_ref,an, mois, jour, heure' |
|---|
| 332 | WRITE(lunout, *)jD_ref + jH_ref, an, mois, jour, heure |
|---|
| 333 | |
|---|
| 334 | IF (iflag_phys==1) THEN |
|---|
| 335 | ! these initialisations have already been done (via iniacademic) |
|---|
| 336 | ! if running in SW or Newtonian mode |
|---|
| 337 | !----------------------------------------------------------------------- |
|---|
| 338 | ! Initialisation des constantes dynamiques : |
|---|
| 339 | ! ------------------------------------------ |
|---|
| 340 | dtvr = zdtvr |
|---|
| 341 | CALL iniconst |
|---|
| 342 | |
|---|
| 343 | !----------------------------------------------------------------------- |
|---|
| 344 | ! Initialisation de la geometrie : |
|---|
| 345 | ! -------------------------------- |
|---|
| 346 | CALL inigeom |
|---|
| 347 | |
|---|
| 348 | !----------------------------------------------------------------------- |
|---|
| 349 | ! Initialisation du filtre : |
|---|
| 350 | ! -------------------------- |
|---|
| 351 | CALL inifilr |
|---|
| 352 | ENDIF ! of if (iflag_phys.EQ.1) |
|---|
| 353 | |
|---|
| 354 | !----------------------------------------------------------------------- |
|---|
| 355 | ! Initialisation de la dissipation : |
|---|
| 356 | ! ---------------------------------- |
|---|
| 357 | |
|---|
| 358 | CALL inidissip(lstardis, nitergdiv, nitergrot, niterh, & |
|---|
| 359 | tetagdiv, tetagrot, tetatemp, vert_prof_dissip) |
|---|
| 360 | |
|---|
| 361 | ! numero de stockage pour les fichiers de redemarrage: |
|---|
| 362 | |
|---|
| 363 | !----------------------------------------------------------------------- |
|---|
| 364 | ! Initialisation des I/O : |
|---|
| 365 | ! ------------------------ |
|---|
| 366 | |
|---|
| 367 | IF (nday>=0) THEN |
|---|
| 368 | day_end = day_ini + nday |
|---|
| 369 | else |
|---|
| 370 | day_end = day_ini - nday / day_step |
|---|
| 371 | ENDIF |
|---|
| 372 | WRITE(lunout, 300)day_ini, day_end |
|---|
| 373 | 300 FORMAT('1'/, 15x, 'run du jour', i7, 2x, 'au jour', i7//) |
|---|
| 374 | |
|---|
| 375 | CALL ju2ymds(jD_ref + day_ini - day_ref, an, mois, jour, heure) |
|---|
| 376 | write (lunout, 301)jour, mois, an |
|---|
| 377 | CALL ju2ymds(jD_ref + day_end - day_ref, an, mois, jour, heure) |
|---|
| 378 | write (lunout, 302)jour, mois, an |
|---|
| 379 | 301 FORMAT('1'/, 15x, 'run du ', i2, '/', i2, '/', i4) |
|---|
| 380 | 302 FORMAT('1'/, 15x, ' au ', i2, '/', i2, '/', i4) |
|---|
| 381 | |
|---|
| 382 | !----------------------------------------------------------------------- |
|---|
| 383 | ! Initialisation de la physique : |
|---|
| 384 | ! ------------------------------- |
|---|
| 385 | |
|---|
| 386 | IF ((iflag_phys==1).OR.(iflag_phys>=100)) THEN |
|---|
| 387 | ! Physics: |
|---|
| 388 | IF (CPPKEY_PHYS) THEN |
|---|
| 389 | CALL iniphysiq(iim, jjm, llm, & |
|---|
| 390 | (jjm - 1) * iim + 2, comm_lmdz, & |
|---|
| 391 | daysec, day_ini, dtphys / nsplit_phys, & |
|---|
| 392 | rlatu, rlatv, rlonu, rlonv, aire, cu, cv, rad, g, r, cpp, & |
|---|
| 393 | iflag_phys) |
|---|
| 394 | END IF |
|---|
| 395 | ENDIF ! of IF ((iflag_phys==1).OR.(iflag_phys>=100)) |
|---|
| 396 | |
|---|
| 397 | ! if (planet_type.EQ."earth") THEN |
|---|
| 398 | ! Write an Earth-format restart file |
|---|
| 399 | |
|---|
| 400 | CALL dynredem0("restart.nc", day_end, phis) |
|---|
| 401 | ! endif |
|---|
| 402 | |
|---|
| 403 | ecripar = .TRUE. |
|---|
| 404 | |
|---|
| 405 | time_step = zdtvr |
|---|
| 406 | IF (ok_dyn_ins) THEN |
|---|
| 407 | ! initialize output file for instantaneous outputs |
|---|
| 408 | ! t_ops = iecri * daysec ! do operations every t_ops |
|---|
| 409 | t_ops = ((1.0 * iecri) / day_step) * daysec |
|---|
| 410 | t_wrt = daysec ! iecri * daysec ! write output every t_wrt |
|---|
| 411 | CALL inithist(day_ref, annee_ref, time_step, & |
|---|
| 412 | t_ops, t_wrt) |
|---|
| 413 | ENDIF |
|---|
| 414 | |
|---|
| 415 | IF (ok_dyn_ave) THEN |
|---|
| 416 | ! initialize output file for averaged outputs |
|---|
| 417 | t_ops = iperiod * time_step ! do operations every t_ops |
|---|
| 418 | t_wrt = periodav * daysec ! write output every t_wrt |
|---|
| 419 | CALL initdynav(day_ref, annee_ref, time_step, & |
|---|
| 420 | t_ops, t_wrt) |
|---|
| 421 | END IF |
|---|
| 422 | dtav = iperiod * dtvr / daysec |
|---|
| 423 | |
|---|
| 424 | ! Choix des frequences de stokage pour le offline |
|---|
| 425 | ! istdyn=day_step/4 ! stockage toutes les 6h=1jour/4 |
|---|
| 426 | ! istdyn=day_step/12 ! stockage toutes les 2h=1jour/12 |
|---|
| 427 | istdyn = day_step / 4 ! stockage toutes les 6h=1jour/12 |
|---|
| 428 | istphy = istdyn / iphysiq |
|---|
| 429 | |
|---|
| 430 | !----------------------------------------------------------------------- |
|---|
| 431 | ! Integration temporelle du modele : |
|---|
| 432 | ! ---------------------------------- |
|---|
| 433 | |
|---|
| 434 | ! WRITE(78,*) 'ucov',ucov |
|---|
| 435 | ! WRITE(78,*) 'vcov',vcov |
|---|
| 436 | ! WRITE(78,*) 'teta',teta |
|---|
| 437 | ! WRITE(78,*) 'ps',ps |
|---|
| 438 | ! WRITE(78,*) 'q',q |
|---|
| 439 | |
|---|
| 440 | CALL leapfrog(ucov, vcov, teta, ps, masse, phis, q, time_0) |
|---|
| 441 | |
|---|
| 442 | END PROGRAM gcm |
|---|