subroutine read_dust_scenario(ngrid,nlayer,zday,pplev,tau_pref_scenario) ! Reading of the dust scenario file use netcdf use geometry_mod, only: latitude, longitude ! in radians use datafile_mod, only: datadir use dust_param_mod, only: odpref, dustscaling_mode use planete_h, only: year_day USE mod_phys_lmdz_transfert_para, ONLY: bcast implicit none include "callkeys.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) :: tau_pref_scenario ! visible dust column ! opacity at odpref from scenario ! 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,save :: radeg,pi integer :: timedim,londim,latdim real, dimension(:), allocatable, save :: lat,lon,time real, dimension(:,:,:), allocatable, save :: tautes integer, save :: timelen,lonlen,latlen character(len=33),save :: filename !$OMP THREADPRIVATE(firstcall,radeg,pi, & !$OMP lat,lon,time,tautes, & !$OMP timelen,lonlen,latlen,filename) realday=mod(zday,669.) ! AS: firstcall OK absolute if (firstcall) then firstcall=.false. pi=acos(-1.) radeg=180/pi ! assimilated dust file: (NB: iaervar is a common in "callkeys.h") ! iaervar=4 means read dust_tes.nc file ! iaervar=6 means read dust_cold.nc file ! iaervar=7 means read dust_warm.nc file ! iaervar=8 means read dust_clim.nc file ! iaervar=24 means read dust_MY24.nc file ! iaervar=25 means read dust_MY25.nc file ! iaervar=26 means read dust_MY26.nc file, etc. if (iaervar.eq.4) then ! NB: 4: old TES assimilated MY24 dust scenarios (at 700Pa ref pressure!) filename="dust_tes.nc" else if (iaervar.eq.6) then filename="dust_cold.nc" else if (iaervar.eq.7) then filename="dust_warm.nc" else if (iaervar.eq.8) then filename="dust_clim.nc" else if ((iaervar.ge.24).and.(iaervar.le.35)) then write(filename,'(a7,i2,a3)')"dust_MY",iaervar,".nc" ! 124,125,126: old TES assimilated dust scenarios (at 700Pa ref pressure!) else if (iaervar.eq.124) then filename="dust_tes_MY24.nc" else if (iaervar.eq.125) then filename="dust_tes_MY25.nc" else if (iaervar.eq.126) then filename="dust_tes_MY26.nc" endif !$OMP MASTER ierr=nf90_open(trim(datadir)//"/"//trim(filename),NF90_NOWRITE,nid) IF (ierr.NE.nf90_noerr) THEN write(*,*)'Problem opening ',trim(filename),' (in phymars/read_dust_scenario.F90)' write(*,*)'It should be in :',trim(datadir),'/' write(*,*)'1) You can change this directory address in callfis.def with' write(*,*)' datadir=/path/to/datafiles' write(*,*)'2) If necessary, dust*.nc (and other datafiles)' write(*,*)' can be obtained online on:' write(*,*)' http://www.lmd.jussieu.fr/~lmdz/planets/mars/datadir' CALL abort_physic("read_dust_scenario","Cannot find file",1) ENDIF ierr=nf90_inq_dimid(nid,"Time",timedim) if (ierr.ne.nf90_noerr) then ! 'Time' dimension not found, look for 'time' ierr=nf90_inq_dimid(nid,"time",timedim) if (ierr.ne.nf90_noerr) then write(*,*)"Error: read_dust_scenario