NCEPLIBS-sp 2.4.0
spgradx.f
Go to the documentation of this file.
1C> @file
2C> @brief Compute x-gradient in Fourier space
3C> @author IREDELL @date 96-02-20
4
5C> This subprogram computes the x-gradient of fields
6C> in complex Fourier space.
7C>
8C> The x-gradient of a vector field W is
9C> WX=CONJG(W)*L/RERTH
10C> where L is the wavenumber and RERTH is the Earth radius,
11C> so that the result is the x-gradient of the pseudo-vector.
12C>
13C> The x-gradient of a scalar field W is
14C> WX=CONJG(W)*L/(RERTH*CLAT)
15C> where CLAT is the cosine of latitude.
16C>
17C> At the pole this is undefined, so the way to get
18C> the x-gradient at the pole is by passing both
19C> the weighted wavenumber 0 and the unweighted wavenumber 1
20C> amplitudes at the pole and setting MP=10.
21C> In this case, the wavenumber 1 amplitudes are used
22C> to compute the x-gradient and then zeroed out.
23C>
24C> @note This subprogram is thread-safe.
25C>
26C> @param M Fourier wavenumber truncation
27C> @param INCW first dimension of the complex amplitude array
28C> (INCW >= M+1)
29C> @param KMAX number of Fourier fields
30C> @param MP identifiers
31C> (0 or 10 for scalar, 1 for vector)
32C> @param CLAT cosine of latitude
33C> @param[out] W Fourier amplitudes corrected when MP=10 and CLAT=0
34C> @param[out] WX complex amplitudes of x-gradients
35C>
36C> @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