source: codes/icosagcm/branches/SATURN_DYNAMICO/LMDZ.COMMON/config/ppsrc/dyn/init_gcm_lmdz.f @ 224

Last change on this file since 224 was 224, checked in by ymipsl, 10 years ago
File size: 27.3 KB
Line 
1!
2! $Id: gcm.F 1446 2010-10-22 09:27:25Z emillour $
3!
4c
5c
6      SUBROUTINE init_gcm_lmdz(nbp,nproc,distrib_icosa,latfi,lonfi,
7     &                         airefi)
8
9
10
11
12
13
14      USE mod_const_mpi, ONLY: init_const_mpi
15      USE parallel_lmdz
16      USE infotrac
17      USE mod_interface_dyn_phys
18      USE mod_hallo
19      USE Bands
20      USE getparam
21      USE filtreg_mod
22      USE control_mod, only: planet_type,nday,day_step,iperiod,iphysiq,
23     &                       raz_date,anneeref,starttime,dayref,
24     &                       ok_dyn_ins,ok_dyn_ave,iecri,periodav,
25     &                       less1day,fractday,ndynstep,nsplit_phys
26      use cpdet_mod, only: ini_cpdet
27
28
29
30
31
32
33
34! Ehouarn: the following are needed with (parallel) physics:
35
36      USE mod_grid_phy_lmdz
37      USE mod_phys_lmdz_para, ONLY : klon_mpi_para_nb
38      USE mod_phys_lmdz_omp_data, ONLY: klon_omp 
39      USE dimphy
40      USE comgeomphy
41
42      IMPLICIT NONE
43      INTEGER, INTENT(IN) :: nbp
44      INTEGER, INTENT(IN) :: nproc
45      INTEGER, INTENT(IN) :: distrib_icosa(nproc)
46      REAL, INTENT(IN) :: latfi(nbp)
47      REAL, INTENT(IN) :: lonfi(nbp)
48      REAL, INTENT(IN) :: airefi(nbp)
49
50      REAL :: zcufi(nbp)
51      REAL :: zcvfi(nbp)
52
53c      ......   Version  du 10/01/98    ..........
54
55c             avec  coordonnees  verticales hybrides 
56c   avec nouveaux operat. dissipation * ( gradiv2,divgrad2,nxgraro2 )
57
58c=======================================================================
59c
60c   Auteur:  P. Le Van /L. Fairhead/F.Hourdin
61c   -------
62c
63c   Objet:
64c   ------
65c
66c   GCM LMD nouvelle grille
67c
68c=======================================================================
69c
70c  ... Dans inigeom , nouveaux calculs pour les elongations  cu , cv
71c      et possibilite d'appeler une fonction f(y)  a derivee tangente
72c      hyperbolique a la  place de la fonction a derivee sinusoidale.
73c  ... Possibilite de choisir le schema pour l'advection de
74c        q  , en modifiant iadv dans traceur.def  (MAF,10/02) .
75c
76c      Pour Van-Leer + Vapeur d'eau saturee, iadv(1)=4. (F.Codron,10/99)
77c      Pour Van-Leer iadv=10
78c
79c-----------------------------------------------------------------------
80c   Declarations:
81c   -------------
82
83!-----------------------------------------------------------------------
84!   INCLUDE 'dimensions.h'
85!
86!   dimensions.h contient les dimensions du modele
87!   ndm est tel que iim=2**ndm
88!-----------------------------------------------------------------------
89
90      INTEGER iim,jjm,llm,ndm
91
92      PARAMETER (iim= 128,jjm=96,llm=64,ndm=1)
93
94!-----------------------------------------------------------------------
95!
96! $Header$
97!
98!
99!  ATTENTION!!!!: ce fichier include est compatible format fixe/format libre
100!                 veillez  n'utiliser que des ! pour les commentaires
101!                 et  bien positionner les & des lignes de continuation
102!                 (les placer en colonne 6 et en colonne 73)
103!
104!
105!-----------------------------------------------------------------------
106!   INCLUDE 'paramet.h'
107
108      INTEGER  iip1,iip2,iip3,jjp1,llmp1,llmp2,llmm1
109      INTEGER  kftd,ip1jm,ip1jmp1,ip1jmi1,ijp1llm
110      INTEGER  ijmllm,mvar
111      INTEGER jcfil,jcfllm
112
113      PARAMETER( iip1= iim+1,iip2=iim+2,iip3=iim+3                       &
114     &    ,jjp1=jjm+1-1/jjm)
115      PARAMETER( llmp1 = llm+1,  llmp2 = llm+2, llmm1 = llm-1 )
116      PARAMETER( kftd  = iim/2 -ndm )
117      PARAMETER( ip1jm  = iip1*jjm,  ip1jmp1= iip1*jjp1 )
118      PARAMETER( ip1jmi1= ip1jm - iip1 )
119      PARAMETER( ijp1llm= ip1jmp1 * llm, ijmllm= ip1jm * llm )
120      PARAMETER( mvar= ip1jmp1*( 2*llm+1) + ijmllm )
121      PARAMETER( jcfil=jjm/2+5, jcfllm=jcfil*llm )
122
123!-----------------------------------------------------------------------
124!
125! $Id: comconst.h 1437 2010-09-30 08:29:10Z emillour $
126!
127!-----------------------------------------------------------------------
128! INCLUDE comconst.h
129
130      COMMON/comconsti/im,jm,lllm,imp1,jmp1,lllmm1,lllmp1,lcl,          &
131     &                 iflag_top_bound,mode_top_bound
132      COMMON/comconstr/dtvr,daysec,                                     &
133     & pi,dtphys,dtdiss,rad,r,kappa,cotot,unsim,g,omeg                  &
134     & ,dissip_fac_mid,dissip_fac_up,dissip_deltaz,dissip_hdelta        &
135     & ,dissip_pupstart  ,tau_top_bound,                                &
136     & daylen,molmass, ihf
137      COMMON/cpdetvenus/cpp,nu_venus,t0_venus
138
139      INTEGER im,jm,lllm,imp1,jmp1,lllmm1,lllmp1,lcl
140      REAL dtvr ! dynamical time step (in s)
141      REAL daysec !length (in s) of a standard day
142      REAL pi    ! something like 3.14159....
143      REAL dtphys ! (s) time step for the physics
144      REAL dtdiss ! (s) time step for the dissipation
145      REAL rad ! (m) radius of the planet
146      REAL r ! Reduced Gas constant r=R/mu
147             ! with R=8.31.. J.K-1.mol-1, mu: mol mass of atmosphere (kg/mol)
148      REAL cpp   ! Cp
149      REAL kappa ! kappa=R/Cp
150      REAL cotot
151      REAL unsim ! = 1./iim
152      REAL g ! (m/s2) gravity
153      REAL omeg ! (rad/s) rotation rate of the planet
154! Dissipation factors, for Earth model:
155      REAL dissip_factz,dissip_zref !dissip_deltaz
156! Dissipation factors, for other planets:
157      REAL dissip_fac_mid,dissip_fac_up,dissip_deltaz,dissip_hdelta
158      REAL dissip_pupstart
159      INTEGER iflag_top_bound,mode_top_bound
160      REAL tau_top_bound
161      REAL daylen ! length of solar day, in 'standard' day length
162      REAL molmass ! (g/mol) molar mass of the atmosphere
163
164      REAL nu_venus,t0_venus ! coeffs needed for Cp(T), Venus atmosphere
165      REAL ihf  ! (W/m2) intrinsic heat flux for giant planets
166
167
168!-----------------------------------------------------------------------
169!
170! $Id: comdissnew.h 1319 2010-02-23 21:29:54Z fairhead $
171!
172!
173!  ATTENTION!!!!: ce fichier include est compatible format fixe/format libre
174!                 veillez à n'utiliser que des ! pour les commentaires
175!                 et à bien positionner les & des lignes de continuation
176!                 (les placer en colonne 6 et en colonne 73)
177!
178!-----------------------------------------------------------------------
179! INCLUDE 'comdissnew.h'
180
181      COMMON/comdissnew/ lstardis,nitergdiv,nitergrot,niterh,tetagdiv,  &
182     &                   tetagrot,tetatemp,coefdis, vert_prof_dissip
183
184      LOGICAL lstardis
185      INTEGER nitergdiv, nitergrot, niterh
186
187! For the Earth model:
188      integer vert_prof_dissip ! vertical profile of horizontal dissipation
189!     Allowed values:
190!     0: rational fraction, function of pressure
191!     1: tanh of altitude
192
193      REAL     tetagdiv, tetagrot,  tetatemp, coefdis
194
195!
196! ... Les parametres de ce common comdissnew sont  lues par defrun_new
197!              sur le fichier  run.def    ....
198!
199!-----------------------------------------------------------------------
200!
201! $Id: comvert.h 1654 2012-09-24 15:07:18Z aslmd $
202!
203!-----------------------------------------------------------------------
204!   INCLUDE 'comvert.h'
205
206      COMMON/comvertr/ap(llm+1),bp(llm+1),presnivs(llm),dpres(llm),     &
207     &               pa,preff,nivsigs(llm),nivsig(llm+1),               &
208     &               aps(llm),bps(llm),scaleheight,pseudoalt(llm)
209
210      common/comverti/disvert_type, pressure_exner
211
212      real ap     ! hybrid pressure contribution at interlayers
213      real bp     ! hybrid sigma contribution at interlayer
214      real presnivs ! (reference) pressure at mid-layers
215      real dpres
216      real pa     ! reference pressure (Pa) at which hybrid coordinates
217                  ! become purely pressure
218      real preff  ! reference surface pressure (Pa)
219      real nivsigs
220      real nivsig
221      real aps    ! hybrid pressure contribution at mid-layers
222      real bps    ! hybrid sigma contribution at mid-layers
223      real scaleheight ! atmospheric (reference) scale height (km)
224      real pseudoalt ! pseudo-altitude of model levels (km), based on presnivs(),
225                     ! preff and scaleheight
226
227      integer disvert_type ! type of vertical discretization:
228                           ! 1: Earth (default for planet_type==earth),
229                           !     automatic generation
230                           ! 2: Planets (default for planet_type!=earth),
231                           !     using 'z2sig.def' (or 'esasig.def) file
232
233      logical pressure_exner
234!     compute pressure inside layers using Exner function, else use mean
235!     of pressure values at interfaces
236
237 !-----------------------------------------------------------------------
238!
239! $Header$
240!
241!CDK comgeom
242      COMMON/comgeom/                                                   &
243     & cu(ip1jmp1),cv(ip1jm),unscu2(ip1jmp1),unscv2(ip1jm),             &
244     & aire(ip1jmp1),airesurg(ip1jmp1),aireu(ip1jmp1),                  &
245     & airev(ip1jm),unsaire(ip1jmp1),apoln,apols,                       &
246     & unsairez(ip1jm),airuscv2(ip1jm),airvscu2(ip1jm),                 &
247     & aireij1(ip1jmp1),aireij2(ip1jmp1),aireij3(ip1jmp1),              &
248     & aireij4(ip1jmp1),alpha1(ip1jmp1),alpha2(ip1jmp1),                &
249     & alpha3(ip1jmp1),alpha4(ip1jmp1),alpha1p2(ip1jmp1),               &
250     & alpha1p4(ip1jmp1),alpha2p3(ip1jmp1),alpha3p4(ip1jmp1),           &
251     & fext(ip1jm),constang(ip1jmp1),rlatu(jjp1),rlatv(jjm),            &
252     & rlonu(iip1),rlonv(iip1),cuvsurcv(ip1jm),cvsurcuv(ip1jm),         &
253     & cvusurcu(ip1jmp1),cusurcvu(ip1jmp1),cuvscvgam1(ip1jm),           &
254     & cuvscvgam2(ip1jm),cvuscugam1(ip1jmp1),                           &
255     & cvuscugam2(ip1jmp1),cvscuvgam(ip1jm),cuscvugam(ip1jmp1),         &
256     & unsapolnga1,unsapolnga2,unsapolsga1,unsapolsga2,                 &
257     & unsair_gam1(ip1jmp1),unsair_gam2(ip1jmp1),unsairz_gam(ip1jm),    &
258     & aivscu2gam(ip1jm),aiuscv2gam(ip1jm),xprimu(iip1),xprimv(iip1)
259
260!
261        REAL                                                            &
262     & cu,cv,unscu2,unscv2,aire,airesurg,aireu,airev,unsaire,apoln     ,&
263     & apols,unsairez,airuscv2,airvscu2,aireij1,aireij2,aireij3,aireij4,&
264     & alpha1,alpha2,alpha3,alpha4,alpha1p2,alpha1p4,alpha2p3,alpha3p4 ,&
265     & fext,constang,rlatu,rlatv,rlonu,rlonv,cuvscvgam1,cuvscvgam2     ,&
266     & cvuscugam1,cvuscugam2,cvscuvgam,cuscvugam,unsapolnga1,unsapolnga2&
267     & ,unsapolsga1,unsapolsga2,unsair_gam1,unsair_gam2,unsairz_gam    ,&
268     & aivscu2gam ,aiuscv2gam,cuvsurcv,cvsurcuv,cvusurcu,cusurcvu,xprimu&
269     & , xprimv
270!
271!
272! $Id: logic.h 1520 2011-05-23 11:37:09Z emillour $
273!
274!
275! NB: keep items of different kinds in seperate common blocs to avoid
276!     "misaligned commons" issues
277!-----------------------------------------------------------------------
278! INCLUDE 'logic.h'
279
280      COMMON/logicl/ purmats,forward,leapf,apphys,                      &
281     &  statcl,conser,apdiss,apdelq,saison,ecripar,fxyhypb,ysinus       &
282     &  ,read_start,ok_guide,ok_strato,tidal,ok_gradsfile               &
283     &  ,ok_limit,ok_etat0,hybrid                                       &
284     &  ,moyzon_mu,moyzon_ch
285
286      COMMON/logici/ iflag_phys,iflag_trac
287     
288      LOGICAL purmats,forward,leapf,apphys,statcl,conser,               &
289     & apdiss,apdelq,saison,ecripar,fxyhypb,ysinus                      &
290     &  ,read_start,ok_guide,ok_strato,tidal,ok_gradsfile               &
291     &  ,ok_limit,ok_etat0
292      logical hybrid ! vertical coordinate is hybrid if true (sigma otherwise)
293                     ! (only used if disvert_type==2)
294      logical moyzon_mu,moyzon_ch ! used for zonal averages in Titan
295
296      integer iflag_phys,iflag_trac
297!$OMP THREADPRIVATE(/logicl/)
298!$OMP THREADPRIVATE(/logici/)
299!-----------------------------------------------------------------------
300!
301! $Id: temps.h 1577 2011-10-20 15:06:47Z fairhead $
302!
303!  ATTENTION!!!!: ce fichier include est compatible format fixe/format libre
304!                 veillez  n'utiliser que des ! pour les commentaires
305!                 et  bien positionner les & des lignes de continuation
306!                 (les placer en colonne 6 et en colonne 73)
307!
308!
309! jD_ref = jour julien de la date de reference (lancement de l'experience)
310! hD_ref = "heure" julienne de la date de reference
311!-----------------------------------------------------------------------
312! INCLUDE 'temps.h'
313
314      COMMON/temps_r/dt,jD_ref,jH_ref,start_time,hour_ini
315      COMMON/temps_i/day_ini,day_end,annee_ref,day_ref,                 &
316     &             itau_dyn,itau_phy,itaufin
317      COMMON/temps_c/calend
318
319
320      INTEGER   itaufin ! total number of dynamical steps for the run
321      INTEGER   itau_dyn, itau_phy
322      INTEGER   day_ini ! initial day # of simulation sequence
323      INTEGER   day_end ! final day # ; i.e. day # when this simulation ends
324      INTEGER   annee_ref
325      INTEGER   day_ref
326      REAL      dt ! (dynamics) time step (changes if doing Matsuno or LF step)
327      REAL      jD_ref, jH_ref, start_time
328      CHARACTER (len=10) :: calend
329
330      ! Additionnal Mars stuff:
331      real hour_ini ! initial fraction of day of simulation sequence (0=<hour_ini<1)
332
333!-----------------------------------------------------------------------
334!!!!!!!!!!!#include "control.h"
335!
336! $Id: ener.h 1447 2010-10-22 16:18:27Z jghattas $
337!
338!  ATTENTION!!!!: ce fichier include est compatible format fixe/format libre
339!                 veillez à n'utiliser que des ! pour les commentaires
340!                 et à bien positionner les & des lignes de continuation
341!                 (les placer en colonne 6 et en colonne 73)
342!
343! INCLUDE 'ener.h'
344
345      COMMON/ener/ang0,etot0,ptot0,ztot0,stot0,                         &
346     &            ang,etot,ptot,ztot,stot,rmsdpdt ,                     &
347     &            rmsv,gtot(llmm1)
348
349      REAL ang0,etot0,ptot0,ztot0,stot0,                                &
350     &     ang,etot,ptot,ztot,stot,rmsdpdt,rmsv,gtot
351
352!-----------------------------------------------------------------------
353!
354! $Header$
355!
356      character *120 descript
357      common /titre/descript
358!
359! $Header$
360!
361!c
362!c
363!c..include serre.h
364!c
365       REAL clon,clat,transx,transy,alphax,alphay,pxo,pyo,              &
366     &  grossismx, grossismy, dzoomx, dzoomy,taux,tauy
367       COMMON/serre/clon,clat,transx,transy,alphax,alphay,pxo,pyo ,     &
368     &  grossismx, grossismy, dzoomx, dzoomy,taux,tauy
369!#include "com_io_dyn.h"
370!
371! $Header$
372!
373!
374! gestion des impressions de sorties et de débogage
375! lunout:    unité du fichier dans lequel se font les sorties
376!                           (par defaut 6, la sortie standard)
377! prt_level: niveau d'impression souhaité (0 = minimum)
378!
379      INTEGER lunout, prt_level
380      COMMON /comprint/ lunout, prt_level
381!
382! $Header$
383!
384      common /tracstoke/istdyn,istphy,unittrac
385      integer istdyn,istphy,unittrac
386
387
388      REAL zdtvr
389
390c   variables dynamiques
391      REAL vcov(ip1jm,llm),ucov(ip1jmp1,llm) ! vents covariants
392      REAL teta(ip1jmp1,llm)                 ! temperature potentielle
393      REAL, ALLOCATABLE, DIMENSION(:,:,:):: q! champs advectes
394      REAL ps(ip1jmp1)                       ! pression  au sol
395c      REAL p (ip1jmp1,llmp1  )               ! pression aux interfac.des couches
396c      REAL pks(ip1jmp1)                      ! exner au  sol
397c      REAL pk(ip1jmp1,llm)                   ! exner au milieu des couches
398c      REAL pkf(ip1jmp1,llm)                  ! exner filt.au milieu des couches
399      REAL masse(ip1jmp1,llm)                ! masse d'air
400      REAL phis(ip1jmp1)                     ! geopotentiel au sol
401c      REAL phi(ip1jmp1,llm)                  ! geopotentiel
402c      REAL w(ip1jmp1,llm)                    ! vitesse verticale
403
404c variables dynamiques intermediaire pour le transport
405
406c   variables pour le fichier histoire
407      REAL dtav      ! intervalle de temps elementaire
408
409      REAL time_0
410
411      LOGICAL lafin
412c      INTEGER ij,iq,l,i,j
413      INTEGER i,j
414
415
416      real time_step, t_wrt, t_ops
417
418
419      LOGICAL call_iniphys
420      data call_iniphys/.true./
421
422c      REAL alpha(ip1jmp1,llm),beta(ip1jmp1,llm)
423c+jld variables test conservation energie
424c      REAL ecin(ip1jmp1,llm),ecin0(ip1jmp1,llm)
425C     Tendance de la temp. potentiel d (theta)/ d t due a la 
426C     tansformation d'energie cinetique en energie thermique
427C     cree par la dissipation
428c      REAL dhecdt(ip1jmp1,llm)
429c      REAL vcont(ip1jm,llm),ucont(ip1jmp1,llm)
430c      REAL      d_h_vcol, d_qt, d_qw, d_ql, d_ec
431c      CHARACTER (len=15) :: ztit
432c-jld
433
434
435      character (len=80) :: dynhist_file, dynhistave_file
436      character (len=20) :: modname
437      character (len=80) :: abort_message
438! locales pour gestion du temps
439      INTEGER :: an, mois, jour
440      REAL :: heure
441
442
443c-----------------------------------------------------------------------
444c    variables pour l'initialisation de la physique :
445c    ------------------------------------------------
446      INTEGER ngridmx
447      PARAMETER( ngridmx = 2+(jjm-1)*iim - 1/jjm   )
448!      REAL zcufi(ngridmx),zcvfi(ngridmx)
449!      REAL latfi(ngridmx),lonfi(ngridmx)
450!      REAL airefi(ngridmx)
451!      SAVE latfi, lonfi, airefi
452     
453      INTEGER :: ierr
454
455
456c-----------------------------------------------------------------------
457c   Initialisations:
458c   ----------------
459
460      abort_message = 'last timestep reached'
461      modname = 'gcm'
462      descript = 'Run GCM LMDZ'
463      lafin    = .FALSE.
464      dynhist_file = 'dyn_hist'
465      dynhistave_file = 'dyn_hist_ave'
466
467
468
469c----------------------------------------------------------------------
470c  lecture des fichiers gcm.def ou run.def
471c  ---------------------------------------
472c
473! Ehouarn: dump possibility of using defrun
474!#ifdef CPP_IOIPSL
475      CALL conf_gcm( 99, .TRUE. )
476!#else
477!      CALL defrun( 99, .TRUE. , clesphy0 )
478!#endif
479c
480c
481c------------------------------------
482c   Initialisation partie parallele
483c------------------------------------
484
485      CALL init_const_mpi
486!      call init_parallel
487      call ini_getparam("out.def")
488!      call Read_Distrib
489
490!        CALL init_phys_lmdz(iim,jjp1,llm,mpi_size,distrib_phys)
491        CALL Init_Phys_lmdz(iim,jjp1,llm,nproc,distrib_icosa)
492!      CALL set_bands
493!#ifdef 1
494!      CALL Init_interface_dyn_phys
495!#endif
496!      CALL barrier
497
498!      if (mpi_rank==0) call WriteBands
499!      call SetDistrib(jj_Nb_Caldyn)
500
501!c$OMP PARALLEL
502!      call Init_Mod_hallo
503!c$OMP END PARALLEL
504
505c$OMP PARALLEL
506      call initcomgeomphy
507c$OMP END PARALLEL 
508
509!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
510! Initialisation de XIOS
511!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
512
513
514c
515c Initialisations pour Cp(T) Venus
516      call ini_cpdet
517c
518c-----------------------------------------------------------------------
519c   Choix du calendrier
520c   -------------------
521
522c      calend = 'earth_365d'
523
524c-----------------------------------------------------------------------
525
526      IF (type_trac == 'inca') THEN
527      END IF
528
529c-----------------------------------------------------------------------
530c   Initialisation des traceurs
531c   ---------------------------
532c  Choix du nombre de traceurs et du schema pour l'advection
533c  dans fichier traceur.def, par default ou via INCA
534      call infotrac_init
535
536c Allocation de la tableau q : champs advectes   
537      ALLOCATE(q(ip1jmp1,llm,nqtot))
538
539c-----------------------------------------------------------------------
540c   Lecture de l'etat initial :
541c   ---------------------------
542
543c  lecture du fichier start.nc
544!      if (read_start) then
545!      ! we still need to run iniacademic to initialize some
546!      ! constants & fields, if we run the 'newtonian' or 'SW' cases:
547!        if (iflag_phys.ne.1) then
548!          CALL iniacademic(vcov,ucov,teta,q,masse,ps,phis,time_0)
549!        endif
550!
551!        CALL dynetat0("start.nc",vcov,ucov,
552!     &              teta,q,masse,ps,phis, time_0)
553!       
554!        ! Load relaxation fields (simple nudging). AS 09/2013
555!        ! ---------------------------------------------------
556!        if (planet_type.eq."generic") then
557!         if (ok_guide) then
558!           CALL relaxetat0("relax.nc")
559!         endif
560!        endif
561 
562c       write(73,*) 'ucov',ucov
563c       write(74,*) 'vcov',vcov
564c       write(75,*) 'teta',teta
565c       write(76,*) 'ps',ps
566c       write(77,*) 'q',q
567
568!      endif ! of if (read_start)
569
570c le cas echeant, creation d un etat initial
571      IF (prt_level > 9) WRITE(lunout,*)
572     .              'GCM: AVANT iniacademic AVANT AVANT AVANT AVANT'
573      if (.not.read_start) then
574         CALL iniacademic(vcov,ucov,teta,q,masse,ps,phis,time_0)
575      endif
576
577
578c-----------------------------------------------------------------------
579c   Lecture des parametres de controle pour la simulation :
580c   -------------------------------------------------------
581c  on recalcule eventuellement le pas de temps
582      call conf_planete
583      dtvr    = daysec/REAL(day_step)
584      zdtvr=dtvr
585      CALL iniconst
586      CALL inigeom
587      CALL inifilr
588
589      IF(MOD(day_step,iperiod).NE.0) THEN
590        abort_message = 
591     .  'Il faut choisir un nb de pas par jour multiple de iperiod'
592        call abort_gcm(modname,abort_message,1)
593      ENDIF
594
595      IF(MOD(day_step,iphysiq).NE.0) THEN
596        abort_message = 
597     * 'Il faut choisir un nb de pas par jour multiple de iphysiq'
598        call abort_gcm(modname,abort_message,1)
599      ENDIF
600
601      zdtvr    = daysec/REAL(day_step)
602        IF(dtvr.NE.zdtvr) THEN
603         WRITE(lunout,*)
604     .    'WARNING!!! changement de pas de temps',dtvr,'>',zdtvr
605        ENDIF
606
607C
608C on remet le calendrier à zero si demande
609c
610      IF (start_time /= starttime) then
611        WRITE(lunout,*)' GCM: Attention l''heure de depart lue dans le'
612     &,' fichier restart ne correspond pas à celle lue dans le run.def'
613        IF (raz_date == 1) then
614          WRITE(lunout,*)'Je prends l''heure lue dans run.def'
615          start_time = starttime
616        ELSE
617          call abort_gcm("gcm", "'Je m''arrete'", 1)
618        ENDIF
619      ENDIF
620      IF (raz_date == 1) THEN
621        annee_ref = anneeref
622        day_ref = dayref
623        day_ini = dayref
624        itau_dyn = 0
625        itau_phy = 0
626        time_0 = 0.
627        write(lunout,*)
628     .   'GCM: On reinitialise a la date lue dans gcm.def'
629      ELSE IF (annee_ref .ne. anneeref .or. day_ref .ne. dayref) THEN
630        write(lunout,*)
631     .  'GCM: Attention les dates initiales lues dans le fichier'
632        write(lunout,*)
633     .  ' restart ne correspondent pas a celles lues dans '
634        write(lunout,*)' gcm.def'
635        write(lunout,*)' annee_ref=',annee_ref," anneeref=",anneeref
636        write(lunout,*)' day_ref=',day_ref," dayref=",dayref
637        write(lunout,*)' Pas de remise a zero'
638      ENDIF
639
640c      if (annee_ref .ne. anneeref .or. day_ref .ne. dayref) then
641c        write(lunout,*)
642c     .  'GCM: Attention les dates initiales lues dans le fichier'
643c        write(lunout,*)
644c     .  ' restart ne correspondent pas a celles lues dans '
645c        write(lunout,*)' gcm.def'
646c        write(lunout,*)' annee_ref=',annee_ref," anneeref=",anneeref
647c        write(lunout,*)' day_ref=',day_ref," dayref=",dayref
648c        if (raz_date .ne. 1) then
649c          write(lunout,*)
650c     .    'GCM: On garde les dates du fichier restart'
651c        else
652c          annee_ref = anneeref
653c          day_ref = dayref
654c          day_ini = dayref
655c          itau_dyn = 0
656c          itau_phy = 0
657c          time_0 = 0.
658c          write(lunout,*)
659c     .   'GCM: On reinitialise a la date lue dans gcm.def'
660c        endif
661c      ELSE
662c        raz_date = 0
663c      endif
664
665! Ehouarn: we still need to define JD_ref and JH_ref
666! and since we don't know how many days there are in a year
667! we set JD_ref to 0 (this should be improved ...)
668      jD_ref=0
669      jH_ref=0
670
671      if (iflag_phys.eq.1) then
672      ! these initialisations have already been done (via iniacademic)
673      ! if running in SW or Newtonian mode
674c-----------------------------------------------------------------------
675c   Initialisation des constantes dynamiques :
676c   ------------------------------------------
677        dtvr = zdtvr
678        CALL iniconst
679
680c-----------------------------------------------------------------------
681c   Initialisation de la geometrie :
682c   --------------------------------
683        CALL inigeom
684
685c-----------------------------------------------------------------------
686c   Initialisation du filtre :
687c   --------------------------
688!        CALL inifilr
689      endif ! of if (iflag_phys.eq.1)
690c
691c-----------------------------------------------------------------------
692c   Initialisation de la dissipation :
693c   ----------------------------------
694
695!      CALL inidissip( lstardis, nitergdiv, nitergrot, niterh   ,
696!     *                tetagdiv, tetagrot , tetatemp, vert_prof_dissip)
697
698c-----------------------------------------------------------------------
699c   Initialisation de la physique :
700c   -------------------------------
701
702!      IF (call_iniphys.and.(iflag_phys==1.or.iflag_phys>=100)) THEN
703!         latfi(1)=rlatu(1)
704!         lonfi(1)=0.
705!         zcufi(1) = cu(1)
706!         zcvfi(1) = cv(1)
707!         DO j=2,jjm
708!            DO i=1,iim
709!               latfi((j-2)*iim+1+i)= rlatu(j)
710!               lonfi((j-2)*iim+1+i)= rlonv(i)
711!               zcufi((j-2)*iim+1+i) = cu((j-1)*iip1+i)
712!               zcvfi((j-2)*iim+1+i) = cv((j-1)*iip1+i)
713!            ENDDO
714!         ENDDO
715!         latfi(ngridmx)= rlatu(jjp1)
716!         lonfi(ngridmx)= 0.
717!         zcufi(ngridmx) = cu(ip1jm+1)
718!         zcvfi(ngridmx) = cv(ip1jm-iim)
719!
720!         ! build airefi(), mesh area on physics grid
721!         CALL gr_dyn_fi(1,iip1,jjp1,ngridmx,aire,airefi)
722!         ! Poles are single points on physics grid
723!         airefi(1)=airefi(1)*iim
724!         airefi(ngridmx)=airefi(ngridmx)*iim
725
726! Physics
727!         CALL iniphysiq(ngridmx,llm,daysec,day_ini,dtphys/nsplit_phys,
728!     &                latfi,lonfi,airefi,zcufi,zcvfi,rad,g,r,cpp,
729!     &                iflag_phys)
730
731         zcufi(nbp)=1.
732         zcvfi(nbp)=1.
733
734         CALL iniphysiq(klon_glo,llm,daysec,day_ini,dtphys/nsplit_phys, 
735     &                latfi,lonfi,airefi,zcufi,zcvfi,rad,g,r,cpp, 
736     &                iflag_phys) 
737
738         call_iniphys=.false.
739!      ENDIF ! of IF (call_iniphys.and.(iflag_phys==1.or.iflag_phys>=100))
740
741
742c-----------------------------------------------------------------------
743c   Initialisation des dimensions d'INCA :
744c   --------------------------------------
745      IF (type_trac == 'inca') THEN
746      END IF
747
748c-----------------------------------------------------------------------
749c   Initialisation des I/O :
750c   ------------------------
751
752
753      if (nday>=0) then ! standard case
754        day_end=day_ini+nday
755      else ! special case when nday <0, run -nday dynamical steps
756        day_end=day_ini-nday/day_step
757      endif
758      if (less1day) then
759        day_end=day_ini+floor(time_0+fractday)
760      endif
761      if (ndynstep.gt.0) then
762        day_end=day_ini+floor(time_0+float(ndynstep)/float(day_step))
763      endif
764     
765      WRITE(lunout,'(a,i7,a,i7)')
766     &             "run from day ",day_ini,"  to day",day_end
767
768
769      if (planet_type=="mars") then
770         ! For Mars we transmit day_ini
771        CALL dynredem0_p("restart.nc", day_ini, phis)
772      else
773        CALL dynredem0_p("restart.nc", day_end, phis)
774      endif
775      ecripar = .TRUE.
776
777! #endif of #ifdef CPP_IOIPSL
778
779c  Choix des frequences de stokage pour le offline
780c      istdyn=day_step/4     ! stockage toutes les 6h=1jour/4
781c      istdyn=day_step/12     ! stockage toutes les 2h=1jour/12
782      istdyn=day_step/4     ! stockage toutes les 6h=1jour/12
783      istphy=istdyn/iphysiq     
784
785
786c
787c-----------------------------------------------------------------------
788c   Integration temporelle du modele :
789c   ----------------------------------
790
791c       write(78,*) 'ucov',ucov
792c       write(78,*) 'vcov',vcov
793c       write(78,*) 'teta',teta
794c       write(78,*) 'ps',ps
795c       write(78,*) 'q',q
796
797!c$OMP PARALLEL DEFAULT(SHARED) COPYIN(/temps/,/logici/,/logicl/)
798!      CALL leapfrog_p(ucov,vcov,teta,ps,masse,phis,q,
799!     .              time_0)
800!c$OMP END PARALLEL
801
802
803      END
804
Note: See TracBrowser for help on using the repository browser.