Programs for deducing potentials and fields at a flat mesh of parallel round wires (xmpl2d20.dat).

These can be copied from the end of file xmpl2d20.dat, which is supplied with the CPO2D package.

Appendix A

Program used to deduce v1, v2, vc and ec from the results in the output data

File temp20a.dat :

C Program for finding average potentials in region of a mesh

C Used in conjunction with xmpl2d20.dat

DIMENSION a(201)

CHARACTER dummy*6

n = 100

OPEN (UNIT=1,FILE='temp20a.dat',STATUS='OLD')

C =trajectory output file

OPEN (UNIT=2,FILE='tempres.dat',STATUS='UNKNOWN')

C =results file

IF (dummy.NE.' x') GOTO 100

C The results give the potential along x for constant y

C Integrate over x, using Simpsons rule

C The first point in each row is not given in the output file. It is 0,

C the potential at the wire

DO iz = 1 , 2

C -correspond to z=+r, -r

C Integrate over x:

DO i = 1 , n

READ (1,*) dummy1 , dummy2 , a(i)

ENDDO

avx = a(n)

C =end points (remembering that the first end point is 0)

DO i = 1 , (n-1) , 2

avx = avx + 4.*a(i)

C =odd points

ENDDO

DO i = 2 , (n-2) , 2

avx = avx + 2.*a(i)

C =even points

ENDDO

avx = avx/3.

C =Simpson integration, for unit spacing

avx = avx/real(n)

C =average for this row

WRITE (2,'(F10.6)') avx

DO i = 1 , 5

ENDDO

ENDDO

C z=-r:

C Finally, read pot and field at centre:

READ (1,*) (a(i), i = 1 , 5)

pot = a(3)

field = a(5)

WRITE (2,'(2F10.6)') pot , field

STOP

END

Appendix B

Program used to derive fourier components of the potential, and average and

maximum values of the field, from the results in the output data file

(tmp20a.dat), when the above file has the lines:

y y potentials and fields required? (y/n)

0.0 -0.0 x and z coordinates of initial end

0.5 -0.0 x and z coordinates of final end (in mm)

101 number of points, circle and its centre

0.00001 inaccuracy of potentials and fields

y y potentials and fields required? (y/n)

0.0 -0.2 x and z coordinates of initial end

0.5 -0.2 x and z coordinates of final end (in mm)

101 number of points, circle and its centre

0.00001 inaccuracy of potentials and fields

etc

and when the output file is copied to tempin.dat and the lines containing words

are deleted.

If the radius of the wires is changed, remember to change the applied

potentials.

C Program for finding average and maximum field strengths and fourier

C components of penetrating fields through meshes, July 1998.

C For 2D parallel wires, using xmpl2d20.dat.

DIMENSION pot(1001)

OPEN (UNIT=1,FILE='tempin.dat',STATUS='OLD')

C =field data, from temp20a.dat

OPEN (UNIT=2,FILE='tempres.dat',STATUS='UNKNOWN')

C =results file

pi = 4.*ATAN(1.)

av_e = 0.

e_max = 0.

av_pot = 0.

f1 = 0.

f2 = 0.

f3 = 0.

angle = 0.

xprev = 0.

n = 3

i = 0

100 CONTINUE

i = i + 1

READ (1,*) x , z , pot(i) , ex , ez , etotal

IF (i.EQ.1) THEN

x1 = x

xprev = x

ENDIF

IF (i.EQ.2) THEN

dx = x - xprev

n = (0.500001/dx) + 1

C =total number of points

ENDIF

C Integrate by Simpons rule:

IF ( (i.EQ.1) .OR. (i.EQ.n) ) THEN

av_e = av_e + etotal

av_pot = av_pot + pot(i)

ELSEIF (mod(i,2).EQ.0) THEN

av_e = av_e + 4.*etotal

av_pot = av_pot + 4.*pot(i)

ELSE

av_e = av_e + 2.*etotal

av_pot = av_pot + 2.*pot(i)

ENDIF

C find maximum:

e_max = max(etotal,e_max)

IF (i.EQ.n) GOTO 200

GOTO 100

200 CONTINUE

av_e = av_e/(3.*real(n-1))

C Calculate fourier components:

C Integrate by Simpons rule:

DO i = 1 , n

angle = 2.*pi*real(i-1)*0.5/real(n-1)

C =2*pi*x/s

cos1 = cos(angle)

cos2 = cos(2.*angle)

cos3 = cos(3.*angle)

dpot = pot(i) -av_pot

IF ( (i.EQ.1) .OR. (i.EQ.n) ) THEN

f1 = f1 + dpot*cos1

f2 = f2 + dpot*cos2

f3 = f3 + dpot*cos3

ELSEIF (mod(i,2).EQ.0) THEN

f1 = f1 + 4.*dpot*cos1

f2 = f2 + 4.*dpot*cos2

f3 = f3 + 4.*dpot*cos3

ELSE

f1 = f1 + 2.*dpot*cos1

f2 = f2 + 2.*dpot*cos2

f3 = f3 + 2.*dpot*cos3

ENDIF

ENDDO

C Value of integral of cos(2*pi*x/s)**2 from 0 to s/2 is 0.25

f1 = f1/(1.5*real(n-1))

f2 = f2/(1.5*real(n-1))

f3 = f3/(1.5*real(n-1))

C Multiply by exp(-2*m*pi*z/s):

f1 = f1*exp(-2.*pi*z)

f2 = f2*exp(-4.*pi*z)

f3 = f3*exp(-6.*pi*z)

WRITE (2,'(1P6E11.3)') z , av_e , e_max , f1 , f2 , f3

STOP

END