NCEPLIBS-ip 5.2.0
Loading...
Searching...
No Matches
spuv2dz.f
Go to the documentation of this file.
1C> @file
2C> @brief Compute divergence and vorticity from winds.
3C> @author Iredell @date 92-10-31
4
5C> Computes the divergence and vorticity from wind components
6C> in spectral space.
7C>
8C> Subprogram speps() should be called already.
9C>
10C> If L is the zonal wavenumber, N is the total wavenumber,
11C> EPS(L,N)=SQRT((N**2-L**2)/(4*N**2-1)) and A is earth radius,
12C> then the divergence D is computed as:
13C> <pre>
14C> D(L,N)=I*L*A*U(L,N)
15C> +EPS(L,N+1)*N*A*V(L,N+1)-EPS(L,N)*(N+1)*A*V(L,N-1)
16C> </pre>
17C>
18C> and the vorticity Z is computed as:
19C> <pre>
20C> Z(L,N)=I*L*A*V(L,N)
21C> -EPS(L,N+1)*N*A*U(L,N+1)+EPS(L,N)*(N+1)*A*U(L,N-1)
22C> </pre>
23C>
24C> where U is the zonal wind and V is the meridional wind.
25C>
26C> U and V are weighted by the secant of latitude.
27C>
28C> Extra terms are used over top of the spectral domain.
29C>
30C> Advantage is taken of the fact that EPS(L,L)=0
31C> in order to vectorize over the entire spectral domain.
32C>
33C> @param I integer spectral domain shape
34C> (0 for triangular, 1 for rhomboidal)
35C> @param M INTEGER spectral truncation
36C> @param ENN1 ((M+1)*((I+1)*M+2)/2) N*(N+1)/A**2
37C> @param ELONN1 ((M+1)*((I+1)*M+2)/2) L/(N*(N+1))*A
38C> @param EON ((M+1)*((I+1)*M+2)/2) EPSILON/N*A
39C> @param EONTOP (M+1) EPSILON/N*A over top
40C> @param U ((M+1)*((I+1)*M+2)) zonal wind (over coslat)
41C> @param V ((M+1)*((I+1)*M+2)) merid wind (over coslat)
42C> @param UTOP (2*(M+1)) zonal wind (over coslat) over top
43C> @param VTOP (2*(M+1)) merid wind (over coslat) over top
44C> @param D ((M+1)*((I+1)*M+2)) divergence
45C> @param Z ((M+1)*((I+1)*M+2)) vorticity
46C>
47C> @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
55C 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
73C COMPUTE TERMS FROM OVER TOP OF THE SPECTRAL DOMAIN
74CDIR$ 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
83C 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