NCEPLIBS-sp 2.4.0
sptgpsd.f
Go to the documentation of this file.
1C> @file
2C> @brief Transform spectral to polar stereographic gradients
3C> ### Program history log:
4C> Date | Programmer | Comments
5C> -----|------------|----------
6C> 96-02-29 | IREDELL | Initial.
7C> 1998-12-15 | IREDELL | OpenMP directives inserted.
8C> @author IREDELL @date 96-02-29
9
10C> This subprogram performs a spherical transform
11C> from spectral coefficients of scalar fields
12C> to gradient fields on a pair of polar stereographic grids.
13C> The wave-space can be either triangular or rhomboidal.
14C> The wave and grid fields may have general indexing,
15C> but each wave field is in sequential 'ibm order',
16C> i.e., with zonal wavenumber as the slower index.
17C> The two square polar stereographic grids are centered
18C> on the respective poles, with the orientation longitude
19C> of the southern hemisphere grid 180 degrees opposite
20C> that of the northern hemisphere grid.
21C> The vectors are automatically rotated to be resolved
22C> relative to the respective polar stereographic grids.
23C>
24C> The transform is made efficient by combining points in eight
25C> sectors of each polar stereographic grid, numbered as in the
26C> following diagram. The pole and the sector boundaries are
27C> treated specially in the code. Unfortunately, this approach
28C> induces some hairy indexing and code loquacity, for which
29C> the developer apologizes.
30C>
31C> \verbatim
32C> \ 4 | 5 /
33C> \ | /
34C> 3 \ | / 6
35C> \|/
36C> ----+----
37C> /|\
38C> 2 / | \ 7
39C> / | \
40C> / 1 | 8 \
41C> \endverbatim
42C>
43C> The transforms are all multiprocessed over sector points.
44C> transform several fields at a time to improve vectorization.
45C> Subprogram can be called from a multiprocessing environment.
46C>
47C> @param IROMB Spectral domain shape
48C> (0 for triangular, 1 for rhomboidal)
49C> @param MAXWV Spectral truncation
50C> @param KMAX Number of fields to transform
51C> @param NPS Odd order of the polar stereographic grids
52C> @param KWSKIP Skip number between wave fields
53C> (defaults to (MAXWV+1)*((IROMB+1)*MAXWV+2) if KWSKIP=0)
54C> @param KGSKIP Skip number between grid fields
55C> (defaults to NPS*NPS if KGSKIP=0)
56C> @param NISKIP Skip number between grid i-points
57C> (defaults to 1 if NISKIP=0)
58C> @param NJSKIP Skip number between grid j-points
59C> (defaults to NPS if NJSKIP=0)
60C> @param TRUE Latitude at which PS grid is true (usually 60.)
61C> @param XMESH Grid length at true latitude (M)
62C> @param ORIENT Longitude at bottom of northern PS grid
63C> (southern PS grid will have opposite orientation.)
64C> @param WAVE Wave fields
65C> @param XN Northern polar stereographic x-gradients
66C> @param YN Northern polar stereographic y-gradients
67C> @param XS Southern polar stereographic x-gradients
68C> @param YS Southern polar stereographic y-gradients
69C>
70C> @author IREDELL @date 96-02-29
71 SUBROUTINE sptgpsd(IROMB,MAXWV,KMAX,NPS,
72 & KWSKIP,KGSKIP,NISKIP,NJSKIP,
73 & TRUE,XMESH,ORIENT,WAVE,XN,YN,XS,YS)
74
75 REAL WAVE(*),XN(*),YN(*),XS(*),YS(*)
76 REAL EPS((MAXWV+1)*((IROMB+1)*MAXWV+2)/2),EPSTOP(MAXWV+1)
77 REAL ENN1((MAXWV+1)*((IROMB+1)*MAXWV+2)/2)
78 REAL ELONN1((MAXWV+1)*((IROMB+1)*MAXWV+2)/2)
79 REAL EON((MAXWV+1)*((IROMB+1)*MAXWV+2)/2),EONTOP(MAXWV+1)
80 REAL WD((MAXWV+1)*((IROMB+1)*MAXWV+2)/2*2+1,KMAX)
81 REAL WZ((MAXWV+1)*((IROMB+1)*MAXWV+2)/2*2+1,KMAX)
82C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
83C CALCULATE PRELIMINARY CONSTANTS
84 CALL spwget(iromb,maxwv,eps,epstop,enn1,elonn1,eon,eontop)
85 mx=(maxwv+1)*((iromb+1)*maxwv+2)/2
86 mdim=2*mx+1
87 kw=kwskip
88 IF(kw.EQ.0) kw=2*mx
89C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
90C CALCULATE GRADIENTS
91C$OMP PARALLEL DO PRIVATE(KWS)
92 DO k=1,kmax
93 kws=(k-1)*kw
94 CALL splaplac(iromb,maxwv,enn1,wave(kws+1),wd(1,k),1)
95 wz(1:2*mx,k)=0.
96 ENDDO
97 CALL sptgpsv(iromb,maxwv,kmax,nps,mdim,kgskip,niskip,njskip,
98 & true,xmesh,orient,wd,wz,xn,yn,xs,ys)
99C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
100 END
subroutine splaplac(I, M, ENN1, Q, QD2, IDIR)
Computes the laplacian or the inverse laplacian of a scalar field in spectral space.
Definition: splaplac.f:25
subroutine sptgpsd(IROMB, MAXWV, KMAX, NPS, KWSKIP, KGSKIP, NISKIP, NJSKIP, TRUE, XMESH, ORIENT, WAVE, XN, YN, XS, YS)
This subprogram performs a spherical transform from spectral coefficients of scalar fields to gradien...
Definition: sptgpsd.f:74
subroutine sptgpsv(IROMB, MAXWV, KMAX, NPS, KWSKIP, KGSKIP, NISKIP, NJSKIP, TRUE, XMESH, ORIENT, WAVED, WAVEZ, UN, VN, US, VS)
This subprogram performs a spherical transform from spectral coefficients of divergences and curls to...
Definition: sptgpsv.f:83
subroutine spwget(IROMB, MAXWV, EPS, EPSTOP, ENN1, ELONN1, EON, EONTOP)
This subprogram gets wave-space constants.
Definition: spwget.f:18