source: PSPA/parmelaPSPA/trunk/eh.f @ 404

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

parmela pspa initial

File size: 1.4 KB
Line 
1      subroutine eh
2c--calculate instantaneous E and H fields a moving charge j at position i
3c--------------------------------------------------------------------------
4c
5      include 'psizescom.h'
6c
7      common/ehparm/xi,yi,zi,ex,ey,eez,hx,hy,hz,xj,yj,zj,gbxj,gbyj,
8     . gbzj,gamma,qfac
9c--------------------------------------------------------------------------
10c*
11c        r = vector from j to i
12      rx = xi - xj
13      ry = yi - yj
14      rz = zi - zj
15      rxsq = rx**2
16      rysq = ry**2
17      rzsq = rz**2
18      rsq = rxsq + rysq + rzsq
19c        skip if rsq = 0
20      if (rsq.lt.1.e-10) return
21c        scalar product of gamma*beta(j) and r
22      cosesq = (gbxj*rx + gbyj*ry + gbzj*rz)**2
23c        calculate field at i of moving charge j, assuming uniform velocity
24c        at present value
25      crsq = rsq + cosesq
26      crsq = crsq*crsq*crsq
27      qf = qfac
28c        reduce the charge if superparticles are too close
29      if (rxsq.lt.xsqsiz.and.rysq.lt.ysqsiz.and.rzsq.lt.zsqsiz)
30     . qf = qf*sqrt(rxsq*rysq*rzsq)/xyzvol
31      efac = qf/sqrt(crsq)
32      exj = efac*rx
33      eyj = efac*ry
34      ezj = efac*rz
35      ex = ex + exj*gamma
36      ey = ey + eyj*gamma
37      eez=eez + ezj*gamma
38      hx = hx + gbyj*ezj - gbzj*eyj
39      hy = hy + gbzj*exj - gbxj*ezj
40      hz = hz + gbxj*eyj - gbyj*exj
41      return
42      end
43c++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*
Note: See TracBrowser for help on using the repository browser.