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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

trunk/dyn3d/coefpoly.f revision 123 by guez, Thu Feb 5 12:41:08 2015 UTC trunk/Sources/misc/coefpoly.f revision 149 by guez, Thu Jun 18 12:23:44 2015 UTC
# Line 2  module coefpoly_m Line 2  module coefpoly_m
2    
3    IMPLICIT NONE    IMPLICIT NONE
4    
5      DOUBLE PRECISION a0, a1, a2, a3
6    
7  contains  contains
8    
9    SUBROUTINE coefpoly(xf1, xf2, xprim1, xprim2, xtild1, xtild2, a0, a1, a2, a3)    SUBROUTINE coefpoly(y1, y2, yp1, yp2, x1, x2)
10    
11      ! From LMDZ4/libf/dyn3d/coefpoly.F, version 1.1.1.1 2004/05/19 12:53:05      ! From LMDZ4/libf/dyn3d/coefpoly.F, version 1.1.1.1 2004/05/19 12:53:05
12    
13      ! Author: P. Le Van      ! Author: P. Le Van
14    
15      ! Calcul des coefficients a0, a1, a2, a3 du polynôme de degré 3 qui      ! Calcul des coefficients a0, a1, a2, a3 du polynôme de degré 3
16      ! satisfait aux 4 équations suivantes :      ! qui passe par les points (x1, Y1) et (x2, Y2) avec les
17        ! dérivées yp1 et yp2. Système linéaire de 4 équations à 4
18      ! a0 + a1 * xtild1 + a2 * xtild1**2 + a3 * xtild1**3 = Xf1      ! inconnues :
19      ! a0 + a1 * xtild2 + a2 * xtild2**2 + a3 * xtild2**3 = Xf2  
20      ! a1 + 2. * a2 * xtild1 + 3. * a3 * xtild1**2 = Xprim1      ! a0 + a1 * x1 + a2 * x1**2 + a3 * x1**3 = Y1
21      ! a1 + 2. * a2 * xtild2 + 3. * a3 * xtild2**2 = Xprim2      ! a0 + a1 * x2 + a2 * x2**2 + a3 * x2**3 = Y2
22        ! a1 + 2 * a2 * x1 + 3 * a3 * x1**2 = Yp1
23      ! (passe par les points (Xf(it), xtild(it)) et (Xf(it + 1),      ! a1 + 2 * a2 * x2 + 3 * a3 * x2**2 = Yp2
     ! xtild(it + 1))  
24    
25      ! On en revient à resoudre un système de 4 équations à 4 inconnues      DOUBLE PRECISION, intent(in):: y1, y2, yp1, yp2, x1, x2
     ! a0, a1, a2, a3.  
   
     DOUBLE PRECISION, intent(in):: xf1, xf2, xprim1, xprim2, xtild1, xtild2  
     DOUBLE PRECISION, intent(out):: a0, a1, a2, a3  
26    
27      ! Local:      ! Local:
28      DOUBLE PRECISION xtil1car, xtil2car, derr, x1x2car      DOUBLE PRECISION x1car, x2car
29    
30      !------------------------------------------------------------      !------------------------------------------------------------
31    
32      xtil1car = xtild1 * xtild1      x1car = x1 * x1
33      xtil2car = xtild2 * xtild2      x2car = x2 * x2
   
     derr = 2. * (xf2-xf1)/(xtild1-xtild2)  
   
     x1x2car = (xtild1-xtild2) * (xtild1-xtild2)  
34    
35      a3 = (derr+xprim1+xprim2)/x1x2car      a3 = (2d0 * (y2-y1)/(x1-x2)+yp1+yp2)/((x1-x2) * (x1-x2))
36      a2 = (xprim1-xprim2+3. * a3 * (xtil2car-xtil1car))/(2. * (xtild1-xtild2))      a2 = (yp1-yp2+3d0 * a3 * (x2car-x1car))/(2d0 * (x1-x2))
37    
38      a1 = xprim1 - 3. * a3 * xtil1car - 2. * a2 * xtild1      a1 = yp1 - 3d0 * a3 * x1car - 2d0 * a2 * x1
39      a0 = xf1 - a3 * xtild1 * xtil1car - a2 * xtil1car - a1 * xtild1      a0 = y1 - a3 * x1 * x1car - a2 * x1car - a1 * x1
40    
41    END SUBROUTINE coefpoly    END SUBROUTINE coefpoly
42    

Legend:
Removed from v.123  
changed lines
  Added in v.149

  ViewVC Help
Powered by ViewVC 1.1.21