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