NCEPLIBS-sp  2.3.3
sptgpmd.f
Go to the documentation of this file.
1 C> @file
2 C>
3 C> Transform spectral to mercator 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 mercator grid.
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 mercator grid is identified by the location
14 C> of its first point and by its respective increments.
15 C> The transforms are all multiprocessed over sector points.
16 C> Transform several fields at a time to improve vectorization.
17 C> subprogram can be called from a multiprocessing environment.
18 C>
19 C> @param IROMB - INTEGER SPECTRAL DOMAIN SHAPE
20 C> (0 FOR TRIANGULAR, 1 FOR RHOMBOIDAL)
21 C> @param MAXWV - INTEGER SPECTRAL TRUNCATION
22 C> @param KMAX - INTEGER NUMBER OF FIELDS TO TRANSFORM.
23 C> @param MI - INTEGER NUMBER OF POINTS IN THE FASTER ZONAL DIRECTION
24 C> @param MJ - INTEGER NUMBER OF POINTS IN THE SLOWER MERID DIRECTION
25 C> @param KWSKIP - INTEGER SKIP NUMBER BETWEEN WAVE FIELDS
26 C> (DEFAULTS TO (MAXWV+1)*((IROMB+1)*MAXWV+2) IF KWSKIP=0)
27 C> @param KGSKIP - INTEGER SKIP NUMBER BETWEEN GRID FIELDS
28 C> (DEFAULTS TO MI*MJ IF KGSKIP=0)
29 C> @param NISKIP - INTEGER SKIP NUMBER BETWEEN GRID I-POINTS
30 C> (DEFAULTS TO 1 IF NISKIP=0)
31 C> @param NJSKIP - INTEGER SKIP NUMBER BETWEEN GRID J-POINTS
32 C> (DEFAULTS TO MI IF NJSKIP=0)
33 C> @param RLAT1 - REAL LATITUDE OF THE FIRST GRID POINT IN DEGREES
34 C> @param RLON1 - REAL LONGITUDE OF THE FIRST GRID POINT IN DEGREES
35 C> @param DLAT - REAL LATITUDE INCREMENT IN DEGREES SUCH THAT
36 C> D(PHI)/D(J)=DLAT*COS(PHI) WHERE J IS MERIDIONAL INDEX.
37 C> DLAT IS NEGATIVE FOR GRIDS INDEXED SOUTHWARD.
38 C> (IN TERMS OF GRID INCREMENT DY VALID AT LATITUDE RLATI,
39 C> THE LATITUDE INCREMENT DLAT IS DETERMINED AS
40 C> DLAT=DPR*DY/(RERTH*COS(RLATI/DPR))
41 C> WHERE DPR=180/PI AND RERTH IS EARTH'S RADIUS)
42 C> @param DLON - REAL LONGITUDE INCREMENT IN DEGREES SUCH THAT
43 C> D(LAMBDA)/D(I)=DLON WHERE I IS ZONAL INDEX.
44 C> DLON IS NEGATIVE FOR GRIDS INDEXED WESTWARD.
45 C> @param WAVE - REAL (*) WAVE FIELDS
46 C> @param XM - REAL (*) MERCATOR X-GRADIENTS
47 C> @param YM - REAL (*) MERCATOR Y-GRADIENTS
48 C>
49 C> SUBPROGRAMS CALLED:
50 C> - SPWGET() GET WAVE-SPACE CONSTANTS
51 C> - SPLAPLAC() COMPUTE LAPLACIAN IN SPECTRAL SPACE
52 C> - SPTGPMV() TRANSFORM SPECTRAL VECTOR TO MERCATOR
53  SUBROUTINE sptgpmd(IROMB,MAXWV,KMAX,MI,MJ,
54  & KWSKIP,KGSKIP,NISKIP,NJSKIP,
55  & RLAT1,RLON1,DLAT,DLON,WAVE,XM,YM)
56 
57  REAL WAVE(*),XM(*),YM(*)
58  REAL EPS((MAXWV+1)*((IROMB+1)*MAXWV+2)/2),EPSTOP(MAXWV+1)
59  REAL ENN1((MAXWV+1)*((IROMB+1)*MAXWV+2)/2)
60  REAL ELONN1((MAXWV+1)*((IROMB+1)*MAXWV+2)/2)
61  REAL EON((MAXWV+1)*((IROMB+1)*MAXWV+2)/2),EONTOP(MAXWV+1)
62  REAL WD((MAXWV+1)*((IROMB+1)*MAXWV+2)/2*2+1,KMAX)
63  REAL WZ((MAXWV+1)*((IROMB+1)*MAXWV+2)/2*2+1,KMAX)
64 C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
65 C CALCULATE PRELIMINARY CONSTANTS
66  CALL spwget(iromb,maxwv,eps,epstop,enn1,elonn1,eon,eontop)
67  mx=(maxwv+1)*((iromb+1)*maxwv+2)/2
68  mdim=2*mx+1
69  kw=kwskip
70  IF(kw.EQ.0) kw=2*mx
71 C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
72 C CALCULATE GRADIENTS
73 C$OMP PARALLEL DO PRIVATE(KWS)
74  DO k=1,kmax
75  kws=(k-1)*kw
76  CALL splaplac(iromb,maxwv,enn1,wave(kws+1),wd(1,k),1)
77  wz(1:2*mx,k)=0.
78  ENDDO
79  CALL sptgpmv(iromb,maxwv,kmax,mi,mj,mdim,kgskip,niskip,njskip,
80  & rlat1,rlon1,dlat,dlon,wd,wz,xm,ym)
81 C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
82  END
spwget
subroutine spwget(IROMB, MAXWV, EPS, EPSTOP, ENN1, ELONN1, EON, EONTOP)
This subprogram gets wave-space constants.
Definition: spwget.f:22
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
sptgpmv
subroutine sptgpmv(IROMB, MAXWV, KMAX, MI, MJ, KWSKIP, KGSKIP, NISKIP, NJSKIP, RLAT1, RLON1, DLAT, DLON, WAVED, WAVEZ, UM, VM)
THIS SUBPROGRAM PERFORMS A SPHERICAL TRANSFORM FROM SPECTRAL COEFFICIENTS OF DIVERGENCES AND CURLS TO...
Definition: sptgpmv.f:62
sptgpmd
subroutine sptgpmd(IROMB, MAXWV, KMAX, MI, MJ, KWSKIP, KGSKIP, NISKIP, NJSKIP, RLAT1, RLON1, DLAT, DLON, WAVE, XM, YM)
This subprogram performs a spherical transform from spectral coefficients of scalar fields to gradien...
Definition: sptgpmd.f:56