Changeset a4288fa in flexpart.git


Ignore:
Timestamp:
Dec 15, 2020, 2:15:39 PM (3 years ago)
Author:
Espen Sollum ATMOS <eso@…>
Branches:
GFS_025, dev
Children:
759df5f
Parents:
5635973
Message:

Added option to write surface pressure/temperature to netcdf output

Location:
src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/netcdf_output_mod.f90

    • Property mode changed from 100644 to 100755
    r23547f3 ra4288fa  
    3636  use outg_mod,  only: outheight,oroout,densityoutgrid,factor3d,volume,&
    3737                       wetgrid,wetgridsigma,drygrid,drygridsigma,grid,gridsigma,&
    38                        area,arean,volumen, orooutn
     38                       area,arean,volumen, orooutn, p0out, t0out
    3939  use par_mod,   only: dep_prec, sp, dp, maxspec, maxreceptor, nclassunc,&
    40                        unitoutrecept,unitoutreceptppt, nxmax,unittmp
     40                       unitoutrecept,unitoutreceptppt, nxmax,unittmp, &
     41                       write_p0t0
    4142  use com_mod,   only: path,length,ldirect,ibdate,ibtime,iedate,ietime, &
    4243                       loutstep,loutaver,loutsample,outlon0,outlat0,&
     
    5758                       ioutputforeachrelease, iflux, mdomainfill, mquasilag, &
    5859                       nested_output, ipout, surf_only, linit_cond, &
    59                        flexversion,mpi_mode,DRYBKDEP,WETBKDEP
     60                       flexversion,mpi_mode,DRYBKDEP,WETBKDEP, ps, tt2
    6061
    6162  use mean_mod
     
    8182  integer, dimension(maxspec) :: specID,specIDppt, wdspecID,ddspecID
    8283  integer, dimension(maxspec) :: specIDn,specIDnppt, wdspecIDn,ddspecIDn
     84  integer :: psID, tt2ID
    8385  integer                     :: timeID, timeIDn
    8486  integer, dimension(6)       :: dimids, dimidsn
     
    388390  if (write_area) call nf90_err(nf90_def_var(ncid, 'area', nf90_float, &
    389391       &(/ lonDimID, latDimID /), areaID))
     392
     393    ! surfarce pressure / temperature
     394    if (write_p0t0) then
     395       call nf90_err(nf90_def_var(ncid, 'pressure', nf90_float, &
     396            &(/ lonDimID, latDimID, timeDimID /), psID))
     397       call nf90_err(nf90_def_var(ncid, 'temperature', nf90_float, &
     398            &(/ lonDimID, latDimID, timeDimID /), tt2ID))
     399    end if
    390400
    391401
     
    761771  ! real(sp)            :: wetgridtotal,wetgridsigmatotal
    762772  ! real(sp)            :: drygridtotal,drygridsigmatotal
     773    real :: ddx,ddy,p0h,t0h,p1,p2,p3,p4,rddx,rddy,xlon,xlat,ylat,xtn,ytn
     774    integer :: i1,ixp,j1,jyp,j
    763775
    764776  real, parameter     :: weightair=28.97
     
    10411053  end do
    10421054
     1055
     1056    if (write_p0t0) then
     1057       ! Loop over all output grid cells
     1058       !********************************
     1059
     1060       do jjy=0,numygrid-1
     1061          do iix=0,numxgrid-1
     1062             p0h=0.
     1063             t0h=0.
     1064
     1065             ! Take 100 samples of the topography in every grid cell
     1066             !******************************************************
     1067
     1068             do j1=1,10
     1069                ylat=outlat0+(real(jjy)+real(j1)/10.-0.05)*dyout
     1070                yl=(ylat-ylat0)/dy
     1071                do i1=1,10
     1072                   xlon=outlon0+(real(iix)+real(i1)/10.-0.05)*dxout
     1073                   xl=(xlon-xlon0)/dx
     1074
     1075                   ! Determine the nest we are in
     1076                   !*****************************
     1077
     1078                   ngrid=0
     1079                   do j=numbnests,1,-1
     1080                      if ((xl.gt.xln(j)+eps).and.(xl.lt.xrn(j)-eps).and. &
     1081                           (yl.gt.yln(j)+eps).and.(yl.lt.yrn(j)-eps)) then
     1082                         ngrid=j
     1083                         goto 43
     1084                      endif
     1085                   end do
     108643                 continue
     1087
     1088                   ! Determine (nested) grid coordinates and auxiliary parameters used for interpolation
     1089                   !*****************************************************************************
     1090
     1091                   if (ngrid.gt.0) then
     1092                      xtn=(xl-xln(ngrid))*xresoln(ngrid)
     1093                      ytn=(yl-yln(ngrid))*yresoln(ngrid)
     1094                      ix=int(xtn)
     1095                      jy=int(ytn)
     1096                      ddy=ytn-real(jy)
     1097                      ddx=xtn-real(ix)
     1098                   else
     1099                      ix=int(xl)
     1100                      jy=int(yl)
     1101                      ddy=yl-real(jy)
     1102                      ddx=xl-real(ix)
     1103                   endif
     1104                   ixp=ix+1
     1105                   jyp=jy+1
     1106                   rddx=1.-ddx
     1107                   rddy=1.-ddy
     1108                   p1=rddx*rddy
     1109                   p2=ddx*rddy
     1110                   p3=rddx*ddy
     1111                   p4=ddx*ddy
     1112
     1113                   p0h=p0h+p1*ps(ix ,jy,1,memind(1)) &
     1114                        + p2*ps(ixp,jy,1,memind(1)) &
     1115                        + p3*ps(ix ,jyp,1,memind(1)) &
     1116                        + p4*ps(ixp,jyp,1,memind(1))
     1117                   t0h=t0h+p1*tt2(ix ,jy,1,memind(1)) &
     1118                        + p2*tt2(ixp,jy,1,memind(1)) &
     1119                        + p3*tt2(ix ,jyp,1,memind(1)) &
     1120                        + p4*tt2(ixp,jyp,1,memind(1))
     1121                end do
     1122             end do
     1123
     1124             ! Divide by the number of samples taken
     1125             !**************************************
     1126             p0out(iix,jjy)=p0h/100.
     1127             t0out(iix,jjy)=t0h/100.
     1128          end do
     1129       end do
     1130
     1131       call nf90_err(nf90_put_var(ncid, psID, p0out, (/ 1,1,tpointer /), (/ numxgrid,numygrid,1 /)))
     1132       call nf90_err(nf90_put_var(ncid, tt2ID, t0out,(/ 1,1,tpointer /), (/ numxgrid,numygrid,1 /)))
     1133    end if
     1134
     1135
    10431136  ! Close netCDF file
    10441137  !**************************
  • src/outg_mod.f90

    • Property mode changed from 100644 to 100755
    r92fab65 ra4288fa  
    1212  real,allocatable, dimension (:,:) :: oroout
    1313  real,allocatable, dimension (:,:) :: orooutn
     14  real,allocatable, dimension (:,:) :: t0out
     15  real,allocatable, dimension (:,:) :: p0out
    1416  real,allocatable, dimension (:,:) :: area
    1517  real,allocatable, dimension (:,:) :: arean
  • src/par_mod.f90

    • Property mode changed from 100644 to 100755
    r5635973 ra4288fa  
    3232
    3333  integer,parameter :: dep_prec=sp
     34
     35  !***********************************************************
     36  ! Additional output of lowest level pressure and temperature
     37  ! (for netcdf output)
     38  !***********************************************************
     39  logical,parameter :: write_p0t0 = .false.
     40
    3441
    3542  !****************************************************************
  • src/readoutgrid.f90

    • Property mode changed from 100644 to 100755
    r92fab65 ra4288fa  
    210210  allocate(areanorth(0:numxgrid-1,0:numygrid-1,numzgrid),stat=stat)
    211211  if (stat.ne.0) write(*,*)'ERROR: could not allocate areanorth'
     212! ESO: surface pressure/temperature
     213  if (write_p0t0) then
     214     allocate(t0out(0:numxgrid-1,0:numygrid-1),stat=stat)
     215     allocate(p0out(0:numxgrid-1,0:numygrid-1),stat=stat)
     216  end if
     217
     218
    212219  return
    213220
Note: See TracChangeset for help on using the changeset viewer.
hosted by ZAMG