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