NCEPLIBS-sp  2.5.0
sptgpmd.f
Go to the documentation of this file.
1 C> @file
2 C> @brief Transform spectral to Mercator gradients.
3 C> @author Iredell @date 96-02-29
4 
5 C> This subprogram performs a spherical transform
6 C> from spectral coefficients of scalar fields
7 C> to gradient fields on a Mercator grid.
8 C>
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>
14 C> The Mercator grid is identified by the location
15 C> of its first point and by its respective increments.
16 C>
17 C> The transforms are all multiprocessed over sector points.
18 C>
19 C> Transform several fields at a time to improve vectorization.
20 C> Subprogram can be called from a multiprocessing environment.
21 C>
22 C> @param IROMB Spectral domain shape
23 C> (0 for triangular, 1 for rhomboidal)
24 C> @param MAXWV Spectral truncation
25 C> @param KMAX Number of fields to transform
26 C> @param MI Number of points in the faster zonal direction
27 C> @param MJ Number of points in the slower merid direction
28 C> @param KWSKIP Skip number between wave fields
29 C> (defaults to (MAXWV+1)*((IROMB+1)*MAXWV+2) if KWSKIP=0)
30 C> @param KGSKIP Skip number between grid fields
31 C> (defaults to MI*MJ if KGSKIP=0)
32 C> @param NISKIP Skip number between grid i-points
33 C> (defaults to 1 if NISKIP=0)
34 C> @param NJSKIP Skip number between grid j-points
35 C> (defaults to MI if NJSKIP=0)
36 C> @param RLAT1 Latitude of the first grid point in degrees
37 C> @param RLON1 Longitude of the first grid point in degrees
38 C> @param DLAT Latitude increment in degrees such that
39 C> D(PHI)/D(J)=DLAT*COS(PHI) where J is meridional index.
40 C> DLAT is negative for grids indexed southward.
41 C> (in terms of grid increment dy valid at latitude RLATI,
42 C> the latitude increment DLAT is determined as
43 C> DLAT=DPR*DY/(RERTH*COS(RLATI/DPR))
44 C> where DPR=180/PI and RERTH is Earth's radius)
45 C> @param DLON Longitude increment in degrees such that
46 C> D(LAMBDA)/D(I)=DLON where I is zonal index.
47 C> DLON is negative for grids indexed westward.
48 C> @param WAVE Wave fields
49 C> @param XM Mercator x-gradients
50 C> @param YM Mercator y-gradients
51 C>
52 C> @author Iredell @date 96-02-29
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 
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 
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  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 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
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:63
subroutine spwget(IROMB, MAXWV, EPS, EPSTOP, ENN1, ELONN1, EON, EONTOP)
This subprogram gets wave-space constants.
Definition: spwget.f:18