Changes in / [bb579a9:aa8c34a] in flexpart.git
- Files:
-
- 8 added
- 9 deleted
- 26 edited
Legend:
- Unmodified
- Added
- Removed
-
src/FLEXPART.f90
rd8eed02 rc8fc724 33 33 ! * 34 34 !***************************************************************************** 35 ! Changes: *36 ! Unified ECMWF and GFS builds *37 ! Marian Harustak, 12.5.2017 *38 ! - Added detection of metdata format using gributils routines *39 ! - Distinguished calls to ecmwf/gfs gridcheck versions based on *40 ! detected metdata format *41 ! - Passed metdata format down to timemanager *42 !*****************************************************************************43 35 ! * 44 36 ! Variables: * … … 54 46 use netcdf_output_mod, only: writeheader_netcdf 55 47 use random_mod, only: gasdev1 56 use class_gribfile57 48 58 49 implicit none … … 61 52 integer :: idummy = -320 62 53 character(len=256) :: inline_options !pathfile, flexversion, arg2 63 integer :: metdata_format = GRIBFILE_CENTRE_UNKNOWN64 integer :: detectformat65 66 54 67 55 … … 82 70 ! FLEXPART version string 83 71 flexversion_major = '10' ! Major version number, also used for species file names 84 flexversion='Version '//trim(flexversion_major)//'. 2beta (2017-08-01)'72 flexversion='Version '//trim(flexversion_major)//'.1beta (2016-11-02)' 85 73 verbosity=0 86 74 … … 184 172 call readavailable 185 173 186 ! Detect metdata format187 !**********************188 189 metdata_format = detectformat()190 191 if (metdata_format.eq.GRIBFILE_CENTRE_ECMWF) then192 print *,'ECMWF metdata detected'193 elseif (metdata_format.eq.GRIBFILE_CENTRE_NCEP) then194 print *,'NCEP metdata detected'195 else196 print *,'Unknown metdata format'197 return198 endif199 200 201 202 174 ! If nested wind fields are used, allocate arrays 203 175 !************************************************ … … 216 188 endif 217 189 218 if (metdata_format.eq.GRIBFILE_CENTRE_ECMWF) then 219 call gridcheck_ecmwf 220 else 221 call gridcheck_gfs 222 end if 190 call gridcheck 223 191 224 192 if (verbosity.gt.1) then … … 443 411 endif 444 412 445 call timemanager (metdata_format)413 call timemanager 446 414 447 415 ! NIK 16.02.2005 -
src/FLEXPART_MPI.f90
rd8eed02 r5184a7c 33 33 ! * 34 34 !***************************************************************************** 35 ! Changes: *36 ! Unified ECMWF and GFS builds *37 ! Marian Harustak, 12.5.2017 *38 ! - Added detection of metdata format using gributils routines *39 ! - Distinguished calls to ecmwf/gfs gridcheck versions based on *40 ! detected metdata format *41 ! - Passed metdata format down to timemanager *42 !*****************************************************************************43 35 ! * 44 36 ! Variables: * … … 55 47 use netcdf_output_mod, only: writeheader_netcdf 56 48 use random_mod, only: gasdev1 57 use class_gribfile58 49 59 50 implicit none … … 62 53 integer :: idummy = -320 63 54 character(len=256) :: inline_options !pathfile, flexversion, arg2 64 integer :: metdata_format = GRIBFILE_CENTRE_UNKNOWN65 integer :: detectformat66 67 55 68 56 … … 92 80 ! FLEXPART version string 93 81 flexversion_major = '10' ! Major version number, also used for species file names 94 flexversion='Ver. '//trim(flexversion_major)//'. 2beta MPI (2017-08-01)'82 flexversion='Ver. '//trim(flexversion_major)//'.1beta MPI (2016-11-02)' 95 83 verbosity=0 96 84 … … 209 197 call readavailable 210 198 211 ! Detect metdata format212 !**********************213 214 metdata_format = detectformat()215 216 if (metdata_format.eq.GRIBFILE_CENTRE_ECMWF) then217 print *,'ECMWF metdata detected'218 elseif (metdata_format.eq.GRIBFILE_CENTRE_NCEP) then219 print *,'NCEP metdata detected'220 else221 print *,'Unknown metdata format'222 return223 endif224 225 226 227 199 ! If nested wind fields are used, allocate arrays 228 200 !************************************************ … … 241 213 endif 242 214 243 if (metdata_format.eq.GRIBFILE_CENTRE_ECMWF) then 244 call gridcheck_ecmwf 245 else 246 call gridcheck_gfs 247 end if 248 215 call gridcheck 249 216 250 217 if (verbosity.gt.1 .and. lroot) then … … 489 456 490 457 491 call timemanager (metdata_format)458 call timemanager 492 459 493 460 -
src/calcmatrix.f90
rd8eed02 re200b7a 20 20 !********************************************************************** 21 21 22 subroutine calcmatrix(lconv,delt,cbmf ,metdata_format)22 subroutine calcmatrix(lconv,delt,cbmf) 23 23 ! o i o 24 24 !***************************************************************************** … … 30 30 ! Petra Seibert, Bernd C. Krueger, 2000-2001 * 31 31 ! * 32 !*****************************************************************************33 ! Changes: *34 32 ! changed by C. Forster, November 2003 - February 2004 * 35 33 ! array fmassfrac(nconvlevmax,nconvlevmax) represents * 36 34 ! the convective redistribution matrix for the particles * 37 35 ! * 38 ! Unified ECMWF and GFS builds *39 ! Marian Harustak, 12.5.2017 *40 ! - Merged calcmatrix and calcmatrix_gfs into one routine using if-then *41 ! for meteo-type dependent code *42 !*****************************************************************************43 ! *44 36 ! lconv indicates whether there is convection in this cell, or not * 45 37 ! delt time step for convection [s] * 46 38 ! cbmf cloud base mass flux * 47 ! metdata_format format of metdata (ecmwf/gfs) *48 39 ! * 49 40 !***************************************************************************** … … 52 43 use com_mod 53 44 use conv_mod 54 use class_gribfile55 45 56 46 implicit none 57 47 58 48 real :: rlevmass,summe 59 integer :: metdata_format60 49 61 50 integer :: iflag, k, kk, kuvz … … 88 77 do kuvz = 2,nuvz 89 78 k = kuvz-1 90 if (metdata_format.eq.GRIBFILE_CENTRE_ECMWF) then91 79 pconv(k) = (akz(kuvz) + bkz(kuvz)*psconv) 92 80 phconv(kuvz) = (akm(kuvz) + bkm(kuvz)*psconv) 93 else94 phconv(kuvz) = 0.5*(pconv(kuvz)+pconv(k))95 endif96 81 dpr(k) = phconv(k) - phconv(kuvz) 97 82 qsconv(k) = f_qvsat( pconv(k), tconv(k) ) … … 100 85 do kk=1,nconvlev 101 86 fmassfrac(k,kk)=0. 102 end 103 end 87 enddo 88 enddo 104 89 105 90 -
src/calcpar.f90
r6ecb30a re200b7a 20 20 !********************************************************************** 21 21 22 subroutine calcpar(n,uuh,vvh,pvh ,metdata_format)22 subroutine calcpar(n,uuh,vvh,pvh) 23 23 ! i i i o 24 24 !***************************************************************************** … … 37 37 ! new variables in call to richardson * 38 38 ! * 39 ! CHANGE 17/11/2005 Caroline Forster NCEP GFS version * 40 ! * 41 ! Changes, Bernd C. Krueger, Feb. 2001: * 42 ! Variables tth and qvh (on eta coordinates) in common block * 43 ! * 44 ! Unified ECMWF and GFS builds * 45 ! Marian Harustak, 12.5.2017 * 46 ! - Merged calcpar and calcpar_gfs into one routine using if-then * 47 ! for meteo-type dependent code * 48 !***************************************************************************** 49 39 !***************************************************************************** 40 ! Changes, Bernd C. Krueger, Feb. 2001: 41 ! Variables tth and qvh (on eta coordinates) in common block 50 42 !***************************************************************************** 51 43 ! * 52 44 ! Variables: * 53 45 ! n temporal index for meteorological fields (1 to 3) * 54 ! uuh *55 ! vvh *56 ! pvh *57 ! metdata_format format of metdata (ecmwf/gfs) *58 46 ! * 59 47 ! Constants: * … … 68 56 use par_mod 69 57 use com_mod 70 use class_gribfile71 58 72 59 implicit none 73 60 74 integer :: metdata_format 75 integer :: n,ix,jy,i,kz,lz,kzmin,llev,loop_start 61 integer :: n,ix,jy,i,kz,lz,kzmin 76 62 real :: ttlev(nuvzmax),qvlev(nuvzmax),obukhov,scalev,ol,hmixplus 77 63 real :: ulev(nuvzmax),vlev(nuvzmax),ew,rh,vd(maxspec),subsceff,ylat 78 real :: altmin,tvold,pold,zold,pint,tv,zlev(nuvzmax) ,hmixdummy64 real :: altmin,tvold,pold,zold,pint,tv,zlev(nuvzmax) 79 65 real :: uuh(0:nxmax-1,0:nymax-1,nuvzmax) 80 66 real :: vvh(0:nxmax-1,0:nymax-1,nuvzmax) … … 125 111 !*********************************************** 126 112 127 if (metdata_format.eq.GRIBFILE_CENTRE_NCEP) then128 ! NCEP version: find first level above ground129 llev = 0130 do i=1,nuvz131 if (ps(ix,jy,1,n).lt.akz(i)) llev=i132 end do133 llev = llev+1134 if (llev.gt.nuvz) llev = nuvz-1135 ! NCEP version136 137 ! calculate inverse Obukhov length scale with tth(llev)138 113 ol=obukhov(ps(ix,jy,1,n),tt2(ix,jy,1,n),td2(ix,jy,1,n), & 139 tth(ix,jy,llev,n),ustar(ix,jy,1,n),sshf(ix,jy,1,n),akm,bkm,akz(llev),metdata_format) 140 else 141 llev=0 142 ol=obukhov(ps(ix,jy,1,n),tt2(ix,jy,1,n),td2(ix,jy,1,n), & 143 tth(ix,jy,2,n),ustar(ix,jy,1,n),sshf(ix,jy,1,n),akm,bkm,akz(llev),metdata_format) 144 end if 145 114 tth(ix,jy,2,n),ustar(ix,jy,1,n),sshf(ix,jy,1,n),akm,bkm) 146 115 if (ol.ne.0.) then 147 116 oli(ix,jy,1,n)=1./ol … … 161 130 end do 162 131 163 if (metdata_format.eq.GRIBFILE_CENTRE_NCEP) then164 ! NCEP version hmix has been read in in readwind.f, is therefore not calculated here165 132 call richardson(ps(ix,jy,1,n),ustar(ix,jy,1,n),ttlev,qvlev, & 166 133 ulev,vlev,nuvz,akz,bkz,sshf(ix,jy,1,n),tt2(ix,jy,1,n), & 167 td2(ix,jy,1,n),hmixdummy,wstar(ix,jy,1,n),hmixplus,metdata_format) 168 else 169 call richardson(ps(ix,jy,1,n),ustar(ix,jy,1,n),ttlev,qvlev, & 170 ulev,vlev,nuvz,akz,bkz,sshf(ix,jy,1,n),tt2(ix,jy,1,n), & 171 td2(ix,jy,1,n),hmix(ix,jy,1,n),wstar(ix,jy,1,n),hmixplus,metdata_format) 172 end if 134 td2(ix,jy,1,n),hmix(ix,jy,1,n),wstar(ix,jy,1,n),hmixplus) 173 135 174 136 if(lsubgrid.eq.1) then … … 211 173 !****************************************************** 212 174 213 ! 1) Calculate altitudes of model levels214 !*************************************** 175 ! 1) Calculate altitudes of ECMWF model levels 176 !********************************************* 215 177 216 178 tvold=tt2(ix,jy,1,n)*(1.+0.378*ew(td2(ix,jy,1,n))/ & … … 218 180 pold=ps(ix,jy,1,n) 219 181 zold=0. 220 if (metdata_format.eq.GRIBFILE_CENTRE_ECMWF) then 221 loop_start=2 222 else 223 loop_start=llev 224 end if 225 do kz=loop_start,nuvz 182 do kz=2,nuvz 226 183 pint=akz(kz)+bkz(kz)*ps(ix,jy,1,n) ! pressure on model layers 227 184 tv=tth(ix,jy,kz,n)*(1.+0.608*qvh(ix,jy,kz,n)) … … 242 199 !************************************************************************ 243 200 244 if (metdata_format.eq.GRIBFILE_CENTRE_ECMWF) then 245 loop_start=1 246 else 247 loop_start=llev 248 end if 249 250 do kz=loop_start,nuvz 201 do kz=1,nuvz 251 202 if (zlev(kz).ge.altmin) then 252 203 kzmin=kz -
src/calcpar_nests.f90
r6ecb30a rdb712a8 20 20 !********************************************************************** 21 21 22 subroutine calcpar_nests(n,uuhn,vvhn,pvhn ,metdata_format)22 subroutine calcpar_nests(n,uuhn,vvhn,pvhn) 23 23 ! i i i o 24 24 !***************************************************************************** … … 39 39 ! * 40 40 !***************************************************************************** 41 ! Changes, Bernd C. Krueger, Feb. 2001: * 42 ! Variables tth and qvh (on eta coordinates) in common block * 43 ! * 44 ! Unified ECMWF and GFS builds * 45 ! Marian Harustak, 12.5.2017 * 46 ! - Added passing of metdata_format as it was needed by called routines * 41 ! Changes, Bernd C. Krueger, Feb. 2001: 42 ! Variables tth and qvh (on eta coordinates) in common block 47 43 !***************************************************************************** 48 44 ! * 49 45 ! Variables: * 50 46 ! n temporal index for meteorological fields (1 to 3) * 51 ! metdata_format format of metdata (ecmwf/gfs) *52 47 ! * 53 48 ! Constants: * … … 65 60 implicit none 66 61 67 integer :: metdata_format68 62 integer :: n,ix,jy,i,l,kz,lz,kzmin 69 real :: ttlev(nuvzmax),qvlev(nuvzmax),obukhov,scalev,ol,hmixplus ,dummyakzllev63 real :: ttlev(nuvzmax),qvlev(nuvzmax),obukhov,scalev,ol,hmixplus 70 64 real :: ulev(nuvzmax),vlev(nuvzmax),ew,rh,vd(maxspec),subsceff,ylat 71 65 real :: altmin,tvold,pold,zold,pint,tv,zlev(nuvzmax) … … 116 110 ol=obukhov(psn(ix,jy,1,n,l),tt2n(ix,jy,1,n,l), & 117 111 td2n(ix,jy,1,n,l),tthn(ix,jy,2,n,l),ustarn(ix,jy,1,n,l), & 118 sshfn(ix,jy,1,n,l),akm,bkm ,dummyakzllev,metdata_format)112 sshfn(ix,jy,1,n,l),akm,bkm) 119 113 if (ol.ne.0.) then 120 114 olin(ix,jy,1,n,l)=1./ol … … 137 131 qvlev,ulev,vlev,nuvz,akz,bkz,sshfn(ix,jy,1,n,l), & 138 132 tt2n(ix,jy,1,n,l),td2n(ix,jy,1,n,l),hmixn(ix,jy,1,n,l), & 139 wstarn(ix,jy,1,n,l),hmixplus ,metdata_format)133 wstarn(ix,jy,1,n,l),hmixplus) 140 134 141 135 if(lsubgrid.eq.1) then -
src/convmix.f90
r6ecb30a r8a65cb0 20 20 !********************************************************************** 21 21 22 subroutine convmix(itime ,metdata_format)22 subroutine convmix(itime) 23 23 ! i 24 24 !************************************************************** … … 31 31 !CHANGES by A. Stohl: 32 32 ! various run-time optimizations - February 2005 33 ! CHANGES by C. Forster, November 2005, NCEP GFS version34 ! in the ECMWF version convection is calculated on the35 ! original eta-levels36 ! in the GFS version convection is calculated on the37 ! FLEXPART levels38 !39 ! Unified ECMWF and GFS builds40 ! Marian Harustak, 12.5.201741 ! - Merged convmix and convmix_gfs into one routine using if-then42 ! for meteo-type dependent code43 33 !************************************************************** 44 34 … … 47 37 use com_mod 48 38 use conv_mod 49 use class_gribfile50 39 51 40 implicit none … … 55 44 integer :: jy, kpart, ktop, ngrid,kz 56 45 integer :: igrid(maxpart), ipoint(maxpart), igridn(maxpart,maxnests) 57 integer :: metdata_format58 46 59 47 ! itime [s] current time … … 116 104 117 105 ngrid=0 118 if (metdata_format.eq.GRIBFILE_CENTRE_ECMWF) then119 106 do j=numbnests,1,-1 120 107 if ( x.gt.xln(j)+eps .and. x.lt.xrn(j)-eps .and. & … … 124 111 endif 125 112 end do 126 else127 do j=numbnests,1,-1128 if ( x.gt.xln(j) .and. x.lt.xrn(j) .and. &129 y.gt.yln(j) .and. y.lt.yrn(j) ) then130 ngrid=j131 goto 23132 endif133 end do134 endif135 113 23 continue 136 114 … … 189 167 td2conv=(td2(ix,jy,1,mind1)*dt2+td2(ix,jy,1,mind2)*dt1)*dtt 190 168 !!$ do kz=1,nconvlev+1 !old 191 if (metdata_format.eq.GRIBFILE_CENTRE_ECMWF) then192 169 do kz=1,nuvz-1 !bugfix 193 170 tconv(kz)=(tth(ix,jy,kz+1,mind1)*dt2+ & … … 196 173 qvh(ix,jy,kz+1,mind2)*dt1)*dtt 197 174 end do 198 else199 do kz=1,nuvz-1 !bugfix200 pconv(kz)=(pplev(ix,jy,kz,mind1)*dt2+ &201 pplev(ix,jy,kz,mind2)*dt1)*dtt202 tconv(kz)=(tt(ix,jy,kz,mind1)*dt2+ &203 tt(ix,jy,kz,mind2)*dt1)*dtt204 qconv(kz)=(qv(ix,jy,kz,mind1)*dt2+ &205 qv(ix,jy,kz,mind2)*dt1)*dtt206 end do207 end if208 175 209 176 ! Calculate translocation matrix 210 call calcmatrix(lconv,delt,cbaseflux(ix,jy) ,metdata_format)177 call calcmatrix(lconv,delt,cbaseflux(ix,jy)) 211 178 igrold = igr 212 179 ktop = 0 … … 285 252 ! calculate translocation matrix 286 253 !******************************* 287 call calcmatrix(lconv,delt,cbasefluxn(ix,jy,inest) ,metdata_format)254 call calcmatrix(lconv,delt,cbasefluxn(ix,jy,inest)) 288 255 igrold = igr 289 256 ktop = 0 -
src/getfields.f90
r6ecb30a rd1a8707 20 20 !********************************************************************** 21 21 22 subroutine getfields(itime,nstop ,metdata_format)22 subroutine getfields(itime,nstop) 23 23 ! i o 24 24 !***************************************************************************** … … 38 38 ! * 39 39 !***************************************************************************** 40 ! Changes, Bernd C. Krueger, Feb. 2001: * 41 ! Variables tth,qvh,tthn,qvhn (on eta coordinates) in common block. * 42 ! Function of nstop extended. * 43 ! * 44 ! Unified ECMWF and GFS builds * 45 ! Marian Harustak, 12.5.2017 * 46 ! - Added passing of metdata_format as it was needed by called routines * 40 ! Changes, Bernd C. Krueger, Feb. 2001: 41 ! Variables tth,qvh,tthn,qvhn (on eta coordinates) in common block. 42 ! Function of nstop extended. 47 43 !***************************************************************************** 48 44 ! * … … 62 58 ! tt(0:nxmax,0:nymax,nuvzmax,2) temperature [K] * 63 59 ! ps(0:nxmax,0:nymax,2) surface pressure [Pa] * 64 ! metdata_format format of metdata (ecmwf/gfs) *65 60 ! * 66 61 ! Constants: * … … 72 67 use par_mod 73 68 use com_mod 74 use class_gribfile75 69 76 70 implicit none 77 71 78 72 integer :: indj,itime,nstop,memaux 79 integer :: metdata_format80 73 81 74 real :: uuh(0:nxmax-1,0:nymax-1,nuvzmax) … … 132 125 do indj=indmin,numbwf-1 133 126 if (ldirect*wftime(indj+1).gt.ldirect*itime) then 134 if (metdata_format.eq.GRIBFILE_CENTRE_ECMWF) then 135 call readwind_ecmwf(indj+1,memind(2),uuh,vvh,wwh) 136 else 137 call readwind_gfs(indj+1,memind(2),uuh,vvh,wwh) 138 end if 127 call readwind(indj+1,memind(2),uuh,vvh,wwh) 139 128 call readwind_nests(indj+1,memind(2),uuhn,vvhn,wwhn) 140 call calcpar(memind(2),uuh,vvh,pvh,metdata_format) 141 call calcpar_nests(memind(2),uuhn,vvhn,pvhn,metdata_format) 142 if (metdata_format.eq.GRIBFILE_CENTRE_ECMWF) then 143 call verttransform_ecmwf(memind(2),uuh,vvh,wwh,pvh) 144 else 145 call verttransform_gfs(memind(2),uuh,vvh,wwh,pvh) 146 end if 129 call calcpar(memind(2),uuh,vvh,pvh) 130 call calcpar_nests(memind(2),uuhn,vvhn,pvhn) 131 call verttransform(memind(2),uuh,vvh,wwh,pvh) 147 132 call verttransform_nests(memind(2),uuhn,vvhn,wwhn,pvhn) 148 133 memtime(2)=wftime(indj+1) … … 167 152 (ldirect*wftime(indj+1).gt.ldirect*itime)) then 168 153 memind(1)=1 169 if (metdata_format.eq.GRIBFILE_CENTRE_ECMWF) then 170 call readwind_ecmwf(indj,memind(1),uuh,vvh,wwh) 171 else 172 call readwind_gfs(indj,memind(1),uuh,vvh,wwh) 173 end if 154 call readwind(indj,memind(1),uuh,vvh,wwh) 174 155 call readwind_nests(indj,memind(1),uuhn,vvhn,wwhn) 175 call calcpar(memind(1),uuh,vvh,pvh,metdata_format) 176 call calcpar_nests(memind(1),uuhn,vvhn,pvhn,metdata_format) 177 if (metdata_format.eq.GRIBFILE_CENTRE_ECMWF) then 178 call verttransform_ecmwf(memind(1),uuh,vvh,wwh,pvh) 179 else 180 call verttransform_gfs(memind(1),uuh,vvh,wwh,pvh) 181 end if 156 call calcpar(memind(1),uuh,vvh,pvh) 157 call calcpar_nests(memind(1),uuhn,vvhn,pvhn) 158 call verttransform(memind(1),uuh,vvh,wwh,pvh) 182 159 call verttransform_nests(memind(1),uuhn,vvhn,wwhn,pvhn) 183 160 memtime(1)=wftime(indj) 184 161 memind(2)=2 185 if (metdata_format.eq.GRIBFILE_CENTRE_ECMWF) then 186 call readwind_ecmwf(indj+1,memind(2),uuh,vvh,wwh) 187 else 188 call readwind_gfs(indj+1,memind(2),uuh,vvh,wwh) 189 end if 162 call readwind(indj+1,memind(2),uuh,vvh,wwh) 190 163 call readwind_nests(indj+1,memind(2),uuhn,vvhn,wwhn) 191 call calcpar(memind(2),uuh,vvh,pvh,metdata_format) 192 call calcpar_nests(memind(2),uuhn,vvhn,pvhn,metdata_format) 193 if (metdata_format.eq.GRIBFILE_CENTRE_ECMWF) then 194 call verttransform_ecmwf(memind(2),uuh,vvh,wwh,pvh) 195 else 196 call verttransform_gfs(memind(2),uuh,vvh,wwh,pvh) 197 end if 164 call calcpar(memind(2),uuh,vvh,pvh) 165 call calcpar_nests(memind(2),uuhn,vvhn,pvhn) 166 call verttransform(memind(2),uuh,vvh,wwh,pvh) 198 167 call verttransform_nests(memind(2),uuhn,vvhn,wwhn,pvhn) 199 168 memtime(2)=wftime(indj+1) -
src/getfields_mpi.f90
r6ecb30a r78e62dc 20 20 !********************************************************************** 21 21 22 subroutine getfields(itime,nstop,memstat ,metdata_format)22 subroutine getfields(itime,nstop,memstat) 23 23 ! i o o 24 24 !***************************************************************************** … … 58 58 ! memstat=0: no new fields to be read 59 59 ! 60 ! Unified ECMWF and GFS builds61 ! Marian Harustak, 12.5.201762 ! - Added passing of metdata_format as it was needed by called routines63 !64 60 !***************************************************************************** 65 61 ! * … … 81 77 ! tt(0:nxmax,0:nymax,nuvzmax,numwfmem) temperature [K] * 82 78 ! ps(0:nxmax,0:nymax,numwfmem) surface pressure [Pa] * 83 ! metdata_format format of metdata (ecmwf/gfs) *84 79 ! * 85 80 ! Constants: * … … 92 87 use com_mod 93 88 use mpi_mod, only: lmpreader,lmp_use_reader,lmp_sync 94 use class_gribfile95 89 96 90 implicit none 97 91 98 integer :: metdata_format99 92 integer :: indj,itime,nstop,memaux,mindread 100 93 ! mindread: index of where to read 3rd field … … 211 204 if (ldirect*wftime(indj+1).gt.ldirect*itime) then 212 205 if (lmpreader.or..not. lmp_use_reader) then 213 if (metdata_format.eq.GRIBFILE_CENTRE_ECMWF) then 214 call readwind_ecmwf(indj+1,mindread,uuh,vvh,wwh) 215 else 216 call readwind_gfs(indj+1,mindread,uuh,vvh,wwh) 217 end if 206 call readwind(indj+1,mindread,uuh,vvh,wwh) 218 207 call readwind_nests(indj+1,mindread,uuhn,vvhn,wwhn) 219 call calcpar(mindread,uuh,vvh,pvh,metdata_format) 220 call calcpar_nests(mindread,uuhn,vvhn,pvhn,metdata_format) 221 if (metdata_format.eq.GRIBFILE_CENTRE_ECMWF) then 222 call verttransform_ecmwf(mindread,uuh,vvh,wwh,pvh) 223 else 224 call verttransform_gfs(mindread,uuh,vvh,wwh,pvh) 225 end if 208 call calcpar(mindread,uuh,vvh,pvh) 209 call calcpar_nests(mindread,uuhn,vvhn,pvhn) 210 call verttransform(mindread,uuh,vvh,wwh,pvh) 226 211 call verttransform_nests(mindread,uuhn,vvhn,wwhn,pvhn) 227 212 end if … … 245 230 memind(1)=1 246 231 if (lmpreader.or..not.lmp_use_reader) then 247 if (metdata_format.eq.GRIBFILE_CENTRE_ECMWF) then 248 call readwind_ecmwf(indj,memind(1),uuh,vvh,wwh) 249 else 250 call readwind_gfs(indj,memind(1),uuh,vvh,wwh) 251 end if 232 call readwind(indj,memind(1),uuh,vvh,wwh) 252 233 call readwind_nests(indj,memind(1),uuhn,vvhn,wwhn) 253 call calcpar(memind(1),uuh,vvh,pvh,metdata_format) 254 call calcpar_nests(memind(1),uuhn,vvhn,pvhn,metdata_format) 255 if (metdata_format.eq.GRIBFILE_CENTRE_ECMWF) then 256 call verttransform_ecmwf(memind(1),uuh,vvh,wwh,pvh) 257 else 258 call verttransform_gfs(memind(1),uuh,vvh,wwh,pvh) 259 end if 234 call calcpar(memind(1),uuh,vvh,pvh) 235 call calcpar_nests(memind(1),uuhn,vvhn,pvhn) 236 call verttransform(memind(1),uuh,vvh,wwh,pvh) 260 237 call verttransform_nests(memind(1),uuhn,vvhn,wwhn,pvhn) 261 238 end if … … 263 240 memind(2)=2 264 241 if (lmpreader.or..not.lmp_use_reader) then 265 if (metdata_format.eq.GRIBFILE_CENTRE_ECMWF) then 266 call readwind_ecmwf(indj+1,memind(2),uuh,vvh,wwh) 267 else 268 call readwind_gfs(indj+1,memind(2),uuh,vvh,wwh) 269 end if 242 call readwind(indj+1,memind(2),uuh,vvh,wwh) 270 243 call readwind_nests(indj+1,memind(2),uuhn,vvhn,wwhn) 271 call calcpar(memind(2),uuh,vvh,pvh,metdata_format) 272 call calcpar_nests(memind(2),uuhn,vvhn,pvhn,metdata_format) 273 if (metdata_format.eq.GRIBFILE_CENTRE_ECMWF) then 274 call verttransform_ecmwf(memind(2),uuh,vvh,wwh,pvh) 275 else 276 call verttransform_gfs(memind(2),uuh,vvh,wwh,pvh) 277 end if 244 call calcpar(memind(2),uuh,vvh,pvh) 245 call calcpar_nests(memind(2),uuhn,vvhn,pvhn) 246 call verttransform(memind(2),uuh,vvh,wwh,pvh) 278 247 call verttransform_nests(memind(2),uuhn,vvhn,wwhn,pvhn) 279 248 end if -
src/gridcheck_gfs.f90
rd8eed02 r4c64400 20 20 !********************************************************************** 21 21 22 subroutine gridcheck _gfs22 subroutine gridcheck 23 23 24 24 !********************************************************************** … … 38 38 ! CHANGE: 03/12/2008, Harald Sodemann, update to f90 with * 39 39 ! ECMWF grib_api * 40 ! *41 ! Unified ECMWF and GFS builds *42 ! Marian Harustak, 12.5.2017 *43 ! - Renamed routine from gridcheck to gridcheck_gfs *44 40 ! * 45 41 !********************************************************************** … … 231 227 yaux2in,iret) 232 228 call grib_check(iret,gribFunction,gribErrorMsg) 233 234 ! Fix for flexpart.eu ticket #48235 if (xaux2in.lt.0) xaux2in = 359.0236 229 237 230 xaux1=xaux1in … … 544 537 endif 545 538 546 end subroutine gridcheck _gfs539 end subroutine gridcheck -
src/makefile
rd8eed02 rd1a8707 12 12 # 'make -j ecmwf gcc=4.9', 13 13 # also set environment variable LD_LIBRARY_PATH to point to compiler libraries 14 #15 # Makefile was modified to produce unified executable for both ECMWF and GFS meteo data formats16 # gributils were included to detect format of meteo data17 #18 # Cpp directives USE_MPIINPLACE were added to three source files. The effect of these directives19 # are to enable the MPI_IN_PLACE option only if compiled with a -DUSE_MPIINPLACE directive.20 # Otherwise, a safer option (which requires the allocation of another array) is used by default.21 # In makefile added the -x f95-cpp-input flag for compiling of cpp directives.22 14 # 23 15 # USAGE 24 # Compile serial FLEXPART 25 # make [-j] serial26 # 27 # Compile parallel FLEXPART 28 # make [-j] mpi16 # Compile serial FLEXPART (ECMWF) 17 # make [-j] ecmwf 18 # 19 # Compile parallel FLEXPART (ECMWF) 20 # make [-j] ecmwf-mpi 29 21 # 30 # Compile for debugging parallel FLEXPART 31 # make [-j] mpi-dbg 22 # Compile for debugging parallel FLEXPART (ECMWF) 23 # make [-j] ecmwf-mpi-dbg 24 # 25 # Compile serial FLEXPART (GFS) 26 # make [-j] gfs 27 # 28 # Compile parallel FLEXPART (GFS) 29 # make [-j] gfs-mpi 32 30 # 33 31 ################################################################################ 34 32 35 33 ## PROGRAMS 36 # Unified executable names 37 # The same executable is used for both ECMWF and GFS metdata 38 39 # Parallel processing executable 40 FLEXPART-MPI = FLEXPART_MPI 41 42 # Parallel processing executable with debugging info 43 FLEXPART-MPI-DBG = DBG_FLEXPART_MPI 44 45 # Serial processing executable 46 FLEXPART-SERIAL = FLEXPART 47 34 FLEXPART-ECMWF-MPI = FP_ecmwf_MPI 35 FLEXPART-ECMWF-MPI-DBG = DBG_FP_ecmwf_MPI 36 FLEXPART-ECMWF = FP_ecmwf_gfortran 37 FLEXPART-GFS = FP_gfs_gfortran 38 FLEXPART-GFS-MPI = FP_gfs_MPI 48 39 49 40 ifeq ($(gcc), 4.9) … … 70 61 71 62 72 # path to gributils used to detect meteodata format73 VPATH = gributils/74 75 76 63 ## OPTIMIZATION LEVEL 77 64 O_LEV = 2 # [0,1,2,3,g,s,fast] … … 81 68 LIBS = -lgrib_api_f90 -lgrib_api -lm -ljasper -lnetcdff # -fopenmp 82 69 83 FFLAGS = -I$(INCPATH1) -I$(INCPATH2) -O$(O_LEV) -g - cpp -m64 -mcmodel=medium -fconvert=little-endian -frecord-marker=4 -fmessage-length=0 -flto=jobserver -O$(O_LEV) $(FUSER) #-Warray-bounds -fcheck=all # -march=native84 85 DBGFLAGS = -I$(INCPATH1) -I$(INCPATH2) -O$(O_LEV_DBG) -g3 -ggdb3 - cpp -m64 -mcmodel=medium -fconvert=little-endian -frecord-marker=4 -fmessage-length=0 -flto=jobserver -O$(O_LEV_DBG) -fbacktrace -Wall -fdump-core $(FUSER) # -ffpe-trap=invalid,overflow,denormal,underflow,zero -Warray-bounds -fcheck=all86 87 LDFLAGS = $(FFLAGS) -L$(LIBPATH1) -Wl,-rpath,$(LIBPATH1)$(LIBS) #-L$(LIBPATH2)70 FFLAGS = -I$(INCPATH1) -I$(INCPATH2) -O$(O_LEV) -g -m64 -mcmodel=medium -fconvert=little-endian -frecord-marker=4 -fmessage-length=0 -flto=jobserver -O$(O_LEV) $(FUSER) #-Warray-bounds -fcheck=all # -march=native 71 72 DBGFLAGS = -I$(INCPATH1) -I$(INCPATH2) -O$(O_LEV_DBG) -g3 -ggdb3 -m64 -mcmodel=medium -fconvert=little-endian -frecord-marker=4 -fmessage-length=0 -flto=jobserver -O$(O_LEV_DBG) -fbacktrace -Wall -fdump-core $(FUSER) # -ffpe-trap=invalid,overflow,denormal,underflow,zero -Warray-bounds -fcheck=all 73 74 LDFLAGS = $(FFLAGS) -L$(LIBPATH1) $(LIBS) #-L$(LIBPATH2) 88 75 LDDEBUG = $(DBGFLAGS) -L$(LIBPATH1) $(LIBS) #-L$(LIBPATH2) 89 76 … … 95 82 xmass_mod.o flux_mod.o \ 96 83 point_mod.o outg_mod.o \ 97 mean_mod.o random_mod.o \ 98 class_gribfile_mod.o 84 mean_mod.o random_mod.o 99 85 100 86 MPI_MODOBJS = \ … … 113 99 redist.o \ 114 100 concoutput_surf.o concoutput_surf_nest.o \ 115 getfields.o \ 116 readwind_ecmwf.o 101 getfields.o 117 102 118 103 ## For MPI version … … 127 112 redist_mpi.o \ 128 113 concoutput_surf_mpi.o concoutput_surf_nest_mpi.o \ 129 getfields_mpi.o \ 130 readwind_ecmwf_mpi.o 114 getfields_mpi.o 115 116 ### WINDFIELDS 117 ## For ECMWF (serial) version: 118 OBJECTS_ECMWF = \ 119 calcpar.o readwind.o \ 120 richardson.o verttransform.o \ 121 obukhov.o gridcheck.o \ 122 convmix.o calcmatrix.o \ 123 ecmwf_mod.o 124 125 126 ## For ECMWF MPI version: 127 OBJECTS_ECMWF_MPI = \ 128 gridcheck.o readwind_mpi.o \ 129 calcpar.o \ 130 richardson.o verttransform.o \ 131 obukhov.o \ 132 convmix.o calcmatrix.o \ 133 ecmwf_mod.o 134 135 ## For GFS (serial) version: 136 OBJECTS_GFS = \ 137 calcpar_gfs.o readwind_gfs.o \ 138 richardson_gfs.o verttransform_gfs.o \ 139 obukhov_gfs.o gridcheck_gfs.o \ 140 convmix_gfs.o calcmatrix_gfs.o \ 141 gfs_mod.o 131 142 132 143 OBJECTS = \ … … 143 154 ew.o readreleases.o \ 144 155 readdepo.o get_vdep_prob.o \ 145 get_wetscav.o readwind_gfs.o\156 get_wetscav.o \ 146 157 psim.o outgrid_init.o \ 147 outgrid_init_nest.o calcmatrix.o\158 outgrid_init_nest.o \ 148 159 photo_O1D.o readlanduse.o \ 149 160 interpol_wind.o readoutgrid.o \ 150 161 interpol_all.o readpaths.o \ 151 getrb.o obukhov.o\152 getrc.o convmix.o\162 getrb.o \ 163 getrc.o \ 153 164 getvdep.o readspecies.o \ 154 interpol_misslev.o richardson.o\155 scalev.o verttransform_ecmwf.o\156 pbl_profile.o readOHfield.o 157 juldate.o verttransform_gfs.o\165 interpol_misslev.o \ 166 scalev.o \ 167 pbl_profile.o readOHfield.o\ 168 juldate.o \ 158 169 interpol_vdep.o interpol_rain.o \ 159 170 hanna.o wetdepokernel.o \ 160 calcpar.owetdepo.o \171 wetdepo.o \ 161 172 hanna_short.o windalign.o \ 162 hanna1.o gridcheck_ecmwf.o\163 gridcheck_gfs.ogridcheck_nests.o \173 hanna1.o \ 174 gridcheck_nests.o \ 164 175 readwind_nests.o calcpar_nests.o \ 165 176 verttransform_nests.o interpol_all_nests.o \ 166 177 interpol_wind_nests.o interpol_misslev_nests.o \ 167 178 interpol_vdep_nests.o interpol_rain_nests.o \ 168 readageclasses.o detectformat.o\179 readageclasses.o \ 169 180 calcfluxes.o fluxoutput.o \ 170 181 qvsat.o skplin.o \ … … 190 201 %.o: %.mod 191 202 192 # serial executable 193 serial: $(FLEXPART-SERIAL) 194 serial: FC := $(F90) 195 196 # parallel processing executable 197 mpi: $(FLEXPART-MPI) 198 mpi: FC := $(MPIF90) 199 200 # parallel processing with debugging info 201 mpi-dbg: $(FLEXPART-MPI-DBG) 202 mpi-dbg: FFLAGS := $(DBGFLAGS) 203 mpi-dbg: LDFLAGS:= $(LDDEBUG) 204 mpi-dbg: FC := $(MPIF90) 205 206 $(FLEXPART-SERIAL): $(MODOBJS) $(OBJECTS) $(OBJECTS_SERIAL) 207 +$(FC) -o $@ $(MODOBJS) $(OBJECTS) $(OBJECTS_SERIAL) $(LDFLAGS) 208 209 $(FLEXPART-MPI): $(MODOBJS) $(MPI_MODOBJS) $(OBJECTS) $(OBJECTS_MPI) 203 ecmwf: $(FLEXPART-ECMWF) 204 ecmwf: FC := $(F90) 205 206 ecmwf-mpi: $(FLEXPART-ECMWF-MPI) 207 ecmwf-mpi: FC := $(MPIF90) 208 209 ecmwf-mpi-dbg: $(FLEXPART-ECMWF-MPI-DBG) 210 ecmwf-mpi-dbg: FFLAGS := $(DBGFLAGS) 211 ecmwf-mpi-dbg: LDFLAGS:= $(LDDEBUG) 212 ecmwf-mpi-dbg: FC := $(MPIF90) 213 214 gfs: $(FLEXPART-GFS) 215 gfs: FC := $(F90) 216 217 gfs-mpi: $(FLEXPART-GFS-MPI) 218 gfs-mpi: FC := $(MPIF90) 219 220 #all: $(FLEXPART-ECMWF) 221 #all: $(FLEXPART-ECMWF-MPI) 222 223 ## This allows for switching between ECMWF/GFS without editing source code. 224 wind_mod = ecmwf_mod.o # default wind 225 # ifeq ($(MAKECMDGOALS),ecmwf) 226 # wind_mod = ecmwf_mod.o 227 # endif 228 # ifeq ($(MAKECMDGOALS),ecmwf-mpi) 229 # wind_mod = ecmwf_mod.o 230 # endif 231 # ifeq ($(MAKECMDGOALS),ecmwf-mpi-dbg) 232 # wind_mod = ecmwf_mod.o 233 # endif 234 235 ifeq ($(MAKECMDGOALS),gfs) 236 wind_mod = gfs_mod.o 237 endif 238 ifeq ($(MAKECMDGOALS),gfs-mpi) 239 wind_mod = gfs_mod.o 240 endif 241 242 $(FLEXPART-ECMWF): $(MODOBJS) $(OBJECTS) $(OBJECTS_SERIAL) $(OBJECTS_ECMWF) 243 +$(FC) -o $@ $(MODOBJS) $(OBJECTS) $(OBJECTS_SERIAL) $(OBJECTS_ECMWF) $(LDFLAGS) 244 245 $(FLEXPART-ECMWF-MPI): $(MODOBJS) $(MPI_MODOBJS) $(OBJECTS) $(OBJECTS_MPI) $(OBJECTS_ECMWF_MPI) 210 246 +$(FC) -o $@ $(MODOBJS) $(MPI_MODOBJS) $(OBJECTS) $(OBJECTS_MPI) \ 211 $(LDFLAGS) 212 213 $(FLEXPART-MPI-DBG): $(MODOBJS) $(MPI_MODOBJS) $(OBJECTS) $(OBJECTS_MPI) 247 $(OBJECTS_ECMWF_MPI) $(LDFLAGS) 248 # +$(FC) -o $@ *.o $(LDFLAGS) 249 250 $(FLEXPART-ECMWF-MPI-DBG): $(MODOBJS) $(MPI_MODOBJS) $(OBJECTS) $(OBJECTS_MPI) \ 251 $(OBJECTS_ECMWF_MPI) 214 252 +$(FC) -o $@ $(MODOBJS) $(MPI_MODOBJS) $(OBJECTS) $(OBJECTS_MPI) \ 215 $(LDFLAGS) 253 $(OBJECTS_ECMWF_MPI) $(LDFLAGS) 254 255 $(FLEXPART-GFS): $(MODOBJS) $(OBJECTS) $(OBJECTS_SERIAL) $(OBJECTS_GFS) 256 +$(FC) -o $@ $(MODOBJS) $(OBJECTS) $(OBJECTS_SERIAL) $(OBJECTS_GFS) $(LDFLAGS) 257 258 $(FLEXPART-GFS-MPI): $(MODOBJS) $(MPI_MODOBJS) $(OBJECTS) $(OBJECTS_MPI) $(OBJECTS_GFS) 259 +$(FC) -o $@ $(MODOBJS) $(MPI_MODOBJS) $(OBJECTS) $(OBJECTS_MPI) \ 260 $(OBJECTS_GFS) $(LDFLAGS) 216 261 217 262 %.o: %.f90 … … 222 267 223 268 cleanall: 224 \rm -f *.o *.mod $(FLEXPART- MPI) $(FLEXPART-MPI-DBG) $(FLEXPART-SERIAL)225 269 \rm -f *.o *.mod $(FLEXPART-ECMWF-MPI) $(FLEXPART-ECMWF-MPI-DBG) $(FLEXPART-ECMWF) \ 270 $(FLEXPART-GFS-MPI) $(FLEXPART-GFS) 226 271 227 272 .SUFFIXES = $(SUFFIXES) .f90 … … 237 282 random_mod.o 238 283 calcfluxes.o: com_mod.o flux_mod.o outg_mod.o par_mod.o 239 calcmatrix.o: com_mod.o conv_mod.o par_mod.o class_gribfile_mod.o 240 calcpar.o: com_mod.o par_mod.o class_gribfile_mod.o 284 calcmatrix.o: com_mod.o conv_mod.o par_mod.o 285 calcmatrix_gfs.o: com_mod.o conv_mod.o par_mod.o 286 calcpar.o: com_mod.o par_mod.o 287 calcpar_gfs.o: com_mod.o par_mod.o 241 288 calcpar_nests.o: com_mod.o par_mod.o 242 289 calcpv.o: com_mod.o par_mod.o … … 264 311 conv_mod.o: par_mod.o 265 312 convect43c.o: conv_mod.o par_mod.o 266 convmix.o: com_mod.o conv_mod.o flux_mod.o par_mod.o class_gribfile_mod.o 313 convmix.o: com_mod.o conv_mod.o flux_mod.o par_mod.o 314 convmix_gfs.o: com_mod.o conv_mod.o par_mod.o 267 315 coordtrafo.o: com_mod.o par_mod.o point_mod.o 268 detectformat.o: com_mod.o par_mod.o class_gribfile_mod.o269 316 distance.o: par_mod.o 270 317 distance2.o: par_mod.o … … 272 319 drydepokernel_nest.o: com_mod.o par_mod.o unc_mod.o 273 320 erf.o: par_mod.o 274 FLEXPART.o: com_mod.o conv_mod.o par_mod.o point_mod.o random_mod.o netcdf_output_mod.o class_gribfile_mod.o321 FLEXPART.o: com_mod.o conv_mod.o par_mod.o point_mod.o random_mod.o netcdf_output_mod.o 275 322 FLEXPART_MPI.o: com_mod.o conv_mod.o mpi_mod.o par_mod.o point_mod.o \ 276 random_mod.o netcdf_output_mod.o class_gribfile_mod.o323 random_mod.o netcdf_output_mod.o 277 324 fluxoutput.o: com_mod.o flux_mod.o outg_mod.o par_mod.o 278 325 get_settling.o: com_mod.o par_mod.o 279 getfields.o: com_mod.o par_mod.o class_gribfile_mod.o280 getfields_mpi.o: com_mod.o par_mod.o mpi_mod.o class_gribfile_mod.o326 getfields.o: com_mod.o par_mod.o 327 getfields_mpi.o: com_mod.o par_mod.o mpi_mod.o 281 328 gethourlyOH.o: com_mod.o oh_mod.o par_mod.o 282 329 getrb.o: par_mod.o … … 284 331 getvdep.o: com_mod.o par_mod.o 285 332 getvdep_nests.o: com_mod.o par_mod.o 286 gridcheck _ecmwf.o: cmapf_mod.o com_mod.o conv_mod.o par_mod.o333 gridcheck.o: cmapf_mod.o com_mod.o conv_mod.o par_mod.o 287 334 gridcheck_emos.o: com_mod.o conv_mod.o par_mod.o 288 335 gridcheck_fnl.o: cmapf_mod.o com_mod.o conv_mod.o par_mod.o … … 319 366 mpi_mod.o: com_mod.o par_mod.o unc_mod.o 320 367 netcdf_output_mod.o: com_mod.o outg_mod.o par_mod.o point_mod.o unc_mod.o mean_mod.o 321 obukhov.o: par_mod.o class_gribfile_mod.o 368 obukhov.o: par_mod.o 369 obukhov_gfs.o: par_mod.o 322 370 ohreaction.o: com_mod.o oh_mod.o par_mod.o 323 371 openouttraj.o: com_mod.o par_mod.o point_mod.o … … 326 374 outgrid_init.o: com_mod.o flux_mod.o oh_mod.o outg_mod.o par_mod.o unc_mod.o 327 375 outgrid_init_nest.o: com_mod.o outg_mod.o par_mod.o unc_mod.o 376 par_mod.o : $(wind_mod) 328 377 part0.o: par_mod.o 329 378 partdep.o: par_mod.o … … 353 402 readreleases.o: com_mod.o par_mod.o point_mod.o xmass_mod.o 354 403 readspecies.o: com_mod.o par_mod.o 355 readwind _ecmwf.o: com_mod.o par_mod.o404 readwind.o: com_mod.o par_mod.o 356 405 readwind_emos.o: com_mod.o par_mod.o 357 406 readwind_gfs.o: com_mod.o par_mod.o 358 407 readwind_gfs_emos.o: com_mod.o par_mod.o 359 readwind_ ecmwf_mpi.o: com_mod.o mpi_mod.o par_mod.o408 readwind_mpi.o: com_mod.o mpi_mod.o par_mod.o 360 409 readwind_nests.o: com_mod.o par_mod.o 361 410 readwind_nests_emos.o: com_mod.o par_mod.o … … 366 415 releaseparticles_mpi.o: com_mod.o mpi_mod.o par_mod.o point_mod.o \ 367 416 random_mod.o xmass_mod.o 368 richardson.o: par_mod.o class_gribfile_mod.o 417 richardson.o: par_mod.o 418 richardson_gfs.o: par_mod.o 369 419 scalev.o: par_mod.o 370 420 shift_field.o: par_mod.o … … 375 425 par_mod.o point_mod.o unc_mod.o xmass_mod.o netcdf_output_mod.o 376 426 unc_mod.o: par_mod.o 377 verttransform _ecmwf.o: cmapf_mod.o com_mod.o par_mod.o427 verttransform.o: cmapf_mod.o com_mod.o par_mod.o 378 428 verttransform_gfs.o: cmapf_mod.o com_mod.o par_mod.o 379 429 verttransform_nests.o: com_mod.o par_mod.o -
src/mpi_mod.f90
r6ecb30a raa8c34a 59 59 ! * 60 60 !***************************************************************************** 61 ! *62 ! Modification by DJM, 2017-05-09 - added #ifdef USE_MPIINPLACE cpp *63 ! directive to mpif_tm_reduce_grid() to insure that MPI_IN_PLACE is *64 ! used in the MPI_Reduce() only if specifically compiled with that *65 ! directive. *66 ! *67 !*****************************************************************************68 61 69 62 use mpi … … 2432 2425 2433 2426 ! 2) Using in-place reduction 2434 2435 !!!--------------------------------------------------------------------2436 !!! DJM - 2017-05-09 change - MPI_IN_PLACE option for MPI_Reduce() causes2437 !!! severe numerical problems in some cases. I'm guessing there are memory2438 !!! overrun issues in this complex code, but have so far failed to identify2439 !!! a specific problem. And/or, when one searches the Internet for this2440 !!! issue, there is "some" hint that the implementation may be buggy.2441 !!!2442 !!! At this point, with the following CPP USE_MPIINPLACE directive, the2443 !!! default behaviour will be to not use the MPI_IN_PLACE option.2444 !!! Users will have to compile with -DUSE_MPIINPLACE if they want that option.2445 !!! Introduction of the CPP directives also requires that the code be compiled2446 !!! with the "-x f95-cpp-input" option.2447 !!!2448 !!! Modification of this section requires the addition of array gridunc0, which2449 !!! requires an allocation in outgrid_init.f90 and initial declaration in2450 !!! unc_mod.f90.2451 !!!--------------------------------------------------------------------2452 2453 #ifdef USE_MPIINPLACE2454 2455 2427 if (lroot) then 2456 2428 call MPI_Reduce(MPI_IN_PLACE, gridunc, grid_size3d, mp_sp, MPI_SUM, id_root, & … … 2461 2433 & mp_comm_used, mp_ierr) 2462 2434 end if 2463 2464 #else2465 2466 call MPI_Reduce(gridunc, gridunc0, grid_size3d, mp_sp, MPI_SUM, id_root, &2467 & mp_comm_used, mp_ierr)2468 if (lroot) gridunc = gridunc02469 2470 #endif2471 2435 2472 2436 if ((WETDEP).and.(ldirect.gt.0)) then -
src/obukhov.f90
r6ecb30a re200b7a 20 20 !********************************************************************** 21 21 22 real function obukhov(ps,tsurf,tdsurf,tlev,ustar,hf,akm,bkm ,plev,metdata_format)22 real function obukhov(ps,tsurf,tdsurf,tlev,ustar,hf,akm,bkm) 23 23 24 24 !******************************************************************** … … 27 27 ! Date: 1994-06-27 * 28 28 ! * 29 ! This program calculates Obukhov scale height from surface*30 ! meteorological data and sensible heat flux.*29 ! Update: A. Stohl, 2000-09-25, avoid division by zero by * 30 ! setting ustar to minimum value * 31 31 ! * 32 32 !******************************************************************** 33 33 ! * 34 ! Update: A. Stohl, 2000-09-25, avoid division by zero by * 35 ! setting ustar to minimum value * 36 ! CHANGE: 17/11/2005 Caroline Forster NCEP GFS version * 37 ! * 38 ! Unified ECMWF and GFS builds * 39 ! Marian Harustak, 12.5.2017 * 40 ! - Merged obukhov and obukhov_gfs into one routine using * 41 ! if-then for meteo-type dependent code * 34 ! This program calculates Obukhov scale height from surface * 35 ! meteorological data and sensible heat flux. * 42 36 ! * 43 37 !******************************************************************** … … 53 47 ! akm ECMWF vertical discretization parameter * 54 48 ! bkm ECMWF vertical discretization parameter * 55 ! plev *56 ! metdata_format format of metdata (ecmwf/gfs) *57 49 ! * 58 50 !******************************************************************** 59 51 60 52 use par_mod 61 use class_gribfile62 53 63 54 implicit none 64 55 65 integer :: metdata_format66 56 real :: akm(nwzmax),bkm(nwzmax) 67 57 real :: ps,tsurf,tdsurf,tlev,ustar,hf,e,ew,tv,rhoa,plev … … 72 62 tv=tsurf*(1.+0.378*e/ps) ! virtual temperature 73 63 rhoa=ps/(r_air*tv) ! air density 74 if (metdata_format.eq.GRIBFILE_CENTRE_ECMWF) then75 64 ak1=(akm(1)+akm(2))/2. 76 65 bk1=(bkm(1)+bkm(2))/2. 77 66 plev=ak1+bk1*ps ! Pressure level 1 78 end if79 67 theta=tlev*(100000./plev)**(r_air/cpa) ! potential temperature 80 68 if (ustar.le.0.) ustar=1.e-8 -
src/outgrid_init.f90
r6ecb30a r6b22af9 19 19 ! along with FLEXPART. If not, see <http://www.gnu.org/licenses/>. * 20 20 !********************************************************************** 21 ! *22 ! DJM - 2017-05-09 - added #ifdef USE_MPIINPLACE cpp directive to *23 ! enable allocation of a gridunc0 array if required by MPI code in *24 ! mpi_mod.f90 *25 ! *26 !**********************************************************************27 28 21 29 22 subroutine outgrid_init … … 222 215 ! Extra field for totals at MPI root process 223 216 if (lroot.and.mpi_mode.gt.0) then 224 225 #ifdef USE_MPIINPLACE 226 #else 227 ! If MPI_IN_PLACE option is not used in mpi_mod.f90::mpif_tm_reduce_grid(), 228 ! then an aux array is needed for parallel grid reduction 229 allocate(gridunc0(0:numxgrid-1,0:numygrid-1,numzgrid,maxspec, & 230 maxpointspec_act,nclassunc,maxageclass),stat=stat) 231 if (stat.ne.0) write(*,*)'ERROR: could not allocate gridunc0' 232 #endif 217 ! allocate(gridunc0(0:numxgrid-1,0:numygrid-1,numzgrid,maxspec, & 218 ! maxpointspec_act,nclassunc,maxageclass),stat=stat) 219 ! if (stat.ne.0) write(*,*)'ERROR: could not allocate gridunc0' 233 220 if (ldirect.gt.0) then 234 221 allocate(wetgridunc0(0:numxgrid-1,0:numygrid-1,maxspec, & -
src/par_mod.f90
rd8eed02 rd1a8707 37 37 38 38 module par_mod 39 40 !************************************************************************ 41 ! wind_mod: is gfs_mod.f90 for target gfs, ecmwf_mod.f90 for target ecmwf 42 !************************************************************************ 43 use wind_mod 39 44 40 45 implicit none … … 141 146 !********************************************* 142 147 143 ! integer,parameter :: nxmax=361,nymax=181,nuvzmax=92,nwzmax=92,nzmax=92 !ECMWF new 144 integer,parameter :: nxmax=361,nymax=181,nuvzmax=138,nwzmax=138,nzmax=138 !ECMWF new 145 146 ! integer,parameter :: nxmax=181,nymax=91,nuvzmax=138,nwzmax=138,nzmax=138 !ECMWF new 147 148 ! INTEGER,PARAMETER :: nxmax=361,nymax=181,nuvzmax=138,nwzmax=138,nzmax=138 !NCEP data 149 150 ! integer,parameter :: nxshift=359 ! for ECMWF 151 integer,parameter :: nxshift=0 ! for GFS 152 153 !********************************************* 154 ! Maximum dimensions of the nested input grids 155 !********************************************* 156 157 integer,parameter :: maxnests=1,nxmaxn=451,nymaxn=226 158 159 ! nxmax,nymax maximum dimension of wind fields in x and y 160 ! direction, respectively 161 ! nuvzmax,nwzmax maximum dimension of (u,v) and (w) wind fields in z 162 ! direction (for fields on eta levels) 163 ! nzmax maximum dimension of wind fields in z direction 164 ! for the transformed Cartesian coordinates 165 ! nxshift for global grids (in x), the grid can be shifted by 166 ! nxshift grid points, in order to accomodate nested 167 ! grids, and output grids overlapping the domain "boundary" 168 ! nxshift must not be negative; "normal" setting would be 0 169 148 ! Moved to ecmwf_mod.f90 (for ECMWF) / gfs_mod.f90 (for GFS) 170 149 171 150 integer,parameter :: nconvlevmax = nuvzmax-1 … … 290 269 integer,parameter :: icmv=-9999 291 270 271 ! Parameters for testing 272 !******************************************* 273 ! integer :: verbosity=0 292 274 293 275 end module par_mod -
src/readwind_gfs.f90
r6ecb30a r8a65cb0 20 20 !********************************************************************** 21 21 22 subroutine readwind _gfs(indj,n,uuh,vvh,wwh)22 subroutine readwind(indj,n,uuh,vvh,wwh) 23 23 24 24 !*********************************************************************** … … 38 38 !* CHANGE: 03/12/2008, Harald Sodemann, update to f90 with * 39 39 !* ECMWF grib_api * 40 ! *41 ! Unified ECMWF and GFS builds *42 ! Marian Harustak, 12.5.2017 *43 ! - Renamed routine from readwind to readwind_gfs *44 40 !* * 45 41 !*********************************************************************** … … 720 716 stop 'Execution terminated' 721 717 722 end subroutine readwind _gfs718 end subroutine readwind -
src/richardson.f90
r6ecb30a rc2162ce 21 21 22 22 subroutine richardson(psurf,ust,ttlev,qvlev,ulev,vlev,nuvz, & 23 akz,bkz,hf,tt2,td2,h,wst,hmixplus ,metdata_format)23 akz,bkz,hf,tt2,td2,h,wst,hmixplus) 24 24 ! i i i i i i i 25 25 ! i i i i i o o o … … 41 41 ! Meteor. 81, 245-269. * 42 42 ! * 43 !****************************************************************************44 ! *45 43 ! Update: 1999-02-01 by G. Wotawa * 46 44 ! * … … 48 46 ! instead of first model level. * 49 47 ! New input variables tt2, td2 introduced. * 50 ! *51 ! CHANGE: 17/11/2005 Caroline Forster NCEP GFS version *52 ! *53 ! Unified ECMWF and GFS builds *54 ! Marian Harustak, 12.5.2017 *55 ! - Merged richardson and richardson_gfs into one routine using *56 ! if-then for meteo-type dependent code *57 48 ! * 58 49 !**************************************************************************** … … 64 55 ! tv virtual temperature * 65 56 ! wst convective velocity scale * 66 ! metdata_format format of metdata (ecmwf/gfs) *67 57 ! * 68 58 ! Constants: * … … 72 62 73 63 use par_mod 74 use class_gribfile75 64 76 65 implicit none 77 66 78 integer :: metdata_format 79 integer :: i,k,nuvz,iter,llev,loop_start 67 integer :: i,k,nuvz,iter 80 68 real :: tv,tvold,zref,z,zold,pint,pold,theta,thetaref,ri 81 69 real :: akz(nuvz),bkz(nuvz),ulev(nuvz),vlev(nuvz),hf,wst,tt2,td2,ew … … 88 76 excess=0.0 89 77 iter=0 90 91 if (metdata_format.eq.GRIBFILE_CENTRE_NCEP) then92 ! NCEP version: find first model level above ground93 !**************************************************94 95 llev = 096 do i=1,nuvz97 if (psurf.lt.akz(i)) llev=i98 end do99 llev = llev+1100 ! sec llev should not be 1!101 if (llev.eq.1) llev = 2102 if (llev.gt.nuvz) llev = nuvz-1103 ! NCEP version104 end if105 106 78 107 79 ! Compute virtual temperature and virtual potential temperature at … … 123 95 ! Integrate z up to one level above zt 124 96 !************************************* 125 if (metdata_format.eq.GRIBFILE_CENTRE_ECMWF) then 126 loop_start=2 127 else 128 loop_start=llev 129 end if 130 do k=loop_start,nuvz 97 98 do k=2,nuvz 131 99 pint=akz(k)+bkz(k)*psurf ! pressure on model layers 132 100 tv=ttlev(k)*(1.+0.608*qvlev(k)) -
src/timemanager.f90
r6ecb30a ra76d954 20 20 !********************************************************************** 21 21 22 subroutine timemanager (metdata_format)22 subroutine timemanager 23 23 24 24 !***************************************************************************** … … 50 50 ! For compatibility with MPI version, * 51 51 ! variables uap,ucp,uzp,us,vs,ws,cbt now in module com_mod * 52 ! Unified ECMWF and GFS builds *53 ! Marian Harustak, 12.5.2017 *54 ! - Added passing of metdata_format as it was needed by called routines *55 52 !***************************************************************************** 56 53 ! * … … 86 83 ! xtra1(maxpart), ytra1(maxpart), ztra1(maxpart) = * 87 84 ! spatial positions of trajectories * 88 ! metdata_format format of metdata (ecmwf/gfs) *89 85 ! * 90 86 ! Constants: * … … 106 102 implicit none 107 103 108 integer :: metdata_format109 104 integer :: j,ks,kp,l,n,itime=0,nstop,nstop1 110 105 ! integer :: ksp … … 199 194 write (*,*) 'timemanager> call convmix -- backward' 200 195 endif 201 call convmix(itime ,metdata_format)196 call convmix(itime) 202 197 if (verbosity.gt.1) then 203 198 !CALL SYSTEM_CLOCK(count_clock, count_rate, count_max) … … 212 207 write (*,*) 'timemanager> call getfields' 213 208 endif 214 call getfields(itime,nstop1 ,metdata_format)209 call getfields(itime,nstop1) 215 210 if (verbosity.gt.1) then 216 211 CALL SYSTEM_CLOCK(count_clock) … … 271 266 write (*,*) 'timemanager> call convmix -- forward' 272 267 endif 273 call convmix(itime ,metdata_format)268 call convmix(itime) 274 269 endif 275 270 -
src/timemanager_mpi.f90
rd8eed02 rb5127f9 20 20 !********************************************************************** 21 21 22 subroutine timemanager (metdata_format)22 subroutine timemanager 23 23 24 24 !***************************************************************************** … … 50 50 ! MPI version * 51 51 ! Variables uap,ucp,uzp,us,vs,ws,cbt now in module com_mod * 52 ! Unified ECMWF and GFS builds *53 ! Marian Harustak, 12.5.2017 *54 ! - Added passing of metdata_format as it was needed by called routines *55 52 !***************************************************************************** 56 53 ! * … … 86 83 ! xtra1(maxpart), ytra1(maxpart), ztra1(maxpart) = * 87 84 ! spatial positions of trajectories * 88 ! metdata_format format of metdata (ecmwf/gfs) *89 85 ! * 90 86 ! Constants: * … … 107 103 implicit none 108 104 109 integer :: metdata_format110 105 logical :: reqv_state=.false. ! .true. if waiting for a MPI_Irecv to complete 111 106 integer :: j,ks,kp,l,n,itime=0,nstop,nstop1,memstat=0 … … 210 205 endif 211 206 ! readwind process skips this step 212 if (.not.(lmpreader.and.lmp_use_reader)) call convmix(itime ,metdata_format)207 if (.not.(lmpreader.and.lmp_use_reader)) call convmix(itime) 213 208 endif 214 209 … … 223 218 if (mp_measure_time) call mpif_mtime('getfields',0) 224 219 225 call getfields(itime,nstop1,memstat ,metdata_format)220 call getfields(itime,nstop1,memstat) 226 221 227 222 if (mp_measure_time) call mpif_mtime('getfields',1) … … 351 346 write (*,*) 'timemanager> call convmix -- forward' 352 347 endif 353 call convmix(itime ,metdata_format)348 call convmix(itime) 354 349 endif 355 350 -
src/unc_mod.f90
r6ecb30a r4c64400 19 19 ! along with FLEXPART. If not, see <http://www.gnu.org/licenses/>. * 20 20 !********************************************************************** 21 ! *22 ! DJM - 2017-05-09 - added #ifdef USE_MPIINPLACE cpp directive to *23 ! enable declaration of a gridunc0 array if required by MPI code in *24 ! mpi_mod.f90 *25 ! *26 !**********************************************************************27 21 28 22 module unc_mod … … 33 27 34 28 real,allocatable, dimension (:,:,:,:,:,:,:) :: gridunc 35 #ifdef USE_MPIINPLACE36 #else37 ! If MPI_IN_PLACE option is not used in mpi_mod.f90::mpif_tm_reduce_grid(),38 ! then an aux array is needed for parallel grid reduction39 real,allocatable, dimension (:,:,:,:,:,:,:) :: gridunc040 #endif41 29 real,allocatable, dimension (:,:,:,:,:,:,:) :: griduncn 42 30 real(dep_prec),allocatable, dimension (:,:,:,:,:,:) :: drygridunc -
src/verttransform_gfs.f90
r6ecb30a r4fbe7a5 20 20 !********************************************************************** 21 21 22 subroutine verttransform _gfs(n,uuh,vvh,wwh,pvh)22 subroutine verttransform(n,uuh,vvh,wwh,pvh) 23 23 ! i i i i i 24 24 !***************************************************************************** … … 47 47 ! Changes, Bernd C. Krueger, Feb. 2001: 48 48 ! Variables tth and qvh (on eta coordinates) from common block 49 !50 ! Unified ECMWF and GFS builds51 ! Marian Harustak, 12.5.201752 ! - Renamed routine from verttransform to verttransform_gfs53 !54 49 !***************************************************************************** 55 50 ! * … … 536 531 537 532 538 end subroutine verttransform _gfs533 end subroutine verttransform -
src/writeheader.f90
r6ecb30a rf13406c 35 35 !***************************************************************************** 36 36 ! * 37 ! Modified to remove TRIM around the output of flexversion so that *38 ! it will be a constant length (defined in com_mod.f90) in output header *39 ! *40 ! Don Morton, Boreal Scientific Computing *41 ! 07 May 2017 *42 ! *43 !*****************************************************************************44 ! *45 37 ! Variables: * 46 38 ! * … … 75 67 76 68 if (ldirect.eq.1) then 77 write(unitheader) ibdate,ibtime, flexversion69 write(unitheader) ibdate,ibtime, trim(flexversion) 78 70 else 79 write(unitheader) iedate,ietime, flexversion71 write(unitheader) iedate,ietime, trim(flexversion) 80 72 endif 81 73 -
src/writeheader_nest.f90
r6ecb30a r4fbe7a5 35 35 !***************************************************************************** 36 36 ! * 37 ! Modified to remove TRIM around the output of flexversion so that *38 ! it will be a constant length (defined in com_mod.f90) in output header *39 ! *40 ! Don Morton, Boreal Scientific Computing *41 ! 07 May 2017 *42 ! *43 !*****************************************************************************44 ! *45 37 ! Variables: * 46 38 ! * … … 75 67 76 68 if (ldirect.eq.1) then 77 write(unitheader) ibdate,ibtime, flexversion69 write(unitheader) ibdate,ibtime, trim(flexversion) 78 70 else 79 write(unitheader) iedate,ietime, flexversion71 write(unitheader) iedate,ietime, trim(flexversion) 80 72 endif 81 73 -
src/writeheader_nest_surf.f90
r6ecb30a rf13406c 35 35 !***************************************************************************** 36 36 ! * 37 ! Modified to remove TRIM around the output of flexversion so that *38 ! it will be a constant length (defined in com_mod.f90) in output header *39 ! *40 ! Don Morton, Boreal Scientific Computing *41 ! 07 May 2017 *42 ! *43 !*****************************************************************************44 ! *45 37 ! Variables: * 46 38 ! * … … 75 67 76 68 if (ldirect.eq.1) then 77 write(unitheader) ibdate,ibtime, flexversion69 write(unitheader) ibdate,ibtime,trim(flexversion) 78 70 else 79 write(unitheader) iedate,ietime, flexversion71 write(unitheader) iedate,ietime,trim(flexversion) 80 72 endif 81 73 -
src/writeheader_surf.f90
r6ecb30a rf13406c 35 35 !***************************************************************************** 36 36 ! * 37 ! Modified to remove TRIM around the output of flexversion so that *38 ! it will be a constant length (defined in com_mod.f90) in output header *39 ! *40 ! Don Morton, Boreal Scientific Computing *41 ! 07 May 2017 *42 ! *43 !*****************************************************************************44 ! *45 37 ! Variables: * 46 38 ! * … … 75 67 76 68 if (ldirect.eq.1) then 77 write(unitheader) ibdate,ibtime, flexversion69 write(unitheader) ibdate,ibtime, trim(flexversion) 78 70 else 79 write(unitheader) iedate,ietime, flexversion71 write(unitheader) iedate,ietime, trim(flexversion) 80 72 endif 81 73 -
tests/NILU/basic_tests
rdd6a4aa rca350ba 1 1 #WORKSPACE=/xnilu_wrk/flexbuild 2 2 #WORKSPACE=/home/ignacio/repos/ 3 FP_exec=$WORKSPACE/src/F LEXPART3 FP_exec=$WORKSPACE/src/FP_ecmwf_gfortran 4 4 path_flextest=$WORKSPACE/flextest/ 5 5 declare -a test_names=('1' 'HelloWorld' 'Fwd1' 'Fwd2' 'Bwd1' 'Volc' '2') -
tests/NILU/run_tests
rdd6a4aa rca350ba 9 9 #FP_exec=/home/ignacio/repos/flexpart/src/FP_ecmwf_gfortran 10 10 #FP_exec=/xnilu_wrk/flexbuild/tests/NILU/FP_ecmwf_gfortran 11 #FP_exec=$WORKSPACE/src/FP_ecmwf_gfortran 12 # CTBTO unified executable 13 FP_exec=$WORKSPACE/src/FLEXPART 11 FP_exec=$WORKSPACE/src/FP_ecmwf_gfortran 14 12 #path_flextest=/home/ignacio/repos/flextest/ 15 13 #path_flextest=/xnilu_wrk/flexbuild/flextest/
Note: See TracChangeset
for help on using the changeset viewer.