NCEPLIBS-sp  2.5.0
spuv2dz.f
Go to the documentation of this file.
1 C> @file
2 C> @brief Compute divergence and vorticity from winds.
3 C> @author Iredell @date 92-10-31
4 
5 C> Computes the divergence and vorticity from wind components
6 C> in spectral space.
7 C>
8 C> Subprogram speps() should be called already.
9 C>
10 C> If L is the zonal wavenumber, N is the total wavenumber,
11 C> EPS(L,N)=SQRT((N**2-L**2)/(4*N**2-1)) and A is earth radius,
12 C> then the divergence D is computed as:
13 C> <pre>
14 C> D(L,N)=I*L*A*U(L,N)
15 C> +EPS(L,N+1)*N*A*V(L,N+1)-EPS(L,N)*(N+1)*A*V(L,N-1)
16 C> </pre>
17 C>
18 C> and the vorticity Z is computed as:
19 C> <pre>
20 C> Z(L,N)=I*L*A*V(L,N)
21 C> -EPS(L,N+1)*N*A*U(L,N+1)+EPS(L,N)*(N+1)*A*U(L,N-1)
22 C> </pre>
23 C>
24 C> where U is the zonal wind and V is the meridional wind.
25 C>
26 C> U and V are weighted by the secant of latitude.
27 C>
28 C> Extra terms are used over top of the spectral domain.
29 C>
30 C> Advantage is taken of the fact that EPS(L,L)=0
31 C> in order to vectorize over the entire spectral domain.
32 C>
33 C> @param I integer spectral domain shape
34 C> (0 for triangular, 1 for rhomboidal)
35 C> @param M INTEGER spectral truncation
36 C> @param ENN1 ((M+1)*((I+1)*M+2)/2) N*(N+1)/A**2
37 C> @param ELONN1 ((M+1)*((I+1)*M+2)/2) L/(N*(N+1))*A
38 C> @param EON ((M+1)*((I+1)*M+2)/2) EPSILON/N*A
39 C> @param EONTOP (M+1) EPSILON/N*A over top
40 C> @param U ((M+1)*((I+1)*M+2)) zonal wind (over coslat)
41 C> @param V ((M+1)*((I+1)*M+2)) merid wind (over coslat)
42 C> @param UTOP (2*(M+1)) zonal wind (over coslat) over top
43 C> @param VTOP (2*(M+1)) merid wind (over coslat) over top
44 C> @param D ((M+1)*((I+1)*M+2)) divergence
45 C> @param Z ((M+1)*((I+1)*M+2)) vorticity
46 C>
47 C> @author Iredell @date 92-10-31
48  SUBROUTINE spuv2dz(I,M,ENN1,ELONN1,EON,EONTOP,U,V,UTOP,VTOP,D,Z)
49  REAL ENN1((M+1)*((I+1)*M+2)/2),ELONN1((M+1)*((I+1)*M+2)/2)
50  REAL EON((M+1)*((I+1)*M+2)/2),EONTOP(M+1)
51  REAL U((M+1)*((I+1)*M+2)),V((M+1)*((I+1)*M+2))
52  REAL UTOP(2*(M+1)),VTOP(2*(M+1))
53  REAL D((M+1)*((I+1)*M+2)),Z((M+1)*((I+1)*M+2))
54 
55 C COMPUTE TERMS FROM THE SPECTRAL DOMAIN
56  k=1
57  d(2*k-1)=0.
58  d(2*k)=0.
59  z(2*k-1)=0.
60  z(2*k)=0.
61  DO k=2,(m+1)*((i+1)*m+2)/2-1
62  d(2*k-1)=-elonn1(k)*u(2*k)+eon(k+1)*v(2*k+1)-eon(k)*v(2*k-3)
63  d(2*k)=elonn1(k)*u(2*k-1)+eon(k+1)*v(2*k+2)-eon(k)*v(2*k-2)
64  z(2*k-1)=-elonn1(k)*v(2*k)-eon(k+1)*u(2*k+1)+eon(k)*u(2*k-3)
65  z(2*k)=elonn1(k)*v(2*k-1)-eon(k+1)*u(2*k+2)+eon(k)*u(2*k-2)
66  ENDDO
67  k=(m+1)*((i+1)*m+2)/2
68  d(2*k-1)=-elonn1(k)*u(2*k)-eon(k)*v(2*k-3)
69  d(2*k)=elonn1(k)*u(2*k-1)-eon(k)*v(2*k-2)
70  z(2*k-1)=-elonn1(k)*v(2*k)+eon(k)*u(2*k-3)
71  z(2*k)=elonn1(k)*v(2*k-1)+eon(k)*u(2*k-2)
72 
73 C COMPUTE TERMS FROM OVER TOP OF THE SPECTRAL DOMAIN
74 CDIR$ IVDEP
75  DO l=0,m
76  k=l*(2*m+(i-1)*(l-1))/2+i*l+m+1
77  d(2*k-1)=d(2*k-1)+eontop(l+1)*vtop(2*l+1)
78  d(2*k)=d(2*k)+eontop(l+1)*vtop(2*l+2)
79  z(2*k-1)=z(2*k-1)-eontop(l+1)*utop(2*l+1)
80  z(2*k)=z(2*k)-eontop(l+1)*utop(2*l+2)
81  ENDDO
82 
83 C MULTIPLY BY LAPLACIAN TERM
84  DO k=2,(m+1)*((i+1)*m+2)/2
85  d(2*k-1)=d(2*k-1)*enn1(k)
86  d(2*k)=d(2*k)*enn1(k)
87  z(2*k-1)=z(2*k-1)*enn1(k)
88  z(2*k)=z(2*k)*enn1(k)
89  ENDDO
90  RETURN
91  END
subroutine spuv2dz(I, M, ENN1, ELONN1, EON, EONTOP, U, V, UTOP, VTOP, D, Z)
Computes the divergence and vorticity from wind components in spectral space.
Definition: spuv2dz.f:49