NCEPLIBS-sp 2.4.0
splegend.f
Go to the documentation of this file.
1C> @file
2C>
3C> Compute Legendre polynomials
4C> @author IREDELL @date 92-10-31
5
6C> Evaluates the orthonormal associated Legendre polynomials in the
7C> spectral domain at a given latitude. Subprogram splegend should
8C> be called already. If l is the zonal wavenumber, N is the total
9C> wavenumber, and EPS(L,N)=SQRT((N**2-L**2)/(4*N**2-1)) then the
10C> following bootstrapping formulas are used:
11C>
12C> <pre>
13C> PLN(0,0)=SQRT(0.5)
14C> PLN(L,L)=PLN(L-1,L-1)*CLAT*SQRT(FLOAT(2*L+1)/FLOAT(2*L))
15C> PLN(L,N)=(SLAT*PLN(L,N-1)-EPS(L,N-1)*PLN(L,N-2))/EPS(L,N)
16C> </pre>
17C>
18C> Synthesis at the pole needs only two zonal wavenumbers. Scalar
19C> fields are synthesized with zonal wavenumber 0 while vector
20C> fields are synthesized with zonal wavenumber 1. (Thus polar
21C> vector fields are implicitly divided by clat.) The following
22C> bootstrapping formulas are used at the pole:
23C>
24C> <pre>
25C> PLN(0,0)=SQRT(0.5)
26C> PLN(1,1)=SQRT(0.75)
27C> PLN(L,N)=(PLN(L,N-1)-EPS(L,N-1)*PLN(L,N-2))/EPS(L,N)
28C> </pre>
29C>
30C> PROGRAM HISTORY LOG:
31C> - 91-10-31 MARK IREDELL
32C> - 98-06-10 MARK IREDELL GENERALIZE PRECISION
33C>
34C> @param I - INTEGER SPECTRAL DOMAIN SHAPE
35C> (0 FOR TRIANGULAR, 1 FOR RHOMBOIDAL)
36C> @param M - INTEGER SPECTRAL TRUNCATION
37C> @param SLAT - REAL SINE OF LATITUDE
38C> @param CLAT - REAL COSINE OF LATITUDE
39C> @param EPS - REAL ((M+1)*((I+1)*M+2)/2) SQRT((N**2-L**2)/(4*N**2-1))
40C> @param EPSTOP - REAL (M+1) SQRT((N**2-L**2)/(4*N**2-1)) OVER TOP
41C> @param[out] PLN - REAL ((M+1)*((I+1)*M+2)/2) LEGENDRE POLYNOMIAL
42C> @param[out] PLNTOP - REAL (M+1) LEGENDRE POLYNOMIAL OVER TOP
43C>
44 SUBROUTINE splegend(I,M,SLAT,CLAT,EPS,EPSTOP,PLN,PLNTOP)
45
46CFPP$ NOCONCUR R
47 REAL EPS((M+1)*((I+1)*M+2)/2),EPSTOP(M+1)
48 REAL PLN((M+1)*((I+1)*M+2)/2),PLNTOP(M+1)
49 REAL(KIND=selected_real_kind(15,45)):: dln((m+1)*((i+1)*m+2)/2)
50C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
51C ITERATIVELY COMPUTE PLN WITHIN SPECTRAL DOMAIN AT POLE
52 m1=m+1
53 m2=2*m+i+1
54 mx=(m+1)*((i+1)*m+2)/2
55 IF(clat.EQ.0.) THEN
56 dln(1)=sqrt(0.5)
57 IF(m.GT.0) THEN
58 dln(m1+1)=sqrt(0.75)
59 dln(2)=slat*dln(1)/eps(2)
60 ENDIF
61 IF(m.GT.1) THEN
62 dln(m1+2)=slat*dln(m1+1)/eps(m1+2)
63 dln(3)=(slat*dln(2)-eps(2)*dln(1))/eps(3)
64 DO n=3,m
65 k=1+n
66 dln(k)=(slat*dln(k-1)-eps(k-1)*dln(k-2))/eps(k)
67 k=m1+n
68 dln(k)=(slat*dln(k-1)-eps(k-1)*dln(k-2))/eps(k)
69 ENDDO
70 IF(i.EQ.1) THEN
71 k=m2
72 dln(k)=(slat*dln(k-1)-eps(k-1)*dln(k-2))/eps(k)
73 ENDIF
74 DO k=m2+1,mx
75 dln(k)=0.
76 ENDDO
77 ENDIF
78C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
79C COMPUTE POLYNOMIALS OVER TOP OF SPECTRAL DOMAIN
80 k=m1+1
81 plntop(1)=(slat*dln(k-1)-eps(k-1)*dln(k-2))/epstop(1)
82 IF(m.GT.0) THEN
83 k=m2+1
84 plntop(2)=(slat*dln(k-1)-eps(k-1)*dln(k-2))/epstop(2)
85 DO l=2,m
86 plntop(l+1)=0.
87 ENDDO
88 ENDIF
89C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
90C ITERATIVELY COMPUTE PLN(L,L) (BOTTOM HYPOTENUSE OF DOMAIN)
91 ELSE
92 nml=0
93 k=1
94 dln(k)=sqrt(0.5)
95 DO l=1,m+(i-1)*nml
96 kp=k
97 k=l*(2*m+(i-1)*(l-1))/2+l+nml+1
98 dln(k)=dln(kp)*clat*sqrt(float(2*l+1)/float(2*l))
99 ENDDO
100C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
101C COMPUTE PLN(L,L+1) (DIAGONAL NEXT TO BOTTOM HYPOTENUSE OF DOMAIN)
102 nml=1
103CDIR$ IVDEP
104 DO l=0,m+(i-1)*nml
105 k=l*(2*m+(i-1)*(l-1))/2+l+nml+1
106 dln(k)=slat*dln(k-1)/eps(k)
107 ENDDO
108C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
109C COMPUTE REMAINING PLN IN SPECTRAL DOMAIN
110 DO nml=2,m
111CDIR$ IVDEP
112 DO l=0,m+(i-1)*nml
113 k=l*(2*m+(i-1)*(l-1))/2+l+nml+1
114 dln(k)=(slat*dln(k-1)-eps(k-1)*dln(k-2))/eps(k)
115 ENDDO
116 ENDDO
117C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
118C COMPUTE POLYNOMIALS OVER TOP OF SPECTRAL DOMAIN
119 DO l=0,m
120 nml=m+1+(i-1)*l
121 k=l*(2*m+(i-1)*(l-1))/2+l+nml+1
122 plntop(l+1)=(slat*dln(k-1)-eps(k-1)*dln(k-2))/epstop(l+1)
123 ENDDO
124 ENDIF
125C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
126C RETURN VALUES
127 DO k=1,mx
128 pln(k)=dln(k)
129 ENDDO
130 RETURN
131 END
subroutine splegend(I, M, SLAT, CLAT, EPS, EPSTOP, PLN, PLNTOP)
Evaluates the orthonormal associated Legendre polynomials in the spectral domain at a given latitude.
Definition: splegend.f:45