File: getmet.f

package info (click to toggle)
flextra 5.0-2.1
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 860 kB
  • ctags: 402
  • sloc: fortran: 6,987; makefile: 55; sh: 17
file content (91 lines) | stat: -rw-r--r-- 3,934 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
      subroutine getmet(itime,xt,yt,zt,qqint,pvint,thint)
C                         i   i  i  i    i     i     i
********************************************************************************
*                                                                              *
*     Interpolation of meteorological data (i.e. specific humidity, potential  *
*     vorticity and potential temperature) onto trajectory positions.          *
*                                                                              *
*     Author: A. Stohl                                                         *
*                                                                              *
*     29 January 2000                                                          *
*                                                                              *
********************************************************************************
*                                                                              *
* Variables:                                                                   *
* itime [s]          current temporal position                                 *
* xt,yt,zt           coordinates of position for which data shall be interpolat*
* pvint              interpolated potential vorticity                          *
* qqint              interpolated specific humidity                            *
* thint              interpolated potential temperature                        *
*                                                                              *
********************************************************************************

      include 'includepar'
      include 'includecom'

      integer itime,indexf,ngrid,j
      real xt,yt,zt,xtn,ytn,qqint,pvint,thint


C  Determine the times of the wind fields needed for interpolation
******************************************************************

      if ((ldirect*memtime(1).lt.ldirect*itime).and.
     +(ldirect*memtime(2).ge.ldirect*itime)) then ! between 1st and 2nd
        indexf=1
      else if((ldirect*memtime(2).lt.ldirect*itime).and.
     +(ldirect*memtime(3).ge.ldirect*itime)) then ! between 2nd and 3rd
        indexf=2
      endif


C Determine which nesting level to be used
******************************************

      ngrid=0
      do 12 j=numbnests,1,-1
        if ((xt.gt.xln(j)).and.(xt.lt.xrn(j)).and.
     +  (yt.gt.yln(j)).and.(yt.lt.yrn(j))) then
          ngrid=j
          goto 13
        endif
12      continue
13    continue


C Do linear interpolation of the meteo data
*******************************************

      if (ngrid.eq.0) then         ! mother grid
        call lininterpol(qq,nxmax,nymax,nuvzmax,nx,ny,nuvz,memind,
     +  uvheight,xt,yt,zt,memtime(indexf),memtime(indexf+1),itime,
     +  indexf,qqint)
        call lininterpol(pv,nxmax,nymax,nuvzmax,nx,ny,nuvz,memind,
     +  uvheight,xt,yt,zt,memtime(indexf),memtime(indexf+1),itime,
     +  indexf,pvint)
        call lininterpol(th,nxmax,nymax,nuvzmax,nx,ny,nuvz,memind,
     +  uvheight,xt,yt,zt,memtime(indexf),memtime(indexf+1),itime,
     +  indexf,thint)

      else if (ngrid.gt.0) then      ! nested grid

C Determine nested grid coordinates
***********************************

        xtn=(xt-xln(ngrid))*xresoln(ngrid)
        ytn=(yt-yln(ngrid))*yresoln(ngrid)

        call lininterpoln(qqn,maxnests,nxmaxn,nymaxn,nuvzmax,
     +  ngrid,nxn,nyn,nuvz,memind,uvheight,xtn,ytn,zt,memtime(indexf),
     +  memtime(indexf+1),itime,indexf,qqint)
        call lininterpoln(pvn,maxnests,nxmaxn,nymaxn,nuvzmax,
     +  ngrid,nxn,nyn,nuvz,memind,uvheight,xtn,ytn,zt,memtime(indexf),
     +  memtime(indexf+1),itime,indexf,pvint)
        call lininterpoln(thn,maxnests,nxmaxn,nymaxn,nuvzmax,
     +  ngrid,nxn,nyn,nuvz,memind,uvheight,xtn,ytn,zt,memtime(indexf),
     +  memtime(indexf+1),itime,indexf,thint)

      endif

      return
      end