NCEPLIBS-sp  2.5.0
spgrady.f
Go to the documentation of this file.
1 C> @file
2 C> @brief Compute y-gradient in spectral space.
3 C> @author IREDELL @date 92-10-31
4 
5 C> Computes the horizontal vector y-gradient of a scalar field
6 c> in spectral space.
7 C>
8 C> Subprogram speps should be called already.
9 C>
10 C> If L is the zonal wavenumber, N is the total wavenumber,
11 C> EPS(L,N)=SQRT((N**2-L**2)/(4*N**2-1)) and A is Earth radius,
12 C> then the meridional gradient of Q(L,N) is computed as
13 C> EPS(L,N+1)*(N+2)/A*Q(L,N+1)-EPS(L,N+1)*(N-1)/A*Q(L,N-1).
14 C>
15 C> Extra terms are computed over top of the spectral domain.
16 C>
17 C> Advantage is taken of the fact that EPS(L,L)=0
18 C> in order to vectorize over the entire spectral domain.
19 C>
20 C> @param I spectral domain shape
21 c> (0 for triangular, 1 for rhomboidal)
22 C> @param M spectral truncation
23 C> @param ENN1 N*(N+1)/A**2
24 C> @param EON EPSILON/N*A
25 C> @param EONTOP EPSILON/N*A over top
26 C> @param Q scalar field
27 C> @param QDY merid gradient (times coslat)
28 C> @param QDYTOP merid gradient (times coslat) over top
29 C>
30 C> @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 
39 C 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 
51 C 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