subroutine flds(r,z,er,ez) c------------------------------------------------------------------------ c include 'fldcom.h' include 'ucom.h' c r1=rp z1=zp c----------------------------------------------------------------------- c* c evaluate fields at r1,z1 due to ring of charge at r,z. call fldring (r1,z1,r,z,er1,ez1) if (rwall.le.0.) go to 10 c---calculate field due to image charge on wall if (r.gt.0.9*rwall) go to 5 call scwall (r,z,erw,ezw) er1=er1-erw ez1=ez1-ezw if (r1.lt.rwall) go to 10 er1=-erw ez1=0. go to 10 c---simulate wall by one image ring 5 continue rim=2.*rwall-r call fldring (r1,z1,rim,z,erw,ezw) er1=er1-erw ez1=ez1-ezw 10 continue if (nip.eq.0) go to 50 erw2=0. ezw2=0. erw3=0. ezw3=0. er2=0. ez2=0. er3=0. ez3=0. do 40 i=1,nip xi=i if (rwall.le.0.) go to 25 if (r.le.0.9*rwall) go to 20 call fldring (r1,z1,rim,z+xi*pl,erw2,ezw2) call fldring (r1,z1,rim,z-xi*pl,erw3,ezw3) go to 25 20 continue call scwall (r,z+xi*pl,erw2,ezw2) call scwall (r,z-xi*pl,erw3,ezw3) if (r1.eq.rwall) go to 30 25 continue call fldring (r1,z1,r,z+xi*pl,er2,ez2) call fldring (r1,z1,r,z-xi*pl,er3,ez3) 30 continue er1=er1+er2+er3-erw2-erw3 ez1=ez1+ez2+ez3-ezw2-ezw3 40 continue 50 continue er=er1 ez=ez1 return end c++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*