source: LMDZ4/branches/IPSL-CM4_IPCC_patches/libf/dyn3d/splint.F @ 5451

Last change on this file since 5451 was 524, checked in by lmdzadmin, 21 years ago

Initial revision

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 963 bytes
Line 
1!
2! $Header$
3!
4     
5      SUBROUTINE splint(xa,ya,y2a,n,x,y)
6     
7c
8c     Routine to compute a cubic-spline interpolated value Y given the
9c     value of X, the arrays XA, YA and the 2nd derivative array Y2A
10c     computed by SUBROUTINE SPLINE. See "Numerical Recipes" for details
11c
12     
13      IMPLICIT REAL (a-h,o-z)
14      IMPLICIT INTEGER (i-n)
15      DIMENSION xa(n),ya(n),y2a(n)
16     
17      kl0=1
18     
19      khi=n
20c means of bisection
21 1    IF(khi-kl0.gt.1) THEN
22     
23       k=(khi+kl0)/2
24     
25       IF(xa(k).gt.x) THEN
26     
27        khi=k
28     
29       ELSE
30     
31        kl0=k
32     
33       END IF
34     
35       GO TO 1
36     
37      END IF
38c KL0 and KHI now bracket the X
39      h=xa(khi)-xa(kl0)
40     
41      IF(h.eq.0.0) STOP
42      a=(xa(khi)-x)/h
43c evaluation of cubic spline polynomial
44      b=(x-xa(kl0))/h
45     
46      y=a*ya(kl0)+b*ya(khi)+((a**3-a)*y2a(kl0)+(b**3-b)*y2a(khi))*(h**2)
47     
48     ./6.
49     
50c
51     
52      RETURN
53     
54      END
55     
56
Note: See TracBrowser for help on using the repository browser.