NCEPLIBS-sp  2.3.3
sptranv.f
Go to the documentation of this file.
1 C> @file
2 C>
3 C> Perform a vector spherical transform
4 C> @author IREDELL @date 96-02-29
5 
6 C> THIS SUBPROGRAM PERFORMS A SPHERICAL TRANSFORM
7 C> BETWEEN SPECTRAL COEFFICIENTS OF DIVERGENCES AND CURLS
8 C> AND VECTOR FIELDS ON A GLOBAL CYLINDRICAL GRID.
9 C> THE WAVE-SPACE CAN BE EITHER TRIANGULAR OR RHOMBOIDAL.
10 C> THE GRID-SPACE CAN BE EITHER AN EQUALLY-SPACED GRID
11 C> (WITH OR WITHOUT POLE POINTS) OR A GAUSSIAN GRID.
12 C> THE WAVE AND GRID FIELDS MAY HAVE GENERAL INDEXING,
13 C> BUT EACH WAVE FIELD IS IN SEQUENTIAL 'IBM ORDER',
14 C> I.E. WITH ZONAL WAVENUMBER AS THE SLOWER INDEX.
15 C> TRANSFORMS ARE DONE IN LATITUDE PAIRS FOR EFFICIENCY;
16 C> THUS GRID ARRAYS FOR EACH HEMISPHERE MUST BE PASSED.
17 C> IF SO REQUESTED, JUST A SUBSET OF THE LATITUDE PAIRS
18 C> MAY BE TRANSFORMED IN EACH INVOCATION OF THE SUBPROGRAM.
19 C> THE TRANSFORMS ARE ALL MULTIPROCESSED OVER LATITUDE EXCEPT
20 C> THE TRANSFORM FROM FOURIER TO SPECTRAL IS MULTIPROCESSED
21 C> OVER ZONAL WAVENUMBER TO ENSURE REPRODUCIBILITY.
22 C> TRANSFORM SEVERAL FIELDS AT A TIME TO IMPROVE VECTORIZATION.
23 C> SUBPROGRAM CAN BE CALLED FROM A MULTIPROCESSING ENVIRONMENT.
24 C>
25 C> PROGRAM HISTORY LOG:
26 C> - 96-02-29 IREDELL
27 C> - 1998-12-15 IREDELL GENERIC FFT USED, OPENMP DIRECTIVES INSERTED
28 C>
29 C> @param IROMB - INTEGER SPECTRAL DOMAIN SHAPE
30 C> (0 FOR TRIANGULAR, 1 FOR RHOMBOIDAL)
31 C> @param MAXWV - INTEGER SPECTRAL TRUNCATION
32 C> @param IDRT - INTEGER GRID IDENTIFIER
33 C> (IDRT=4 FOR GAUSSIAN GRID,
34 C> IDRT=0 FOR EQUALLY-SPACED GRID INCLUDING POLES,
35 C> IDRT=256 FOR EQUALLY-SPACED GRID EXCLUDING POLES)
36 C> @param IMAX - INTEGER EVEN NUMBER OF LONGITUDES.
37 C> @param JMAX - INTEGER NUMBER OF LATITUDES.
38 C> @param KMAX - INTEGER NUMBER OF FIELDS TO TRANSFORM.
39 C> @param IPRIME - INTEGER LONGITUDE INDEX FOR THE PRIME MERIDIAN.
40 C> (DEFAULTS TO 1 IF IPRIME=0)
41 C> @param ISKIP - INTEGER SKIP NUMBER BETWEEN LONGITUDES
42 C> (DEFAULTS TO 1 IF ISKIP=0)
43 C> @param JNSKIP - INTEGER SKIP NUMBER BETWEEN N.H. LATITUDES FROM NORTH
44 C> (DEFAULTS TO IMAX IF JNSKIP=0)
45 C> @param JSSKIP - INTEGER SKIP NUMBER BETWEEN S.H. LATITUDES FROM SOUTH
46 C> (DEFAULTS TO -IMAX IF JSSKIP=0)
47 C> @param KWSKIP - INTEGER SKIP NUMBER BETWEEN WAVE FIELDS
48 C> (DEFAULTS TO (MAXWV+1)*((IROMB+1)*MAXWV+2) IF KWSKIP=0)
49 C> @param KGSKIP - INTEGER SKIP NUMBER BETWEEN GRID FIELDS
50 C> (DEFAULTS TO IMAX*JMAX IF KGSKIP=0)
51 C> @param JBEG - INTEGER LATITUDE INDEX (FROM POLE) TO BEGIN TRANSFORM
52 C> (DEFAULTS TO 1 IF JBEG=0)
53 C> (IF JBEG=0 AND IDIR<0, WAVE IS ZEROED BEFORE TRANSFORM)
54 C> @param JEND - INTEGER LATITUDE INDEX (FROM POLE) TO END TRANSFORM
55 C> (DEFAULTS TO (JMAX+1)/2 IF JEND=0)
56 C> @param JCPU - INTEGER NUMBER OF CPUS OVER WHICH TO MULTIPROCESS
57 C> @param[out] WAVED - REAL (*) WAVE DIVERGENCE FIELDS IF IDIR>0
58 C> [WAVED=(D(GRIDU)/DLAM+D(CLAT*GRIDV)/DPHI)/(CLAT*RERTH)]
59 C> @param[out] WAVEZ - REAL (*) WAVE VORTICITY FIELDS IF IDIR>0
60 C> [WAVEZ=(D(GRIDV)/DLAM-D(CLAT*GRIDU)/DPHI)/(CLAT*RERTH)]
61 C> @param[out] GRIDUN - REAL (*) N.H. GRID U-WINDS (STARTING AT JBEG) IF IDIR<0
62 C> @param[out] GRIDUS - REAL (*) S.H. GRID U-WINDS (STARTING AT JBEG) IF IDIR<0
63 C> @param[out] GRIDVN - REAL (*) N.H. GRID V-WINDS (STARTING AT JBEG) IF IDIR<0
64 C> @param[out] GRIDVS - REAL (*) S.H. GRID V-WINDS (STARTING AT JBEG) IF IDIR<0
65 C> @param IDIR - INTEGER TRANSFORM FLAG
66 C> (IDIR>0 FOR WAVE TO GRID, IDIR<0 FOR GRID TO WAVE)
67 C>
68 C> SUBPROGRAMS CALLED:
69 C> - SPTRANFV PERFORM A VECTOR SPHERICAL TRANSFORM
70 C>
71 C> REMARKS: MINIMUM GRID DIMENSIONS FOR UNALIASED TRANSFORMS TO SPECTRAL:
72 C> DIMENSION |LINEAR |QUADRATIC
73 C> ----------------------- |--------- |-------------
74 C> IMAX |2*MAXWV+2 |3*MAXWV/2*2+2
75 C> JMAX (IDRT=4,IROMB=0) |1*MAXWV+1 |3*MAXWV/2+1
76 C> JMAX (IDRT=4,IROMB=1) |2*MAXWV+1 |5*MAXWV/2+1
77 C> JMAX (IDRT=0,IROMB=0) |2*MAXWV+3 |3*MAXWV/2*2+3
78 C> JMAX (IDRT=0,IROMB=1) |4*MAXWV+3 |5*MAXWV/2*2+3
79 C> JMAX (IDRT=256,IROMB=0) |2*MAXWV+1 |3*MAXWV/2*2+1
80 C> JMAX (IDRT=256,IROMB=1) |4*MAXWV+1 |5*MAXWV/2*2+1
81  SUBROUTINE sptranv(IROMB,MAXWV,IDRT,IMAX,JMAX,KMAX,
82  & IPRIME,ISKIP,JNSKIP,JSSKIP,KWSKIP,KGSKIP,
83  & JBEG,JEND,JCPU,
84  & WAVED,WAVEZ,GRIDUN,GRIDUS,GRIDVN,GRIDVS,IDIR)
85 
86  REAL WAVED(*),WAVEZ(*),GRIDUN(*),GRIDUS(*),GRIDVN(*),GRIDVS(*)
87 C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
88  MX=(maxwv+1)*((iromb+1)*maxwv+2)/2
89  ip=iprime
90  is=iskip
91  jn=jnskip
92  js=jsskip
93  kw=kwskip
94  kg=kgskip
95  jb=jbeg
96  je=jend
97  jc=jcpu
98  IF(ip.EQ.0) ip=1
99  IF(is.EQ.0) is=1
100  IF(jn.EQ.0) jn=imax
101  IF(js.EQ.0) js=-jn
102  IF(kw.EQ.0) kw=2*mx
103  IF(kg.EQ.0) kg=imax*jmax
104  IF(jb.EQ.0) jb=1
105  IF(je.EQ.0) je=(jmax+1)/2
106  IF(jc.EQ.0) jc=ncpus()
107 C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
108  IF(idir.LT.0.AND.jbeg.EQ.0) THEN
109  DO k=1,kmax
110  kws=(k-1)*kw
111  waved(kws+1:kws+2*mx)=0
112  wavez(kws+1:kws+2*mx)=0
113  ENDDO
114  ENDIF
115 C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
116  CALL sptranfv(iromb,maxwv,idrt,imax,jmax,kmax,
117  & ip,is,jn,js,kw,kg,jb,je,jc,
118  & waved,wavez,gridun,gridus,gridvn,gridvs,idir)
119 C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
120  END
ncpus
function ncpus()
Set number of cpus.
Definition: ncpus.F:21
sptranv
subroutine sptranv(IROMB, MAXWV, IDRT, IMAX, JMAX, KMAX, IPRIME, ISKIP, JNSKIP, JSSKIP, KWSKIP, KGSKIP, JBEG, JEND, JCPU, WAVED, WAVEZ, GRIDUN, GRIDUS, GRIDVN, GRIDVS, IDIR)
THIS SUBPROGRAM PERFORMS A SPHERICAL TRANSFORM BETWEEN SPECTRAL COEFFICIENTS OF DIVERGENCES AND CURLS...
Definition: sptranv.f:85
sptranfv
subroutine sptranfv(IROMB, MAXWV, IDRT, IMAX, JMAX, KMAX, IP, IS, JN, JS, KW, KG, JB, JE, JC, WAVED, WAVEZ, GRIDUN, GRIDUS, GRIDVN, GRIDVS, IDIR)
THIS SUBPROGRAM PERFORMS A SPHERICAL TRANSFORM BETWEEN SPECTRAL COEFFICIENTS OF DIVERGENCES AND CURLS...
Definition: sptranfv.f:81