NCEPLIBS-sp  2.5.0
spvar.f
Go to the documentation of this file.
1 C> @file
2 C> @brief Compute variance by total wavenumber.
3 C> @author Iredell @date 92-10-31
4 
5 C> Computes the variances by total wavenumber
6 C> of a scalar field in spectral space.
7 C>
8 C> @param I spectral domain shape
9 C> (0 for triangular, 1 for rhomboidal)
10 C> @param M spectral truncation
11 C> @param Q ((M+1)*((I+1)*M+2)) scalar field
12 C> @param QVAR (0:(I+1)*M) variances
13 C>
14 C> @author Iredell @date 92-10-31
15  SUBROUTINE spvar(I,M,Q,QVAR)
16  REAL Q((M+1)*((I+1)*M+2))
17  REAL QVAR(0:(I+1)*M)
18 
19  l=0
20  DO n=0,m
21  ks=l*(2*m+(i-1)*(l-1))+2*n
22  qvar(n)=0.5*q(ks+1)**2
23  ENDDO
24  DO n=m+1,(i+1)*m
25  qvar(n)=0.
26  ENDDO
27  DO n=0,(i+1)*m
28  DO l=max(1,n-m),min(n,m)
29  ks=l*(2*m+(i-1)*(l-1))+2*n
30  qvar(n)=qvar(n)+q(ks+1)**2+q(ks+2)**2
31  ENDDO
32  ENDDO
33 
34  RETURN
35  END
subroutine spvar(I, M, Q, QVAR)
Computes the variances by total wavenumber of a scalar field in spectral space.
Definition: spvar.f:16