NCEPLIBS-sp  2.3.3
sptgpsd.f
Go to the documentation of this file.
1 C> @file
2 C>
3 C> Transform spectral to polar stereo. gradients
4 C> @author IREDELL @date 96-02-29
5 
6 C> this subprogram performs a spherical transform
7 C> from spectral coefficients of scalar fields
8 C> to gradient fields on a pair of polar stereographic grids.
9 C> The wave-space can be either triangular or rhomboidal.
10 C> The wave and grid fields may have general indexing,
11 C> but each wave field is in sequential 'ibm order',
12 C> i.e. with zonal wavenumber as the slower index.
13 C> the two square polar stereographic grids are centered
14 C> on the respective poles, with the orientation longitude
15 C> of the southern hemisphere grid 180 degrees opposite
16 C> that of the northern hemisphere grid.
17 C> The vectors are automatically rotated to be resolved
18 C> relative to the respective polar stereographic grids.
19 C>
20 C> The transform is made efficient \ 4 | 5 /
21 C> by combining points in eight sectors \ | /
22 C> of each polar stereographic grid, 3 \ | / 6
23 C> numbered as in the diagram at right. \|/
24 C> The pole and the sector boundaries ----+----
25 C> are treated specially in the code. /|\
26 C> Unfortunately, this approach induces 2 / | \ 7
27 C> some hairy indexing and code loquacity, / | \
28 C> for which the developer apologizes. / 1 | 8 \
29 C>
30 C> The transforms are all multiprocessed over sector points.
31 C> transform several fields at a time to improve vectorization.
32 C> Subprogram can be called from a multiprocessing environment.
33 C>
34 C> PROGRAM HISTORY LOG:
35 C> - 96-02-29 IREDELL
36 C> - 1998-12-15 IREDELL OPENMP DIRECTIVES INSERTED
37 C>
38 C> @param IROMB - INTEGER SPECTRAL DOMAIN SHAPE
39 C> (0 FOR TRIANGULAR, 1 FOR RHOMBOIDAL)
40 C> @param MAXWV - INTEGER SPECTRAL TRUNCATION
41 C> @param KMAX - INTEGER NUMBER OF FIELDS TO TRANSFORM.
42 C> @param NPS - INTEGER ODD ORDER OF THE POLAR STEREOGRAPHIC GRIDS
43 C> @param KWSKIP - INTEGER SKIP NUMBER BETWEEN WAVE FIELDS
44 C> (DEFAULTS TO (MAXWV+1)*((IROMB+1)*MAXWV+2) IF KWSKIP=0)
45 C> @param KGSKIP - INTEGER SKIP NUMBER BETWEEN GRID FIELDS
46 C> (DEFAULTS TO NPS*NPS IF KGSKIP=0)
47 C> @param NISKIP - INTEGER SKIP NUMBER BETWEEN GRID I-POINTS
48 C> (DEFAULTS TO 1 IF NISKIP=0)
49 C> @param NJSKIP - INTEGER SKIP NUMBER BETWEEN GRID J-POINTS
50 C> (DEFAULTS TO NPS IF NJSKIP=0)
51 C> @param TRUE - REAL LATITUDE AT WHICH PS GRID IS TRUE (USUALLY 60.)
52 C> @param XMESH - REAL GRID LENGTH AT TRUE LATITUDE (M)
53 C> @param ORIENT - REAL LONGITUDE AT BOTTOM OF NORTHERN PS GRID
54 C> (SOUTHERN PS GRID WILL HAVE OPPOSITE ORIENTATION.)
55 C> @param WAVE - REAL (*) WAVE FIELDS
56 C> @param XN - REAL (*) NORTHERN POLAR STEREOGRAPHIC X-GRADIENTS
57 C> @param YN - REAL (*) NORTHERN POLAR STEREOGRAPHIC Y-GRADIENTS
58 C> @param XS - REAL (*) SOUTHERN POLAR STEREOGRAPHIC X-GRADIENTS
59 C> @param YS - REAL (*) SOUTHERN POLAR STEREOGRAPHIC Y-GRADIENTS
60 C>
61 C> SUBPROGRAMS CALLED:
62 C> - SPWGET() GET WAVE-SPACE CONSTANTS
63 C> - SPLAPLAC() COMPUTE LAPLACIAN IN SPECTRAL SPACE
64 C> - SPTGPSV() TRANSFORM SPECTRAL VECTOR TO POLAR STEREO.
65  SUBROUTINE sptgpsd(IROMB,MAXWV,KMAX,NPS,
66  & KWSKIP,KGSKIP,NISKIP,NJSKIP,
67  & TRUE,XMESH,ORIENT,WAVE,XN,YN,XS,YS)
68 
69  REAL WAVE(*),XN(*),YN(*),XS(*),YS(*)
70  REAL EPS((MAXWV+1)*((IROMB+1)*MAXWV+2)/2),EPSTOP(MAXWV+1)
71  REAL ENN1((MAXWV+1)*((IROMB+1)*MAXWV+2)/2)
72  REAL ELONN1((MAXWV+1)*((IROMB+1)*MAXWV+2)/2)
73  REAL EON((MAXWV+1)*((IROMB+1)*MAXWV+2)/2),EONTOP(MAXWV+1)
74  REAL WD((MAXWV+1)*((IROMB+1)*MAXWV+2)/2*2+1,KMAX)
75  REAL WZ((MAXWV+1)*((IROMB+1)*MAXWV+2)/2*2+1,KMAX)
76 C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
77 C CALCULATE PRELIMINARY CONSTANTS
78  CALL spwget(iromb,maxwv,eps,epstop,enn1,elonn1,eon,eontop)
79  mx=(maxwv+1)*((iromb+1)*maxwv+2)/2
80  mdim=2*mx+1
81  kw=kwskip
82  IF(kw.EQ.0) kw=2*mx
83 C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
84 C CALCULATE GRADIENTS
85 C$OMP PARALLEL DO PRIVATE(KWS)
86  DO k=1,kmax
87  kws=(k-1)*kw
88  CALL splaplac(iromb,maxwv,enn1,wave(kws+1),wd(1,k),1)
89  wz(1:2*mx,k)=0.
90  ENDDO
91  CALL sptgpsv(iromb,maxwv,kmax,nps,mdim,kgskip,niskip,njskip,
92  & true,xmesh,orient,wd,wz,xn,yn,xs,ys)
93 C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
94  END
spwget
subroutine spwget(IROMB, MAXWV, EPS, EPSTOP, ENN1, ELONN1, EON, EONTOP)
This subprogram gets wave-space constants.
Definition: spwget.f:22
sptgpsv
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:81
splaplac
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:22
sptgpsd
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:68