NCEPLIBS-sp  2.5.0
spanaly.f
Go to the documentation of this file.
1 C> @file
2 C> @brief Analyze spectral from Fourier.
3 C>
4 C> ### Program History Log
5 C> Date | Programmer | Comments
6 C> -----|------------|---------
7 C> 91-10-31 | Mark Iredell | Initial.
8 C> 94-08-01 | Mark Iredell | Moved zonal wavenumber loop inside.
9 C> 1998-12-15 | Iredell | Openmp directives inserted.
10 C>
11 C> @author Iredell @date 91-10-31
12 
13 C> Analyzes spectral coefficients from Fourier coefficients
14 C> for a latitude pair (Northern and Southern hemispheres).
15 C>
16 C> Vector components are multiplied by cosine of latitude.
17 C>
18 C> @param I spectral domain shape (0 for triangular, 1 for rhomboidal)
19 C> @param M spectral truncation
20 C> @param IM even number of Fourier coefficients
21 C> @param IX dimension of Fourier coefficients (IX>=IM+2)
22 C> @param NC dimension of spectral coefficients (NC>=(M+1)*((I+1)*M+2))
23 C> @param NCTOP dimension of spectral coefficients over top (NCTOP>=2*(M+1))
24 C> @param KM number of fields
25 C> @param WGT Gaussian weight
26 C> @param CLAT cosine of latitude
27 C> @param PLN Legendre polynomials
28 C> @param PLNTOP Legendre polynomial over top
29 C> @param MP identifiers (0 for scalar, 1 for vector)
30 C> @param F Fourier coefficients combined
31 C> @param SPC spectral coefficients
32 C> @param SPCTOP spectral coefficients over top
33 C>
34 C> @author Iredell @date 91-10-31
35  SUBROUTINE spanaly(I,M,IM,IX,NC,NCTOP,KM,WGT,CLAT,PLN,PLNTOP,MP,
36  & F,SPC,SPCTOP)
37  INTEGER MP(KM)
38  REAL PLN((M+1)*((I+1)*M+2)/2),PLNTOP(M+1)
39  REAL F(IX,2,KM)
40  REAL SPC(NC,KM),SPCTOP(NCTOP,KM)
41  REAL FW(2,2)
42 
43 C FOR EACH ZONAL WAVENUMBER, ANALYZE TERMS OVER TOTAL WAVENUMBER.
44 C ANALYZE EVEN AND ODD POLYNOMIALS SEPARATELY.
45  lx=min(m,im/2)
46 !C$OMP PARALLEL DO PRIVATE(L,NT,KS,KP,FW)
47  DO k=1,km
48  DO l=0,lx
49  nt=mod(m+1+(i-1)*l,2)+1
50  ks=l*(2*m+(i-1)*(l-1))
51  kp=ks/2+1
52  IF(mp(k).EQ.0) THEN
53  fw(1,1)=wgt*(f(2*l+1,1,k)+f(2*l+1,2,k))
54  fw(2,1)=wgt*(f(2*l+2,1,k)+f(2*l+2,2,k))
55  fw(1,2)=wgt*(f(2*l+1,1,k)-f(2*l+1,2,k))
56  fw(2,2)=wgt*(f(2*l+2,1,k)-f(2*l+2,2,k))
57  ELSE
58  fw(1,1)=wgt*clat*(f(2*l+1,1,k)+f(2*l+1,2,k))
59  fw(2,1)=wgt*clat*(f(2*l+2,1,k)+f(2*l+2,2,k))
60  fw(1,2)=wgt*clat*(f(2*l+1,1,k)-f(2*l+1,2,k))
61  fw(2,2)=wgt*clat*(f(2*l+2,1,k)-f(2*l+2,2,k))
62  spctop(2*l+1,k)=spctop(2*l+1,k)+plntop(l+1)*fw(1,nt)
63  spctop(2*l+2,k)=spctop(2*l+2,k)+plntop(l+1)*fw(2,nt)
64  ENDIF
65  DO n=l,i*l+m,2
66  spc(ks+2*n+1,k)=spc(ks+2*n+1,k)+pln(kp+n)*fw(1,1)
67  spc(ks+2*n+2,k)=spc(ks+2*n+2,k)+pln(kp+n)*fw(2,1)
68  ENDDO
69  DO n=l+1,i*l+m,2
70  spc(ks+2*n+1,k)=spc(ks+2*n+1,k)+pln(kp+n)*fw(1,2)
71  spc(ks+2*n+2,k)=spc(ks+2*n+2,k)+pln(kp+n)*fw(2,2)
72  ENDDO
73  ENDDO
74  ENDDO
75  RETURN
76  END
subroutine spanaly(I, M, IM, IX, NC, NCTOP, KM, WGT, CLAT, PLN, PLNTOP, MP, F, SPC, SPCTOP)
Analyzes spectral coefficients from Fourier coefficients for a latitude pair (Northern and Southern h...
Definition: spanaly.f:37