!-------------------------------------- LICENCE BEGIN ------------------------------------
!Environment Canada - Atmospheric Science and Technology License/Disclaimer, 
!                     version 3; Last Modified: May 7, 2008.
!This is free but copyrighted software; you can use/redistribute/modify it under the terms 
!of the Environment Canada - Atmospheric Science and Technology License/Disclaimer 
!version 3 or (at your option) any later version that should be found at: 
!http://collaboration.cmc.ec.gc.ca/science/rpn.comm/license.html 
!
!This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
!without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
!See the above mentioned License/Disclaimer for more details.
!You should have received a copy of the License/Disclaimer along with this software; 
!if not, you can write to: EC-RPN COMM Group, 2121 TransCanada, suite 500, Dorval (Quebec), 
!CANADA, H9P 1J3; or send e-mail to service.rpn@ec.gc.ca
!-------------------------------------- LICENCE END --------------------------------------
***s/r pospers_tl - TLM of pospers 
*
#include "model_macros_f.h"
*

      subroutine pospers_tl 1
*
#include "impnone.cdk"
*
*author
*     M.Tanguay
*
*revision
* v2_10 - Tanguay M.        - initial MPI version
* v2_31 - Tanguay M.        - adapt ADJ for new advection code 
*
*object
*     see id section
*
*arguments
*     none
*
*implicits
#include "glb_ld.cdk"
#include "geomg.cdk"
#include "vth.cdk"
#include "vthm.cdk"
*
*modules
      integer  vmmlod,vmmget,vmmuld
      external vmmlod,vmmget,vmmuld
*
      integer pnerr, pnlkey1(12),i, j, k, ijk, nij, pnlod 
      real pr1
**
      nij = l_ni * l_nj
*
      pnlkey1(1) = VMM_KEY(xth)
      pnlkey1(2) = VMM_KEY(yth)
      pnlkey1(3) = VMM_KEY(zth)
      pnlkey1(4) = VMM_KEY(xcth)
      pnlkey1(5) = VMM_KEY(ycth)
      pnlkey1(6) = VMM_KEY(zcth)
      pnlod = 6 
*
      pnlkey1(pnlod+1) = VMM_KEY(xthm)
      pnlkey1(pnlod+2) = VMM_KEY(ythm)
      pnlkey1(pnlod+3) = VMM_KEY(zthm)
      pnlkey1(pnlod+4) = VMM_KEY(xcthm)
      pnlkey1(pnlod+5) = VMM_KEY(ycthm)
      pnlkey1(pnlod+6) = VMM_KEY(zcthm)
      pnlod = pnlod+6 
*
      pnerr = vmmlod(pnlkey1,pnlod)
*
      pnerr = VMM_GET_VAR(xth)
      pnerr = VMM_GET_VAR(yth)
      pnerr = VMM_GET_VAR(zth)
      pnerr = VMM_GET_VAR(xcth)
      pnerr = VMM_GET_VAR(ycth)
      pnerr = VMM_GET_VAR(zcth)
*
      pnerr = VMM_GET_VAR(xthm)
      pnerr = VMM_GET_VAR(ythm)
      pnerr = VMM_GET_VAR(zthm)
      pnerr = VMM_GET_VAR(xcthm)
      pnerr = VMM_GET_VAR(ycthm)
      pnerr = VMM_GET_VAR(zcthm)
*
      do k = 1, l_nk
      do j = 1, l_nj
      do i = 1, l_ni
*
         ijk=(k-1)*nij+(j-1)*l_ni+i
*
*        TRAJ 
*        ----
         xthm(ijk) = Geomg_x_8(i)
         ythm(ijk) = Geomg_y_8(j)
         zthm(ijk) = Geomg_z_8(k)
*
         pr1       = cos(ythm(ijk))
*
         zcthm(ijk)= sin(ythm(ijk))
         xcthm(ijk)= cos(xthm(ijk)) * pr1
         ycthm(ijk)= sin(xthm(ijk)) * pr1
*
*        TLM 
*        ---
         xth(ijk)  = 0. 
         yth(ijk)  = 0. 
         zth(ijk)  = 0. 
*
         zcth(ijk) = 0. 
         xcth(ijk) = 0. 
         ycth(ijk) = 0. 
*
      end do
      end do
      end do
*
      pnerr = vmmuld(-1,0)
*
*     ---------------------------------------------------------------
*
      return
      end