NCEPLIBS-sp 2.4.0
sptgptvd.f
Go to the documentation of this file.
1C> @file
2C> @brief Transform spectral vector to station points.
3C>
4C> ### Program History Log
5C> Date | Programmer | Comments
6C> -----|------------|---------
7C> 96-02-29 | Iredell | Initial.
8C> 1998-12-15 | Iredell | Openmp directives inserted.
9C> 1999-08-18 | Iredell | Openmp directive typo fixed.
10C>
11C> @author Iredell @date 96-02-29
12
13C> This subprogram performs a spherical transform
14C> from spectral coefficients of divergences and curls
15C> to specified sets of station point vectors and their
16C> gradients on the globe.
17C>
18C> <pre>
19C> DP=(D(UP)/DLON+D(VP*CLAT)/DLAT)/(R*CLAT)
20C> ZP=(D(VP)/DLON-D(UP*CLAT)/DLAT)/(R*CLAT)
21C> UXP=D(UP*CLAT)/DLON/(R*CLAT)
22C> VXP=D(VP*CLAT)/DLON/(R*CLAT)
23C> UYP=D(UP*CLAT)/DLAT/R
24C> VYP=D(VP*CLAT)/DLAT/R
25C> </pre>
26C>
27C> The wave-space can be either triangular or rhomboidal.
28C>
29C> The wave and point fields may have general indexing,
30C> but each wave field is in sequential 'IBM order',
31C> i.e. with zonal wavenumber as the slower index.
32C>
33C> The transforms are all multiprocessed over stations.
34C>
35C> Transform several fields at a time to improve vectorization.
36C>
37C> Subprogram can be called from a multiprocessing environment.
38C>
39C> @param IROMB spectral domain shape
40C> (0 for triangular, 1 for rhomboidal)
41C> @param MAXWV spectral truncation
42C> @param KMAX number of fields to transform.
43C> @param NMAX number of station points to return
44C> @param KWSKIP skip number between wave fields
45C> (defaults to (MAXWV+1)*((IROMB+1)*MAXWV+2) IF KWSKIP=0)
46C> @param KGSKIP skip number between station point sets
47C> (defaults to NMAX if KGSKIP=0)
48C> @param NRSKIP skip number between station lats and lons
49C> (defaults to 1 if NRSKIP=0)
50C> @param NGSKIP skip number between station points
51C> (defaults to 1 if NGSKIP=0)
52C> @param RLAT station latitudes in degrees
53C> @param RLON station longitudes in degrees
54C> @param WAVED wave divergence fields
55C> @param WAVEZ wave vorticity fields
56C> @param DP station point divergence sets
57C> @param ZP station point vorticity sets
58C> @param UP station point u-wind sets
59C> @param VP station point v-wind sets
60C> @param UXP station point u-wind x-gradient sets
61C> @param VXP station point v-wind x-gradient sets
62C> @param UYP station point u-wind y-gradient sets
63C> @param VYP station point v-wind y-gradient sets
64C>
65C> @author Iredell @date 96-02-29
66 SUBROUTINE sptgptvd(IROMB,MAXWV,KMAX,NMAX,
67 & KWSKIP,KGSKIP,NRSKIP,NGSKIP,
68 & RLAT,RLON,WAVED,WAVEZ,
69 & DP,ZP,UP,VP,UXP,VXP,UYP,VYP)
70
71 REAL RLAT(*),RLON(*),WAVED(*),WAVEZ(*)
72 REAL DP(*),ZP(*),UP(*),VP(*),UXP(*),VXP(*),UYP(*),VYP(*)
73 REAL EPS((MAXWV+1)*((IROMB+1)*MAXWV+2)/2),EPSTOP(MAXWV+1)
74 REAL ENN1((MAXWV+1)*((IROMB+1)*MAXWV+2)/2)
75 REAL ELONN1((MAXWV+1)*((IROMB+1)*MAXWV+2)/2)
76 REAL EON((MAXWV+1)*((IROMB+1)*MAXWV+2)/2),EONTOP(MAXWV+1)
77 INTEGER MP(4*KMAX)
78 REAL W((MAXWV+1)*((IROMB+1)*MAXWV+2)/2*2,4*KMAX)
79 REAL WTOP(2*(MAXWV+1),4*KMAX)
80 REAL PLN((MAXWV+1)*((IROMB+1)*MAXWV+2)/2),PLNTOP(MAXWV+1)
81 REAL F(2*MAXWV+2,2,6*KMAX),G(6*KMAX)
82 parameter(pi=3.14159265358979)
83
84C CALCULATE PRELIMINARY CONSTANTS
85 CALL spwget(iromb,maxwv,eps,epstop,enn1,elonn1,eon,eontop)
86 mx=(maxwv+1)*((iromb+1)*maxwv+2)/2
87 mxtop=maxwv+1
88 mdim=2*mx
89 idim=2*maxwv+2
90 kw=kwskip
91 kg=kgskip
92 nr=nrskip
93 ng=ngskip
94 IF(kw.EQ.0) kw=2*mx
95 IF(kg.EQ.0) kg=nmax
96 IF(nr.EQ.0) nr=1
97 IF(ng.EQ.0) ng=1
98 mp(1:2*kmax)=0
99 mp(2*kmax+1:4*kmax)=1
100
101C CALCULATE SPECTRAL WINDS
102C$OMP PARALLEL DO PRIVATE(KWS,KD,KZ,KU,KV)
103 DO k=1,kmax
104 kws=(k-1)*kw
105 kd=0*kmax+k
106 kz=1*kmax+k
107 ku=2*kmax+k
108 kv=3*kmax+k
109 DO i=1,2*mx
110 w(i,kd)=waved(kws+i)
111 w(i,kz)=wavez(kws+i)
112 ENDDO
113 DO i=1,2*mxtop
114 wtop(i,kd)=0
115 wtop(i,kz)=0
116 ENDDO
117 CALL spdz2uv(iromb,maxwv,enn1,elonn1,eon,eontop,
118 & waved(kws+1),wavez(kws+1),
119 & w(1,ku),w(1,kv),wtop(1,ku),wtop(1,kv))
120 ENDDO
121
122C CALCULATE STATION FIELDS
123C$OMP PARALLEL DO PRIVATE(KD,KZ,KU,KV,KUX,KVX,SLAT1,CLAT1)
124C$OMP& PRIVATE(PLN,PLNTOP,F,G,NK)
125 DO n=1,nmax
126 ku=2*kmax+1
127 kux=4*kmax+1
128 IF(abs(rlat((n-1)*nr+1)).GE.89.9995) THEN
129 slat1=sign(1.,rlat((n-1)*nr+1))
130 clat1=0.
131 ELSE
132 slat1=sin(pi/180*rlat((n-1)*nr+1))
133 clat1=cos(pi/180*rlat((n-1)*nr+1))
134 ENDIF
135 CALL splegend(iromb,maxwv,slat1,clat1,eps,epstop,
136 & pln,plntop)
137 CALL spsynth(iromb,maxwv,2*maxwv,idim,mdim,2*mxtop,4*kmax,
138 & clat1,pln,plntop,mp,w,wtop,f)
139 CALL spgradx(maxwv,idim,2*kmax,mp(2*kmax+1),clat1,
140 & f(1,1,2*kmax+1),f(1,1,4*kmax+1))
141 CALL spfftpt(maxwv,1,idim,1,6*kmax,rlon((n-1)*nr+1),f,g)
142 DO k=1,kmax
143 kd=0*kmax+k
144 kz=1*kmax+k
145 ku=2*kmax+k
146 kv=3*kmax+k
147 kux=4*kmax+k
148 kvx=5*kmax+k
149 nk=(n-1)*ng+(k-1)*kg+1
150 dp(nk)=g(kd)
151 zp(nk)=g(kz)
152 up(nk)=g(ku)
153 vp(nk)=g(kv)
154 uxp(nk)=g(kux)
155 vxp(nk)=g(kvx)
156 uyp(nk)=g(kvx)-clat1*g(kz)
157 vyp(nk)=clat1*g(kd)-g(kux)
158 ENDDO
159 ENDDO
160 END
subroutine spdz2uv(I, M, ENN1, ELONN1, EON, EONTOP, D, Z, U, V, UTOP, VTOP)
Computes the wind components from divergence and vorticity in spectral space.
Definition: spdz2uv.f:49
subroutine spfftpt(M, N, INCW, INCG, KMAX, RLON, W, G)
This subprogram computes a slow Fourier transform from Fourier space to a set of gridpoints.
Definition: spfftpt.f:23
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
subroutine splegend(I, M, SLAT, CLAT, EPS, EPSTOP, PLN, PLNTOP)
Evaluates the orthonormal associated Legendre polynomials in the spectral domain at a given latitude.
Definition: splegend.f:45
subroutine spsynth(I, M, IM, IX, NC, NCTOP, KM, CLAT, PLN, PLNTOP, MP, SPC, SPCTOP, F)
Synthesizes Fourier coefficients from spectral coefficients for a latitude pair (Northern and Souther...
Definition: spsynth.f:39
subroutine sptgptvd(IROMB, MAXWV, KMAX, NMAX, KWSKIP, KGSKIP, NRSKIP, NGSKIP, RLAT, RLON, WAVED, WAVEZ, DP, ZP, UP, VP, UXP, VXP, UYP, VYP)
This subprogram performs a spherical transform from spectral coefficients of divergences and curls to...
Definition: sptgptvd.f:70
subroutine spwget(IROMB, MAXWV, EPS, EPSTOP, ENN1, ELONN1, EON, EONTOP)
This subprogram gets wave-space constants.
Definition: spwget.f:18