NCEPLIBS-sp  2.3.3
spgradq.f
Go to the documentation of this file.
1 C> @file
2 C>
3 C> Compute gradient in spectral space
4 C> @author IREDELL @date 92-10-31
5 
6 C> COMPUTES THE HORIZONTAL VECTOR GRADIENT OF A SCALAR FIELD
7 C> IN SPECTRAL SPACE.
8 C> SUBPROGRAM SPEPS SHOULD BE CALLED ALREADY.
9 C> IF L IS THE ZONAL WAVENUMBER, N IS THE TOTAL WAVENUMBER,
10 C> EPS(L,N)=SQRT((N**2-L**2)/(4*N**2-1)) AND A IS EARTH RADIUS,
11 C> THEN THE ZONAL GRADIENT OF Q(L,N) IS SIMPLY I*L/A*Q(L,N)
12 C> WHILE 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> EXTRA TERMS ARE COMPUTED OVER TOP OF THE SPECTRAL DOMAIN.
15 C> ADVANTAGE IS TAKEN OF THE FACT THAT EPS(L,L)=0
16 C> IN ORDER TO VECTORIZE OVER THE ENTIRE SPECTRAL DOMAIN.
17 C>
18 C> @param I - INTEGER SPECTRAL DOMAIN SHAPE
19 C> (0 FOR TRIANGULAR, 1 FOR RHOMBOIDAL)
20 C> @param M - INTEGER SPECTRAL TRUNCATION
21 C> @param ENN1 - REAL ((M+1)*((I+1)*M+2)/2) N*(N+1)/A**2
22 C> @param ELONN1 - REAL ((M+1)*((I+1)*M+2)/2) L/(N*(N+1))*A
23 C> @param EON - REAL ((M+1)*((I+1)*M+2)/2) EPSILON/N*A
24 C> @param EONTOP - REAL (M+1) EPSILON/N*A OVER TOP
25 C> @param Q - REAL ((M+1)*((I+1)*M+2)) SCALAR FIELD
26 C> @param QDX - REAL ((M+1)*((I+1)*M+2)) ZONAL GRADIENT (TIMES COSLAT)
27 C> @param QDY - REAL ((M+1)*((I+1)*M+2)) MERID GRADIENT (TIMES COSLAT)
28 C> @param QDYTOP - REAL (2*(M+1)) MERID GRADIENT (TIMES COSLAT) OVER TOP
29  SUBROUTINE spgradq(I,M,ENN1,ELONN1,EON,EONTOP,Q,QDX,QDY,QDYTOP)
30 
31  REAL ENN1((M+1)*((I+1)*M+2)/2),ELONN1((M+1)*((I+1)*M+2)/2)
32  REAL EON((M+1)*((I+1)*M+2)/2),EONTOP(M+1)
33  REAL Q((M+1)*((I+1)*M+2))
34  REAL QDX((M+1)*((I+1)*M+2)),QDY((M+1)*((I+1)*M+2))
35  REAL QDYTOP(2*(M+1))
36 C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
37 C TAKE ZONAL AND MERIDIONAL GRADIENTS
38  k=1
39  qdx(2*k-1)=0.
40  qdx(2*k)=0.
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  qdx(2*k-1)=-elonn1(k)*enn1(k)*q(2*k)
45  qdx(2*k)=elonn1(k)*enn1(k)*q(2*k-1)
46  qdy(2*k-1)=eon(k+1)*enn1(k+1)*q(2*k+1)-eon(k)*enn1(k-1)*q(2*k-3)
47  qdy(2*k)=eon(k+1)*enn1(k+1)*q(2*k+2)-eon(k)*enn1(k-1)*q(2*k-2)
48  ENDDO
49  k=(m+1)*((i+1)*m+2)/2
50  qdx(2*k-1)=-elonn1(k)*enn1(k)*q(2*k)
51  qdx(2*k)=elonn1(k)*enn1(k)*q(2*k-1)
52  qdy(2*k-1)=-eon(k)*enn1(k-1)*q(2*k-3)
53  qdy(2*k)=-eon(k)*enn1(k-1)*q(2*k-2)
54 C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
55 C TAKE MERIDIONAL GRADIENT OVER TOP
56  DO l=0,m
57  k=l*(2*m+(i-1)*(l-1))/2+i*l+m+1
58  qdytop(2*l+1)=-eontop(l+1)*enn1(k)*q(2*k-1)
59  qdytop(2*l+2)=-eontop(l+1)*enn1(k)*q(2*k)
60  ENDDO
61 C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
62  RETURN
63  END
spgradq
subroutine spgradq(I, M, ENN1, ELONN1, EON, EONTOP, Q, QDX, QDY, QDYTOP)
COMPUTES THE HORIZONTAL VECTOR GRADIENT OF A SCALAR FIELD IN SPECTRAL SPACE.
Definition: spgradq.f:30