Corregido un error en la lectura de los array.
[ptslat.git] / elipt.f90
bloba2cb9e5f860e9295c194e7bc530f00d2105106d7
1 MODULE ELIPT_MOD
3 IMPLICIT NONE
5 CONTAINS
7 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
8 ! Heuman's function (KP!!2 = 1-K!!2) !
9 ! !
10 ! (PI/2)* LAMBDA0(PSI,K) = !
11 ! !
12 ! = E(K)*F(PSI,KP) + K(K)*( E(PSI,KP) - F(PSI,KP) ) !
13 ! !
14 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
16 DOUBLE PRECISION FUNCTION LAMBDA0(PSI,K)
18 !!!!! variables 'dummy' y variables internas !!!!!!!!!!!!!!!!!!!!!!!!!!!
20 DOUBLE PRECISION &
21 PSI,K,KFUN,EFUN,KP,FINTEL,EINTEL,PI,DPI
23 !!!!! COMMON variables !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
26 PI = DATAN(1.D0)*4.D0
27 DPI = 2.D0*PI
29 CALL ELIPT0(K,KFUN,EFUN)
31 KP = DSQRT(1.D0-K**2)
33 CALL ELIPT(PSI,KP,FINTEL,EINTEL)
35 LAMBDA0 = (2.D0/PI)*( EFUN*FINTEL + KFUN*( EINTEL-FINTEL ) )
37 RETURN
38 END FUNCTION LAMBDA0
40 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
41 ! Incomplete elliptic integrals
42 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
44 SUBROUTINE ELIPT(PSI,K,FINTEL,EINTEL)
46 !!!!! variables 'dummy' y variables internas !!!!!!!!!!!!!!!!!!!!!!!!!!!
48 DOUBLE PRECISION PSI,K,FINTEL,EINTEL,S,C
49 INTEGER IERR
51 !!!!! function names !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
53 DOUBLE PRECISION DRF,DRD
55 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
57 S = DSIN(PSI)
58 C = DCOS(PSI)
60 FINTEL = S*DRF(C**2,1.D0-(K*S)**2,1.D0,IERR)
62 IF (IERR.NE.0) THEN
63 WRITE(6,*) 'STOP EN FINTEL','IERR =',IERR
64 STOP
65 END IF
67 EINTEL = FINTEL &
68 - (K**2/3.D0)*S**3*DRD(C**2,1.D0-(K*S)**2,1.D0,IERR)
70 IF (IERR.NE.0) THEN
71 WRITE(6,*) 'STOP EN EINTEL','IERR =',IERR
72 STOP
73 END IF
75 RETURN
76 END SUBROUTINE ELIPT
78 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
79 ! Complete elliptic integrals
80 ! poner los limites en K = 0
81 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
83 SUBROUTINE ELIPT0(K,KFUN,EFUN)
85 !!!!! variables 'dummy' y variables internas !!!!!!!!!!!!!!!!!!!!!!!!!!!
87 DOUBLE PRECISION K,KFUN,EFUN
88 INTEGER IERR
90 !!!!! function names !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
92 DOUBLE PRECISION DRF,DRD
94 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
96 KFUN = DRF(0.D0,1.D0-K**2,1.D0,IERR)
98 IF (IERR.NE.0) THEN
99 WRITE(6,*) 'STOP IN KFUN','IERR =',IERR
100 STOP
101 END IF
103 EFUN = KFUN &
104 - (K**2/3.D0)*DRD(0.D0,1.D0-K**2,1.D0,IERR)
106 IF (IERR.NE.0) THEN
107 WRITE(6,*) 'STOP IN EFUN','IERR =',IERR
108 STOP
109 END IF
111 RETURN
112 END SUBROUTINE ELIPT0
114 SUBROUTINE ELIPTK0(K,KFUN)
116 !!!!! variables 'dummy' y variables internas !!!!!!!!!!!!!!!!!!!!!!!!!!!
118 DOUBLE PRECISION K,KFUN
119 INTEGER IERR
121 !!!!! function names !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
123 DOUBLE PRECISION DRF
125 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
127 KFUN = DRF(0.D0,1.D0-K**2,1.D0,IERR)
129 IF (IERR.NE.0) THEN
130 WRITE(6,*) 'STOP IN KFUN','IERR =',IERR
131 STOP
132 END IF
134 RETURN
135 END SUBROUTINE ELIPTK0
137 END MODULE ELIPT_MOD