NCEPLIBS-sp  2.5.0
spgradx.f
Go to the documentation of this file.
1 C> @file
2 C> @brief Compute x-gradient in Fourier space
3 C> @author IREDELL @date 96-02-20
4 
5 C> This subprogram computes the x-gradient of fields
6 C> in complex Fourier space.
7 C>
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>
13 C> The x-gradient of a scalar field W is
14 C> WX=CONJG(W)*L/(RERTH*CLAT)
15 C> where CLAT is the cosine of latitude.
16 C>
17 C> At the pole this is undefined, so the way to get
18 C> the x-gradient at the pole is by passing both
19 C> the weighted wavenumber 0 and the unweighted wavenumber 1
20 C> amplitudes at the pole and setting MP=10.
21 C> In this case, the wavenumber 1 amplitudes are used
22 C> to compute the x-gradient and then zeroed out.
23 C>
24 C> @note This subprogram is thread-safe.
25 C>
26 C> @param M Fourier wavenumber truncation
27 C> @param INCW first dimension of the complex amplitude array
28 C> (INCW >= M+1)
29 C> @param KMAX number of Fourier fields
30 C> @param MP identifiers
31 C> (0 or 10 for scalar, 1 for vector)
32 C> @param CLAT cosine of latitude
33 C> @param[out] W Fourier amplitudes corrected when MP=10 and CLAT=0
34 C> @param[out] WX complex amplitudes of x-gradients
35 C>
36 C> @author IREDELL @date 96-02-20
37  SUBROUTINE spgradx(M,INCW,KMAX,MP,CLAT,W,WX)
38 
39  IMPLICIT NONE
40  INTEGER,INTENT(IN):: M,INCW,KMAX,MP(KMAX)
41  REAL,INTENT(IN):: CLAT
42  REAL,INTENT(INOUT):: W(2*INCW,KMAX)
43  REAL,INTENT(OUT):: WX(2*INCW,KMAX)
44  INTEGER K,L
45  REAL,PARAMETER:: RERTH=6.3712e6
46 
47  DO k=1,kmax
48  IF(mp(k).EQ.1) THEN
49  DO l=0,m
50  wx(2*l+1,k)=-w(2*l+2,k)*(l/rerth)
51  wx(2*l+2,k)=+w(2*l+1,k)*(l/rerth)
52  ENDDO
53  ELSEIF(clat.EQ.0.) THEN
54  DO l=0,m
55  wx(2*l+1,k)=0
56  wx(2*l+2,k)=0
57  ENDDO
58  IF(mp(k).EQ.10.AND.m.GE.2) THEN
59  wx(3,k)=-w(4,k)/rerth
60  wx(4,k)=+w(3,k)/rerth
61  w(3,k)=0
62  w(4,k)=0
63  ENDIF
64  ELSE
65  DO l=0,m
66  wx(2*l+1,k)=-w(2*l+2,k)*(l/(rerth*clat))
67  wx(2*l+2,k)=+w(2*l+1,k)*(l/(rerth*clat))
68  ENDDO
69  ENDIF
70  ENDDO
71 
72  END SUBROUTINE
subroutine spgradx(M, INCW, KMAX, MP, CLAT, W, WX)
This subprogram computes the x-gradient of fields in complex Fourier space.
Definition: spgradx.f:38