subroutine meso_readtesassim(ngrid,nlayer,zday,pplev,tauref,day_translate) ! Reading of the dust assimilation file implicit none include "dimensions.h" include "dimphys.h" include "comgeomfi.h" include "netcdf.inc" include "datafile.h" integer, intent(in) :: ngrid,nlayer real, intent(in) :: zday ! date in martian days real, dimension(ngrid,nlayer+1), intent(in) :: pplev real, dimension(ngrid), intent(out) :: tauref ! Local variables real :: realday integer nid,nvarid,ierr integer ltloop,lsloop,iloop,jloop,varloop,ig real, dimension(2) :: taubuf real tau1(4),tau real alt(4) integer latp(4),lonp(4) integer yinf,ysup,xinf,xsup,tinf,tsup real latinf,latsup,loninf,lonsup real latintmp,lonintmp,latdeg,londeg real colat,dlat,dlon,colattmp logical, save :: firstcall=.true. logical :: timeflag real radeg,pi integer :: timedim,londim,latdim real, dimension(:), allocatable, save :: lat,lon,time real, dimension(:,:,:), allocatable, save :: tautes integer, save :: timelen,lonlen,latlen INTEGER, external:: lnblnk !!WRF added INTEGER :: day_translate pi=acos(-1.) radeg=180/pi realday=mod(zday,669.) if (firstcall) then firstcall=.false. !! Note: datafile() is defined in "datafile.h" !print *,datafile(1:lnblnk(datafile)) !ierr=NF_OPEN (datafile(1:lnblnk(datafile))//"/input_totoptdep.nc",NF_NOWRITE,nid) !!------------------------------------- !! iaervar is used here to communicate the day starting the diagfi !! -- in addition, inpu_totoptdep.nc must be prepared day_translate=day_translate-1000 ierr=NF_OPEN ("./input_totoptdep.nc",NF_NOWRITE,nid) !!------------------------------------- IF (ierr.NE.NF_NOERR) THEN !write(*,*)'Problem opening dust.nc (in phymars/readtesassim.F90)' !write(*,*)'It should be in :',datafile(1:lnblnk(datafile)),'/' !write(*,*)'1) You can change this directory address in ' !write(*,*)' file phymars/datafile.h' !write(*,*)'2) If necessary, dust.nc (and other datafiles)' !write(*,*)' can be obtained online on:' !write(*,*)' http://www.lmd.jussieu.fr/~forget/datagcm/datafile' write(*,*)'Problem opening input_totoptdep.nc ...' CALL ABORT ENDIF ierr=NF_INQ_DIMID(nid,"time",timedim) ierr=NF_INQ_DIMLEN(nid,timedim,timelen) ierr=NF_INQ_DIMID(nid,"lat",latdim) ierr=NF_INQ_DIMLEN(nid,latdim,latlen) ierr=NF_INQ_DIMID(nid,"lon",londim) ierr=NF_INQ_DIMLEN(nid,londim,lonlen) allocate(tautes(lonlen,latlen,timelen)) allocate(lat(latlen), lon(lonlen), time(timelen)) ierr = NF_INQ_VARID (nid, "totoptdep",nvarid) #ifdef NC_DOUBLE ierr = NF_GET_VAR_DOUBLE(nid, nvarid, tautes) #else ierr = NF_GET_VAR_REAL(nid, nvarid, tautes) #endif IF (ierr .NE. NF_NOERR) THEN PRINT*, "Error: Readtesassim not found" stop ENDIF !!****WRF !! diagfi files feature the dust opacity divided by 700 Pa tautes=tautes*700. !!****WRF ierr = NF_INQ_VARID (nid, "time",nvarid) #ifdef NC_DOUBLE ierr = NF_GET_VAR_DOUBLE(nid, nvarid, time) #else ierr = NF_GET_VAR_REAL(nid, nvarid, time) #endif IF (ierr .NE. NF_NOERR) THEN PRINT*, "Error: Readtesassim