SUBROUTINE dynetat0(fichnom,vcov,ucov, . teta,q,masse,ps,phis,time0) use netcdf use infotrac, only: tname,nqtot use control_mod, only: timestart USE comvert_mod, ONLY: pa,preff USE comconst_mod, ONLY: im,jm,lllm,daysec,dtvr, . rad,omeg,r,cpp,kappa,g USE logic_mod, ONLY: fxyhypb,ysinus USE serre_mod, ONLY: clon,clat,grossismx,grossismy,dzoomx,dzoomy, . taux,tauy USE temps_mod, ONLY: day_ini,hour_ini USE ener_mod, ONLY: etot0,ptot0,ztot0,stot0,ang0 IMPLICIT NONE c======================================================================= c c Auteur: P. Le Van / L.Fairhead c ------- c c objet: c ------ c c Lecture de l'etat initial c c Modifs: Oct.2008 read in tracers by name. Ehouarn Millour c Aug.2010 use NetCDF90 to load variables (enables using c r4 or r8 restarts independently of having compiled c the GCM in r4 or r8) c June 2013 TN : Possibility to read files with a time axis. c NOW defrun_new MUST BE CALLED BEFORE dynetat0. c======================================================================= c----------------------------------------------------------------------- c Declarations: c ------------- #include "dimensions.h" #include "paramet.h" #include "comgeom2.h" !#include "advtrac.h" !#include "control.h" c Arguments: c ---------- CHARACTER*(*) fichnom REAL vcov(iip1,jjm,llm),ucov(iip1,jjp1,llm),teta(iip1,jjp1,llm) REAL q(iip1,jjp1,llm,nqtot) REAL masse(iip1,jjp1,llm) REAL ps(iip1,jjp1),phis(iip1,jjp1) REAL time0 ! fraction of day the fields correspond to c Variables c REAL traceur(iip1,jjp1,llm) ! to temporarily store a tracer INTEGER length,iq,i,j,l PARAMETER (length = 100) REAL tab_cntrl(length) ! tableau des parametres du run INTEGER ierr, nid, nvarid, nqold CHARACTER str3*3,yes*1 REAL,ALLOCATABLE :: time(:) ! times stored in start INTEGER timelen ! number of times stored in the file INTEGER indextime ! index of selected time !REAL hour_ini ! fraction of day of stored date. Equivalent of day_ini, but 0= est absent" write(*,*)trim(nf90_strerror(ierr)) CALL abort ENDIF ierr=nf90_get_var(nid,nvarid,tab_cntrl) IF (ierr .NE. nf90_noerr) THEN PRINT*, "dynetat0: Lecture echoue pour " write(*,*)trim(nf90_strerror(ierr)) CALL abort ENDIF im = tab_cntrl(1) jm = tab_cntrl(2) lllm = tab_cntrl(3) day_ini = tab_cntrl(4) rad = tab_cntrl(5) omeg = tab_cntrl(6) g = tab_cntrl(7) cpp = tab_cntrl(8) kappa = tab_cntrl(9) daysec = tab_cntrl(10) dtvr = tab_cntrl(11) etot0 = tab_cntrl(12) ptot0 = tab_cntrl(13) ztot0 = tab_cntrl(14) stot0 = tab_cntrl(15) ang0 = tab_cntrl(16) pa = tab_cntrl(17) preff = tab_cntrl(18) hour_ini = tab_cntrl(29) c clon = tab_cntrl(19) clat = tab_cntrl(20) grossismx = tab_cntrl(21) grossismy = tab_cntrl(22) c IF ( tab_cntrl(23).EQ.1. ) THEN fxyhypb = . TRUE . dzoomx = tab_cntrl(24) dzoomy = tab_cntrl(25) taux = tab_cntrl(27) tauy = tab_cntrl(28) ELSE fxyhypb = . FALSE . ysinus = . FALSE . IF( tab_cntrl(26).EQ.1. ) ysinus = . TRUE. ENDIF c ................................................................. c c PRINT*,'dynetat0: rad,omeg,g,cpp,kappa',rad,omeg,g,cpp,kappa IF( im.ne.iim ) THEN PRINT 1,im,iim STOP ELSE IF( jm.ne.jjm ) THEN PRINT 2,jm,jjm STOP ELSE IF( lllm.ne.llm ) THEN PRINT 3,lllm,llm STOP ENDIF ierr=nf90_inq_varid(nid,"rlonu",nvarid) IF (ierr .NE. nf90_noerr) THEN PRINT*, "dynetat0: Le champ est absent" write(*,*)trim(nf90_strerror(ierr)) CALL abort ENDIF ierr=nf90_get_var(nid,nvarid,rlonu) IF (ierr .NE. nf90_noerr) THEN PRINT*, "dynetat0: Lecture echouee pour " write(*,*)trim(nf90_strerror(ierr)) CALL abort ENDIF ierr=nf90_inq_varid(nid,"rlatu",nvarid) IF (ierr .NE. nf90_noerr) THEN PRINT*, "dynetat0: Le champ est absent" write(*,*)trim(nf90_strerror(ierr)) CALL abort ENDIF ierr=nf90_get_var(nid,nvarid,rlatu) IF (ierr .NE. nf90_noerr) THEN PRINT*, "dynetat0: Lecture echouee pour " write(*,*)trim(nf90_strerror(ierr)) CALL abort ENDIF ierr=nf90_inq_varid(nid,"rlonv",nvarid) IF (ierr .NE. nf90_noerr) THEN PRINT*, "dynetat0: Le champ est absent" write(*,*)trim(nf90_strerror(ierr)) CALL abort ENDIF ierr=nf90_get_var(nid,nvarid,rlonv) IF (ierr .NE. nf90_noerr) THEN PRINT*, "dynetat0: Lecture echouee pour " write(*,*)trim(nf90_strerror(ierr)) CALL abort ENDIF ierr=nf90_inq_varid(nid,"rlatv",nvarid) IF (ierr .NE. nf90_noerr) THEN PRINT*, "dynetat0: Le champ est absent" write(*,*)trim(nf90_strerror(ierr)) CALL abort ENDIF ierr=nf90_get_var(nid,nvarid,rlatv) IF (ierr .NE. nf90_noerr) THEN PRINT*, "dynetat0: Lecture echouee pour rlatv" write(*,*)trim(nf90_strerror(ierr)) CALL abort ENDIF ierr=nf90_inq_varid(nid,"cu",nvarid) IF (ierr .NE. nf90_noerr) THEN PRINT*, "dynetat0: Le champ est absent" write(*,*)trim(nf90_strerror(ierr)) CALL abort ENDIF ierr=nf90_get_var(nid,nvarid,cu) IF (ierr .NE. nf90_noerr) THEN PRINT*, "dynetat0: Lecture echouee pour " write(*,*)trim(nf90_strerror(ierr)) CALL abort ENDIF ierr=nf90_inq_varid(nid,"cv",nvarid) IF (ierr .NE. nf90_noerr) THEN PRINT*, "dynetat0: Le champ est absent" write(*,*)trim(nf90_strerror(ierr)) CALL abort ENDIF ierr=nf90_get_var(nid,nvarid,cv) IF (ierr .NE. nf90_noerr) THEN PRINT*, "dynetat0: Lecture echouee pour " write(*,*)trim(nf90_strerror(ierr)) CALL abort ENDIF ierr=nf90_inq_varid(nid,"aire",nvarid) IF (ierr .NE. nf90_noerr) THEN PRINT*, "dynetat0: Le champ est absent" write(*,*)trim(nf90_strerror(ierr)) CALL abort ENDIF ierr=nf90_get_var(nid,nvarid,aire) IF (ierr .NE. nf90_noerr) THEN PRINT*, "dynetat0: Lecture echouee pour " write(*,*)trim(nf90_strerror(ierr)) CALL abort ENDIF ierr=nf90_inq_varid(nid,"phisinit",nvarid) IF (ierr .NE. nf90_noerr) THEN PRINT*, "dynetat0: Le champ est absent" write(*,*)trim(nf90_strerror(ierr)) CALL abort ENDIF ierr=nf90_get_var(nid,nvarid,phis) IF (ierr .NE. nf90_noerr) THEN PRINT*, "dynetat0: Lecture echouee pour " write(*,*)trim(nf90_strerror(ierr)) CALL abort ENDIF ! read time axis ierr = nf90_inq_dimid(nid,"Time",nvarid) ierr = nf90_inquire_dimension(nid,nvarid,len=timelen) ALLOCATE(time(timelen)) ierr=nf90_inq_varid(nid,"Time",nvarid) IF (ierr .NE. nf90_noerr) THEN ierr=nf90_inq_varid(nid,"temps", nvarid) IF (ierr .NE. nf90_noerr) THEN PRINT*, "dynetat0: