[1] | 1 | ! |
---|
[7] | 2 | ! $Id: gcm.F 1446 2010-10-22 09:27:25Z emillour $ |
---|
[1] | 3 | ! |
---|
[1441] | 4 | ! |
---|
| 5 | ! |
---|
| 6 | PROGRAM gcm |
---|
[1] | 7 | |
---|
| 8 | #ifdef CPP_IOIPSL |
---|
[1441] | 9 | USE IOIPSL |
---|
[1] | 10 | #else |
---|
[1441] | 11 | ! if not using IOIPSL, we still need to use (a local version of) getin |
---|
| 12 | USE ioipsl_getincom |
---|
[1] | 13 | #endif |
---|
| 14 | |
---|
[1019] | 15 | |
---|
| 16 | #ifdef CPP_XIOS |
---|
[1441] | 17 | ! ug Pour les sorties XIOS |
---|
| 18 | USE wxios |
---|
[1019] | 19 | #endif |
---|
| 20 | |
---|
[1441] | 21 | USE filtreg_mod |
---|
| 22 | USE infotrac |
---|
| 23 | USE control_mod, only: planet_type,nday,day_step,iperiod,iphysiq, & |
---|
| 24 | raz_date,anneeref,starttime,dayref, & |
---|
| 25 | ok_dyn_ins,ok_dyn_ave,iecri,periodav, & |
---|
[2507] | 26 | less1day,fractday,ndynstep,nsplit_phys,& |
---|
| 27 | ecritstart |
---|
[1543] | 28 | USE mod_const_mpi, ONLY: COMM_LMDZ |
---|
[1441] | 29 | use cpdet_mod, only: ini_cpdet |
---|
| 30 | USE temps_mod, ONLY: calend,start_time,annee_ref,day_ref, & |
---|
| 31 | itau_dyn,itau_phy,day_ini,jD_ref,jH_ref,day_end |
---|
[3836] | 32 | use parse_args_mod, only: parse_args |
---|
[1] | 33 | |
---|
[1019] | 34 | |
---|
[1] | 35 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
| 36 | ! FH 2008/05/09 On elimine toutes les clefs physiques dans la dynamique |
---|
| 37 | ! A nettoyer. On ne veut qu'une ou deux routines d'interface |
---|
| 38 | ! dynamique -> physique pour l'initialisation |
---|
[776] | 39 | ! Ehouarn: the following are needed with (parallel) physics: |
---|
[101] | 40 | #ifdef CPP_PHYS |
---|
[1523] | 41 | USE iniphysiq_mod, ONLY: iniphysiq |
---|
[780] | 42 | #endif |
---|
[1422] | 43 | |
---|
[1441] | 44 | USE comconst_mod, ONLY: daysec,dtvr,dtphys,rad,g,r,cpp |
---|
| 45 | USE logic_mod, ONLY: read_start,iflag_phys,ok_guide,ecripar |
---|
| 46 | |
---|
[1] | 47 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
| 48 | |
---|
[1441] | 49 | IMPLICIT NONE |
---|
[1] | 50 | |
---|
[1441] | 51 | ! ...... Version du 10/01/98 .......... |
---|
[1] | 52 | |
---|
[1441] | 53 | ! avec coordonnees verticales hybrides |
---|
| 54 | ! avec nouveaux operat. dissipation * ( gradiv2,divgrad2,nxgraro2 ) |
---|
[1] | 55 | |
---|
[1441] | 56 | !======================================================================= |
---|
| 57 | ! |
---|
| 58 | ! Auteur: P. Le Van /L. Fairhead/F.Hourdin |
---|
| 59 | ! ------- |
---|
| 60 | ! |
---|
| 61 | ! Objet: |
---|
| 62 | ! ------ |
---|
| 63 | ! |
---|
| 64 | ! GCM LMD nouvelle grille |
---|
| 65 | ! |
---|
| 66 | !======================================================================= |
---|
| 67 | ! |
---|
| 68 | ! ... Dans inigeom , nouveaux calculs pour les elongations cu , cv |
---|
| 69 | ! et possibilite d'appeler une fonction f(y) a derivee tangente |
---|
| 70 | ! hyperbolique a la place de la fonction a derivee sinusoidale. |
---|
| 71 | ! ... Possibilite de choisir le schema pour l'advection de |
---|
| 72 | ! q , en modifiant iadv dans traceur.def (MAF,10/02) . |
---|
| 73 | ! |
---|
| 74 | ! Pour Van-Leer + Vapeur d'eau saturee, iadv(1)=4. (F.Codron,10/99) |
---|
| 75 | ! Pour Van-Leer iadv=10 |
---|
| 76 | ! |
---|
| 77 | !----------------------------------------------------------------------- |
---|
| 78 | ! Declarations: |
---|
| 79 | ! ------------- |
---|
[1] | 80 | |
---|
[1441] | 81 | include "dimensions.h" |
---|
| 82 | include "paramet.h" |
---|
| 83 | include "comdissnew.h" |
---|
| 84 | include "comgeom.h" |
---|
[1] | 85 | !!!!!!!!!!!#include "control.h" |
---|
| 86 | !#include "com_io_dyn.h" |
---|
[1441] | 87 | include "iniprint.h" |
---|
| 88 | include "tracstoke.h" |
---|
[1] | 89 | |
---|
[1441] | 90 | REAL zdtvr |
---|
[1] | 91 | |
---|
[1441] | 92 | ! variables dynamiques |
---|
| 93 | REAL vcov(ip1jm,llm),ucov(ip1jmp1,llm) ! vents covariants |
---|
| 94 | REAL teta(ip1jmp1,llm) ! temperature potentielle |
---|
| 95 | REAL, ALLOCATABLE, DIMENSION(:,:,:):: q! champs advectes |
---|
| 96 | REAL ps(ip1jmp1) ! pression au sol |
---|
| 97 | REAL p (ip1jmp1,llmp1 ) ! pression aux interfac.des couches |
---|
| 98 | REAL masse(ip1jmp1,llm) ! masse d'air |
---|
| 99 | REAL phis(ip1jmp1) ! geopotentiel au sol |
---|
| 100 | REAL phi(ip1jmp1,llm) ! geopotentiel |
---|
| 101 | REAL w(ip1jmp1,llm) ! vitesse verticale |
---|
[1] | 102 | |
---|
[1441] | 103 | ! variables dynamiques intermediaire pour le transport |
---|
[1] | 104 | |
---|
[1441] | 105 | ! variables pour le fichier histoire |
---|
| 106 | REAL dtav ! intervalle de temps elementaire |
---|
[1] | 107 | |
---|
[1441] | 108 | REAL time_0 |
---|
[1] | 109 | |
---|
[1441] | 110 | LOGICAL lafin |
---|
| 111 | INTEGER ij,iq,l,i,j |
---|
[1] | 112 | |
---|
| 113 | |
---|
[1441] | 114 | real time_step, t_wrt, t_ops |
---|
[1] | 115 | |
---|
[1441] | 116 | LOGICAL first |
---|
[1] | 117 | |
---|
[1441] | 118 | ! LOGICAL call_iniphys |
---|
| 119 | ! data call_iniphys/.true./ |
---|
[1] | 120 | |
---|
[1441] | 121 | !+jld variables test conservation energie |
---|
| 122 | ! REAL ecin(ip1jmp1,llm),ecin0(ip1jmp1,llm) |
---|
| 123 | ! Tendance de la temp. potentiel d (theta)/ d t due a la |
---|
| 124 | ! tansformation d'energie cinetique en energie thermique |
---|
| 125 | ! cree par la dissipation |
---|
| 126 | REAL dhecdt(ip1jmp1,llm) |
---|
| 127 | ! REAL vcont(ip1jm,llm),ucont(ip1jmp1,llm) |
---|
| 128 | ! REAL d_h_vcol, d_qt, d_qw, d_ql, d_ec |
---|
| 129 | CHARACTER (len=15) :: ztit |
---|
| 130 | !-jld |
---|
[1] | 131 | |
---|
| 132 | |
---|
[1441] | 133 | character (len=80) :: dynhist_file, dynhistave_file |
---|
| 134 | character (len=20) :: modname |
---|
| 135 | character (len=80) :: abort_message |
---|
| 136 | ! locales pour gestion du temps |
---|
| 137 | INTEGER :: an, mois, jour |
---|
| 138 | REAL :: heure |
---|
| 139 | logical use_filtre_fft |
---|
[2564] | 140 | logical :: present |
---|
[1] | 141 | |
---|
[1441] | 142 | !----------------------------------------------------------------------- |
---|
| 143 | ! Initialisations: |
---|
| 144 | ! ---------------- |
---|
[3836] | 145 | ! Parse command-line options |
---|
| 146 | call parse_args() |
---|
[1] | 147 | |
---|
[1441] | 148 | abort_message = 'last timestep reached' |
---|
| 149 | modname = 'gcm' |
---|
| 150 | lafin = .FALSE. |
---|
| 151 | dynhist_file = 'dyn_hist.nc' |
---|
| 152 | dynhistave_file = 'dyn_hist_ave.nc' |
---|
[1] | 153 | |
---|
| 154 | |
---|
| 155 | |
---|
[1441] | 156 | !---------------------------------------------------------------------- |
---|
[2564] | 157 | ! Load flags and options from run.def |
---|
[1441] | 158 | ! --------------------------------------- |
---|
| 159 | ! |
---|
[2564] | 160 | ! Start by checking that there indeed is a run.def file |
---|
| 161 | INQUIRE(file="run.def", EXIST=present) |
---|
| 162 | IF(.not. present) then |
---|
| 163 | CALL abort_gcm("gcm", "file run.def not found, Aborting!",1) |
---|
| 164 | ENDIF |
---|
| 165 | |
---|
[1441] | 166 | CALL conf_gcm( 99, .TRUE. ) |
---|
| 167 | if (mod(iphysiq, iperiod) /= 0) call abort_gcm("conf_gcm", & |
---|
| 168 | "iphysiq must be a multiple of iperiod", 1) |
---|
[1] | 169 | |
---|
[1441] | 170 | use_filtre_fft=.FALSE. |
---|
| 171 | CALL getin('use_filtre_fft',use_filtre_fft) |
---|
[1572] | 172 | IF (use_filtre_fft) call abort_gcm("gcm",'FFT filter is not available in the ' & |
---|
[1441] | 173 | // 'sequential version of the dynamics.', 1) |
---|
[1] | 174 | |
---|
| 175 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
[1019] | 176 | ! Initialisation de XIOS |
---|
| 177 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
| 178 | |
---|
| 179 | #ifdef CPP_XIOS |
---|
[1441] | 180 | CALL wxios_init("LMDZ") |
---|
[1019] | 181 | #endif |
---|
| 182 | |
---|
| 183 | |
---|
| 184 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
[1] | 185 | ! FH 2008/05/02 |
---|
| 186 | ! A nettoyer. On ne veut qu'une ou deux routines d'interface |
---|
| 187 | ! dynamique -> physique pour l'initialisation |
---|
[1543] | 188 | !#ifdef CPP_PHYS |
---|
| 189 | ! CALL init_phys_lmdz(iim,jjp1,llm,1,(/(jjm-1)*iim+2/)) |
---|
| 190 | !! call initcomgeomphy ! now done in iniphysiq |
---|
| 191 | !#endif |
---|
[1] | 192 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
[1441] | 193 | ! |
---|
| 194 | ! Initialisations pour Cp(T) Venus |
---|
| 195 | call ini_cpdet |
---|
| 196 | ! |
---|
| 197 | !----------------------------------------------------------------------- |
---|
| 198 | ! Choix du calendrier |
---|
| 199 | ! ------------------- |
---|
[1] | 200 | |
---|
[1441] | 201 | ! calend = 'earth_365d' |
---|
[1] | 202 | |
---|
| 203 | #ifdef CPP_IOIPSL |
---|
[1441] | 204 | if (calend == 'earth_360d') then |
---|
| 205 | call ioconf_calendar('360d') |
---|
| 206 | write(lunout,*)'CALENDRIER CHOISI: Terrestre a 360 jours/an' |
---|
| 207 | else if (calend == 'earth_365d') then |
---|
| 208 | call ioconf_calendar('noleap') |
---|
| 209 | write(lunout,*)'CALENDRIER CHOISI: Terrestre a 365 jours/an' |
---|
| 210 | else if (calend == 'earth_366d') then |
---|
| 211 | call ioconf_calendar('gregorian') |
---|
| 212 | write(lunout,*)'CALENDRIER CHOISI: Terrestre bissextile' |
---|
| 213 | else if (calend == 'titan') then |
---|
[97] | 214 | ! call ioconf_calendar('titan') |
---|
[1441] | 215 | write(lunout,*)'CALENDRIER CHOISI: Titan' |
---|
| 216 | abort_message = 'A FAIRE...' |
---|
| 217 | call abort_gcm(modname,abort_message,1) |
---|
| 218 | else if (calend == 'venus') then |
---|
[97] | 219 | ! call ioconf_calendar('venus') |
---|
[1441] | 220 | write(lunout,*)'CALENDRIER CHOISI: Venus' |
---|
| 221 | abort_message = 'A FAIRE...' |
---|
| 222 | call abort_gcm(modname,abort_message,1) |
---|
| 223 | else |
---|
| 224 | abort_message = 'Mauvais choix de calendrier' |
---|
| 225 | call abort_gcm(modname,abort_message,1) |
---|
| 226 | endif |
---|
[1] | 227 | #endif |
---|
[1441] | 228 | !----------------------------------------------------------------------- |
---|
| 229 | ! |
---|
| 230 | ! |
---|
| 231 | !------------------------------------ |
---|
| 232 | ! Initialisation partie parallele |
---|
| 233 | !------------------------------------ |
---|
[1] | 234 | |
---|
[1441] | 235 | ! |
---|
| 236 | ! |
---|
| 237 | !----------------------------------------------------------------------- |
---|
| 238 | ! Initialisation des traceurs |
---|
| 239 | ! --------------------------- |
---|
| 240 | ! Choix du nombre de traceurs et du schema pour l'advection |
---|
| 241 | ! dans fichier traceur.def, par default ou via INCA |
---|
| 242 | call infotrac_init |
---|
[1] | 243 | |
---|
[1441] | 244 | ! Allocation de la tableau q : champs advectes |
---|
| 245 | allocate(q(ip1jmp1,llm,nqtot)) |
---|
[1] | 246 | |
---|
[1441] | 247 | !----------------------------------------------------------------------- |
---|
| 248 | ! Lecture de l'etat initial : |
---|
| 249 | ! --------------------------- |
---|
[1] | 250 | |
---|
[1441] | 251 | ! lecture du fichier start.nc |
---|
| 252 | if (read_start) then |
---|
| 253 | ! we still need to run iniacademic to initialize some |
---|
| 254 | ! constants & fields, if we run the 'newtonian' or 'SW' cases: |
---|
| 255 | if (iflag_phys.ne.1) then |
---|
| 256 | CALL iniacademic(vcov,ucov,teta,q,masse,ps,phis,time_0) |
---|
| 257 | endif |
---|
[1] | 258 | |
---|
[1441] | 259 | CALL dynetat0("start.nc",vcov,ucov, & |
---|
| 260 | teta,q,masse,ps,phis, time_0) |
---|
[1024] | 261 | |
---|
[1441] | 262 | ! Load relaxation fields (simple nudging). AS 09/2013 |
---|
| 263 | ! --------------------------------------------------- |
---|
| 264 | if (planet_type.eq."generic") then |
---|
| 265 | if (ok_guide) then |
---|
| 266 | CALL relaxetat0("relax.nc") |
---|
| 267 | endif |
---|
| 268 | endif |
---|
[1024] | 269 | |
---|
[1441] | 270 | ! write(73,*) 'ucov',ucov |
---|
| 271 | ! write(74,*) 'vcov',vcov |
---|
| 272 | ! write(75,*) 'teta',teta |
---|
| 273 | ! write(76,*) 'ps',ps |
---|
| 274 | ! write(77,*) 'q',q |
---|
[1] | 275 | |
---|
[1441] | 276 | endif ! of if (read_start) |
---|
[1] | 277 | |
---|
| 278 | |
---|
[1441] | 279 | ! le cas echeant, creation d un etat initial |
---|
| 280 | IF (prt_level > 9) WRITE(lunout,*) & |
---|
| 281 | 'GCM: AVANT iniacademic AVANT AVANT AVANT AVANT' |
---|
| 282 | if (.not.read_start) then |
---|
| 283 | CALL iniacademic(vcov,ucov,teta,q,masse,ps,phis,time_0) |
---|
| 284 | endif |
---|
[1] | 285 | |
---|
| 286 | |
---|
[1441] | 287 | !----------------------------------------------------------------------- |
---|
| 288 | ! Lecture des parametres de controle pour la simulation : |
---|
| 289 | ! ------------------------------------------------------- |
---|
| 290 | ! on recalcule eventuellement le pas de temps |
---|
[1] | 291 | |
---|
[1441] | 292 | IF(MOD(day_step,iperiod).NE.0) THEN |
---|
| 293 | abort_message = & |
---|
| 294 | 'Il faut choisir un nb de pas par jour multiple de iperiod' |
---|
| 295 | call abort_gcm(modname,abort_message,1) |
---|
| 296 | ENDIF |
---|
[1] | 297 | |
---|
[1441] | 298 | IF(MOD(day_step,iphysiq).NE.0) THEN |
---|
| 299 | abort_message = & |
---|
| 300 | 'Il faut choisir un nb de pas par jour multiple de iphysiq' |
---|
| 301 | call abort_gcm(modname,abort_message,1) |
---|
| 302 | ENDIF |
---|
[1] | 303 | |
---|
[1441] | 304 | zdtvr = daysec/REAL(day_step) |
---|
| 305 | IF(dtvr.NE.zdtvr) THEN |
---|
| 306 | WRITE(lunout,*) & |
---|
[3615] | 307 | 'WARNING!!! time step change: ',dtvr,'>',zdtvr |
---|
[1441] | 308 | ENDIF |
---|
[2478] | 309 | dtvr=zdtvr |
---|
[1] | 310 | |
---|
[1441] | 311 | ! |
---|
[3615] | 312 | ! reset calendar if requested |
---|
[1441] | 313 | ! |
---|
[3615] | 314 | IF (raz_date == 1) then |
---|
| 315 | WRITE(lunout,*)'Reinitializing to start time from run.def' |
---|
| 316 | start_time = starttime |
---|
[1441] | 317 | ENDIF |
---|
[3615] | 318 | |
---|
[1441] | 319 | IF (raz_date == 1) THEN |
---|
| 320 | annee_ref = anneeref |
---|
| 321 | day_ref = dayref |
---|
| 322 | day_ini = dayref |
---|
| 323 | itau_dyn = 0 |
---|
| 324 | itau_phy = 0 |
---|
| 325 | time_0 = 0. |
---|
| 326 | write(lunout,*) & |
---|
| 327 | 'GCM: On reinitialise a la date lue dans gcm.def' |
---|
| 328 | ELSE IF (annee_ref .ne. anneeref .or. day_ref .ne. dayref) THEN |
---|
| 329 | write(lunout,*) & |
---|
| 330 | 'GCM: Attention les dates initiales lues dans le fichier' |
---|
| 331 | write(lunout,*) & |
---|
| 332 | ' restart ne correspondent pas a celles lues dans ' |
---|
| 333 | write(lunout,*)' gcm.def' |
---|
| 334 | write(lunout,*)' annee_ref=',annee_ref," anneeref=",anneeref |
---|
| 335 | write(lunout,*)' day_ref=',day_ref," dayref=",dayref |
---|
| 336 | write(lunout,*)' Pas de remise a zero' |
---|
| 337 | ENDIF |
---|
[1] | 338 | |
---|
[1441] | 339 | ! if (annee_ref .ne. anneeref .or. day_ref .ne. dayref) then |
---|
| 340 | ! write(lunout,*) |
---|
| 341 | ! . 'GCM: Attention les dates initiales lues dans le fichier' |
---|
| 342 | ! write(lunout,*) |
---|
| 343 | ! . ' restart ne correspondent pas a celles lues dans ' |
---|
| 344 | ! write(lunout,*)' gcm.def' |
---|
| 345 | ! write(lunout,*)' annee_ref=',annee_ref," anneeref=",anneeref |
---|
| 346 | ! write(lunout,*)' day_ref=',day_ref," dayref=",dayref |
---|
| 347 | ! if (raz_date .ne. 1) then |
---|
| 348 | ! write(lunout,*) |
---|
| 349 | ! . 'GCM: On garde les dates du fichier restart' |
---|
| 350 | ! else |
---|
| 351 | ! annee_ref = anneeref |
---|
| 352 | ! day_ref = dayref |
---|
| 353 | ! day_ini = dayref |
---|
| 354 | ! itau_dyn = 0 |
---|
| 355 | ! itau_phy = 0 |
---|
| 356 | ! time_0 = 0. |
---|
| 357 | ! write(lunout,*) |
---|
| 358 | ! . 'GCM: On reinitialise a la date lue dans gcm.def' |
---|
| 359 | ! endif |
---|
| 360 | ! ELSE |
---|
| 361 | ! raz_date = 0 |
---|
| 362 | ! endif |
---|
[1] | 363 | |
---|
| 364 | #ifdef CPP_IOIPSL |
---|
[1441] | 365 | mois = 1 |
---|
| 366 | heure = 0. |
---|
[97] | 367 | ! Ce n'est defini pour l'instant que pour la Terre... |
---|
[1441] | 368 | if (planet_type.eq.'earth') then |
---|
| 369 | call ymds2ju(annee_ref, mois, day_ref, heure, jD_ref) |
---|
| 370 | jH_ref = jD_ref - int(jD_ref) |
---|
| 371 | jD_ref = int(jD_ref) |
---|
[1] | 372 | |
---|
[1441] | 373 | call ioconf_startdate(INT(jD_ref), jH_ref) |
---|
[1] | 374 | |
---|
[1441] | 375 | write(lunout,*)'DEBUG' |
---|
| 376 | write(lunout,*)'annee_ref, mois, day_ref, heure, jD_ref' |
---|
| 377 | write(lunout,*)annee_ref, mois, day_ref, heure, jD_ref |
---|
| 378 | call ju2ymds(jD_ref+jH_ref,an, mois, jour, heure) |
---|
| 379 | write(lunout,*)'jD_ref+jH_ref,an, mois, jour, heure' |
---|
| 380 | write(lunout,*)jD_ref+jH_ref,an, mois, jour, heure |
---|
[1672] | 381 | ! else if (planet_type.eq.'titan') then |
---|
| 382 | ! jD_ref=1 ! Only if we use old Titan starts (J.V.O 2016) |
---|
[1441] | 383 | else |
---|
[97] | 384 | ! A voir pour Titan et Venus |
---|
[1441] | 385 | jD_ref=0 |
---|
| 386 | jH_ref=0 |
---|
| 387 | write(lunout,*)'A VOIR POUR VENUS ET TITAN: jD_ref, jH_ref' |
---|
| 388 | write(lunout,*)jD_ref,jH_ref |
---|
| 389 | endif ! planet_type |
---|
[1] | 390 | #else |
---|
[1441] | 391 | ! Ehouarn: we still need to define JD_ref and JH_ref |
---|
| 392 | ! and since we don't know how many days there are in a year |
---|
| 393 | ! we set JD_ref to 0 (this should be improved ...) |
---|
| 394 | jD_ref=0 |
---|
| 395 | jH_ref=0 |
---|
[1] | 396 | #endif |
---|
| 397 | |
---|
[1441] | 398 | if (iflag_phys.eq.1) then |
---|
| 399 | ! these initialisations have already been done (via iniacademic) |
---|
| 400 | ! if running in SW or Newtonian mode |
---|
| 401 | !----------------------------------------------------------------------- |
---|
| 402 | ! Initialisation des constantes dynamiques : |
---|
| 403 | ! ------------------------------------------ |
---|
| 404 | dtvr = zdtvr |
---|
| 405 | CALL iniconst |
---|
[1] | 406 | |
---|
[1441] | 407 | !----------------------------------------------------------------------- |
---|
| 408 | ! Initialisation de la geometrie : |
---|
| 409 | ! -------------------------------- |
---|
| 410 | CALL inigeom |
---|
[1] | 411 | |
---|
[1441] | 412 | !----------------------------------------------------------------------- |
---|
| 413 | ! Initialisation du filtre : |
---|
| 414 | ! -------------------------- |
---|
| 415 | CALL inifilr |
---|
| 416 | endif ! of if (iflag_phys.eq.1) |
---|
| 417 | ! |
---|
| 418 | !----------------------------------------------------------------------- |
---|
| 419 | ! Initialisation de la dissipation : |
---|
| 420 | ! ---------------------------------- |
---|
[1] | 421 | |
---|
[1441] | 422 | CALL inidissip( lstardis, nitergdiv, nitergrot, niterh , & |
---|
| 423 | tetagdiv, tetagrot , tetatemp, vert_prof_dissip) |
---|
[1] | 424 | |
---|
[1441] | 425 | !----------------------------------------------------------------------- |
---|
| 426 | ! Initialisation des I/O : |
---|
| 427 | ! ------------------------ |
---|
[1] | 428 | |
---|
[1441] | 429 | if (nday>=0) then ! standard case |
---|
| 430 | day_end=day_ini+nday |
---|
| 431 | else ! special case when nday <0, run -nday dynamical steps |
---|
| 432 | day_end=day_ini-nday/day_step |
---|
| 433 | endif |
---|
| 434 | if (less1day) then |
---|
| 435 | day_end=day_ini+floor(time_0+fractday) |
---|
| 436 | endif |
---|
| 437 | if (ndynstep.gt.0) then |
---|
| 438 | day_end=day_ini+floor(time_0+float(ndynstep)/float(day_step)) |
---|
| 439 | endif |
---|
[1022] | 440 | |
---|
[1441] | 441 | WRITE(lunout,'(a,i7,a,i7)') & |
---|
| 442 | "run from day ",day_ini," to day",day_end |
---|
[1] | 443 | |
---|
| 444 | #ifdef CPP_IOIPSL |
---|
[1441] | 445 | ! Ce n'est defini pour l'instant que pour la Terre... |
---|
| 446 | if (planet_type.eq.'earth') then |
---|
| 447 | call ju2ymds(jD_ref + day_ini - day_ref, an, mois, jour, heure) |
---|
| 448 | write (lunout,301)jour, mois, an |
---|
| 449 | call ju2ymds(jD_ref + day_end - day_ref, an, mois, jour, heure) |
---|
| 450 | write (lunout,302)jour, mois, an |
---|
| 451 | else |
---|
| 452 | ! A voir pour Titan et Venus |
---|
| 453 | write(lunout,*)'A VOIR POUR VENUS/TITAN: separation en annees...' |
---|
| 454 | endif ! planet_type |
---|
| 455 | 301 FORMAT('1'/,15x,'run du ', i2,'/',i2,'/',i4) |
---|
| 456 | 302 FORMAT('1'/,15x,' au ', i2,'/',i2,'/',i4) |
---|
[1] | 457 | #endif |
---|
| 458 | |
---|
[1682] | 459 | |
---|
| 460 | !----------------------------------------------------------------------- |
---|
| 461 | ! Initialisation de la physique : |
---|
| 462 | ! ------------------------------- |
---|
| 463 | |
---|
| 464 | IF ((iflag_phys==1).or.(iflag_phys>=100)) THEN |
---|
| 465 | ! Physics: |
---|
| 466 | #ifdef CPP_PHYS |
---|
[3316] | 467 | CALL iniphysiq(iim,jjm,llm, & |
---|
| 468 | (jjm-1)*iim+2,comm_lmdz, & |
---|
| 469 | daysec,day_ini,dtphys/nsplit_phys, & |
---|
| 470 | rlatu,rlatv,rlonu,rlonv,aire,cu,cv, & |
---|
| 471 | rad,g,r,cpp,iflag_phys) |
---|
[1682] | 472 | #endif |
---|
| 473 | ENDIF ! of IF ((iflag_phys==1).or.(iflag_phys>=100)) |
---|
| 474 | |
---|
| 475 | |
---|
[2507] | 476 | ! If we want to save multiple restart at different time (ecritstart.GT.0) |
---|
| 477 | ! We will write in restart the initial day of the simulation and put all |
---|
| 478 | ! the different time in the Time variable |
---|
| 479 | ! However, if we write only one restart, we save the last day of the |
---|
| 480 | ! simulation and put the remaining time (which is 0 if we do fulls days) |
---|
| 481 | ! in the Time variable |
---|
| 482 | |
---|
[1441] | 483 | if (planet_type=="mars") then |
---|
[2507] | 484 | if (ecritstart.GT.0) then |
---|
[1441] | 485 | ! For Mars we transmit day_ini |
---|
[2507] | 486 | CALL dynredem0("restart.nc", day_ini, phis) |
---|
| 487 | else |
---|
| 488 | CALL dynredem0("restart.nc", day_end, phis) |
---|
| 489 | endif |
---|
[1441] | 490 | else |
---|
| 491 | CALL dynredem0("restart.nc", day_end, phis) |
---|
| 492 | endif |
---|
| 493 | ecripar = .TRUE. |
---|
[1] | 494 | |
---|
| 495 | #ifdef CPP_IOIPSL |
---|
[1441] | 496 | time_step = zdtvr |
---|
| 497 | if (ok_dyn_ins) then |
---|
| 498 | ! initialize output file for instantaneous outputs |
---|
| 499 | ! t_ops = iecri * daysec ! do operations every t_ops |
---|
| 500 | t_ops =((1.0*iecri)/day_step) * daysec |
---|
| 501 | t_wrt = daysec ! iecri * daysec ! write output every t_wrt |
---|
[3305] | 502 | CALL inithist(day_ref,annee_ref,time_step,t_ops,t_wrt) |
---|
[1441] | 503 | endif |
---|
[1] | 504 | |
---|
[1441] | 505 | IF (ok_dyn_ave) THEN |
---|
| 506 | ! initialize output file for averaged outputs |
---|
| 507 | t_ops = iperiod * time_step ! do operations every t_ops |
---|
| 508 | t_wrt = periodav * daysec ! write output every t_wrt |
---|
[3305] | 509 | CALL initdynav(day_ref,annee_ref,time_step,t_ops,t_wrt) |
---|
[1441] | 510 | END IF |
---|
| 511 | dtav = iperiod*dtvr/daysec |
---|
[1] | 512 | #endif |
---|
| 513 | ! #endif of #ifdef CPP_IOIPSL |
---|
| 514 | |
---|
[1441] | 515 | ! Choix des frequences de stokage pour le offline |
---|
| 516 | ! istdyn=day_step/4 ! stockage toutes les 6h=1jour/4 |
---|
| 517 | ! istdyn=day_step/12 ! stockage toutes les 2h=1jour/12 |
---|
| 518 | istdyn=day_step/4 ! stockage toutes les 6h=1jour/12 |
---|
| 519 | istphy=istdyn/iphysiq |
---|
[1] | 520 | |
---|
| 521 | |
---|
[1441] | 522 | ! |
---|
| 523 | !----------------------------------------------------------------------- |
---|
| 524 | ! Integration temporelle du modele : |
---|
| 525 | ! ---------------------------------- |
---|
[1] | 526 | |
---|
[1441] | 527 | ! write(78,*) 'ucov',ucov |
---|
| 528 | ! write(78,*) 'vcov',vcov |
---|
| 529 | ! write(78,*) 'teta',teta |
---|
| 530 | ! write(78,*) 'ps',ps |
---|
| 531 | ! write(78,*) 'q',q |
---|
[1] | 532 | |
---|
| 533 | |
---|
[1441] | 534 | CALL leapfrog(ucov,vcov,teta,ps,masse,phis,q,time_0) |
---|
[1] | 535 | |
---|
[1441] | 536 | END PROGRAM gcm |
---|
[1] | 537 | |
---|