!-------------------------------------- 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 --------------------------------------
!
!
! X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X X
!
subroutine lap(psol,pf,cdgrid) 4,6
!
!**s/r lap - Applies the Laplacian operator to field pf.
!
!
!Author : Luc Fillion - MSC - 10 March 04.
!Revision:
!
! -------------------
!
!Arguments
!
implicit none
!
#include "taglam4d.cdk"
#include "comct0.cdk"
#include "pardim.cdk"
#include "comdim.cdk"
#include "comcst.cdk"
#include "comlun.cdk"
#include "comfftla.cdk"
!
character*1 cdgrid
real*8 psol(ni,nj)
real*8 pf(ni,nj)
!
real*8 zcyc(nj),zreal(nj),zimag(nj)
real*8 zsol(nj)
real*8 zspsol(nfi,2,nj)
real*8 zpm(nfi)
!
integer ji,jj,jk,jfi
real*8 zdlon,zdlat,zdlon2,zdlat2,zalpha,zbeta,za,zra2,zcon
real*8 zdenom,zdenom2
!
!!
call zero
(2*nfi*nj,zspsol)
call zero
(ni*nj,psol)
!
! Fourier Transform rhs in the zonal direction
!
do jj=1,nj
call dft1d
(zspsol(1,1,jj),pf(1,jj),sdft1d,mlen1d,ni)
enddo
!
! Applies meridional part of Laplacian for each zonal wavenumbers
!
do jfi=1,nfi
do jj=1,nj
zreal(jj)=zspsol(jfi,1,jj)
zimag(jj)=zspsol(jfi,2,jj)
enddo
call lapm
(zsol,zreal,cdgrid,jfi)
do jj=1,nj
zspsol(jfi,1,jj)=zsol(jj)
enddo
call lapm
(zsol,zimag,cdgrid,jfi)
do jj=1,nj
zspsol(jfi,2,jj)=zsol(jj)
enddo
enddo
!
! Inverse Fourier Transform solution in the zonal direction
!
do jj=1,nj
call idft1d
(psol(1,jj),zspsol(1,1,jj),sdft1d,mlen1d,ni)
enddo
!
return
end