| 1 | 
      subroutine dyn2plume(qdyn1,qdyn2,idim1,idim2,jdim1,jdim2,i1,i2, | 
| 2 | 
     . j1,j2,Lmdyn,Nsx,Nsy,bi,bj,flag,imout,Lmout,qplume) | 
| 3 | 
C*********************************************************************** | 
| 4 | 
C Purpose: | 
| 5 | 
C   To interpolate an arbitrary quantity from the 'dynamics'  | 
| 6 | 
C               grid to the higher resolution plumes grid  | 
| 7 | 
C Algorithm: | 
| 8 | 
C   Routine performs a direct copy of the field into all the | 
| 9 | 
C        values on the higher resolution grid. | 
| 10 | 
C   Dynamics -> Plumes retains the dynamics layer mean value. | 
| 11 | 
C | 
| 12 | 
C Input: | 
| 13 | 
C   qdyn1.... [im,jm,lmdyn,bi,bj] Arbitrary Quantity on Input Grid | 
| 14 | 
C   qdyn2.... [im,jm,lmdyn,bi,bj] Arbitrary Quantity on Input Grid | 
| 15 | 
C   idim1,2.. Limits for Longitude Dimension of Input | 
| 16 | 
C   jdim1,2.. Limits for Latitude  Dimension of Input | 
| 17 | 
C   Lmdyn.... Vertical  Dimension of Input | 
| 18 | 
C   Nsx...... Number of processes in x-direction | 
| 19 | 
C   Nsy...... Number of processes in y-direction | 
| 20 | 
C   bi....... Index of process number in x-direction | 
| 21 | 
C   bj....... Index of process number in x-direction | 
| 22 | 
C   flag .... Flag to indicate vector (1) or scalar (0) interpolation | 
| 23 | 
C   imout.... Number of points in x-direction to calculate | 
| 24 | 
C   Lmout.... Vertical  Dimension of Output | 
| 25 | 
C | 
| 26 | 
C Output: | 
| 27 | 
C   qplume... [idim2,jdim2,im,Lmout,Nsx] Field at output grid (plumes) | 
| 28 | 
C | 
| 29 | 
C Notes: | 
| 30 | 
C   1) This algorithm assumes that the output (plumes) grid boxes | 
| 31 | 
C      fit exactly into the input (dynamics) grid boxes | 
| 32 | 
C   2) CAUTION! This routine, as currently written, assumes Lmdyn=Lmout | 
| 33 | 
C*********************************************************************** | 
| 34 | 
      implicit none | 
| 35 | 
 | 
| 36 | 
      integer imout, Lmdyn, Lmout, Nsx, Nsy | 
| 37 | 
      integer idim1, idim2, jdim1, jdim2, bi, bj, flag | 
| 38 | 
      integer i1, i2, j1, j2 | 
| 39 | 
      real*4 qdyn1(idim1:idim2,jdim1:jdim2,Lmdyn,Nsx,Nsy) | 
| 40 | 
      real*4 qdyn2(idim1:idim2,jdim1:jdim2,Lmdyn,Nsx,Nsy) | 
| 41 | 
      real*4 qplume(i2,j2,imout,Lmout,Nsx) | 
| 42 | 
      real*4 qd | 
| 43 | 
 | 
| 44 | 
      integer  i,ii,j,L,iiplume | 
| 45 | 
 | 
| 46 | 
      if(flag.eq.1) then | 
| 47 | 
c do loop for all plumes (output) levels | 
| 48 | 
       do L = 1,Lmout | 
| 49 | 
c do loop for all grid points | 
| 50 | 
        do j = j1,j2 | 
| 51 | 
        do i = i1,i2 | 
| 52 | 
         qd = sqrt(qdyn1(i,j,L,bi,bj)*qdyn1(i,j,L,bi,bj) + | 
| 53 | 
     .             qdyn2(i,j,L,bi,bj)*qdyn2(i,j,L,bi,bj) ) | 
| 54 | 
c for U and V fields, assign the magnitude of the wind to all points | 
| 55 | 
         do iiplume = 1,imout | 
| 56 | 
          qplume(i,j,iiplume,L,bi) = qd  | 
| 57 | 
         enddo | 
| 58 | 
        enddo | 
| 59 | 
        enddo | 
| 60 | 
       enddo | 
| 61 | 
      elseif(flag.eq.0) then | 
| 62 | 
c do loop for all plumes (output) levels | 
| 63 | 
       do L = 1,Lmout | 
| 64 | 
c do loop for all grid points | 
| 65 | 
        do j = j1,j2 | 
| 66 | 
        do i = i1,i2 | 
| 67 | 
         qd = qdyn1(i,j,L,bi,bj) | 
| 68 | 
c for Temperature, just assign the Temp to all horiz points | 
| 69 | 
         do iiplume = 1,imout | 
| 70 | 
          qplume(i,j,iiplume,L,bi) = qd  | 
| 71 | 
         enddo | 
| 72 | 
        enddo | 
| 73 | 
        enddo | 
| 74 | 
       enddo | 
| 75 | 
      endif | 
| 76 | 
 | 
| 77 | 
      return | 
| 78 | 
      end |