NCEPLIBS-sp  2.3.3
spvar.f
Go to the documentation of this file.
1 C> @file
2 C>
3 C> Compute variance by total wavenumber
4 C> @author IREDELL @date 92-10-31
5 
6 C> Computes the variances by total wavenumber
7 C> of a scalar field in spectral space.
8 C>
9 C> @param I - INTEGER SPECTRAL DOMAIN SHAPE
10 C> (0 FOR TRIANGULAR, 1 FOR RHOMBOIDAL)
11 C> @param M - INTEGER SPECTRAL TRUNCATION
12 C> @param Q - REAL ((M+1)*((I+1)*M+2)) SCALAR FIELD
13 C> @param QVAR - REAL (0:(I+1)*M) VARIANCES
14 C>
15  SUBROUTINE spvar(I,M,Q,QVAR)
16  REAL Q((M+1)*((I+1)*M+2))
17  REAL QVAR(0:(I+1)*M)
18 C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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 C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
34  RETURN
35  END
spvar
subroutine spvar(I, M, Q, QVAR)
Computes the variances by total wavenumber of a scalar field in spectral space.
Definition: spvar.f:16