NCEPLIBS-sp  2.5.0
splaplac.f
Go to the documentation of this file.
1 C> @file
2 C> @brief Compute laplacian in spectral space.
3 C> @author Iredell @date 92-10-31
4 
5 C> Computes the laplacian or the inverse laplacian
6 C> of a scalar field in spectral space.
7 C>
8 C> Subprogram speps() should be called already.
9 C>
10 C> The Laplacian of Q(L,N) is simply -N*(N+1)/A**2*Q(L,N)
11 C>
12 C> @param I spectral domain shape
13 C> (0 for triangular, 1 for rhomboidal)
14 C> @param M spectral truncation
15 C> @param ENN1 N*(N+1)/A**2
16 C> @param[out] Q if IDIR > 0, scalar field
17 C> (Q(0,0) is not computed)
18 C> @param[out] QD2 if IDIR < 0, Laplacian
19 C> @param IDIR flag
20 C> - IDIR > 0 to take Laplacian
21 C> - IDIR < 0 to take inverse Laplacian
22 C>
23 C> @author Iredell @date 92-10-31
24  SUBROUTINE splaplac(I,M,ENN1,Q,QD2,IDIR)
25 
26  REAL ENN1((M+1)*((I+1)*M+2)/2)
27  REAL Q((M+1)*((I+1)*M+2))
28  REAL QD2((M+1)*((I+1)*M+2))
29 
30 C TAKE LAPLACIAN
31  IF(idir.GT.0) THEN
32  k=1
33  qd2(2*k-1)=0.
34  qd2(2*k)=0.
35  DO k=2,(m+1)*((i+1)*m+2)/2
36  qd2(2*k-1)=q(2*k-1)*(-enn1(k))
37  qd2(2*k)=q(2*k)*(-enn1(k))
38  ENDDO
39 
40 C TAKE INVERSE LAPLACIAN
41  ELSE
42  DO k=2,(m+1)*((i+1)*m+2)/2
43  q(2*k-1)=qd2(2*k-1)/(-enn1(k))
44  q(2*k)=qd2(2*k)/(-enn1(k))
45  ENDDO
46  ENDIF
47 
48  RETURN
49  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