NCEPLIBS-sp  2.3.3
spgradx.f
Go to the documentation of this file.
1 C> @file
2 C>
3 C> Compute x-gradient in fourier space
4 C> @author IREDELL @date 96-02-20
5 
6 C> THIS SUBPROGRAM COMPUTES THE X-GRADIENT OF FIELDS
7 C> IN COMPLEX FOURIER SPACE.
8 C> THE X-GRADIENT OF A VECTOR FIELD W IS
9 C> WX=CONJG(W)*L/RERTH
10 C> WHERE L IS THE WAVENUMBER AND RERTH IS THE EARTH RADIUS,
11 C> SO THAT THE RESULT IS THE X-GRADIENT OF THE PSEUDO-VECTOR.
12 C> THE X-GRADIENT OF A SCALAR FIELD W IS
13 C> WX=CONJG(W)*L/(RERTH*CLAT)
14 C> WHERE CLAT IS THE COSINE OF LATITUDE.
15 C> AT THE POLE THIS IS UNDEFINED, SO THE WAY TO GET
16 C> THE X-GRADIENT AT THE POLE IS BY PASSING BOTH
17 C> THE WEIGHTED WAVENUMBER 0 AND THE UNWEIGHTED WAVENUMBER 1
18 C> AMPLITUDES AT THE POLE AND SETTING MP=10.
19 C> IN THIS CASE, THE WAVENUMBER 1 AMPLITUDES ARE USED
20 C> TO COMPUTE THE X-GRADIENT AND THEN ZEROED OUT.
21 C>
22 C> @param M - INTEGER FOURIER WAVENUMBER TRUNCATION
23 C> @param INCW - INTEGER FIRST DIMENSION OF THE COMPLEX AMPLITUDE ARRAY
24 C> (INCW >= M+1)
25 C> @param KMAX - INTEGER NUMBER OF FOURIER FIELDS
26 C> @param MP - INTEGER (KM) IDENTIFIERS
27 C> (0 OR 10 FOR SCALAR, 1 FOR VECTOR)
28 C> @param CLAT - REAL COSINE OF LATITUDE
29 C> @param[out] W - COMPLEX(INCW,KMAX) FOURIER AMPLITUDES
30 C> CORRECTED WHEN MP=10 AND CLAT=0
31 C> @param[out] WX - COMPLEX(INCW,KMAX) COMPLEX AMPLITUDES OF X-GRADIENTS
32 C>
33 C> @note THIS SUBPROGRAM IS THREAD-SAFE.
34  SUBROUTINE spgradx(M,INCW,KMAX,MP,CLAT,W,WX)
35 
36  IMPLICIT NONE
37  INTEGER,INTENT(IN):: M,INCW,KMAX,MP(KMAX)
38  REAL,INTENT(IN):: CLAT
39  REAL,INTENT(INOUT):: W(2*INCW,KMAX)
40  REAL,INTENT(OUT):: WX(2*INCW,KMAX)
41  INTEGER K,L
42  REAL,PARAMETER:: RERTH=6.3712e6
43 C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
44  DO k=1,kmax
45  IF(mp(k).EQ.1) THEN
46  DO l=0,m
47  wx(2*l+1,k)=-w(2*l+2,k)*(l/rerth)
48  wx(2*l+2,k)=+w(2*l+1,k)*(l/rerth)
49  ENDDO
50  ELSEIF(clat.EQ.0.) THEN
51  DO l=0,m
52  wx(2*l+1,k)=0
53  wx(2*l+2,k)=0
54  ENDDO
55  IF(mp(k).EQ.10.AND.m.GE.2) THEN
56  wx(3,k)=-w(4,k)/rerth
57  wx(4,k)=+w(3,k)/rerth
58  w(3,k)=0
59  w(4,k)=0
60  ENDIF
61  ELSE
62  DO l=0,m
63  wx(2*l+1,k)=-w(2*l+2,k)*(l/(rerth*clat))
64  wx(2*l+2,k)=+w(2*l+1,k)*(l/(rerth*clat))
65  ENDDO
66  ENDIF
67  ENDDO
68 C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
69  END SUBROUTINE
spgradx
subroutine spgradx(M, INCW, KMAX, MP, CLAT, W, WX)
THIS SUBPROGRAM COMPUTES THE X-GRADIENT OF FIELDS IN COMPLEX FOURIER SPACE.
Definition: spgradx.f:35