/[lmdze]/trunk/Sources/misc/coefpoly.f
ViewVC logotype

Contents of /trunk/Sources/misc/coefpoly.f

Parent Directory Parent Directory | Revision Log Revision Log


Revision 146 - (show annotations)
Tue Jun 16 17:27:33 2015 UTC (8 years, 11 months ago) by guez
Original Path: trunk/Sources/dyn3d/coefpoly.f
File size: 1166 byte(s)
We use the fact that \tilde X is an odd function in invert_zoom_x so
we only need arrays for the domain \tilde x \in [0, \pi].

1 module coefpoly_m
2
3 IMPLICIT NONE
4
5 contains
6
7 SUBROUTINE coefpoly(y1, y2, yp1, yp2, x1, x2, a0, a1, a2, a3)
8
9 ! From LMDZ4/libf/dyn3d/coefpoly.F, version 1.1.1.1 2004/05/19 12:53:05
10
11 ! Author: P. Le Van
12
13 ! Calcul des coefficients a0, a1, a2, a3 du polynôme de degré 3
14 ! qui passe par les points (x1, Y1) et (x2, Y2) avec les
15 ! dérivées yp1 et yp2. Système linéaire de 4 équations à 4
16 ! inconnues :
17
18 ! a0 + a1 * x1 + a2 * x1**2 + a3 * x1**3 = Y1
19 ! a0 + a1 * x2 + a2 * x2**2 + a3 * x2**3 = Y2
20 ! a1 + 2 * a2 * x1 + 3 * a3 * x1**2 = Yp1
21 ! a1 + 2 * a2 * x2 + 3 * a3 * x2**2 = Yp2
22
23 DOUBLE PRECISION, intent(in):: y1, y2, yp1, yp2, x1, x2
24 DOUBLE PRECISION, intent(out):: a0, a1, a2, a3
25
26 ! Local:
27 DOUBLE PRECISION x1car, x2car
28
29 !------------------------------------------------------------
30
31 x1car = x1 * x1
32 x2car = x2 * x2
33
34 a3 = (2d0 * (y2-y1)/(x1-x2)+yp1+yp2)/((x1-x2) * (x1-x2))
35 a2 = (yp1-yp2+3d0 * a3 * (x2car-x1car))/(2d0 * (x1-x2))
36
37 a1 = yp1 - 3d0 * a3 * x1car - 2d0 * a2 * x1
38 a0 = y1 - a3 * x1 * x1car - a2 * x1car - a1 * x1
39
40 END SUBROUTINE coefpoly
41
42 end module coefpoly_m

  ViewVC Help
Powered by ViewVC 1.1.21