source: PSPA/parmelaPSPA/trunk/gaus.f @ 315

Last change on this file since 315 was 12, checked in by lemeur, 12 years ago

parmela pspa initial

File size: 2.3 KB
Line 
1      subroutine gaus(r1,r2,z1,z2,opt,er,ez)
2c---calculate er and ez at the r and z location given in fldcom
3c---by gauss quadrature integration over the double
4c---interval from r1 to r2 and from z1 to z2.
5c---if opt.gt.0, determine number of integration points as follows.
6c---let rat = max(cr/cz,cz/cr), where cr=r2-r1, and cz=z2-z1
7c---     if rat.le.2, use 2 x 2 point array
8c---     if rat.gt.2, use 2 x 4 point array
9c---     if rat.gt.4, use 2 x 6 point array
10c---if opt.eq.0, use 2 x 2 point array regardless of rat
11c---if opt.lt.0, use one point.
12c--- rat for ratio
13c--------------------------------------------------------------------------
14      save
15c
16      include 'ucom.h'
17c
18      dimension r(6),z(6),wr(6),wz(6),xx(3,3),wx(3,3)
19c--------------------------------------------------------------------------
20c*
21      data ((xx(i,j),i=1,3),j=1,3)/.2113248654d0,0.,0.,.0694318442d0,
22     1  .3300094782d0,0.,.0337652429d0,.1693953068d0,.380690407d0/
23      data ((wx(i,j),i=1,3),j=1,3)/.5,0.,0.,.1739274226d0,.3260725774d0,
24     1  0., .08566224619d0,.180380786500d0,.233956967300d0/
25      cr=r2-r1
26      cz=z2-z1
27      rfac=2./((r2**2-r1**2)*(z2-z1))
28      crczrfac=cr*cz*rfac
29      ir=1
30      jz=1
31      m=1
32      if (opt.eq.0.) go to 20
33      if (opt.lt.0.) go to 60
34c---determine number of integration points
35      rat=abs(cz/cr)
36      l=0
37      if (rat.ge.1.)go to 10
38      rat=1./rat
39      l=1
40   10 continue
41      if (rat.gt.2.)m=2
42      if (rat.gt.4.)m=3
43      if (l.eq.0) jz=m
44      if (l.eq.1) ir=m
45cdir$ IVDEP
46   20 continue
47      do 30 i=1,ir
48      k=2*i-1
49      r(k)=r1+cr*xx(i,ir)
50      r(k+1)=r2-cr*xx(i,ir)
51      wr(k)=wx(i,ir)
52      wr(k+1)=wx(i,ir)
53   30 continue
54cdir$ IVDEP
55      do 40 j=1,jz
56      k=2*j-1
57      z(k)=z1+cz*xx(j,jz)
58      z(k+1)=z2-cz*xx(j,jz)
59      wz(k)=wx(j,jz)
60      wz(k+1)=wx(j,jz)
61   40 continue
62      ser=0.
63      sez=0.
64      kr=2*ir
65      kz=2*jz
66      do 50 i=1,kr
67      do 50 j=1,kz
68      call flds(r(i),z(j),er1,ez1)
69      ser=ser+wr(i)*wz(j)*er1*r(i)
70      sez=sez+wr(i)*wz(j)*ez1*r(i)
71   50 continue
72      er=crczrfac*ser
73      ez=crczrfac*sez
74      return
75   60 continue
76      rs=sqrt(.5*(r1**2+r2**2))
77      zs=.5*(z1+z2)
78      call flds (rs,zs,er,ez)
79      return
80      end
81c++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*
Note: See TracBrowser for help on using the repository browser.