The TELEMAC-MASCARET system  trunk
gauleg.f
Go to the documentation of this file.
1 ! *****************
2  SUBROUTINE gauleg
3 ! *****************
4 !
5  &( w_leg , x_leg , npoin )
6 !
7 !***********************************************************************
8 ! TOMAWAC V6P1 15/06/2011
9 !***********************************************************************
10 !
11 !brief COMPUTES WEIGHTS AND ABSICSSA FOR THE GAUSS-LEGENDRE QUADRATURE.
12 !+ THE OUTPUT ABSCISSA ARE INCLUDED BETWEEN -1 AND 1.
13 !+ SUBROUTINE CALLED BY PRENL3
14 !
15 !history E. GAGNAIRE-RENOU
16 !+ 04/2011
17 !+ V6P1
18 !+ CREATED
19 !
20 !history G.MATTAROLO (EDF - LNHE)
21 !+ 15/06/2011
22 !+ V6P1
23 !+ Translation of French names of the variables in argument
24 !
25 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
26 !| NPOIN |-->| NUMBER OF INTEGRATION POINTS OVER OMEGA2
27 !| X_LEG |<--| ABSICSSAE FOR THE GAUSS-LEGENDRE QUADRATURE
28 !| W_LEG |<--| WEIGHTS FOR THE GAUSS-LEGENDRE QUADRATURE
29 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
30 !
31  USE declarations_tomawac, ONLY : pi
32 !
33  USE interface_tomawac, ex_gauleg => gauleg
34  IMPLICIT NONE
35 !
36 !.....VARIABLES IN ARGUMENT
37 ! """"""""""""""""""""
38  INTEGER ,INTENT(IN) :: NPOIN
39  DOUBLE PRECISION ,INTENT(INOUT) :: W_LEG(npoin) , X_LEG(npoin)
40 !
41 !.....LOCAL VARIABLES
42 ! """""""""""""""""
43  INTEGER I , M , J
44  DOUBLE PRECISION Z , P1 , P2 , P3 , PP , Z1
45  DOUBLE PRECISION, PARAMETER :: EPS = 3.d-14
46 !
47  m=(npoin+1)/2
48  DO i=1,m
49  z=cos(pi*(dble(i)-0.25d0)/(dble(npoin)+0.5d0))
50  1 CONTINUE
51  p1=1.0d0
52  p2=0.0d0
53  DO j=1,npoin
54  p3=p2
55  p2=p1
56  p1=((2.d0*dble(j)-1.d0)*z*p2-(dble(j)-1.d0)*p3)/dble(j)
57  ENDDO
58  pp=dble(npoin)*(z*p1-p2)/(z*z-1.d0)
59  z1=z
60  z=z-p1/pp
61  IF (abs(z-z1).GT.eps) GOTO 1
62  x_leg(i)=-z
63  x_leg(npoin+1-i)=z
64  w_leg(i)=2.d0/((1.d0-z**2)*pp**2)
65  w_leg(npoin+1-i)=w_leg(i)
66  ENDDO
67 !
68  RETURN
69  END
subroutine gauleg(W_LEG, X_LEG, NPOIN)
Definition: gauleg.f:7