NCEPLIBS-sp 2.4.0
spgrady.f
Go to the documentation of this file.
1C> @file
2C> @brief Compute y-gradient in spectral space.
3C> @author IREDELL @date 92-10-31
4
5C> Computes the horizontal vector y-gradient of a scalar field
6c> in spectral space.
7C>
8C> Subprogram speps should be called already.
9C>
10C> If L is the zonal wavenumber, N is the total wavenumber,
11C> EPS(L,N)=SQRT((N**2-L**2)/(4*N**2-1)) and A is Earth radius,
12C> then the meridional gradient of Q(L,N) is computed as
13C> EPS(L,N+1)*(N+2)/A*Q(L,N+1)-EPS(L,N+1)*(N-1)/A*Q(L,N-1).
14C>
15C> Extra terms are computed over top of the spectral domain.
16C>
17C> Advantage is taken of the fact that EPS(L,L)=0
18C> in order to vectorize over the entire spectral domain.
19C>
20C> @param I spectral domain shape
21c> (0 for triangular, 1 for rhomboidal)
22C> @param M spectral truncation
23C> @param ENN1 N*(N+1)/A**2
24C> @param EON EPSILON/N*A
25C> @param EONTOP EPSILON/N*A over top
26C> @param Q scalar field
27C> @param QDY merid gradient (times coslat)
28C> @param QDYTOP merid gradient (times coslat) over top
29C>
30C> @author IREDELL @date 92-10-31
31 SUBROUTINE spgrady(I,M,ENN1,EON,EONTOP,Q,QDY,QDYTOP)
32
33 REAL ENN1((M+1)*((I+1)*M+2)/2)
34 REAL EON((M+1)*((I+1)*M+2)/2),EONTOP(M+1)
35 REAL Q((M+1)*((I+1)*M+2))
36 REAL QDY((M+1)*((I+1)*M+2))
37 REAL QDYTOP(2*(M+1))
38
39C TAKE MERIDIONAL GRADIENT
40 k=1
41 qdy(2*k-1)=eon(k+1)*enn1(k+1)*q(2*k+1)
42 qdy(2*k)=eon(k+1)*enn1(k+1)*q(2*k+2)
43 DO k=2,(m+1)*((i+1)*m+2)/2-1
44 qdy(2*k-1)=eon(k+1)*enn1(k+1)*q(2*k+1)-eon(k)*enn1(k-1)*q(2*k-3)
45 qdy(2*k)=eon(k+1)*enn1(k+1)*q(2*k+2)-eon(k)*enn1(k-1)*q(2*k-2)
46 ENDDO
47 k=(m+1)*((i+1)*m+2)/2
48 qdy(2*k-1)=-eon(k)*enn1(k-1)*q(2*k-3)
49 qdy(2*k)=-eon(k)*enn1(k-1)*q(2*k-2)
50
51C TAKE MERIDIONAL GRADIENT OVER TOP
52 DO l=0,m
53 k=l*(2*m+(i-1)*(l-1))/2+i*l+m+1
54 qdytop(2*l+1)=-eontop(l+1)*enn1(k)*q(2*k-1)
55 qdytop(2*l+2)=-eontop(l+1)*enn1(k)*q(2*k)
56 ENDDO
57
58 RETURN
59 END
subroutine spgrady(I, M, ENN1, EON, EONTOP, Q, QDY, QDYTOP)
Computes the horizontal vector y-gradient of a scalar field in spectral space.
Definition: spgrady.f:32