[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 |
---|
[3574] | 32 | use version_info_mod, only: print_version_info |
---|
[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 |
---|
[3574] | 136 | character(100) :: arg ! To read command-line arguments |
---|
[1441] | 137 | ! locales pour gestion du temps |
---|
| 138 | INTEGER :: an, mois, jour |
---|
| 139 | REAL :: heure |
---|
| 140 | logical use_filtre_fft |
---|
[2564] | 141 | logical :: present |
---|
[1] | 142 | |
---|
[1441] | 143 | !----------------------------------------------------------------------- |
---|
| 144 | ! Initialisations: |
---|
| 145 | ! ---------------- |
---|
[1] | 146 | |
---|
[3574] | 147 | if (command_argument_count() > 0) then ! Get the number of command-line arguments |
---|
| 148 | call get_command_argument(1,arg) ! Read the argument given to the program |
---|
| 149 | select case (trim(adjustl(arg))) |
---|
| 150 | case('version') |
---|
| 151 | call print_version_info() |
---|
| 152 | stop |
---|
| 153 | case default |
---|
| 154 | error stop "The argument given to the program is unknown!" |
---|
| 155 | end select |
---|
| 156 | endif |
---|
| 157 | |
---|
[1441] | 158 | abort_message = 'last timestep reached' |
---|
| 159 | modname = 'gcm' |
---|
| 160 | lafin = .FALSE. |
---|
| 161 | dynhist_file = 'dyn_hist.nc' |
---|
| 162 | dynhistave_file = 'dyn_hist_ave.nc' |
---|
[1] | 163 | |
---|
| 164 | |
---|
| 165 | |
---|
[1441] | 166 | !---------------------------------------------------------------------- |
---|
[2564] | 167 | ! Load flags and options from run.def |
---|
[1441] | 168 | ! --------------------------------------- |
---|
| 169 | ! |
---|
[2564] | 170 | ! Start by checking that there indeed is a run.def file |
---|
| 171 | INQUIRE(file="run.def", EXIST=present) |
---|
| 172 | IF(.not. present) then |
---|
| 173 | CALL abort_gcm("gcm", "file run.def not found, Aborting!",1) |
---|
| 174 | ENDIF |
---|
| 175 | |
---|
[1441] | 176 | CALL conf_gcm( 99, .TRUE. ) |
---|
| 177 | if (mod(iphysiq, iperiod) /= 0) call abort_gcm("conf_gcm", & |
---|
| 178 | "iphysiq must be a multiple of iperiod", 1) |
---|
[1] | 179 | |
---|
[1441] | 180 | use_filtre_fft=.FALSE. |
---|
| 181 | CALL getin('use_filtre_fft',use_filtre_fft) |
---|
[1572] | 182 | IF (use_filtre_fft) call abort_gcm("gcm",'FFT filter is not available in the ' & |
---|
[1441] | 183 | // 'sequential version of the dynamics.', 1) |
---|
[1] | 184 | |
---|
| 185 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
[1019] | 186 | ! Initialisation de XIOS |
---|
| 187 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
| 188 | |
---|
| 189 | #ifdef CPP_XIOS |
---|
[1441] | 190 | CALL wxios_init("LMDZ") |
---|
[1019] | 191 | #endif |
---|
| 192 | |
---|
| 193 | |
---|
| 194 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
[1] | 195 | ! FH 2008/05/02 |
---|
| 196 | ! A nettoyer. On ne veut qu'une ou deux routines d'interface |
---|
| 197 | ! dynamique -> physique pour l'initialisation |
---|
[1543] | 198 | !#ifdef CPP_PHYS |
---|
| 199 | ! CALL init_phys_lmdz(iim,jjp1,llm,1,(/(jjm-1)*iim+2/)) |
---|
| 200 | !! call initcomgeomphy ! now done in iniphysiq |
---|
| 201 | !#endif |
---|
[1] | 202 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
[1441] | 203 | ! |
---|
| 204 | ! Initialisations pour Cp(T) Venus |
---|
| 205 | call ini_cpdet |
---|
| 206 | ! |
---|
| 207 | !----------------------------------------------------------------------- |
---|
| 208 | ! Choix du calendrier |
---|
| 209 | ! ------------------- |
---|
[1] | 210 | |
---|
[1441] | 211 | ! calend = 'earth_365d' |
---|
[1] | 212 | |
---|
| 213 | #ifdef CPP_IOIPSL |
---|
[1441] | 214 | if (calend == 'earth_360d') then |
---|
| 215 | call ioconf_calendar('360d') |
---|
| 216 | write(lunout,*)'CALENDRIER CHOISI: Terrestre a 360 jours/an' |
---|
| 217 | else if (calend == 'earth_365d') then |
---|
| 218 | call ioconf_calendar('noleap') |
---|
| 219 | write(lunout,*)'CALENDRIER CHOISI: Terrestre a 365 jours/an' |
---|
| 220 | else if (calend == 'earth_366d') then |
---|
| 221 | call ioconf_calendar('gregorian') |
---|
| 222 | write(lunout,*)'CALENDRIER CHOISI: Terrestre bissextile' |
---|
| 223 | else if (calend == 'titan') then |
---|
[97] | 224 | ! call ioconf_calendar('titan') |
---|
[1441] | 225 | write(lunout,*)'CALENDRIER CHOISI: Titan' |
---|
| 226 | abort_message = 'A FAIRE...' |
---|
| 227 | call abort_gcm(modname,abort_message,1) |
---|
| 228 | else if (calend == 'venus') then |
---|
[97] | 229 | ! call ioconf_calendar('venus') |
---|
[1441] | 230 | write(lunout,*)'CALENDRIER CHOISI: Venus' |
---|
| 231 | abort_message = 'A FAIRE...' |
---|
| 232 | call abort_gcm(modname,abort_message,1) |
---|
| 233 | else |
---|
| 234 | abort_message = 'Mauvais choix de calendrier' |
---|
| 235 | call abort_gcm(modname,abort_message,1) |
---|
| 236 | endif |
---|
[1] | 237 | #endif |
---|
[1441] | 238 | !----------------------------------------------------------------------- |
---|
| 239 | ! |
---|
| 240 | ! |
---|
| 241 | !------------------------------------ |
---|
| 242 | ! Initialisation partie parallele |
---|
| 243 | !------------------------------------ |
---|
[1] | 244 | |
---|
[1441] | 245 | ! |
---|
| 246 | ! |
---|
| 247 | !----------------------------------------------------------------------- |
---|
| 248 | ! Initialisation des traceurs |
---|
| 249 | ! --------------------------- |
---|
| 250 | ! Choix du nombre de traceurs et du schema pour l'advection |
---|
| 251 | ! dans fichier traceur.def, par default ou via INCA |
---|
| 252 | call infotrac_init |
---|
[1] | 253 | |
---|
[1441] | 254 | ! Allocation de la tableau q : champs advectes |
---|
| 255 | allocate(q(ip1jmp1,llm,nqtot)) |
---|
[1] | 256 | |
---|
[1441] | 257 | !----------------------------------------------------------------------- |
---|
| 258 | ! Lecture de l'etat initial : |
---|
| 259 | ! --------------------------- |
---|
[1] | 260 | |
---|
[1441] | 261 | ! lecture du fichier start.nc |
---|
| 262 | if (read_start) then |
---|
| 263 | ! we still need to run iniacademic to initialize some |
---|
| 264 | ! constants & fields, if we run the 'newtonian' or 'SW' cases: |
---|
| 265 | if (iflag_phys.ne.1) then |
---|
| 266 | CALL iniacademic(vcov,ucov,teta,q,masse,ps,phis,time_0) |
---|
| 267 | endif |
---|
[1] | 268 | |
---|
[1441] | 269 | CALL dynetat0("start.nc",vcov,ucov, & |
---|
| 270 | teta,q,masse,ps,phis, time_0) |
---|
[1024] | 271 | |
---|
[1441] | 272 | ! Load relaxation fields (simple nudging). AS 09/2013 |
---|
| 273 | ! --------------------------------------------------- |
---|
| 274 | if (planet_type.eq."generic") then |
---|
| 275 | if (ok_guide) then |
---|
| 276 | CALL relaxetat0("relax.nc") |
---|
| 277 | endif |
---|
| 278 | endif |
---|
[1024] | 279 | |
---|
[1441] | 280 | ! write(73,*) 'ucov',ucov |
---|
| 281 | ! write(74,*) 'vcov',vcov |
---|
| 282 | ! write(75,*) 'teta',teta |
---|
| 283 | ! write(76,*) 'ps',ps |
---|
| 284 | ! write(77,*) 'q',q |
---|
[1] | 285 | |
---|
[1441] | 286 | endif ! of if (read_start) |
---|
[1] | 287 | |
---|
| 288 | |
---|
[1441] | 289 | ! le cas echeant, creation d un etat initial |
---|
| 290 | IF (prt_level > 9) WRITE(lunout,*) & |
---|
| 291 | 'GCM: AVANT iniacademic AVANT AVANT AVANT AVANT' |
---|
| 292 | if (.not.read_start) then |
---|
| 293 | CALL iniacademic(vcov,ucov,teta,q,masse,ps,phis,time_0) |
---|
| 294 | endif |
---|
[1] | 295 | |
---|
| 296 | |
---|
[1441] | 297 | !----------------------------------------------------------------------- |
---|
| 298 | ! Lecture des parametres de controle pour la simulation : |
---|
| 299 | ! ------------------------------------------------------- |
---|
| 300 | ! on recalcule eventuellement le pas de temps |
---|
[1] | 301 | |
---|
[1441] | 302 | IF(MOD(day_step,iperiod).NE.0) THEN |
---|
| 303 | abort_message = & |
---|
| 304 | 'Il faut choisir un nb de pas par jour multiple de iperiod' |
---|
| 305 | call abort_gcm(modname,abort_message,1) |
---|
| 306 | ENDIF |
---|
[1] | 307 | |
---|
[1441] | 308 | IF(MOD(day_step,iphysiq).NE.0) THEN |
---|
| 309 | abort_message = & |
---|
| 310 | 'Il faut choisir un nb de pas par jour multiple de iphysiq' |
---|
| 311 | call abort_gcm(modname,abort_message,1) |
---|
| 312 | ENDIF |
---|
[1] | 313 | |
---|
[1441] | 314 | zdtvr = daysec/REAL(day_step) |
---|
| 315 | IF(dtvr.NE.zdtvr) THEN |
---|
| 316 | WRITE(lunout,*) & |
---|
| 317 | 'WARNING!!! changement de pas de temps',dtvr,'>',zdtvr |
---|
| 318 | ENDIF |
---|
[2478] | 319 | dtvr=zdtvr |
---|
[1] | 320 | |
---|
[1441] | 321 | ! |
---|
[2507] | 322 | ! on remet le calendrier a zero si demande |
---|
[1441] | 323 | ! |
---|
| 324 | IF (start_time /= starttime) then |
---|
| 325 | WRITE(lunout,*)' GCM: Attention l''heure de depart lue dans le' & |
---|
[2507] | 326 | ,' fichier restart ne correspond pas a celle lue dans le run.def' |
---|
[1441] | 327 | IF (raz_date == 1) then |
---|
| 328 | WRITE(lunout,*)'Je prends l''heure lue dans run.def' |
---|
| 329 | start_time = starttime |
---|
| 330 | ELSE |
---|
| 331 | call abort_gcm("gcm", "'Je m''arrete'", 1) |
---|
| 332 | ENDIF |
---|
| 333 | ENDIF |
---|
| 334 | IF (raz_date == 1) THEN |
---|
| 335 | annee_ref = anneeref |
---|
| 336 | day_ref = dayref |
---|
| 337 | day_ini = dayref |
---|
| 338 | itau_dyn = 0 |
---|
| 339 | itau_phy = 0 |
---|
| 340 | time_0 = 0. |
---|
| 341 | write(lunout,*) & |
---|
| 342 | 'GCM: On reinitialise a la date lue dans gcm.def' |
---|
| 343 | ELSE IF (annee_ref .ne. anneeref .or. day_ref .ne. dayref) THEN |
---|
| 344 | write(lunout,*) & |
---|
| 345 | 'GCM: Attention les dates initiales lues dans le fichier' |
---|
| 346 | write(lunout,*) & |
---|
| 347 | ' restart ne correspondent pas a celles lues dans ' |
---|
| 348 | write(lunout,*)' gcm.def' |
---|
| 349 | write(lunout,*)' annee_ref=',annee_ref," anneeref=",anneeref |
---|
| 350 | write(lunout,*)' day_ref=',day_ref," dayref=",dayref |
---|
| 351 | write(lunout,*)' Pas de remise a zero' |
---|
| 352 | ENDIF |
---|
[1] | 353 | |
---|
[1441] | 354 | ! if (annee_ref .ne. anneeref .or. day_ref .ne. dayref) then |
---|
| 355 | ! write(lunout,*) |
---|
| 356 | ! . 'GCM: Attention les dates initiales lues dans le fichier' |
---|
| 357 | ! write(lunout,*) |
---|
| 358 | ! . ' restart ne correspondent pas a celles lues dans ' |
---|
| 359 | ! write(lunout,*)' gcm.def' |
---|
| 360 | ! write(lunout,*)' annee_ref=',annee_ref," anneeref=",anneeref |
---|
| 361 | ! write(lunout,*)' day_ref=',day_ref," dayref=",dayref |
---|
| 362 | ! if (raz_date .ne. 1) then |
---|
| 363 | ! write(lunout,*) |
---|
| 364 | ! . 'GCM: On garde les dates du fichier restart' |
---|
| 365 | ! else |
---|
| 366 | ! annee_ref = anneeref |
---|
| 367 | ! day_ref = dayref |
---|
| 368 | ! day_ini = dayref |
---|
| 369 | ! itau_dyn = 0 |
---|
| 370 | ! itau_phy = 0 |
---|
| 371 | ! time_0 = 0. |
---|
| 372 | ! write(lunout,*) |
---|
| 373 | ! . 'GCM: On reinitialise a la date lue dans gcm.def' |
---|
| 374 | ! endif |
---|
| 375 | ! ELSE |
---|
| 376 | ! raz_date = 0 |
---|
| 377 | ! endif |
---|
[1] | 378 | |
---|
| 379 | #ifdef CPP_IOIPSL |
---|
[1441] | 380 | mois = 1 |
---|
| 381 | heure = 0. |
---|
[97] | 382 | ! Ce n'est defini pour l'instant que pour la Terre... |
---|
[1441] | 383 | if (planet_type.eq.'earth') then |
---|
| 384 | call ymds2ju(annee_ref, mois, day_ref, heure, jD_ref) |
---|
| 385 | jH_ref = jD_ref - int(jD_ref) |
---|
| 386 | jD_ref = int(jD_ref) |
---|
[1] | 387 | |
---|
[1441] | 388 | call ioconf_startdate(INT(jD_ref), jH_ref) |
---|
[1] | 389 | |
---|
[1441] | 390 | write(lunout,*)'DEBUG' |
---|
| 391 | write(lunout,*)'annee_ref, mois, day_ref, heure, jD_ref' |
---|
| 392 | write(lunout,*)annee_ref, mois, day_ref, heure, jD_ref |
---|
| 393 | call ju2ymds(jD_ref+jH_ref,an, mois, jour, heure) |
---|
| 394 | write(lunout,*)'jD_ref+jH_ref,an, mois, jour, heure' |
---|
| 395 | write(lunout,*)jD_ref+jH_ref,an, mois, jour, heure |
---|
[1672] | 396 | ! else if (planet_type.eq.'titan') then |
---|
| 397 | ! jD_ref=1 ! Only if we use old Titan starts (J.V.O 2016) |
---|
[1441] | 398 | else |
---|
[97] | 399 | ! A voir pour Titan et Venus |
---|
[1441] | 400 | jD_ref=0 |
---|
| 401 | jH_ref=0 |
---|
| 402 | write(lunout,*)'A VOIR POUR VENUS ET TITAN: jD_ref, jH_ref' |
---|
| 403 | write(lunout,*)jD_ref,jH_ref |
---|
| 404 | endif ! planet_type |
---|
[1] | 405 | #else |
---|
[1441] | 406 | ! Ehouarn: we still need to define JD_ref and JH_ref |
---|
| 407 | ! and since we don't know how many days there are in a year |
---|
| 408 | ! we set JD_ref to 0 (this should be improved ...) |
---|
| 409 | jD_ref=0 |
---|
| 410 | jH_ref=0 |
---|
[1] | 411 | #endif |
---|
| 412 | |
---|
[1441] | 413 | if (iflag_phys.eq.1) then |
---|
| 414 | ! these initialisations have already been done (via iniacademic) |
---|
| 415 | ! if running in SW or Newtonian mode |
---|
| 416 | !----------------------------------------------------------------------- |
---|
| 417 | ! Initialisation des constantes dynamiques : |
---|
| 418 | ! ------------------------------------------ |
---|
| 419 | dtvr = zdtvr |
---|
| 420 | CALL iniconst |
---|
[1] | 421 | |
---|
[1441] | 422 | !----------------------------------------------------------------------- |
---|
| 423 | ! Initialisation de la geometrie : |
---|
| 424 | ! -------------------------------- |
---|
| 425 | CALL inigeom |
---|
[1] | 426 | |
---|
[1441] | 427 | !----------------------------------------------------------------------- |
---|
| 428 | ! Initialisation du filtre : |
---|
| 429 | ! -------------------------- |
---|
| 430 | CALL inifilr |
---|
| 431 | endif ! of if (iflag_phys.eq.1) |
---|
| 432 | ! |
---|
| 433 | !----------------------------------------------------------------------- |
---|
| 434 | ! Initialisation de la dissipation : |
---|
| 435 | ! ---------------------------------- |
---|
[1] | 436 | |
---|
[1441] | 437 | CALL inidissip( lstardis, nitergdiv, nitergrot, niterh , & |
---|
| 438 | tetagdiv, tetagrot , tetatemp, vert_prof_dissip) |
---|
[1] | 439 | |
---|
[1441] | 440 | !----------------------------------------------------------------------- |
---|
| 441 | ! Initialisation des I/O : |
---|
| 442 | ! ------------------------ |
---|
[1] | 443 | |
---|
[1441] | 444 | if (nday>=0) then ! standard case |
---|
| 445 | day_end=day_ini+nday |
---|
| 446 | else ! special case when nday <0, run -nday dynamical steps |
---|
| 447 | day_end=day_ini-nday/day_step |
---|
| 448 | endif |
---|
| 449 | if (less1day) then |
---|
| 450 | day_end=day_ini+floor(time_0+fractday) |
---|
| 451 | endif |
---|
| 452 | if (ndynstep.gt.0) then |
---|
| 453 | day_end=day_ini+floor(time_0+float(ndynstep)/float(day_step)) |
---|
| 454 | endif |
---|
[1022] | 455 | |
---|
[1441] | 456 | WRITE(lunout,'(a,i7,a,i7)') & |
---|
| 457 | "run from day ",day_ini," to day",day_end |
---|
[1] | 458 | |
---|
| 459 | #ifdef CPP_IOIPSL |
---|
[1441] | 460 | ! Ce n'est defini pour l'instant que pour la Terre... |
---|
| 461 | if (planet_type.eq.'earth') then |
---|
| 462 | call ju2ymds(jD_ref + day_ini - day_ref, an, mois, jour, heure) |
---|
| 463 | write (lunout,301)jour, mois, an |
---|
| 464 | call ju2ymds(jD_ref + day_end - day_ref, an, mois, jour, heure) |
---|
| 465 | write (lunout,302)jour, mois, an |
---|
| 466 | else |
---|
| 467 | ! A voir pour Titan et Venus |
---|
| 468 | write(lunout,*)'A VOIR POUR VENUS/TITAN: separation en annees...' |
---|
| 469 | endif ! planet_type |
---|
| 470 | 301 FORMAT('1'/,15x,'run du ', i2,'/',i2,'/',i4) |
---|
| 471 | 302 FORMAT('1'/,15x,' au ', i2,'/',i2,'/',i4) |
---|
[1] | 472 | #endif |
---|
| 473 | |
---|
[1682] | 474 | |
---|
| 475 | !----------------------------------------------------------------------- |
---|
| 476 | ! Initialisation de la physique : |
---|
| 477 | ! ------------------------------- |
---|
| 478 | |
---|
| 479 | IF ((iflag_phys==1).or.(iflag_phys>=100)) THEN |
---|
| 480 | ! Physics: |
---|
| 481 | #ifdef CPP_PHYS |
---|
[3316] | 482 | CALL iniphysiq(iim,jjm,llm, & |
---|
| 483 | (jjm-1)*iim+2,comm_lmdz, & |
---|
| 484 | daysec,day_ini,dtphys/nsplit_phys, & |
---|
| 485 | rlatu,rlatv,rlonu,rlonv,aire,cu,cv, & |
---|
| 486 | rad,g,r,cpp,iflag_phys) |
---|
[1682] | 487 | #endif |
---|
| 488 | ENDIF ! of IF ((iflag_phys==1).or.(iflag_phys>=100)) |
---|
| 489 | |
---|
| 490 | |
---|
[2507] | 491 | ! If we want to save multiple restart at different time (ecritstart.GT.0) |
---|
| 492 | ! We will write in restart the initial day of the simulation and put all |
---|
| 493 | ! the different time in the Time variable |
---|
| 494 | ! However, if we write only one restart, we save the last day of the |
---|
| 495 | ! simulation and put the remaining time (which is 0 if we do fulls days) |
---|
| 496 | ! in the Time variable |
---|
| 497 | |
---|
[1441] | 498 | if (planet_type=="mars") then |
---|
[2507] | 499 | if (ecritstart.GT.0) then |
---|
[1441] | 500 | ! For Mars we transmit day_ini |
---|
[2507] | 501 | CALL dynredem0("restart.nc", day_ini, phis) |
---|
| 502 | else |
---|
| 503 | CALL dynredem0("restart.nc", day_end, phis) |
---|
| 504 | endif |
---|
[1441] | 505 | else |
---|
| 506 | CALL dynredem0("restart.nc", day_end, phis) |
---|
| 507 | endif |
---|
| 508 | ecripar = .TRUE. |
---|
[1] | 509 | |
---|
| 510 | #ifdef CPP_IOIPSL |
---|
[1441] | 511 | time_step = zdtvr |
---|
| 512 | if (ok_dyn_ins) then |
---|
| 513 | ! initialize output file for instantaneous outputs |
---|
| 514 | ! t_ops = iecri * daysec ! do operations every t_ops |
---|
| 515 | t_ops =((1.0*iecri)/day_step) * daysec |
---|
| 516 | t_wrt = daysec ! iecri * daysec ! write output every t_wrt |
---|
[3305] | 517 | CALL inithist(day_ref,annee_ref,time_step,t_ops,t_wrt) |
---|
[1441] | 518 | endif |
---|
[1] | 519 | |
---|
[1441] | 520 | IF (ok_dyn_ave) THEN |
---|
| 521 | ! initialize output file for averaged outputs |
---|
| 522 | t_ops = iperiod * time_step ! do operations every t_ops |
---|
| 523 | t_wrt = periodav * daysec ! write output every t_wrt |
---|
[3305] | 524 | CALL initdynav(day_ref,annee_ref,time_step,t_ops,t_wrt) |
---|
[1441] | 525 | END IF |
---|
| 526 | dtav = iperiod*dtvr/daysec |
---|
[1] | 527 | #endif |
---|
| 528 | ! #endif of #ifdef CPP_IOIPSL |
---|
| 529 | |
---|
[1441] | 530 | ! Choix des frequences de stokage pour le offline |
---|
| 531 | ! istdyn=day_step/4 ! stockage toutes les 6h=1jour/4 |
---|
| 532 | ! istdyn=day_step/12 ! stockage toutes les 2h=1jour/12 |
---|
| 533 | istdyn=day_step/4 ! stockage toutes les 6h=1jour/12 |
---|
| 534 | istphy=istdyn/iphysiq |
---|
[1] | 535 | |
---|
| 536 | |
---|
[1441] | 537 | ! |
---|
| 538 | !----------------------------------------------------------------------- |
---|
| 539 | ! Integration temporelle du modele : |
---|
| 540 | ! ---------------------------------- |
---|
[1] | 541 | |
---|
[1441] | 542 | ! write(78,*) 'ucov',ucov |
---|
| 543 | ! write(78,*) 'vcov',vcov |
---|
| 544 | ! write(78,*) 'teta',teta |
---|
| 545 | ! write(78,*) 'ps',ps |
---|
| 546 | ! write(78,*) 'q',q |
---|
[1] | 547 | |
---|
| 548 | |
---|
[1441] | 549 | CALL leapfrog(ucov,vcov,teta,ps,masse,phis,q,time_0) |
---|
[1] | 550 | |
---|
[1441] | 551 | END PROGRAM gcm |
---|
[1] | 552 | |
---|