NCEPLIBS-sp  2.3.3
spuv2dz.f
Go to the documentation of this file.
1 C> @file
2 C>
3 C> Compute divergence and vorticity from winds
4 C> @author IREDELL @date 92-10-31
5 
6 C> Computes the divergence and vorticity from wind components
7 C> in spectral space.
8 C> SUBPROGRAM SPEPS SHOULD BE CALLED ALREADY.
9 C> IF L IS THE ZONAL WAVENUMBER, N IS THE TOTAL WAVENUMBER,
10 C> EPS(L,N)=SQRT((N**2-L**2)/(4*N**2-1)) AND A IS EARTH RADIUS,
11 C> THEN THE DIVERGENCE D IS COMPUTED AS
12 C> <pre>
13 C> D(L,N)=I*L*A*U(L,N)
14 C> +EPS(L,N+1)*N*A*V(L,N+1)-EPS(L,N)*(N+1)*A*V(L,N-1)
15 C> </pre>
16 C> AND THE VORTICITY Z IS COMPUTED AS
17 C> <pre>
18 C> Z(L,N)=I*L*A*V(L,N)
19 C> -EPS(L,N+1)*N*A*U(L,N+1)+EPS(L,N)*(N+1)*A*U(L,N-1)
20 C> </pre>
21 C> WHERE U IS THE ZONAL WIND AND V IS THE MERIDIONAL WIND.
22 C> U AND V ARE WEIGHTED BY THE SECANT OF LATITUDE.
23 C> EXTRA TERMS ARE USED OVER TOP OF THE SPECTRAL DOMAIN.
24 C> ADVANTAGE IS TAKEN OF THE FACT THAT EPS(L,L)=0
25 C> IN ORDER TO VECTORIZE OVER THE ENTIRE SPECTRAL DOMAIN.
26 C>
27 C> @param I - INTEGER SPECTRAL DOMAIN SHAPE
28 C> (0 FOR TRIANGULAR, 1 FOR RHOMBOIDAL)
29 C> @param M - INTEGER SPECTRAL TRUNCATION
30 C> @param ENN1 - REAL ((M+1)*((I+1)*M+2)/2) N*(N+1)/A**2
31 C> @param ELONN1 - REAL ((M+1)*((I+1)*M+2)/2) L/(N*(N+1))*A
32 C> @param EON - REAL ((M+1)*((I+1)*M+2)/2) EPSILON/N*A
33 C> @param EONTOP - REAL (M+1) EPSILON/N*A OVER TOP
34 C> @param U - REAL ((M+1)*((I+1)*M+2)) ZONAL WIND (OVER COSLAT)
35 C> @param V - REAL ((M+1)*((I+1)*M+2)) MERID WIND (OVER COSLAT)
36 C> @param UTOP - REAL (2*(M+1)) ZONAL WIND (OVER COSLAT) OVER TOP
37 C> @param VTOP - REAL (2*(M+1)) MERID WIND (OVER COSLAT) OVER TOP
38 C> @param D - REAL ((M+1)*((I+1)*M+2)) DIVERGENCE
39 C> @param Z - REAL ((M+1)*((I+1)*M+2)) VORTICITY
40  SUBROUTINE spuv2dz(I,M,ENN1,ELONN1,EON,EONTOP,U,V,UTOP,VTOP,D,Z)
41  REAL ENN1((M+1)*((I+1)*M+2)/2),ELONN1((M+1)*((I+1)*M+2)/2)
42  REAL EON((M+1)*((I+1)*M+2)/2),EONTOP(M+1)
43  REAL U((M+1)*((I+1)*M+2)),V((M+1)*((I+1)*M+2))
44  REAL UTOP(2*(M+1)),VTOP(2*(M+1))
45  REAL D((M+1)*((I+1)*M+2)),Z((M+1)*((I+1)*M+2))
46 C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
47 C COMPUTE TERMS FROM THE SPECTRAL DOMAIN
48  k=1
49  d(2*k-1)=0.
50  d(2*k)=0.
51  z(2*k-1)=0.
52  z(2*k)=0.
53  DO k=2,(m+1)*((i+1)*m+2)/2-1
54  d(2*k-1)=-elonn1(k)*u(2*k)+eon(k+1)*v(2*k+1)-eon(k)*v(2*k-3)
55  d(2*k)=elonn1(k)*u(2*k-1)+eon(k+1)*v(2*k+2)-eon(k)*v(2*k-2)
56  z(2*k-1)=-elonn1(k)*v(2*k)-eon(k+1)*u(2*k+1)+eon(k)*u(2*k-3)
57  z(2*k)=elonn1(k)*v(2*k-1)-eon(k+1)*u(2*k+2)+eon(k)*u(2*k-2)
58  ENDDO
59  k=(m+1)*((i+1)*m+2)/2
60  d(2*k-1)=-elonn1(k)*u(2*k)-eon(k)*v(2*k-3)
61  d(2*k)=elonn1(k)*u(2*k-1)-eon(k)*v(2*k-2)
62  z(2*k-1)=-elonn1(k)*v(2*k)+eon(k)*u(2*k-3)
63  z(2*k)=elonn1(k)*v(2*k-1)+eon(k)*u(2*k-2)
64 C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
65 C COMPUTE TERMS FROM OVER TOP OF THE SPECTRAL DOMAIN
66 CDIR$ IVDEP
67  DO l=0,m
68  k=l*(2*m+(i-1)*(l-1))/2+i*l+m+1
69  d(2*k-1)=d(2*k-1)+eontop(l+1)*vtop(2*l+1)
70  d(2*k)=d(2*k)+eontop(l+1)*vtop(2*l+2)
71  z(2*k-1)=z(2*k-1)-eontop(l+1)*utop(2*l+1)
72  z(2*k)=z(2*k)-eontop(l+1)*utop(2*l+2)
73  ENDDO
74 C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
75 C MULTIPLY BY LAPLACIAN TERM
76  DO k=2,(m+1)*((i+1)*m+2)/2
77  d(2*k-1)=d(2*k-1)*enn1(k)
78  d(2*k)=d(2*k)*enn1(k)
79  z(2*k-1)=z(2*k-1)*enn1(k)
80  z(2*k)=z(2*k)*enn1(k)
81  ENDDO
82 C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
83  RETURN
84  END
spuv2dz
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:41