Space charge effects in high pressure mass spectrometry sources by Mark Busman A thesis submitted in partial fulfillment of the requirements for the degree of Doctor of Philosophy in Chemistry Montana State University © Copyright by Mark Busman (1991) Abstract: Ion transport in unipolar mass spectrometry ion sources like corona API and electrospray has been studied theoretically. Unlike previous work in this area, the study has been done with the consideration of space charge effects. Analytic solutions of the space charge problem have been obtained for simple ion geometries, including the cases of infinite parallel planes, concentric cylinders of infinite length, and concentric spheres. These analytic solutions allow, for their respective geometries, the calculation of electric field, potential, ion density distributions, and ion residence times. It is shown that for typical operating conditions, the minimum potential required to overcome the space charge effect in corona API, or electrospray ion sources, constitutes a dominant or significant fraction of the total applied voltage. Further, the electric field, in the region of the ion sampling orifice and the ion residence time in the ion source are determined mainly by the space charge. Extending the approach to more general geometries, absolute sensitivities of corona API ion sources were calculated using a geometry independent treatment of space charge. Also, general geometries were modelled by a simulation calculation. The calculation was based on a computer program written to model ion flow in various ion sources having different geometries. Finally, the space charge influenced ion drift in a drift tube-type apparatus was modelled, as a function of time. SPACE CHARGE EFFECTS IN HIGH PRESSURE MASS SPECTROMETRY SOURCES by Mark Busman A thesis submitted in partial fulfillment of the requirements for the degree of Doctor of Philosophy in Chemistry MONTANA STATE UNIVERSITY Bozeman, Montana July 1991 ii APPROVAL of a thesis submitted by Mark Busman This thesis has been read by each member of the thesis committee and has been found to be satisfactory regarding content, English usage, format, citations, bibliographic style, and consistency, and is ready for submission to the College of Graduate Studies. ________ Ju ne 2 4 . 1991 Date Approved for the Major Department June 2 4 . 1991 Date Head, Major Department Approved for the College of Graduate Studies /«2, / ? < ? / Date q Graduate' Dean iii STATEMENT OF PERMISSION TO USE In presenting this thesis in partial fulfillment of the requirements for a doctoral degree at Montana State University, I agree that the Library shall make it available to borrowers under rules of the Library. I further agree that copying of this thesis is allowable only for scholarly purposes, consistent with "fair use" as prescribed in the U.S Copyright Law. Requests for extensive copying or reproduction of this thesis should be referred'to University Microfilms International, 300 North Zeeb Road, Ann Arbor, Michigan 48106, to whom I have granted "the exclusive right to reproduce and distribute copies of the dissertation in and from microfilm and the right to reproduce and distribute by abstract in any format." Signat Date iv TABLE OF CONTENTS Page H 03 OO CO I N T R O D U C T I O N ........................ ................... ... Ion T r a n s p o r t ............. ................... ........................ Convective Transport Diffusive Transport .......................... Electrostatic Transport ...................... 3 MATHEMATICAL TREATMENT.OF ION TRANSPORT ............... Drift E q u a t i o n ..................................... Laplacian Field ................................... Space Charge Field ........... Historical Background ............................ Mathematical Background .......................... Analytic Solutions ................................. Planar . .................... C y l i n d r i c a l ............... S p h e r i c a l ..................................... 4 4 5 5 6 8 .10 10 12 18 APPLICATIONS OF THE ANALYTIC SOLUTIONS ............... Corona API in the Spherical G e o m e t r y ............. Electrospray in the Spherical Model ............. 24 27 33 ........................ GENERAL GEOMETRIES Unipolar Charge Drift Formula . Calculation of Absolute Sensitivities ........... Numeric Solutions ................................. Simulation Method ................................. Simulation in General Geometries ................. Point to Plane G e o m e t r y .......................... Electrospray Geometry ............... API G e o m e t r y .............................. . . . . . 38 38 45 51 55 56 62 62 67 TIME DEPENDENT C A S E ..................................... Simulation With One Type of I o n ................. Simulation With Two Types of I o n s ............... 72 74 76 S U M M A R Y .................................................. 80 REFERENCES CITED 82 ....................................... V TABLE OF CONTENTS-Continued Page A P P E N D I C E S ....................... APPENDIX A: ANALYTIC SOLUTIONS ................... Planar geometry .............................. Cylindrical Geometry ........................ Spherical geometry ................. . . . . APPENDIX B : DERIVATIONS FOR LIMITING CONDITIONS . Ion residence time, tres .......... Sampling ion density, p Applied potential, V0 . . .... ............... APPENDIX C: COMPUTER PROGRAMS . . ................ 86 87 88 90 92 95 96 97 98 99 LIST OF FIGURES Figure Page 1. Planar Geometry. n 2. Non-SCD Residence Time and Space Charge.......... 13 3. SCD Residence Time and Space Charge.............. 14 4. Non-SCD Potential and Fields..................... 15 5. SCD Potential and Fields......................... 16 6 . Cylindrical Geometry............................. 17 7. SCD and Non-SCD Fields........................... 19 8 . SCD and Non-SCD Space Charge Densities.......... 20 9. Spherical Geometry........... 21 10. SCD Conditions in the Spherical Geometry. . . . 23 11. Schematic of the Corona-API. . ................ 28 12. Conditions in the Corona-API.................... 30 13. Residence Time, Potential and Ion Density . . . 34 14. Schematic of the Electrospray.................. 35 15. Ion Density vs. Drift T i m e ............. .. 40 16. Field strength map for the nonfocussed case. . 42 17. Field strength map for the focussed case. . . . 42 18. Ion density contour for the unfocussed case. . 43 19. Ion density contour for the focussed case. . . 43 20. Current densities for the Case I and Case 2. . 44 21. Ion densities for the Case I and Case 2. ... 44 22. Kinetically Influenced API Currents. 50 52 23. Calculated API Currents.................... 24. Experimental API Currents. .................... 53 25. Point to Plane Geometry.................... 57 26. "Needle in Can" Geometry.......... 58 27. Parabolic Gr i d .............................. 59 28. Point to Plane Plate Current Distribution. . . 63 29. Electrospray Plate Current Distribution. ... 64 30. Spray Pattern from a Taylor Cone.......... 65 31. Spray Pattern from the "Umbrella" M o d e .... 66 3 2 . Calculated Electrospray Current Distribution. . 68 33. Field and Space Charge Density Contour.... 69 34. Calculated Corona-API Current Distribution. . 70 35. Corona-API Field, Space Charge Contour.... 71 36. Ion Tube in the Fenn Electrospray Source. ... 73 37. Drift Tube Schematic....................... 75 38. One Component Ion Drift Current vs. Time. ... 77 39. Two Component Ion Drift Current vs. Time. ... 78 40. SPACE. B A S ................................. 100 41. SPREAD. B A S ............................ 119 < vii LIST OF FIGURES-Continued Figure 42. TUBE.M . .■ ........ .. . ................ 43,. TUB2.M.............................. 44. VELOCITY.M . ................................ ■ 45. DISPLACEMENT. M ................................... Page 124 128 129 viii ABSTRACT ' Ion transport in unipolar mass spectrometry ion sources, like corona API and electrospray has been studied theoretically. Unlike previous work in this area, the study has been done with the consideration of space charge effects. Analytic solutions of the space charge problem have been obtained for simple ion geometries, including the cases of infinite parallel planes, concentric cylinders of infinite length, and concentric spheres. These analytic solutions allow, for their respective geometries, the calculation of electric field, potential, ion density distributions, and ion residence times. It is shown that for typical operating conditions, the minimum potential required to overcome the space charge effect in corona API, or electrospray ion sources, constitutes a dominant or significant fraction of the total applied voltage. Further, the electric field, in the region of the ion sampling orifice and the ion residence time in the ion source are determined mainly by the space charge. Extending the approach to more general geometries, absolute sensitivities of corona API ion sources were calculated using a geometry independent treatment of space charge. Also, general geometries were modelled by a simulation calculation. The calculation was based on a computer program written to model ion flow in various ion sources having different geometries. Finally, the space charge influenced ion drift in a drift tube-type apparatus was modelled, as a function of time. I INTRODUCTION In the last half century, mass spectrometry has gradually evolved from being an interesting tool for the mass measurement of relatively small ions, into a vital area of analytical chemistry. This evolution has followed the' development of creative techniques for the introduction of molecules into an ion source for mass analysis, and achieving their ionization. The ion sources used in mass spectrometry can be classified according to source pressures. Sources operated at pressures I torr and below can be considered to be low pressure ion sources. Low pressure sources include sources for many of the more commonly used mass spectrometry techniques: electron impact ionization (EI),1*2 chemical ionization (Cl),3 and fast atom bombardment (FAB).4 High pressure ion sources can be thought to be those that operate in the pressure range between I torr and atmospheric pressure, and perhaps beyond. High pressure sources include the sources used for atmospheric pressure ionization (API),5 thermospray ionization (TSP),6 and electrospray ionization (ES) .7,8 The ion sources in both of these categories have been studied to establish appropriate parameters for their operation. Much has been written with 2 respect to the mechanisms pertinent to the Operation of these sources. In mass spectroscopy, the understanding of the production of ions in the ion source is an important aspect of understanding the technique. Further, understanding the processes behind introducing the ions into the mass resolution part of the instrument is vital for insight into the identities and quantities of ions available for detection. The goal of this work is to evaluate certain aspects of ion transport in high pressure mass spectrometry sources with regard to the performance of these sources. Ion Transport In the ion source of the mass spectrometer ions are produced from existing molecules. These ions are then driven toward an aperture separating the high-pressure ion source from the low-pressure mass analyzer section of the mass spectrometer, where they can travel towards the detector. The processes causing the ions to leave the ion source can be of the following types of transport: convective, diffusive, and electrostatic. Convective Transport The ion source is often at much higher pressure than the mass analyzer region. The ions will be carried along with the gas stream down the pressure gradient. The study of 3 how ions can flow along with a moving gas is an important area in fluid dynamics.9 Diffusive Transport In many ion sources, ions are not formed throughout the source, but, instead, are formed in a small volume in the ion source. Here, the concentration of ions may be very high. The ions tend to diffuse out of the areas of high concentration into areas of lower concentration. The mathematical treatment of the diffusion of ions in gases is well developed.10,11 Electrostatic Transport Ions, as charged species, will drift in existing fields. An ion will drift in the direction of existing electrical fields. The drift velocity depends on the field's intensity. Again, the mathematical treatment, of ionic drift has already been developed.9,11 Ion drift will now be discussed in more detail. 4 MATHEMATICAL TREATMENT OF ION TRANSPORT The application of electrostatics to charged particle flow and, in particular, ion flow has been important to physics for many years. The analysis ion flow has been based on Coulomb's and Maxwell's equations.12 It is these equations that make the analysis of ion drift in the mass spectrometer ion source possible. Drift Equation Using appropriate laws of electrostatics, one can predict the magnitude and direction of the forces acting upon ions at specific locations in the source. Moreover, assuming certain characteristics of both the ions, and the neutral gas inside the source, one can predict a velocity for an ion under the influence of a given field. This velocity, the drift velocity, v, can be given as a function of electric field strength, E, by the drift equation, V=K-E, (I) where K is the ion mobility, a constant, dependent on both the characteristics of the ion and its surrounding gas, and generally assumed to be independent of field strength.10,13 ! 5 The drift equation is essentially an empirical equation that summarizes a large amount of experimental data. It has been shown to be applicable at high pressures (above I torr). The mobility, k , is the empirical constant in the equation. The mobility constant's magnitude is dependent on the charged particle's response to an electric field and to the collisions with the neutral bath gas that the particle will experience. Compilations of mobility data have been published, most notably by McDaniel.13 Laolacian Field An ion source often has several electrically insulated components that have different applied potentials. From the geometry of the ion source, it is possible, in theory, to map out the electric fields in the source, that result from the application of the potentials to the various source components.14 Generally, it is assumed that the field strength at any point in the source is dependent on only the external applied field. The field strength at any point is determined by the source geometry and the respective applied voltages on various source components. This external field is commonly called the Laplacian field.11 Space Charge Field As ion densities in the source increase, the coulombic forces between the ions will increasingly modify the i 6 Laplacian electrical fields experienced by ions. In the source the conduction of current will be unipolar. By saying that the current is unipolar, it is meant that particles of only one polarity exist in the source, and that the ion flow can be considered accordingly. The ions in the ion source, traveling at finite velocities, experience a mutual coulombic repulsion during the time that they transit the gap between electrodes, thus forming their own electric field. The Laplacian field is combined with the field caused by the moving charge, the space charge field. This combination is the actual field experienced by the ions. In the extreme, the space charge field, from the unipolar current, can be so large that it completely dominates any applied field. Historical Background The modification of Laplacian fields by space charge was.noticed many years ago by workers studying electrical currents between charged plates. As they attempted to increase the current between these charged plates by changing the conditions between the plates, they found that it was not possible to increase the current beyond a certain limiting current. This was explained by the modification of the fields between the plates, by the current flow.15,16,12 The mathematical picture of space charge was initially developed by Child, in 1908, to model the evaporation of 7 calcium ions from a heated plate. Langmuir, Unaware of Child's work, in 1913, independently developed a similar model to describe the behavior of thermionic currents from filaments.16 In 1914, Townsend described the space charge influenced currents in terms of the mobilities of the charge carriers. It became common for the maximum currents, as allowed by the space charge, to be called space charge limited.12'11'10 The concept of space charge has been used for a wide range of application. From the initial use for currents between charged plates, the space charge concept has been used in electronics for the design of tube-type electronic components,17 in meteorology to model lightning strikes, in aircraft design to evaluate charge buildup on various airplane structural components,9 in industry for the design and maintenance of electrostatic precipitators,18 and in the modelling of fields surrounding high voltage, direct current power transmission lines. As the field of mass spectroscopy developed, it was natural for the concept of space charge to be applied to the emerging technique. However, early workers correctly assumed that they were working with ion currents and ion densities that were too low for space charge to be important. The combinations of source.conditions and ionization techniques being utilized made the modifications 8 of the Laplacian fields in the sources, by the space charge, insignificant.19 Recent years have seen a continual evolution of. the mass spectroscopy field. Hew techniques for ionization have changed the conditions in the ionization source considerably. The atmospheric pressure ionization (API)5 and the electrospray ionization (ESP)7 techniques have utilized sources that have particularly deviated from the conventionally expected conditions of high vacuum and low ion densities. So, it can be argued that an assessment of the importance of space charge in the sources of some of these newer techniques is due. Notable in displaying the use of space charge analysis in high pressure mass spectrometry, is the ECD model by Cobby, Grimsrud and Warden.20 Mathematica] Background To evaluate space charge effects in these newer sources, use of the previously developed methodology for determining space charge influenced fields must be made. However, early work with space charge was restricted to the analysis of simple geometries. Due to the difficulty of the mathematics involved, workers would idealize their experimental apparatus as either infinite parallel planes, concentric cylinders of infinite length, or concentric spheres.'7 Thesej geometries were amenable to mathematical analysis, yielding data appropriate to the individual 9 worker's needs. The computation of space charge influences in these geometries was based on the Poisson equation, -V-E=E1 (2) where V« E is the gradient of the electric field, p is the space charge density in terms of charge per unit volume, and e is electrical permitivity; and the continuity equation. 'dp i-V-J=Or Ft (3) where t is time. When considering stable ion source conditions, the steady state form of the continuity equation. V-J=Or (4) can be used by assuming (dp/dt) =0. Here, J is the ion current density. As was discussed earlier, the ion current will have contributions from diffusion, convection, and electrostatic transport. This dependence of J can be mathematically stated as J=Kp E-DVp+F r (5) where D is the diffusion constant and F is the gas flow vector. The first term relates to the ion drift contribution to the current density vector, while the second and third terms indicate the effects of diffusion and convection, respectively.10 Diffusion and convection terms 10 are important only in some very special situations, and are not treated in this work. Beyond this point the mathematics will be expressed in scalar notation, instead of the previously used vector notation. Analytic Solutions For this work, the Poisson and continuity equations were utilized to predict electric fields, space charge densities, potentials, ion transit times, etc. for ion sources with certain assumed operating parameters. Given the wide variation in the geometries of real ion sources, all three simple geometries, amenable to giving analytical solutions, were considered. Similar analyses have previously been described, for use in discharge physics, by Townsend12 and Chapman.21 Descriptions of these analyses, for each of the three geometries, follow. Planar In this geometry, shown in Figure I, two planes of infinite area are placed parallel to each other at some finite distance, I. A potential difference, V 0, exists between the two plates. A current, i, is assumed to flow between the two plates. Furthermore, all of this current is carried by one type of charged particle, with a mobility, k . The unipolar current originates at one surface, and terminates at the other. 11 Figure I. Planar Geometry, infinite parallel planes. The mathematical analysis of the planar geometry gives electric field strength and ion density as a function of distance, x, from the source plate. A detailed derivation of the equations shown here is presented in Appendix A. The equations for field strength and space charge density are -X+Er ?T/2 12 (7) Here E0 is the field strength at the source plate (x=0). Graphs of the functions for certain sets of initial conditions are given in Figures 2, 3 , 4 , and 5. The Figures show the remarkable modification of the conditions in the source, in the space charge dominated (SCD) case. Especially noteworthy is the decrease in the electric field strength and the increase in the ion density in the area near the source plate. Cylindrical In this geometry, shown in Figure 6, a cylinder of radius, r0, is enclosed by a concentric cylinder of radius, r1. The surface of the inner cylinder acts to supply a current of charged particles that flow to the outer cylinder. These concentric cylinders are assumed to be of infinite length. Again, a potential difference exists between the two cylinders and the current is completely carried by charged particles of mobility, k . The field strength is E0 at the surface of the inner electrode (r=r0) . The mathematical analysis of the cylindrical geometry gives electric field strength and ion density in terms of distance, r, from the axis at the center of the two 8 x IO7 0.003 Time(s) Ion Density(Ions/cc) Ion Density Drift Time 0 1.0 Figure 2. 2.0 3.0 Distance(cm) 4.0 5.0 Non-space charge dominated residence times and space charge densities, in the planar geometry, as a function of distance. The current density is 1.0 x IO'8 A/cm2; the total applied potential, V0=IO ,000 V; and the ion mobility. x=l x i o '4 m2/V*s. 0.012 1.8 x IO8 Ion Density Time(s) Ion Density(Ions/cc) Drift Time 0 0 2.0 3.C Distance(cm) Figure 3. Space charge dominated residence times and space charge densities, in the planar geometry, as a function of position. The current density is 1.0 x 10'8 A/cm2; the applied potential, V.=3,600 V; and the ion mobility, K=I x io*4 m2/V-s. 4.28 -n 10 Potential Z Laplacian Field Potential (kV) Field(kV/cm) \. / Field O 1.0 Figure 4. 2.0 3.0 Distance(cm) 4.0 5.0 Non-space charge dominated potentials and fields, in the planar geometry, as a function of distance! Applied potential, current density, and ion mobility are as specified for Figure 2. 3.6 Potential(kV) Field(kV/cm) Potential Laplacian Field 2.0 3.C Distance(cm) Figure 5. Space charge dominated potentials and fields, in the planar geometry, as a function of distance. Applied potential, ion current, and ion mobility are as specified for Figure 3. 17 Figure 6. Cylindrical geometry, infinite length. concentric cylinders of cylinders. Mathematically, the functions apply to the region between the concentric cylinders. A detailed derivation of the equations shown here is presented in Appendix A. The equations for field strength and space charge density are T/2 (r2-r02)+S02 S=— r 2 itk e0r 02 (8 ) 18 1 - 1/2 " --- i-- - (r2-r02)+E02 2 Trr0ZC 2h k e0r02 . (9) A graph of the functions for a certain set of initial conditions is given in Figures 7 and 8. Interestingly, in the space charge dominated case, the space charge density is independent of position. The cylindrical analysis was used by Shahin to model his cylindrical ion source. However, the dimensions of his source, as well as his low ion currents, made space charge influences negligible.19 Spherical Analogous to the cylindrical case, this geometry, shown in Figure 9, involves concentric spheres. The inner sphere, which acts as an ion supply, is of radius, r0. The radius of the outer sphere is r1. The two spheres are separated by a potential difference, and current flows from the inner sphere to the outer sphere by the drift of charged particles of mobility, k . The field strength is E0 at the inner sphere surface (r=r0) . The mathematical analysis of the spherical geometry gives field strength and ion density in terms of distance, r , from a point at the center of the two spheres. Mathematically, the functions are valid in the region between the concentric spheres. A detailed derivation of the XlO4 non-SCD Radius (m) Figure 7. Fields with the consideration of space charge and without the consideration of space charge in the cylindrical geometry. The radii of the inner and outer cylinders are 0.001 and 0.005 m, respectively. The field at the inner cylinder surface, E0= 2 .5 x IO4 V/m; the ion mobility, K=I x 10'4 m2/ V •s ; and the ion current, i=l x lO"*’ A/m. Ion Density (C/mm3) XIo-5 non-SCD Radius (m) Figure 8. Space charge dominated and non-space charge dominated space charge densities in the cylindrical geometry. The conditions are the same as indicated for Figure 7. 21 Figure 9. Spherical geometry, concentric spheres. equations shown here is presented in Appendix A. The equations for field strength and space charge density are E(r) = h i r i 1/2 (r3-r0 3)+£02 (1 0 ) 6Kne0r0 - r 3-r03W 02 47re0r02x Qne0Kro' 1/2 (H) 22 A graph of the functions for a certain set of initial conditions is given in Figure 10. From the Figure it is evident that any analysis of such a space charge dominated source, without the consideration of space charge, would dramatically underestimate the actual field strength at distances far from the inner sphere surface. Experimental work has been done, in the different geometries, to verify the equations. The cylindrical and planar geometries were experimentally studied by Child, Langmuir and Townsend at the time that the mathematical formulations were originally presented.15,16,12 Much later, Chapman produced similar experimental data to verify the description of the spherical model. Chapman measured the magnitude of space charge limited currents, and showed these currents to be in agreement with the analytic solutions22. 7.5 x IO9 1.8 Potential Y---' U IZl C O U 2. 0.9 d in U Q c O O 3 0.5 Figure 10. r> -zX D rift 1.0 1.5 2.0 Radius(cm) 2.5 3.0 Space charge dominated conditions in the spherical geometry: Electric field potential, ion density and ion drift time for the space charge dominated case. The applied voltage, V0=7,693 V; the supply surface radius, r0=O.l cm; the outer sphere radius, r0ut=3 cm; the ion mobility, *=i x io"4 m2/V-s; and the ion current, i=6/LiA. 24 APPLICATIONS OF THE ANALYTIC SOLUTIONS The analytical solutions for the simple geometries presented in the previous section give at least a qualitative picture of what is happening in a actual ion source. There are two reasons why the models may not correspond directly to physical reality. First, they do not correspond precisely to the actual physical geometry of most sources. Second, they rely on a rather artificial distinction between the ionization and drift regions of the source, as will be discussed below. However, they do serve some instructive purpose. These models can be viewed as some crude approximation of actual source geometries. These models can give important insight into the perturbation of the Laplacian fields by space charge. The spherical, source, especially, can be used to model many ion sources. Many sources can be viewed as having a central ion source, and having walls, at least approximately equidistant, in all directions. This view gives the opportunity to evaluate a particular ion source with respect to some of its known operating parameters (i.e., potential and supply current). The data from this evaluation can give interesting information about the conditions inside the source. Especially important will be the way these 0# 25 conditions will be influenced by the space charge density in the source. The data must then be assessed with respect to its dependence on the geometric approximations made in constructing the model. Particularly useful pieces of information for an ion source are the ion residence time in the source, ion concentration at the sampling aperture and ion drift velocity at various locations in the source. Such information is readily available from this method of analysis, and is very interesting for a variety of applications, especially when the reaction kinetics for the drifting ions is important. The ion source can be thought to be comprised of two rather arbitrarily divided regions; the ionization region and the drift region. When modelling the ion source by this method, the entire volume of the source is not being modelled. Instead, only the drift region is being considered. The ionization region will contain mechanisms that will produce ions, at its surface, at a given rate. Regardless of the ion source in question, processes of complexity beyond the scope of this study will occur in the ionization region. In the drift region, however, ions merely drift to the counter electrode. This reduces the source modelling into a much more workable problem. The somewhat arbitrary division between the ionization region and the drift region has precedent.9 Much of 26 application of space charge theory is rooted in the study of corona discharges. A corona is used in the corona API source and is discussed below in that context. A corona discharge can be stimulated by biasing a needle with a large voltage. Events centered around the tip of the needle arise from the effect of the applied voltage on the air surrounding the needle. Many researchers observed light being emitted from the area immediately around the tip of the needle, at the center of a corona. This light emitting region was assumed to contain a plasma region, whereas the drift region was assumed to be on the outside of the light emitting region. The shape and size of the light emitting region was taken to be an indication of the shape and size of the plasma. This visual observation gave early researchers the justification for the division between the two regions.9*10'11 Shahin used a similarly arbitrary division for the analysis of his cylindrically symmetric corona mass spectrometer source.19 With mathematical models of the space charge influence in the simple geometries developed, attention can be turned to mass spectroscopic techniques utilizing sources in which space charge may have an important effect. Two of these techniques are Atmospheric Pressure Ionization (API) and Electrospray Ionization (ESP). Both of these techniques operate with relatively high source pressures and ion currents.11*7*6 Moreover, the drift region of each source is essentially unipolar. 27 Corona API in the Spherical Geometry In the positive corona API source, shown in Figure 11, the ionization is caused by biasing a needle at a positive voltage high enough to initiate a corona. A detailed description of the processes involved in the corona has been provided by Loeb,10 Rees23 and Sigmond.11 Equations have been formulated to empirically model the behavior of the corona, immediately around the needle. An electron travelling in the corona will strike a number of neutral molecules causing an avalanche of electrons and, as a result, leaves positive ions. This primary ionization process corresponds to Townsend's primary ionization coefficient, a . A secondary ionization process, where ions are produced by collisions between molecules and the electrons produced in the avalanche, is described by a secondary Townsend ionization coefficient, y. Through this complex regime of electronmolecule reactions, positive ions charge are driven outward, away from the needle tip. Similarly, negatively charged particles are attracted to the needle, and collected there.10,11 Outside of a certain distance from the needle tip, only particles of a charge being the same as the needle's will exist. This region, away from the needle tip, can be considered to be the drift region. In this drift region, the only process occurring is the motion of the ions, through ion drift. 28 -I H I mi r -i Figure 11. Schematic of the corona API Using the spherical geometry as a model for the API source, one can model the ion motion in the drift region. First, the ionization region of the source must be made to conform to the developed model. The ionization region can be reduced simply to a spherical ion supply surface, the inner sphere in the spherical model. The idea of the spherically symmetric ion supply surface has been supported by analysis of photographs of the plasma regions surrounding corona needles.9 This ion supply surface will produce an ion current uniformly over its entire surface are a . The ion 29 current will consist of ions having a mobility, k . According to tabulated data of ion mobilities, most ions in an API source will have a mobility of about I x IO"4 m 2/V- s .13 Here, a problem with the entire modelling process must be faced. The solution to the derived equations for the spherical model is dependent on boundary conditions. These boundary conditions are values of important conditions on the boundaries of the region to be modelled. Especially important are the conditions on the ion supply surface. Since the modelling of the ionization processes in the corona, or in terms of the model, the conditions at the supply surface, are beyond the scope of this study, the problem of deciding appropriate parameters for this model becomes especially difficult. It was decided to model the API source with the ability to specify E0, the field strength at the ion supply surface. E0 was varied over a wide range of values and then the entire range of results was evaluated. Figure 12 shows results, in terms of E, p, t and V, of modelling the API over a range of E0 values. As is demonstrated in the Figure, the choice of E at the inner boundary of the drift region does not greatly influence conditions, except for potential, further out in the drift region. The parameters used in the model are k , r0, I0, and E0. For the Figure, K - I x IO'4 m2/V, rQ = 0.03 m and I0 = 6 pA were used. Six different choices for E0 were used: 40, 35, Fields Potentials Potential(kV) Laplacian Field Radius(cm) Figure 12. Conditions in the corona-API source: Field strengths and potential distributions versus radius for 6 different values of applied potential. 31 30, 25,. 20, and 0 kV/cm. As is apparent in the figure, only in the area near the ion supply surface is the effect of the choice of E0 important. The comparison of the Laplacian field curve and the other curves, for actual electric fields, makes obvious the important effect that space charge plays in this system. The space charge domination serves to coalesce the field strengths in the outer area of the spherical source. In the corona API source, the analyte molecules are usually not directly ionized by the corona. Instead, the ions supplied from the corona are largely reagent ions. These reagent ions result from the ionization of some of the neutral gas molecules present in the source. Often the ions in the source are hydrated hydronium ions, H^O+ (H2O)n. The analyte molecules are of much lower concentration than those of the reagent gas. The reagent ions will, in turn, react with the traces of analyte molecules present in the source, often in a reaction of the type: H3O+ (H2O) n + B ^ B H +(H2O) n+1, (12) where B is an analyte molecule. The extent of analyte ionization, and thus sensitivity, will depend on the time that it takes for the reagent ions to transit the gap between the ion supply surface and the sampling orifice on the outer wall of the source. Hence, it becomes important to 32 know the residence time, tres for the reagent ions in the source. It is necessary to know the residence time in order to properly evaluate the kinetic data acquired in corona API experiments. Approximate expressions for ion transit times, along with other interesting source parameters, have been derived from the spherical geometry solutions. For a space charge limited source with the ion supply surface radius, rQ, being much smaller than the outside surface radius, r 1, expressions for ion residence time, t res; sample ion density, Psamp; and applied potential, Vd can be written. 7/2 STrer1 3k i 3ei (13) 7/2 samp (14) STrzer13 2Ir1 7/2 (15) 3 Trzee Derivations of these equations are shown in Appendix B . The 33 equations are graphed, over a certain range of time, in Figure 13. Electrosnrav in the Spherical Model Likewise, the Electrospray (ESP) source, shown in Figure 14, can be analyzed by the spherical space charge model. Similar problems with choices of parameters, relating to boundary conditions, exist in this model. In the ESP source the analyte is introduced into the ion source by injecting a stream of a volatile liquid, containing a small concentration of analyte molecules, through a hypodermic needle. The needle is put at high voltage with respect to the rest of the ion source. As the stream of liquid exits the tip of the needle, it becomes charged and starts to break into droplets. The droplets each carry a charge of the same sign as the charge on the needle. Even though the dynamics of charged droplets, such as these, have been studied since the time of Lord Rayleigh, the exact mechanisms involved in the behavior of these droplets are still not well understood. However, through the work of Vestal,6 Dole,7 Iribarne and Thomson,24 a general scheme for ion production has been developed. As a droplet travels further away from the needle, it is observed that both ions and solvent molecules evaporate from the droplet's surface. Several effects combine to determine the course of the droplet's reduction in size. Surface tension will tend to Ion Density(Ions/cc) Voltage(kV) Drift Time Drift Voltage • ^ —Ion Density Current(jaA) Figure 13. Variation of residence time, potential distribution and ion density with discharge current in the spherical ion source geometry. The conditions are as specified in Figure 10. 35 Figure 14. Schematic of the Electrospray. keep the droplet's surface intact. This will restrict the droplet's contained liquid to a certain volume. Coulombic repulsions will tend to keep the carriers of the droplet's charge separated as far as possible, and therefore, near the droplet's surface. The energy in the system will cause neutrals to evaporate from the surface of the droplet. As the droplet's size reduces, the coulombic repulsive forces will overcome the surface tension and cause the droplet to split into two or more droplets thus reducing the crucial parameter for the coulombic forces, charge per surface area. 36 Further solvent evaporation will cause the cycle of evaporation and droplet splitting for the droplets to continue, until the droplets become very small. At some time during this cycle of events, ions may evaporate from the surface of a charged droplet taking some or all of the droplet's charge with th e m .6 The production of a wide range of both sizes and charges of ions has been noticed. Charges as high as 1000, as well as masses up to 2,000,000 daltons have been reported.7 It is apparent that droplets of varying radii and charge are involved in the production of an ion current at a sampling orifice. The range of charges and masses involved spans a wide range of ion mobilities. To predict the response of the larger droplets to the convective, as well as electrostatic, forces acting in the source would be a difficult task. However, making the simplification of equating the area immediately around the capillary tip with a spherical ion supply surface and assuming all of the ions in the drift region to be of equal charge and mobility, makes the analysis easily possible. Although much mechanistic detail is sacrificed with the model, the information available from the simple analysis gives some interesting and useful information. Using equation 14, the degree of space charge influence can be calculated. Using a needle to orifice distance of 5 cm, a ion mobility value of I x 10"4 m 2/V s, and an ion 37 current of IO'6 A, the space charge potential is about 3500 V. This potential is in the, range of the applied voltage used in the operation of the electrospray source. Therefore the electrospray source is strongly space charge influenced, if not dominated. By this construction of an electrospray model, the model becomes essentially identical to the previously discussed API model. The operating parameters used in the API model are appropriate for the normal range of ESP operating parameters. From Figure 12, the illustration of the API modelling, modelled, it is apparent that the ESP source, as is also strongly space charge influenced. The areas distant from the hypodermic needle tip are relatively unaffected by the changes of E0 at the ion supply surface. However, in a recent paper ion drift times were calculated using the Laplacian electric field.25 Clearly, such analyses will be substantially in error. 38 GENERAL GEOMETRIES The extension of the mobility model of ion transport to more general geometries requires a mathematical approach that can be applied to these general geometries. One possible approach to generalizing the technique is to use numerical methods to solve the same differential equations that were solved analytically for the simple geometries. Another approach would be to take some observations from the simple solutions, and to generalize them without explicitly calculating the electric fields at every point in an ion source. Both approaches will be discussed here, with the latter generalization being pursued first. Unipolar Charge Drift Formula The solution to the cylindrical model has been extended into a form that can be applied to more general geometries. The unipolar charge drift formula, I P (t) I eO (t-to) ' provides space charge densities, for unipolar currents, without requiring any explicit knowledge of the source (16) 39 geometry. Here p(t) is space charge density as a function of time, t. pQ and t0 are the initial space charge.and time, respectively. This equation is useful for. estimating the space charge effect in almost any system. The natural tendency of ions is to spread out, by nature of their coulombic repulsions. It must be cautioned that, although the formula is geometry independent, it is dependent on the ion flow being unipolar. All that is needed to apply this formula is an initial space charge and the time required to travel from the initial point to the point in question. Regardless of the application, the formula will describe the gradual broadening of a cloud of charge, as it drifts.11 The application of the formula to three different initial space charge densities is shown in Figure 15. Interestingly, the ion densities converge at the long drift times. An important consequence of the unipolar drift formula is that it is impossible to "squeeze" space charge closer together. A source cannot be constructed that will increase the concentration of ions in a dilute volume of space charge. The futility of efforts to "focus" ions is apparent in the simplicity of this equation. The equation is totally independent of applied fields. According to the formula, the only way to increase the sampled concentration of ions is to reduce the time between the creation of the ion density and their sampling. This situation has been reinforced by the Timc(s) Figure 15. Ion density versus time in a unipolar ion source for three different values of p0, the ion density at t =0, calculated for the unipolar drift formula. 41 use of a simulation.26'27 In this simulation, a high potential was applied to the walls of a source, in an attempt to "squeeze" ions together. Figures 16, 17, 18 and 19 show the field and ion density contours for the simulation with, and without, the application of the focussing potential. While the ion density contour lines seem to be concentrated toward the sampling aperture, the sampled ion density actually goes down. The applied potential has actually slowed ion flow, and consequently increased the time for the ion density to spread. Further indication of this reduction in sampled ion density is given in Figures 20 and 21, where the focussed and unfocussed ion densities and ion currents are given. 42 =5 0.02 5000 V l * 1 0 - ‘ C/m N e e d le Figure 16. Case I: Potential and field contour. 5000 v 5000 V 0.045 5 0 0 0 V. 0.035 " 0.03 0.025 ■4 0.02 5000 V 1 * 1 0 * C /m ’ O1 z axil (meters) Figure 17. Case 2: Potential and field contour. 43 ~ 0.02 Figure 18. Case I: Charge density contour. H 0.03 ~ 0.02 z axis (meters) Figure 19. Case 2: Charge density contour. 44 lrIO4 Figure 20. Current density vs. radius. 1IO4 C a se I C aee 2 Figure 21. Charge density vs. radius. 45 Calculation of Absolute Sensitivities The spherical ion source model is adequate for rough estimates of residence times for ions that would allow kinetically controlled processes to occur during ion transport. An example of this utility is the use of the unipolar formula for the evaluation of kinetically controlled ion molecule reactions. One can assume a model for the kinetically controlled ion source. The ion supply surface supplies only one type of ion, a reagent ion, R+. This ion can react with a molecule, P. The reaction between these two species is second order. The molecule, P, is the analyte molecule of interest, and therefore, the ion current of the analyte ion, P+, can be modelled on the basis of the transport and reaction processes occurring in the source. The second order reaction is, R ++P -> R+ P + (I?) with the reaction having a second order rate constant k 1. Because the source is at high pressure, the ion densities will be small, as compared to the neutral densities. This condition allows the kinetics to be evaluated as being pseudo-first order. Putting the kinetics in terms of the concentration of the reagent ion concentration gives 46 dt 7Ci[i?+] [P]# (18) or in terms of pseudo-first order kinetics d [ R +] * ZilX] , dt (19) where the pseudo rate constant is JrVk1CP] . - (2 0 ) Rearranging the pseudo-first order rate equation into an integratable form gives (2 1 ) [£ ] which upon integration gives l n [ R +] - l n [ R +]0= - k \ ( t - t 0) . (2 2 ) Assuming t0=O gives ln[R+]=-k/1t+ln[R+]0 (23) or [R+]=e( (24) 47 Upon substituting for the pseudo-first order rate constant, the reagent ion concentration is given as [iT] = [i?+]0e ^ klCP]t). (25) The current, I, exiting an orifice in the source would be the product of the space charge density, p, and the ventilation rate, S , at the orifice aperture I=P-S. (26) The current, I, is composed of charged species passing through the orifice. In this case it would be composed of ions R+ and P+. To produce an expression for the analyte ion current would require a ratio of analyte ion density to total ion density. This ratio, multiplied by the total current at the orifice, would give the analyte current at the orifice. The analyte current, Ip+, would be: I +=P-S- analY te lon concentration p total ion concentration Here, the total ion concentration would be the sum of the reagent and analyte ion concentrations, which would, in turn, be equal to the initial ion concentration: total ion concentration= [R+]+ [P+]= [R+^0. The analyte ion concentration would be the reagent ion (28) 48 concentration subtracted from the initial reagent ion concentration: analyte ion concentration= [P+]= [R+]0-[R+] . (29) From the above kinetic argument, the ratio of analyte ion concentration to total ion concentration would be: analyte ion concentration= [P+] ^on concentration [p+]+ [p+] [P+]0-[P+] (31) [i?+]0 = l-e -k,[P]t [R+Io-LR+10e~k'mt LR+Io Substitution of this expression into the equation for analyte ion concentration gives: (32) (33) 49 I p*=P ' S ’ (34) This equation can be used to model the analyte ion current in a spherical ion source, that is operated with conditions similar to typical corona-API sources. The implications of this relationship are illustrated in Figure 22, where analyte ion current is plotted against ion drift time. The curves correspond to a variety of initial reagent ion and analyte molecule concentrations. The maxima in the curves result from two competing processes. First, the ion-molecule reaction will produce analyte ion concentrations that will increase with time. Second, the space charge expansion will cause the total ion concentration, and thus the analyte ion concentration, to decrease. The canceling effect, ,that these processes have on each other, produces the broad maxima found in Figure 22. For curve e, in Figure 22, a 4mm depth of a curtain gas was included. The other conditions were the same as in curve c. The curtain gas is a current of gas flowing in front of the sampling aperture. It is often composed of dry nitrogen, and serves to decluster the analyte molecules as they exit the ion source. Here, the curtain gas serves to end the region where reactivity is possible, but the unipolar expansion will continue as the ions continue to drift toward the orifice. The x-coordinate for distance was calculated from equation 13, the equation 50 r l (cm) Io n C u rre n t (C o u n ts /s ) 0.01 10-' 10"' IO"' T i m e (s) Figure 22. Kinetically influenced corona API ion currents: analyte ion intensities in a corona API source versus ion drift t i m e . The upper x-axis shows needle to orifice distance for a discharge current of 3(.lA. The curves correspond to: a.) p0=l Oiz ions/cm3, c„ (analyte concentration)=100 ppb; b .) P0=IO10 ions/cm3, c.= 100 ppb; c.) po=10lz ions/cm3, C1=I ppb; d .) Po=IO10 ions/cm3, C1=IOO ppb; and e .) same as c.) but with 4mm of curtain gas in front of the orifice. 51 for ion residence time in the limiting condition of space charge domination. A current of 3AtA was used for the calculation. This methodology can be compared to experimental results for such a system. Figure 23 shows calculated analyte intensities as a function of distance between the source needle and the sampling orifice. The analyte, pyridine, was assumed to have a rate constant, k=2 x IO"9 cm3/molec/s in ambient air. The pyridine was present at a concentration of 0.1 ppb. Included in the model was a 4 mm depth of a curtain gas. Figure 24 shows the corresponding experimental result.28 This model gives insight into the factors determining the absolute ion current at a sampling orifice. Prior to this work there was little understanding of these factors. Numeric Solutions In mathematics, alternatives to analytic methods for solving differential equations have been developed. The field of numerical methods of differential equations has provided methodologies for solving different classes of differential equations. These methods, in general, involve a discretization of a mathematical region. The differential equations are then mapped over the discretized region. This necessitates the transformation of the differential needle-orifice distance (mm) Figure 23. Calculated corona API ion currents: Based upon 0.1 ppb analyte (pyridine) concentration, 4mm of curtain gas and P0=IO12 ions/cm3. H 3O+(H2O) f PyrH needle-orifice distance (mm) Figure 24. Experimental corona API ion currents: detailed in Reference (28). 54 equations into difference equations. It is the difference equations that are mapped over the grid. A variety of methods, including the finite difference and the finite element methods, have been developed to obtain a solution, based on the mapped difference equations. The obtained solution can be used to remap the difference equations on the grid. Typically, an iterative scheme is used to provide a "best" solution to the differential equations, based on the repeatedly remapped difference equations.29 The rigorous numerical solution of a space charge system requires the use of such techniques. These methods require much computational time. The general concept of this application to space charge dominated systems has been discussed by Felici and Atten.17'30 Specific use of the technique to m o d e l .space charge dominated systems has been made by Weber,31 McDonald,18 Leutert and Bohlen.32 Much of the work done in this area was done to model the operation of electrostatic precipitators. A good general work in this area, describing the space charge problems in electrostatic precipitators and how they relate to' the general body of knowledge in electrostatics, has been written by Hinds.33 In general, the work done to model precipitators involves geometries that are either cylindrical or planar. Work in the cylindrical geometries has been done mostly by using the analytical solution to the concentric cylindrical geometry. The planar geometry has required the use of finite 55 difference analysis of the parallel planar system. In the finite difference analysis, the geometry has been reduced to two dimensions by assuming the planar system to possess certain symmetry properties.32 Application of these numerical methods, to the modelling of space charge dominated mass spectrometry sources, has been made by Vogel.25,26 Simulation Method In addition to the actual numerical solving of the differential equations, another approach was used in the study of these systems. The previously discussed numerical methods for solving the differential equations, in addition to requiring large amounts of computer time, necessitate the stipulation of boundary conditions that are not available from the analysis of experimental conditions used for ion sources. An alternate simulation method was used to model these systems. In this method, the flow of ions is simulated by modelling the flow of ions through a grid of discrete cells. The computer program written to allow a user to perform the simulation uses simple equations, previously described, to model the ion's movement as a response to the fields in the ion source. The coulombic forces between the source components and the drifting ions, as well as between the drifting ions and their own space charge field, are 56 considered. An initial field is set up, over the source, and an initial space charge in each of the source's discretized cells is assumed. Then, through a series of "time" steps, a current is introduced into the ion supply area of the source. The amount of charge introduced is appropriate to the length of the time step and the assumed current. As the simulation progresses, the conditions in each cell converge upon a steady state. For a source under simulation the steady state is assumed to give the desired information. Simulation in General Geometries With a simulation strategy in hand, attention can be turned to geometries out of the realm of the analytic solutions. These geometries include sources that are actually of more than one dimension. Interesting geometries that could be thought of as being mathematically two dimensional include the point to plane geometry and the finite length cylindrical geometry. These geometries are illustrated in Figures 25 and 26. To discretize the source into a grid, the source must be divided so that the source is covered with a net of cells. The cells could be regular, such as a set of identically sized squares. However, one could attempt to concentrate the larger number of cells in the areas where the largest changes in the field conditions would be expected to occur. For the simulations, both approaches were 57 I Figure 25. Point to plane geometry. used. For some sources, with little need for a variable grid or little prior knowledge about source conditions, the grid was mapped with square or rectangular cells. Other sources, because of prior knowledge about the source conditions, were mapped with a parabolic grid. Figure 27 illustrates the geometry of the parabolic grid. The two dimensional grid, when rotated around the y-axis, geometry. forms a cylindrical Each cell then becomes a ring, centered around the y-axis. In this manner, the simulation gives the opportunity to model a variety of sources, providing that they possess Figure 26. "Needle in can" geometry. 59 Figure 27. Parabolic grid. symmetry around the axis of the cylindrical geometry. It is assumed that the axis of the geometry is perpendicular to the collector plate. A separate mechanism for mapping an ion supply surface is needed for each geometry. The program user is given the opportunity to specify the current and details concerning the geometry of the supply surface. In the parabolic geometry, the user is asked to describe the width of the ion supply surface in terms of angular width. In the rectangular 60 grid geometry, the user is asked to describe a ring shaped supply surface by giving the rings inner and outer radii. An intercellular distance is required for each cell to cell interaction. These distances are stored in an array. Based on the intercellular distances, fields can be calculated for each cell in the grid. These fields are a sum of both the Laplacian and spade charge fields. The Laplacian fields result from fields calculated from a point charge that is placed at a specified distance behind the ion supply surface. The fields that each cell experiences are resolved I into x- and y-components. Upon the calculation of the fields for each cell, the program can allow for the movement of charge density throughout the grid. This movement is based on the components of the calculated ion velocities and the intercell distances. The fraction of the charge leaving a cell is based on a proportion of the distance travelled by ions in a cell to the size of the cell in which the ions are contained. A mechanism to allow for the movement of ions, based on space charge expansion in a single cell is provided. The ion movement process also allows charge density to exit the entire grid, either by moving charge density to the collector plate or by hitting other defined source walls. The locations at which ion density exits the source are recorded. 61 The charge movement process repeats for a number of cycles. At the end of this set of cycles, the program recalculates the field strengths on the basis of the changed, charge distribution. At certain intervals a charge grid and two field grids, describing, respectively, charge contained in each cell the x- and y- components of field strength in each cell, are saved by the computer. The progress of the simulation can be monitored by the examination of the calculated grids. The "pseudo-time" intervals for charge movement, field recalculation and the total time of program operation are selected upon starting the simulation program. The times can be varied to be appropriate to the initial source parameters. Along with the time parameters, geometry type, needle charge and various source dimensions can be specified at the program's execution. To enhance the applicability of the program, it was assumed that the collector plate would be constructed of a conducting material. A conductor, having a constant potential at every point, requires a special treatment for the calculation of electric fields. In this simulation the "method of mirrors." is used. This method places an imaginary mirror charge, on the other side of the conductor s u r f a c e , f o r each charge. Therefore, each source component has a corresponding "mirror" component, and each grid cell has a corresponding "mirror" grid cell. 62 Point to Plane Geometry For the point to plane geometry, the current intensity on the plate is of interest. Using the two dimensional simulation, a plot of current versus the distance from the axis of the geometry, was drawn. This plot is shown in Figure 28. This current distribution has previously been observed. An empirical modelling of this distribution has also been used by various workers.11 i ' Electrosorav Geometry In electrospray sources it has been noted that an interesting current distribution exists for a geometry that, at least at first glance, appears to look like a point to ■ plane geometry. The current distribution is shown in Figure 29.24 The contrast with the above modelled distribution is striking. This discrepancy can be explained by an important : detail at the tip of the ESP needle. Instead of proceeding ; out of the needle in a straight jet, the liquid in the ESP can spread out in the form of droplets from the surface of a Taylor cone. However, often this Taylor cone is distorted into an umbrella shaped pattern. The droplets then seem to separate from the "rim" of the umbrella. The result is a I ring shaped source of charged droplets, that are caused to j drift towards the plate. The two forms of the electrospray flow are shown in Figures 30 and 31. The simulation of the 'I ; "ring to plate" geometry gives an entirely different current \ ■I 3.5 E O o X < >> C Z ) C <D Ch w C O Ui O U Figure 28. Calculated point to plane current distribution as a function of radius. For the calculation, the radius of the source is 4 cm, the length of the source is 5 cm, the current is I x i o ‘8 A, the needle charge is I x i o '6 C. 1.8 E E o x < 03 (U W m C (U u* U Radius (cm) Figure 29. Experimental electrospray collector plate current distribution as a function of radius: detailed in Reference (25). Figure 30. Spray pattern from a Taylor cone Figure 31. Spray pattern from the "umbrella" mod e . I 67 distribution. This distribution, shown in Figure 32, is seen to closely correspond to the experimentally observed distribution. The contrast between the two current distributions is a direct consequence of the space charge effects, and cannot be explained in terms of Laplacian fields alone. The distribution can also be, at least qualitatively, described by using the unipolar space charge formula. The field and space charge density distributions for the electrospray source are shown in Figure 33. API Geometry Another interesting geometry, accessible with the two dimensional simulation, is the finite length cylindrical geometry. This geometry can be used to model the typical API source. This simulation is distinguished from the point to plane geometry by having defined walls, in addition to having a collector plate. Using standard operating parameters, a simulation can be used to model such things as current distributions on the source walls. Perhaps more importantly, it can be used to determine the degree of approximation that is made, when the spherical geometry, with its analytic solution, is used to model the API source. Results of the API simulation are shown in Figure 34 and 35. 4.8 X !O'9 Z--S CO £ £ U CZD C CD "O CD bfi u 03 -O CO U Radius (cm) Figure 32. Calculated electrospray current distribution, at the collector plate, based upon ion densities at the perimeter of the source. For the calculation, the radius of the source is 10 cm, the length of the source is 2.5 cm, the electrospray current is I x IO'5 A, the electrospray needle charge is I x IO'6 C, and the electrospray current is injected into the source in a ring with inner and outer radii being 1.0 and 2.0 cm, respectively. Figure 33. Field and space charge density contour for the electrospray simulation. The calculation parameters are the same as specified in Figure 32. E c U C <D Q C (L) o U Radius (cm) Figure 34. Calculated corona API current distribution at the collector plate. For the calculation, the radius of the source is 10 cm, the length of the source is 2.5 cm, the corona-API current is I x io'9 A the corona needle charge is I x io'8 C, and the corona current is injected into the source in a circle with a radius of 2.0 cm. Figure 35. Field and space charge density contour for the corona API simulation. The calculation parameters are the same as specified in Figure 34. TIME DEPENDENT CASE The space charge model can be extended beyond steady state systems. The unipolar flow of ions in a dynamic system could be strongly influenced by space charge effects. An example of this type of system should demonstrate the utility of such an approach. For this example, a cylindrical apparatus could be used. This cylinder would be constructed with conditions so that the Laplacian field strength would be constant throughout its entire length. This apparatus could be thought to represent, in a crude way, the ion tubes that are now used in many electrospray sources. The electrospray sources introduced by Fenn and Chait utilize ion tubes to transport ions from one region of the ion source to another. Figure 36 shows a schematic of such a source. A variety of materials have been successfully utilized for the ion tubes.7,34 Moreover, this apparatus can model drift tubes that are in use for ion mobility spectrometry (IMS) .35,36 To model ion transport in these ion tubes,- it is convenient to imagine operating the system in pulse mode. To introduce ions into this system, ions would be filled behind a "gate" that would be a distance, a, from the source end of the tube. From the source plate to the gate, the ion r Electrostatic len ses Cylindrical Quadru pole m ass spectrometer electrode Capillary N eedle Liquid sam ple Skimmer First pumping stage Figure 36. Second pumping stage Ion tube in the Fenn electrospray source. 74 density, yO0, would be constant. All ions in this region would be of the same mobility and charge. Between the gate and the collector plate, the ion density would be zero. The model system is illustrated in Figure 37. At some time, t0, the gate would be 'opened7 allowing the drift of the ions toward the collector plate. The velocity of the ion drift would be dependent on the field strength that each respective ion would experience. This field, as before, would be dependent on both the Laplacian field and the space charge field. Whether the space charge field would be important would depend on the initial space charge behind the gate. Simulation With One Type of Ion The ion tube is treated here by using the infinite parallel plate geometry. This treatment is based on the assumption that both systems have constant Laplacian field strength throughout their entire lengths. A computer model of this system was constructed. In this model, the length of the drift tube was divided into cells of equal length. The number of cells could be chosen oh the basis of the desired accuracy of the model. The cells were each filled with ion density appropriate to the initial conditions. At the each end of the tube was a plate of a certain assigned charge. The model then went through a series of time steps. At each time step the actual field strength in each cell was <-------C a — "H -N Figure 37. Drift tube schematic. 76 calculated. This field strength, in turn, gave a drift velocity for the ions in each cell. The length of the timestep multiplied by the length of the timestep would give an indication of the displacement of ion density out of each cell. At the end of each timestep, a new ion density distribution, appropriate to the ion displacements, was constructed. To record the simulation of the ion flow, the ion collection current, at the collector plate, was recorded as a function of time. This collection current is shown in Figure 38. Simulation With Two Types of Ions As a further example of the utility of this approach, a similar program was written to allow the presence of two types of ions in the tube. The construction of the model was the same as in the preceding example, except for the need to account for two separate ion densities in each cell. The two ion types were assumed to have different ion mobilities. For the simulation, one ion type, ion A, was given an ionic mobility, K = A m2/V-s. The second ion type, ion B, was given an ion mobility, Kg=2 m2/V-s. The collection current for this simulation is shown in Figure 39. The current profile, as a function of time, displays the modification of chromatography, based on ionic mobilities, by space charge. This chromatography, ion mobility spectrometry (IMS), is based on transport in the CoUector Current as a function of time after pulse time(sec.) Figure 38. One component ion drift current versus time. The ion mobility for the drifting ion is 2 x io'4 m2/V*s. The field strength in the drift region is 0.5 V/m. The pulse contains 5 x io*7 ions. Collector Current as a function of time after pulse time(sec.) Figure 39. Two component ion drift current versus time. The field strength in the drift region is 0.05 V/m. The pulse contains 5 x io-6 ions of each drifting species. y 79 ion tube being a function of ion mobility.34 In the case of the ion tube in the electrospray source, the actual retarding effects in the ion flow are not well understood. The importance, in the ion transport, of adsorption of the ions on the ion tubes walls, the degree of hydration of the ions and fluid flow considerations are not well understood and are presently the subject of experimental study. Furthermore, in typical uses of these ion tubes, the effect of the ion transport through the tube may often be overwhelmed by the events occurring at both the entrance and the exit to the tube. The fluid and coulombic influences on ion flow would seem to be difficult to monitor, or model, in these regions. Clearly, additional work will be necessary in this area. 80 SUMMARY In this work, ion transport in unipolar mass spectrometry ion sources like corona API and electrospray has been studied theoretically. Unlike previous work in this area, the study has been done with the consideration of space charge effects. Analytic solutions of the space charge problem have been obtained for simple ion geometries, including the cases of infinite parallel planes, concentric cylinders of infinite length, and concentric spheres. These analytic solutions allow, for their respective geometries, the calculation of electric field, potential, ion density distributions, and ion residence times. It is shown that for typical operating conditions, the minimum potential required to overcome the space charge effect in corona API, or i ' electrospray ion sources, constitutes a dominant or significant fraction of the total applied voltage. Further, the electric field, in the region of the ion sampling 'i orifice and the ion residence time in the ion source are determined mainly by the space charge. Extending the approach to more general geometries, use of the unipolar formula, numerical methods of differential equations and a simulation approach was made. With the unipolar formula, absolute sensitivities of corona API ion sources were 81 calculated. Also, general geometries were modelled by a simulation calculation. The calculation was based on a computer program written to model ion flow in various ion sources having different geometries. Finally, the space charge influenced ion drift in a drift tube-type apparatus was modelled, as a function of time. The analyses, for the first time, provide methods for evaluating the ion sampling efficiency in high pressure, high current ion sources such as corona API and electrospray. Also, presented for the first time is a method for evaluating absolute sensitivities in the corona API source. REFERENCES CITED 83 1. Dempster, W., "A New Method of Positive Ray Analysis," Ph v s . R e v . . 1 1 . 1918, 316-325. 2. Bleakney, W. "A New Method of Positive Ray Analysis and its Application to the Measurement of Ionization Potentials in Mercury Vapor," Ph v s . R e v . . 34, 1929, 157-160. 3. Munson, M.S.B., Field, F .H ., "Chemical Ionization Mass Spectrometry," J. Am. Chem. So c . . 88., 1966, 2621-2630. 4. Barber, M.N., Bordoli, R.S., Sedgick, R . D . , Tyler, A . N . , "Fast Atom Bombardment of Solids (F.A.B.): A New Ion Source for Mass Spectrometry," J. Chem. Soc.,, Chem. Commun. . 7., 1981, 325-327. 5. Mitchum, R . K . , Korfmacher, W . A . , "Atmospheric Pressure Ionization Mass Spectrometry," Anal. Chem. . 55., 1983, 1485A1496A. 6. Vestal, M.L., "Studies of Ionization Mechanisms Involved in Thermospray LC-MS," J. Mass Spectrom.. 4 6 . 1983, 193-196. 7. . Fenn, J.B., Mann, M., Men g , C.K., Wong, S.F., Whitehouse, C.M., "Electrospray Ionization for Mass Spectrometry of Large Biomolecules," Science. 246. 1989, 64-71. 8. Chapman, S., "Carrier Mobility Spectra of Electrified Liquids," Phvs. Rev. . 52., 1939, 184-190. Spray 9. Chapman, S., "The Magnitude of the Corona Point Discharge Current," Journal of Atmospheric Sciences. 34., 1977, 18011809. 10. Loeb, L.B. Basic Processes of Gaseous Electronics. University of California Press, Berkeley, 1955. 11. Sigmond, R . S . , "Electrical Coronas," Electrical Breakdown of Gases. Meek, J.M. and Craggs, J.D. (ed.) Wiley, New York, 1978. 12. Townsend, J.S., "The Potentials Required to Maintain Currents Between Coaxial Cylinders," Phil. M a g . . 2 8 . 1914, 8390. 13. McDaniel, E.W., Mason, E .A ., The Mobility and Diffusion of Ions in Gases. John Wiley and Sons, New York, 1973. 14. Abou-Seada, M.S., Nasser, E., "Digital Computer Calculation of the Electric Potential and Field of a Rod Gap," Proceedings of the IEEE. 5 6 . 1968, 813-820. 84 15. Child, C.D. , "Discharge from Hot CaO," P h v s . Rev. . 32., 1908, 492-511. 16. Langmuir, I., "The Effect of Space Charge and Residual Gases on Thermionic Currents in High Vacuum," P h v s . Rev. . 2., 1913, 450-486. 17. Felici, N., "Recent Advances in the Analysis of D.C. Ionised Electric Fields," Dir. Curr. . 8., 1963, 252-260, 278287. 18. McDonald, J.R, Smith, W . B . , Spencer, H. W . , Sparks, L.E., "A Mathematical Model for Calculating Electrical Conditions in Wire-Duct Precipitation Devices," J. A p p I . Phv s . , 4 8 . 1977, 2231-2243. 19. Shahin, M.M., "Mass-Spectrometric Studies of Corona Discharges in Air at Atmospheric Pressures." J. Che m . Phvs., 45, 1966, 2600-2605. 20. Gobby, P.L., Grimsrud, E.P., Warden, S.W., "Improved Model of the Pulsed Electron Capture Detector," A n a l . Chem.. 52, 1980, 473-482. 21. Chapman, S ., Discharge of Corona Current from Points on Aircraft or on the Ground. Cornell Aeronautical Laboratory, Buffalo, 1955. 22. Chapman, S., Corona Discharge form an Isolated Point in Wind, Rep. No. 161, Cornell Aeronautical Laboratory, Buffalo, 1967. 23. Rees, J.A., "Fundamental Processes in the Electrical Breakdown of Gases," Electrical Breakdown of G a s e s . Meek, J.M. and Craggs, J.D. (e d .) , Wiley, New York, 1978.. 24. Iribarne, J.B, Thomson, B.A., "On the Evaporation of Small Ions from Charged Droplets," J . Chem♦ P h v s .. 6 4 . 1976, 2287-2294. 25. Ikonomou, M.G., Blades, A.T., Kebarle, P., "Investigations of the Electrospray Interface for Liquid Chromatography/Mass Spectrometry, " Anal. Chem., 62 , 1990, 957967 . 26. Vogel, C., Busman, M., Sunner, J., in preparation. 27. Busman, M., Sunner, J., Vogel, C., "Space-Charge Dominated Mass Spectrometry Ion Sources: Modelling and Sensitivity," J. Am. Soc. Mass Spectrom. . 2., 1991, 1-10. 85 28. Sunner, J., Nicol, G., Kebarle, P., "Factors Determining the Relative Sensitivity of Analytes in Positive Mode Atmospheric Pressure Ionization Mass Spectometry," A n a l . Chem.. 6 0 . 1988, 1300-1307. 29. Botha, J.F., Pinder, G.F., Fundamental Concepts in the Numerical Solution of Differential Equations. WileyInterscience, New York, 1983. 30. Atten, P. , "Methode Generale de Resolution du Problems du Champ Electrique Modifie par Une Charge D zEspaCe Unipolaire Injectee." Rev. Gen, de Electr.. 8 3 . 1974, 143-153. 31. Weber, C., "Numerical Solution of Laplace's and Poisson's Equations and the Calculation of Electron Trajectories and Electron Beams," Chapter 1.2, Focusing of Charged Particles. Vol. I . Septier, A. (ed.), Academic Press, New York, 1967. 32. Leutert, G., Bohlen, B., "Der Raumliche Elektrischer Feldstarke und Raumladungsdichte Elektrodefilter," Staub. 3 2 . 1972, 297-301. Verlauf von im Platten- 33. Hinds, W.C., Aerosol Technology. Properties. Behavior, and Measurement of Airborne Particles. John Wiley and Sons, New York, 1982. 34. Chowdhury, S.K., Katta, V., Chait, B.T., "An Electrospray Ionization MS with New Features for Protein Analysis," Presented at the 3 8th ASMS Conference on Mass Spectrometry and Allied Topics, June 3-8, 1990. 35. Revercomb, H.E., Mason, E.A., "Theory of Plasma Chromatography / Gaseous Electrophoresis - A Review," Anal. Chem.. 47, 1975, 970-983. 36. Cohen, M.J., Karasek, F.W., "Plasma Chromatography-A New Dimension for Gas Chromatography and Mass Spectrometry," J. Chromatogr. Sci., 8, 1970, 330-337. 86 APPENDICES 87 APPENDIX A ANALYTIC SOLUTIONS 88 Derivations of field strength expressions for planar, cylindrical and spherical geometries are shown. Planar geometry The ion current .density, J, is J = P ’V, (35) where v is the ion density. Also, i=J'A, (36) where i is the ion current and A is the unit area. So, i=J. (37) V=K 'E. (38) The ion velocity, v, is The space charge density, p, becomes p =- =-±- . v K 'E (39) The Poisson equation in the planar geometry is VzV=-L (40) eo d dV ~dx ~dx (41) _ dE ~dx * (42) 89 This equation, with the expression for space charge. p0, can be integrated to give E . dE= R- dx= — -— dx e0 E0X-E (43) E (44) TI/2 E= (2i X+E0Z G0K (45) E 2= — X+E02 G0K (46) Using the relation P = K -E / the space charge density is given by (47) 90 2i HI/2 ^ +-E02 (48) Cylindrical Geometry The ion current density, J, is J=p*v (49) and the ion current, i, is (50) where A is the surface are of a unit length of the cylinder, with a radius, r. The surface area, A, is given by A=2nr. (51) V=K-E (52) Using, for ion velocity, the space charge density, p, becomes P= 2nrKE (S3) The Poisson equation for a cylindrically symmetric geometry is V 2V = J L eo (54) 91 i a sr. r dr (55) (56) Using the above expression for space charge density, p, one obtains — — (rE) = ___ ____, r dr 2TrrzcSen (57) or upon rearrangement (rS)£ (rS)= 2 ^ w r , (58) This equation can be integrated to give an expression for field strength, E. I. (rE)d(rE) (rE) i rdr 2nKe - J (59) 1 .rz (60) T0E0 STTZfe0 (r2-r02) (61) (r2-r02)+T02S02 (62) ITTKec r 2E 2= STTZfe0 r 92 i r>2_ rO^ r‘ (63) 2TZVCe0 rQ2 2TTVCe0 7/2 r2-r02+E02 (64) 2TTKe0r0d Using the relation (65) 2nrKE' the space charge density is then given by > 1/2 2 Trr0ZC 2 Trzce0T 02 (r2-r02)+E02 (6 6 ) Spherical geometry The ion current density, J, is and the ion current, J = P 'V, (67) I = J ttA l (68) i, is where the area, A, is the surface area of a sphere of radius, r, 93 A=Airr2 (69) V=K -E. (70) The ion velocity, v, is The space charge density, p, can then be given as (71) Anr2KE The Poisson equation for a spherically symmetric geometry is V 2V=JL I d .2 dV dr (72) (73) With the use of the above expression for space charge density, p, one obtains <75) This equation can be integrated to give an expression for E. d (r2E) Ane0K E c (76) 94 (r2E) d (T2E ) = __i__r 2dr 47re0zc (77) T2E J (r2S) d (r2S) = ,1 — fr2c?z- (78) 472'E0Zf J ro 1 (T2E )2 r I= 2 P02E0 — I r 3r| ^ n e 0K 3 (79) r0 T ltE 2- T ^ E 2= - J - (T 3- T 03) (80) Z-4S 4rf 6ii ^ (r3-r "3)+r»<£»2 (81) Sne0K - Z 3 _ ^O3 fro I k 2+ 1 Z 0 S tte 0ZC Z 4 Z 4 (82) Il/2 (83) T 3- T 03 W E 02 Sne0Kr011 Then using (84) Znr2KE the space charge density can be given as I i 4 TTE0Z 02ZC STre0Zer0 - (Z3-Z03)+S02 1/2 (85) 95 APPENDIX B DERIVATIONS FOR LIMITING CONDITIONS. 96 Derivations of expressions for ion residence time, t sampling ion density, Psamp, and applied potential, V0, at the limit of space charge domination and r0« r in a spherically symmetric system are shown. Ion residence time, t The expression for field strength, E , in spherical geometry is 1/2 i E= r r 3 _ r 03 ? 2+ ^ 0 Sne^K r O4 r04 (8 6 ) Upon application of the limit E0>0, T1/2 i 1 _ r O3 I Sne0K r r 4 (87) Now, if r0« r , the field strength, E, becomes i 111/2 Sne0K r (88 ) The velocity, v, of ions in the source is given by the drift equation. /•7>• V=K-E=^E1. dt Substituting the above relation for E , into the drift equation gives (89) 97 dr K ' i dt Sne0Kr 67re0rJ (90) or '67repT/2 Ki r'1 dr. (91) Upon integration, one obtains (6ne0y/z rI Jr172CJr Ki I (92) '67re0W 2 2 Cr1372- ^ 372) Ki I" (93) 'Srre0TH/2 2 „ 3/2 Ki 3r1 (94) or, if r » r n. tres STretJr13 3/ci (95) Sampling ion density, o. An expression for ion current density is J=KpE. (96) At the exterior boundary of the spherical ion source, the ion density, p^, is U1 P r /CE1 / (97) 98 where J1 and E1 are, respectively, the ion current density and field strength at the exterior surface of the ion source. The ion current density, J 1, is given by (98) 47rr1 So, the ion density, P1, will become 1(1/2 'Gne0K (99) 4TTT12 -j— 3ie0 r1 1/2 (100) STrzcr13 Applied potential. V0 Again, the field strength, E, is I T/2 dV Gne0K r dr (101) Upon integration, an expression for applied potential is produced: I 1 T /2 Gne0K r I 7/2 ~2 (rS/z-r0y2) Gne0K (102 ) (103) APPENDIX C COMPUTER PROGRAMS 100 Figure 40. SPACE.BAS: A program, written in VAX BASIC Version 3.3, used for the two dimensional modelling of ion sources. i* I* !* !* !* I* !* !* !* I* I* !* !* S P A C E .BAS A s i m u l a t i o n to m o d e l a t w o - d i m e n s i o n a l ap a c e charge p r o b l e m w i t h c y l i n d r i c a l geometry. W R I T T E N BY DR. J A N S U N N E R DEPT. OF C H E M I S T R Y MONTANA STATE UNIVERSTIY AND MARK BUSMAN DEPT. OF C H E M I S T R Y MONTANA STATE UNIVERSTIY 1 *****»*****»**»*«*******»**»»»«*****************, 1*************»*****************»*****»**»***«**»*******»«**«»**»**»***«*»*»«,»» t* I* !* !* !* !* I* I* I* I* !* !* !* !* I* !* I* I* I* I* I* !* I* I* I* I* I* I* I* I* I* I* I* I* I* I* I* I* I* I* I* I* I* I* L I S T OF V A R I A B L E S CONSTANTS: Z K A P P A : Ion m o b i l i t y . EPSO: Permitivity C O U L C : I / <4*pi*EPS0) TIME: ( s e conds) TTOT: M a x i m u m for total e l a p s e d time T S T E P : Movement timestep T S N A P : T i m e s t e p b e t w e e n " s napshots" TE: Tim e step b e t w e e n f i e l d calculations T: T i m e cou n t e r for e l a p s e d t ime T2: T i m e cou n t e r for "snap s h o t s " TC: T i m e cou n t e r for f i e l d r e c a l c . T S T A R T : Ini t i a l t ime in p r o g r a m r u n . CURRENT: ZJO : CURR: QDC: (amps) C u r r e n t at source G r i d of current m e a s u r e d at surface C u r r e n t i n j e c t e d in a g i v e n cell * * * » » » * * * * * * * * * * * * * GEOMETRY: GRID? NCX NCY Q CHARGE: QN QD QNUM QS U M N U M I n d i c a t i o n of g e o m e t r y t y p e No. of in c r e m e n t s in x - d i r e c t i o n No. of i n c r ements in y - d i r e c t i o n T a n g e n t of angle in p a r a b o l i c geo. (coulombs) N e e d l e charge I n j e c t i o n char g e Charge grid Total charge of e n t i r e g r i d q g a p n u m Total charge of r e d u c e d (gap) g rid Charge grid Q QCH Charge transfer matrix DISTANCES: (meters) FP: D i s t a n c e of n e e d l e c h a r g e b e h i n d tip D: D i s t a n c e b e t w e e n p l a n e s (SQ) D: P l a n e - need l e t i p d i s t a n c e (PARA) DP: D i s t a n c e b e t w e e n cells p a r . to plates Y N E E C : D i s t a n c e b e t w e e n p l a t e a n d n e e d l e tip RDIS: M a x i m u m charge input r a d i u s R O D I S : M i n i m u m charge in p u t radi u s R A D M I N : Min. input rad. at r e s o l . of g r i d R A D M A X : Max. input rad. at r e s o l . of g r i d RD: D i s t a n c e b e t w e e n a d j a c e n t cells * * * * * * * * * * * * * * * * * * * * * * * * 101 F i g u r e 40. S P A C E .B A S - c o n t inued !* I* I* !* I* I* I* I* !* I* !* I* I* !• !* I* I* I* I* AD: G: COUNTERS: NNX: NY: MISC: ADIS RDEG FI D I S SN: FINPS: TlS: T2S: T3S: T4$: T5S: Cl: 02: ASTEP: D i s t a n c e b e t w e e n a d j a c e n t cells D i s t a n c e f r o m focal p o i n t to plate U s e d to count loops w o r k i n g in x-dir U s e d to count loops w o r k i n g in y - d i r M a x i m u m an g l e for c u r r e n t i njection A n g u l a r ra n g e in p a r a b o l i c g e o m e t r y # of f i d t i m e a t e p s p e r m o v e t i m e s t e p R e s t a r t status i d e n t i f i e r D u m m y v a r i a b l e s t o in p u t n o n e s s e n t i a l s t r i n g s f rom dis k f i l e s . T e r m s in s o l u t i o n t o q u a d r a t i c form, u s e d for s e t t i n g p a r a b o l i c grid. A n g u l a r i ncrement in t o r u s i n t e g r . CNm !Set u p arrays, constants, etc. D I M X (15,15), Y (15,15), E X (15,15), E Y ( 1 5 , 1 5 ) , D O U B L E Q N U M (15,15) D I M A ( I S ) , B (15) , A N G (15) , ANGR(IS) D I M D O U B L E Q C H (15,15), D O U B L E Q D (15), D O U B L E Q D C (15) 4 D I M SING L E Q (15) 5 D I M R D (15 , 1 5 , 2 , 1 ), A D ( 15,15,2,1 ) , D R ( 1 5 , 15), DA(15,15) D I M D O U B L E Q S U M N U M (I) , D O U B L E Q G A P N U M (I) I I I N T E G E R I-N D O U B L E A - H , O-Z Z K A P P A - IE-4 E P S O - 8.85E-12 COULC - 1/EPS0/4/PI 10 Iinput dat a - s e c t i o n I N P U T "DO Y O U W A N T TO R E A D F R O M IF (FZ$-"y" O R FZ$-"n") T HEN P R I N T "Set 'Caps L o c k ' " G O T O 10 E N D IF IN P U T " F I L E N A M E ", FILES IF FZ $ « " Y " THEN INPUT " S T A R T T I M E / m s ", TS TSTART-TS*lE-3 INPUT "TOT A L T I M E / m s ", TS TT0T-TS*lE-3 T2-0 TC-O G O S U B 1000 ISNAPRI ITIMESTEPS P R I N T "TSTEP ", TSTEP P R I N T "TSNAP ", TSNAP P R I N T "T,E - f i e l d ", TE P R I N T " D i s c h . c u r r . ", ZJO I N P U T " Change (Y/N) ", AS IF A $ - " Y " THE N TSTEP2-TSTEP INPUT "TIME S T E P , C U R R / u s " T S T E P - T S * I E -6 I N P U T "TIME S T E P ,E - F I E L D / u s F I L E (Y/N) ", FZS !ASSURE SHIFT L O C K F I N D A F I L E F O R R E S T A R T OF P R O G R A M !MOVEMENT T I M ESTEP !"SNAPSHOT" T I M ESTEP !FIELD C A L C U L A T I O N T I M E S T E P !CURRENT !CHANGE A N Y TIM E P A R A M E T E R S ? TS !TIMESTEP M O D I F I C A T I O N S ", TS 102 Fi g u r e 40. S P A C E . B A S - con t i n u e d TE-TS*lE-6 I N P U T "TIME S N A P / u s T S N A P asTS* IE- 6 E N D IF G O S U B 1100 PRINT T I I ! ISN A P R ", TS READ THE SAVED FILE F O R FIELD DISTRIBUTIONS IF T < ( T S T A R T - 1 E - 6 ) T H E N G O T O 100 E N D IF C L O S E #1 O P E N F I L E S F O R O U T P U T AS #1 FINF$-"Y" T2-0 T C-O P R I N T " T S T A R T / s ", T F O R N Y = O TO N C Y + 1 C U RR-O F O R N N X - O TO N C X + I Q (NNX) - C S N G (QNUM (NNX, NY) ) Q ( N N X ) = Q N U M ( N N X fNY) P R I N T NNX, NY, Q(NNX) NEXT NNX F O R N N X = I TO N C X C U R R - C U R R + E Y (NNXrN Y ) * Z K A P P A * Q (NNX)/ (D/NCY) NEXT NNX P R I N T " C u rrent at N Y NY; " is "; C U R R INPUT "Pause ", P N E X T NY ELSE FINP$-"N" I I INPUT "Sq u a r e or P a r a b o l i c gri d s y s t e m (SQ/PARA) ", GRIDS I DETERMIN THE G E O M E T R Y OF THE G R I D S Y S T E M IF G R I D S-"PARA" !PARABOLIC G E O M E T R Y THE N G O S U B 2 8 0 0 !GRID ELSE G O S U B 275 0 IF G R I D S — "SQ" ! G R I D S Q ---R E C T A N G U L A R G E O M E T R Y E N D IF IN P U T " P r i n t - o u t of c o o r d i n a t e s (Y/N), p r i n t e r on? ", AS IF A S - "Y" T H E N G O S U B 2850 E N D IF GROUT I N P U T "TIME S T E P , C U R R / u s ", TS IInput t i m e s t e p p a r a m e t e r s T S T E P = T S * I E -6 IN P U T "TIME S T E P ,E - F I E L D / u s ", TS T E - TS*lE-6 INPUT "TIME S N A P / u s ", TS T S N A P — TS* l E - 6 IN P U T " T O T A L T I M E / u S ", TS TTO T - TS*lE-6 IN P U T " D I S C H A R G E C U R R E N T / u A ", ZJ ZJ0=le-6*ZJ ItO A T-O T2- 0 TC-O F I N P S - "N" G O S U B 1400 ICHINP E N D IF IF GRIDS = nS Q n IINPUT P A R A M E T E R S PERTINENT TO RECTANGULAR THEN !GEOMETRY IN P U T "NE E D L E C H A R G E ", QN I N P U T " D I S T A N C E B E H I N D P L A T E /mm ", FPO FP-FPO/IOOO YNEEC-D+FP ELSE IF G R I D S - nP A R A n IINPUT P A R A M E T E R S PERTINENT TO PARABOLIC 103 Figure 40. SPACE.BA S -continued IG E O M E T R Y I N P U T " NEEDLE C H A R G E ", QN I N P U T "DIS T A N C E B E H I N D P L A T E /mm FP-FP0/1000 YNEEC-D+FP E N D IF E N D IF G O S U B 1500 ICHIN P 2 DNSUM=O F O R N N X = I TO N C X D N S U M = D N S U M + Q D (NNX) NEXT NNX P R I N T "ND S U M = ", D N S U M then ", FPO IF F I N P $ = " Y " THEN IF G R I D S “ "PARA" T H E N G O S U B 2800 E N D IF !GRID IF G R I D S = nSQ" T H E N G O S U B 2750 E N D IF !GRIDSQ G O S U B 2820 !DIST G O S U B 2100 IEFLD FIRSTS="!" LT=I G O T O 300 E N D IF F I R S T S - nN" G O S U B 2820 !DIST SN-TE/TSTEP T-TE G O S U B 1600 !CHINJ G O S U B 1200 ISNAPINI G O S U B 2100 !EFLD 300 !time s t e p p i n g T-T+TSTEP T2 —T2+TSTEP TC=TCtTSTEP P R I N T "T= ", T IF T> (TTOT+1E-10) THEN G O S U B 226 0 !SNAP P R I N T "THIS IS THE END ! ! ! " PRINT G O T O 3000 ELSE SN=I G O S U B 1600 ICHINJ IF T O (TE- (IE-10) ) THEN TC=TC-TE P R I N T " Q - e u m ", Q S U M M t*M P R I N T " Q - g a p ", Q G A P N U M IF F I R S T S - nN" T H E N GO S U B 210 0 E N D IF F I R S T S - nN" LT=I E N D IF IF T 2 > (T S N A P - (IE - 1 0 ) ) THE N T2-T2-TSNAP TMU=T*1E6 P R I N T "Snap output to file" P R I N T "T/us- ", T M U G O S U B 226 0 !SNAP E N D IF GO S U B 200 0 ICURR GO S U B 1900 INEWCH IEFLD 104 Figure 40. S P A C E .B AS-continued E N D IF G O T O 300 !End of M a i n P r o g r a m SUBROUTINE SECTION ******** ******** L I S T OF S U B R O U T I N E S ******** CHCPOUT L O C A T E D B Y U S I N G G O S U B 1800 CH I N I C h a r g e initiation L O C A T E D B Y U S I N G G O S U B 1300 CHINJ Inj e c t s c h a r g e s int o first cell line L O C A T E D B Y U S I N G G O S U B 1600 CHINP C a l c u l a t e i n j e c t e d ch a r g e s int o first cell line L O C A T E D BY U S I N G G O S U B 1400 CHIN P 2 C o n v e r t s i n j e c t i o n cur r e n t t o i n j e c t e d c h arge L O C A T E D B Y U S I N G G O S U B 100 CURR Calculates charge transfer matrix L O C A T E D B Y U S I N G G O S U B 2000 DIST C a l c u l a t e s inte r c e l l d i s t a n c e s L O C A T E D BY U S I N G G O S U B 2820 EFLD Electric field calculation L O C A T E D B Y U S I N G G O S U B 2100 GRID G e o m e t r y input and cell c o o r d i n a t e c a l c u l a t i o n L O C A T E D B Y U S I N G G O S U B 2800 GRIDSQ Sam e as G R I D but for s q u a r e g r i d s y s t e m L O C A T E D B Y U S I N G G O S U B 2750 GOUT O u t p u t t o s c r e e n of g e o m e t r y a n d c o o r d i n a t e s L O C A T E D B Y U S I N G G O S U B 2900 NEWCH C a l c u l a t e s n e w charge d i s t r i b u t i o n L O C A T E D B Y U S I N G G O S U B 1900 RINGINT I n t e g r a t i o n of t h e c h a r g e G O S U B 250 0 in a n y r i n g R I N G S A M E I n t e g r a t i o n of the c h a r g e in the same r ing as a s e l e c t e d cell L O C A T E D BY U S I N G G O S U B 2400 RINTX L O C A T E D B Y U S I N G G O S U B 2700 RINTY L O C A T E D B Y U S I N G G O S U B 2600 SNAP W r i t e s s n a p - i n f o r m a t i o n t o file L O C A T E D BY U S I N G G O S U B 2260 105 Figure 40. SPACE.BA S -continued S NAPINI I n i t i a t e s S N A P - f ile for output, L O C A T E D B Y U S I N G G O S U B 1200 w r i t e s input p a r a m e t e r s SNAPR R e a d s e l e c t r i c f i e l d a n d c h a r g e d i s t r i b u t i o n f r o m SNAP file L O C A T E D B Y U S I N G G O S U B 1100 SNAPRI R e a d s d a t a - h e a d fro m S N A P - f ile L O C A T E D B Y U S I N G G O S U B 1000 1000 * * » * * » * * » • • * * * * * * * * * * * * * * * * * * , , * * * * * SNAPRI - s u b r o u t i n e r e a d d a t a - h e a d fro m S N A P - f i l e O P E N FILES F O R IN P U T A S #1 INPUT #1, GRIDS INPUT #1, TlS IF GRIDS- "SQ" T HEN P R I N T " Square c o o r d i n a INPUT *1, D, DP, N C Y , i ELS E IF G R I D S = nP A R A n THE N INPUT #1, D, F P , N C Y , I END Il END IF INPUT #1, T S N A P , TE, TSTEP INPUT #1, ZJ0 F O R NNX-I TO N C X INPUT #1, QDC(NNX) NEXT NNX RETURN ,,,,,,, ***** !to disk Ig e o m e t r y type !" p o i n t - t o - p l a n e corona' Is q u a r e g e o m e t r y Iinput s q u a r e p a r a m e t e r s Iinput p a r a b o l i c p a r a m e t e r s 1100 |************#************************************e**eeeeeeeeeeeeeeileielleilll IS N A P R - su b r o u t i n e Iinput of e l e c t r i c f i e l d d i s t r i b u t i o n f r o m SNAP file |**********************»*********»»***********«***************»**»************* !ERROR TRAP O N E R R O R G O T O 1150 W H I L E 0-0 INPUT #1, T2$, T !"T- " P R I N T "T ", NS, T INPUT #1, T3S I"ELE C T R I C F I E L D A N D C H A R G E D I S T R I B U T I O N S " I N P U T #1, T4$, Q S U M N U M I"Q,Sum- " INPUT #1, T5S, Q G A P N U M I"Q,gap- " Q S (NS)- C S N G (QSUMNUM) Q S G (NS)- C S N G (QGAPNUM) F O R NY- I TO N C Y F O R NNX-I T O N C X INPUT #1, I, J, E X ( N N X 1N Y ) , E Y ( N N X 1N Y ) , QT I I I I I Q N U M (NNX1N Y ) - C D B L (QT) Q N U M ( N N X 1N Y ) - Q T P R I N T I 1J, E X ( N N X 1N Y ) , Q N U M ( N N x 1NY) NEXT NNX N E X T NY NNX=O 106 Figure 40. S P A C E .BAS-c ontinued I I I I 1150 1160 F O R N Y - O TO N C Y + I IN P U T #1, I, J, QT QNXJM (NNX1NY) - C D B L (QT) QNXJM (NNX1N Y ) - Q T N E X T NY NNX-NCX+1 FOR NY=-O TO N C Y + 1 IN P U T #1, N N X , NY, QT QNXJM (NNX1NY) - C D B L (QT) Q N U M ( N N X 1N Y ) - Q T N E X T NY N Y-O F O R NNX-I TO N C X I N P U T #1, N N X , NY, QT Q N U M ( N N X 1NY)- C D B L ( Q T ) QNXJM (NNXfNY) - Q T NEXT NNX N Y —N C Y + I F O R NN X = I T O N C X IN P U T #1, N N X , NY, QT QNXJM(NNXfN Y ) - C DBL(QT) QNXJM(NNXfN Y ) = Q T NEXT NNX N E X T !WHILE IF ERR= I l T H E N R E S U M E 1160 E L S E ON E R R O R G O T O 0 RETURN 1200 !SNAPINI - su b r o u t i n e !i n i t i a l i z e S N A P - f ile I******************** O P E N FI L E S F O R O U T P U T AS #1 IF GRIDS = 11PARA" THEN P R I N T #1, GR I D S !Geometry t ype P R I N T #1, " P o i n t - t o - p l a n e corona" P R I N T #1, D; FP; NCY; NCX; RDEG a r a m e t e rs ELSE IF G R I D S — "SQ" THEN P R I N T #1, G R I D S P R I N T #1, " P l a n e - t o - p l a n e c orona" P R I N T #1, D; DP; NCY; NCX; ADIS ameters E N D IF E N D IF P R I N T #1, T S N A P ; TE; T S T E P ; ","; T T O T P R I N T #1, ZJ0 !Current F O R N N X = I TO N C X P R I N T #1, QDC(NNX) NEXT NNX I C L O S E #1 RETURN !PARA geome t r y p ISQ g e o metry par ITim e parameters 1300 ********** ************* ICHINI - s u b r o u t i n e Icharge d i s t r i b u t i o n i n i t i a t e d j****************************************************************************** INPUT "Charge on needle QN 107 Figure 40 S P A C E .BAS-continued P R I N T "Charge i n i t i a t i o n " !FOR NY- I TO N C Y !FOR NNX-=I TO N C X !Q N U M (1,5)— ID-12 ! Q N U M (3,5)- O D - I2 IQ N U M (4,5)— OD-12 !NEXT N N X !NEXT NY RETURN 1400 I*******************************************************,********,*.,*,,+*,,,,, ICHINP - s u b r o u t i n e !c a l c u l a te i n j e c t e d c h a r g e s i nto first cell line !****************************************************************************** ! I P R I N T " C a l c u l a t e s i n j e c t i n g c h a rges" N=O NY=NCY ** CHARGE INJECTION FOR PARABOLIC GEOMETRY ** IF G R I D S = "PARA" THEN INPUT " C U R R E N T I N J E C T I O N A N G L E / d e g ", A D I S I A D I S = A D I S I / 1 80 * P I !max an g l e for d i s c h a r g e cu r r e n t F I D I S = I - C o s (ADIS) I s t eradia n s /2/pi F O R NN X = I TO N C X IF N=I T HEN QDC(NNX)-O ELSE IF N N X - I THEN Al = O ELSE A l - A N G R ( N N X ) -AST E P R / 2 E N D IF A 2 -ANGR(NNX)+ASTEPR/2 IF A 2 > A D I S THEN A 2 —A D I S N-I ELSE QDC(NNX) - (COS ( A l ) - C O S (A2))/ F I D IS*ZJ0 E N D IF E N D IF NEXT NNX ELSE •* CHARGE INJECTION F O R SQUARE GEOMETRY ** IF G R I D S — "SQ" THEN INPUT " M A X I M U M C H A R G E INPUT R A D I U S / m m ", R D I S O !Define r i n g for R D I S - R D I S 0/1000 Ii n j e c t i o n of charge INPUT " M I N I M U M C H A R G E INPUT R A D I U S / m m ", R 0 D I S 0 RODIS-RODISO/IOOO T O T S = P I * (RDIS*R D I S - R 0 D I S * R 0 D I S ) F O R NNX-I TO N C X IF N=I THEN QDC(NNX)-O ELSE IF ( N N X - 0 .5)* D P <RDIS !R a d i u s THEN !Total are a of i n j e c t i o n ring insi d e of ring ' s ou t e r b oundary? 108 Figure 40. SPACE.BAS-continued R A D M A X - (NNX-0.5) *DP ELSE RADMAX-RDIS N-I E N D IF IF NN X - I THEN RADMIN-O ELSE R A D M I N - ( N N X - 1 .5)*DP E N D IF IF R A D M I N < R O D I S !R a dius inside of r i n g 's in n e r b o u n d a r y ? IF R A D M A X < R 0 D I S THEN RADMIN-RADMAX ELSE RADMIN-RODIS E N D IF E N D IF O D C ( N N X ) - P I * (RADMAX* R A D M A X - R A D M I N *R A D M I N )/ T O T S * Z J O IC u r r e n t in a cell is the total i n j e c t i o n current !multi p l i e d by the r a t i o of t h e cell's area to the !total area of t h e i n j e c t i o n r i n g . E N D IF NEXT NNX E N D IF E N D IF F O R N N X = I TO NCX P R I N T QDC(NNX) N E X T NN X RETURN 1500 !CHINP2 - s u b r o u t i n e !Converts i n j e c t i o n c u r r e n t t o i n j e c t e d c h arge ********** F O R N N X - I TO N C X Q D ( N N X ) - Q D C ( N N X ) * T STEP !Charge i n j e c t e d in a cell is c u r r e n t ! m ultiplied b y l e n g t h of m o v e m e n t timestep. NEXT NNX RETURN 1600 I* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * , , , , , , , , , , , , , , , , , , , , , , , , , , I* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * , * * « * » * « * * » , * , , , „ , , , , ttt !CHINJ - s u b r o u t i n e Id i s c h a r g e c h arge input F O R NNX-I TO N C X Q N U M ( N N X 1N C Y ) - Q N U M ( N N X fN C Y ) + S N * Q D (NNX) !Puts i n j e c t e d c h a r g e into Ichar g e grid NEXT NNX RETURN 1900 I*.* t**************** INEWCH - s u b r o u t i n e !c a l c u l a tes n e w char g e d i s t r i b u t i o n IAA**************************************************************************** 109 Figure 40. S P A C E .BAS - continued I QSUMtTUM-O QGAPNUM-0 P R I N T "New c h a r g e d i s t r i b u t i o n calcu l a t e d " F O R N Y - O TO N C Y t l F O R NNX-O TO N C X + I Q N U M (NNX.NY) - Q N U M (NNX1NY) + Q C H (NNX1NY) !Add m o v e m e n t c h a r g e to e x i s t i n g char g e Q S U M N U M - Q S U M N U M + Q N U M (NNX, NY) !Total ch ar g e of e n t i r e g r i d P R I N T Q N U M ( N N X fN Y ) , Q C H ( N N X 1NY) NEXT NNX NEXT NY F O R NY=I TO N C Y F O R NN X = I TO N C X Q G A P N U M - Q G A P N U M + Q N U M (NNXfNY) ITotal c h a r g e of "gap" gri d NEXT NNX N E X T NY !PRINT " T OTAL C H A R G E S RETURN ", Q G A P N U M , Q S U M N U M 2000 1»** * # »»****«* CURR -subroutine c a l c u l a t i o n of c h a r g e t r a n s f e r b e t w e e n cells "*********************************«*+***************************************** ** L O C A L V A R I A B L E D E S C R I P T I O N S ** CHARGE: QCH: C h a r g e t r a n s f e r matr i x QL: C h a r g e m o v i n g to left CR: C h a r g e m o v i n g t o right QU: C h a r g e m o v i n g up CD: C h a r g e m o v i n g dow n QUL: C h a r g e m o v i n g up and to left QUR: C h a r g e m o v i n g up and t o right QDL: C h a r g e m o v i n g down and t o left QDR: C h a r g e m o v i n g d o w n and to left C L E A V E : Total c h arge l e a v i n g a cell Q: C h a r g e of a cell fro m w h i c h c h a r g e is being moved. VELOCITY: VR: Radial velocity VA: Angular velocity DIST A N C E : DR: G rid for r a dial d i s t a n c e t r a v e l l e d by a cell. RW: R a d i a l "width" of a cell RC: R a d i a l d i s t a n c e t r a v e l l e d by acell RU: R a d i a l d i s t a n c e t r a v e l l e d b y t h e cel l "up" in t h e grid. RD: R a d i a l d i s t a n c e t r a v e l l e d b y t h e cell "down" in the grid. RDB: A v e r a g e d i s t a n c e t r a v e l l e d b y a cell and the cell "down" in the grid. RUB: A v e r a g e d i s t a n c e t r a v e l l e d b y a cell and the cell "up" in the grid. RWN: R a d i a l d i s t a n c e t r a v e l l e d b y a cell with c o m p e n s a t i o n for " e x p a n s i o n ." DA: G r i d for axial d i s t a n c e t r a v e l l e d by a cell AW: Ax i a l "width" of a cell AC: A x i a l d i s t a n c e t r a v e l l e d b y a cell AR: A x i a l d i s t a n c e t r a v e l l e d by t h e cell to the HO Figure 40. S P A C E .BAS-continued AL: ALB: ARB: AWN: right. A x i a l d i s t a n c e t r a v e l l e d by t h e cell to the left. A v e r a g e d i s t a n c e t r a v e l l e d b y a cell and t h e cell to t h e l e f t . A v e r a g e d i s t a n c e t r a v e l l e d b y a cell and t h e cell t o the right. A x i a l d i s t a n c e t r a v e l l e d b y a cell wit h compensation for "expansion." FIELD: ER: R a d i a l c o m p o n e n t of f i e l d EA: A n g u l a r c o m p o n e n t of field CHARGE/FRACTIO N : QFU: F r a c t i o n of char g e m o v i n g up. QFU: F r a c t i o n of char g e m o v i n g down. QFU: F r a c t i o n of char g e m o v i n g to t h e r i g h t . QFU: F r a c t i o n of c h a r g e m o v i n g to t h e left. QFU: M a x i m u m f r a c t i o n of c h arge m o v i n g . ****************************************************************************** ****************************************************************************** P R I N T "Charge t r a n s f e r / c u r r e n t c a l c u l a t e d " E R A S E QCH F O R N Y-O T O NCY+1 F O R N N X = O TO NCX+1 Q C H ( N N X fNY)-O NEXT NNX NEXT NY QMAX=O F O R NY-I TO N C Y !choose cell F O R NNX=I TO N C X !c a l c u l a t e r a dial e l e c t r i c fi e l d E R - ( - R D (NNXfN Y , 0 , 0 ) * E X (NNXfN Y ) - R D ( N N X fN Y f I , 0 ) * E Y (NNXfN Y ) ) / R D (NNXfN Y f2,0) !calculate axial e l e c t r i c f i e l d E A - (-RD (NNXfN Y f I, 0) *EX (NNXfN Y ) + R D (NNXfN Y f 0, 0) *EY (NNXfNY) ) /RD (NNXfN Y f2,0) IF NNX=I T H E N E A - O E N D IF !radial v e l o c i t y VR=ZKAPPA*ER Iaxial v e l o c i t y VA-ZKAPP A*EA Id i s t a n c e of radial t r a v e l for cell center D R ( N N X fNY) —V R + T S T E P Id i s t a n c e of ax i a l trav e l for cell cent e r D A ( N N X fN Y ) - V A * TS T E P NEXT NNX N E X T NY F O R NNX-I T O N C X F O R NY-I T O N C Y I If r a c t i o n of c h a r g e e x i t i n g left a n d right IF NN X - I !On edg e of g r i d T HEN R I - A D ( N N X fN Y f2 , I ) /2 R F - R I + D A ( N N X + 1 ,N Y ) /2 Q F R - (RF"RF/ R I / R I - 1 ) QFL-O ELSE !M e c h a n i s m for the axial "expa n s i o n " of a cell in response Ito m o v e m e n t of charge in n e i g h b o r i n g cells . A W - A D ( N N X fN Y f2 , I) A C - D A ( N N X fNY) IAx i a l v e l o c i t i e s A L = D A ( N N X - I fNY) IF N N X - N C X IOn ou t e r e dge THEN Ill Figure 40. S P A C E .BAS-continued AR-2*AD-AL E LSE A R - D A (NNX+1, NY) E N D IF A L B - (AL+AC)/2 A R B - (AR+AC) /2 RWIT-AW-AT,B+APB IF A L B < 0 T H E N Q F L — A L B / A W N E L S E Q F L - O E N D IF IF A R B > 0 T H E N Q F R - A R B /A W N E L S E QF R = O E N D IF E N D IF !f r a c t i o n of c h a r g e e x i t i n g u p a n d down R W - R D (NNX,N Y , 2,0) !Distance R C - D R ( N N X 1NY) !Radial distance. IF N Y = N C Y ISame 'slice' of grid? T HEN !Me c h a n i s m for the radial "expansion" of a c ell in response !to m o v e m e n t of c h arge in n e i g h b o r i n g c e l l s . RUB-O ELSE R U - D R (NNX,N Y + I) !Radial distance. R U B - ( R U + R C ) /2 E N D IF IF NY=I THE N RDB=2*RC-RU ELSE R D = D R (NNX,N Y - I ) !Radial distance. R D B = (RD+RC)/2 E N D IF RWN-RW+RUB-RDB IF RU B > 0 T H E N Q F U = R U B / R W N E L S E QF U = O E N D IF !Charge up IF R D B C O T H E N Q F D — R D B / R W N E L S E Q F D - O E N D IF !Charge d own !testing for Q - m a x IF Q F U > Q M A X !Monitor f r a c t i o n of m o v e m e n t - - u p THEN QMAX=QFU NID-I II n d i c a t e t h e d i r e c t i o n of m a x i m u m m o v e m e n t NXM=NNX NYM-NY E N D IF IF Q F R > Q M A X !Monitor f r a c t i o n of m o v e m e n t - - r i g h t THEN QMAX=QFR NID=2 NXM=NNX NYM=NY E N D IF IF Q F D > Q M A X !Monitor f r a c t i o n of m o v e m e n t --down THEN QMAX=QFD NID-3 NXM-NNX NYM-NY E N D IF IF Q F L > Q M A X !Monitor f r a c t i o n of m o v e m e n t - - I e ft THEN QMAX-QFL NID-4 NXM=NNX NYM-NY E N D IF I I Q = C S N G ( Q N U M (NNX,N Y ) ) O = Q N U M (NNX,NY) 112 Figure 40. SPACE.BAS-continued O L - Q F L * ( 1 -QFU-0FD)*Q !Charge g o i n g left from cell Q R - Q F R * ( I - Q F U - Q F D ) *Q IC h arge g o i n g right f rom cell Q U - Q F U * ( I - Q F L - Q F R ) *Q IC h arge g o i n g up from cell Q D - Q F D * ( I - Q F L - Q F R ) *Q IChar g e g o i n g dow n from cell QUL-QFU*QFL*Q !Charge g o i n g up a n d left f r o m cell QUR-QFU*QFR«Q !Charge g o i n g up and right f r o m cell OnL-QFD*QFL*Q IChar g e g o i n g d own and left f r o m cell Q D R - Q F D *QFR*Q !Charge g o i n g u p a n d left f r o m cell Q L E A V E (QL+QR+QU+Q D + Q U L + Q U R + Q D L + Q D R ) !Charge l e a v i n g cell IT r a n a f e r m o v e m e n t i n f o r m a t i o n t o a " m o v e m e n t " m a t r i x Q C H (NNX,N Y ) - Q C H ( N N X 1N Y ) - Q L E A V E Q C H ( N N X t l 1N Y ) - Q C H ( N N X t l 1N Y ) t Q R Q C H ( N N X - I 1N Y ) - Q C H ( N N X - I 1N Y ) tQL Q C H (NNX,N Y t I )- Q C H (NNX, N YtlJtQU Q C H (NNX,N Y - I )- Q C H ( N N X 1N Y - I ) tQD Q C H ( N N X - I 1N Y - I ) - Q C H ( N N X - I 1N Y - I ) tQD L Q C H ( N N X t I 1N Y - I ) - Q C H (N N X t l , N Y - 1 ) t Q D R Q C H (NNX- I 1N Y t l ) - Q C H (NNX-I 1N Y t l ) tQU L Q C H ( N N X t l 1N Y t l ) - Q C H ( N N X t l 1N Y t l ) t Q U R N E X T NY NEXT NNX IF LT=I THEN P R I N T "Q-max ", Q M A X 1 N I D 1 N X M 1 N Y M F O R I-I TO 100 N-I NEXT I LT=O E N D IF IF Q M A X > 0 .05 !Ia m a x i m u m m o v e m e n t over t h e aet t h r e s h o l d ? THEN P R I N T "WARNING, Q 1m a x - ", Q M A X 1 N I D !Display m o v e m e n t P R I N T "TIME ", T 1 N N X 1 NY !warning W A R N S - "Y" E N D IF RETURN 2100 |******************************************$************************,*,,,*„,**, |A**************************************,******,******************,,,***,,*,,,,, !EFLD - s u b r o u t i n e !for c a l c u l a t i o n of e l e c t r i c f i e l d I****************************************************************************** I I I !returns e l e c t r i c f i e l d v e c t o r in e a c h cell P R I N T " C a l c u l a t i o n of E-field" F O R NY= I TO N C Y !cell for w h i c h e l e c t r i c f i e l d is t o be calc. F O R N N X - I TO N C X !NY=2: N N X — 2 !PRINT "NNX, N Y ", N N X 1 N Y EX=O EY-O D S - X (NNX,NY) Ix-coordinate of cell Y l - Y ( N N X 1NY) ! y - coordinate of cell special t r e a t m e n t for axial c e l l s ? ? ? F O R K Y-I TO N C Y !ch a r g e d t o r u s t o be i n t e r a c t e d w i t h cell F O R K X-I TO N C X L-O Q N U M ( K X 1K Y ) - I E - S I IF (KX=I A N D N N X = I D R = X ( K X 1KY) Y 2 = Y (KX1KY) Q = Q N U M ( K X 1KY) DL=Y2-Y1 A N D N Y - K Y ) T H E N G O T O 2150 E N D IF Ix-coordinate for torus Iy - c o o r d i n a t e for torus Icharge for torus !Distance b e t w e e n cell and t o r u s (y-comp.) 113 Figure 40. S P A C E .B AS-continued I DL2-Y2+Y1 !Distance b e t w e e n cell a n d " m i r r o r torus"(v-cp. NSTEP-20 IF (K X - N N X A N D K Y - N Y ) IIs t h e cell c o n t a n i n e d in t h e t o rus? THEN !same t o r u s i n t e r a c t i o n P R I N T KX, N N X , KY, NY IF N N X - I T HEN EXT-O !Define E - f l d for "same t o r u s " a n d first row EYT-O EXM-O E Y M - -C O U L C *Q /DL2/DL2 ELSE G O S U B 2 400 IRINGSAME D e f i n e E - f l d for "same torus" L=I GOSUB 2500 IRINGINT L-O E N D IF ELSE G O S U B 250 0 !R I N G I N T i n t e g r a t e s c o u l o m b o ver c h a r g e d torus Iret u r n s ey2 a n d ex2 E N D IF EX-EX+EXT+EXM EY-EY+EYT+EYM !x - c o m p o n e n t of E - f l d in a cell is the !s u m of the p r e v i o u s v a l u e of E-fld, the Ix - c o m p o n e n t f r o m the to r u s a n d t h e !x - c o m p o n e n t f r o m t h e "mi r r o r t o rus" !y-component of E - f l d in a cell is the Isum of the p r e v i o u s va l u e of E-fld, the Iy - c o m p o n e n t f r o m the to r u s a n d the Iy - c o m p o n e n t f r o m t h e " mirror toru s " !IF IKX-I A N D KY=4) •THEN !PRINT N N X , NY !PRINT " E 1T - C H A R G E ", KX, KY, EXT, EYT !PRINT " E ,M I R R O R - C H " , KX, KY, E X M , E Y M !END IF 2 150 NEXT KX IC o n t i n u e w i t h an i n t e r a c t i o n w i t h a n o t h e r t o r u s N E X T KY !electric f i e l d f r o m n e e d l e c h arge D Y N - Y N E E C -Y (N N X ,N Y ) Iy - c o m p o n e n t of d i s t a n c e f r o m needle D X N = X ( N N X fNY) Ix - c o m p o n e n t of d i s t a n c e f r o m needle DN2«DYN*DYN+DXN*DXN D N - S Q R (DN2) !Distance f r o m n e e d l e E X N - C O U L C * Q N /DN2 * D X N /DN Ix - c o m p o n e n t of E - f l d f r o m n e edle E Y N - - C O U L C * Q N /DN2 *D Y N /DN Iy - c o m p o n e n t of E - f l d f r o m n e edle !electric f i e l d f r o m n e e d l e m i r r o r charge D Y N M = Y N E E C t Y ( N N X fNY) Iy - c o m p o n e n t of d i s t a n c e !from "mirror nee d l e " D N M 2 — D Y N M 4D Y N M + D X N * D X N D N M = S Q R (DNM2) !distance f r o m "m i r r o r n e e d l e " E X N M - -C O U L C * Q N / D N M 2 1D X N /DNM Ix - c o m p o n e n t of E - f l d from I"mirror n e e d l e " EYNM-CouLC 1QNZDNlti1DYNMZDNM !y-component of E - f l d from I"mirror n e e d l e " I P R I N T N N X fNY I P R I N T "NEEDLE ", E X N , E Y N I P R I N T " M I R R O R ", EXNM, E Y N M E X ( N N X fN Y ) - E X + E X N + E X N M E Y (NNX,N Y ) —E Y + E Y N + E Y N M !x-component of E - f l d in a cell is the !sum of t h e p r e v i o u s va l u e of E-fld, the Ix - c o m p o n e n t fro m the n e e d l e a n d the !x-component f r o m the "mirror nee d l e " !y-component of E - f l d in a cell is the Isum of the p r e v i o u s v a l u e of E-fld, the Iy - c o m p o n e n t f r o m the n e e d l e a n d the !y-component f r o m the "mirror nee d l e " 114 Figure 40. SPACE.BA S -continued I Q T - C S N G (QNtTM (NNX ,NY) ) Q T - Q N U M ( N N X 1NX) P R I N T NNX, NY, E X ( N N X 1N Y ) , E Y ( N N X 1N Y ) , QT NEXT NNX N E X T NY RETURN !next cell 2260 I * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * it***,,*********,,,** I******************************************,,*,*,,,*,,*,,***,,*,*, ISNAP - s u b r o u t i n e !output of e l e c t r i c f i e l d d i s t r i b u t i o n t o h a r d disc I*********************************,,*,,**,,,,,,,,,,,,,,,,*,,,,,,,,,,,,,,,,,,,,, I I O P E N FI L E S F O R O U T P U T AS I I ,O R G A N I Z A T I O N S E Q U E N T I A L F I X E D !& ACCESS APPEND !Reopen e x i s t i n g file P R I N T #1, "T— T !Sen d the c u r r e n t t i m e P R I N T #1, " E L E C T R I C F I E L D A N D C H A R G E D I S T R I B U T I O N S " P R I N T #1, "QsumQSUMNUM !Sum of c h a r g e s in g e o m e t r y P R I N T #1, "Q g a p — "; QGAPNUM ISum of c h a r g e s in "reduced geom etry" I I I I I I F O R NY-I TO N C Y F O R N N X = I TO N C X Q T - C S N G ( Q N U M (NNX,N Y ) ) Q T - Q N U M ( N N X fNY) P R I N T *1, NNX; NY; E X ( N N X fN Y ) ; E Y ( N N X fN Y ) ; QT IStore cell " x - i d e n t i f i e r ," cell " y - i d e n t i f i e r , " Ix - c o m p o n e n t of E-fld, y - c o m p o n e n t of E-fld, !a n d the char g e in t h e c e l l . NEXT NNX N E X T NY NNX=O F O R N Y = O TO NCY+1 Q T - C S N G ( Q N U M (NNXfN Y ) ) Q T - Q N U M ( N N X fNY) P R I N T #1, NNX; NY; QT IS t o r e cell " x - i d e n t i f i e r , " cell " y - i d e n t i f i e r , " land the c h arge in t h e cell. N E X T NY N N X —NCX+1 F O R N Y - O TO NCY+1 Q T - C S N G ( Q N U M I N N X fN Y ) ) Q T = Q N U M ( N N X fNY) P R I N T #1, NNX; NY; QT N E X T NY NY-O F O R NNX-I TO NCX Q T - C S N G ( Q N U M (NNXfN Y ) ) Q T - Q N U M ( N N X fNY) P R I N T #1, NNX; NY; QT NEXT NNX NY-NCY+l F O R N N X - I TO N C X Q T - C S N G ( Q N U M (NNXfN Y ) ) Q T - Q N U M ( N N X fNY) P R I N T #1, NNX; NY; QT NEXT NNX C L O S E #1 RETURN 2400 I**************************************************************************** + * I****************************************************************************** IRINGSAME - s u b r o u t i n e 115 Figure 40. SPACE.BA S -continued !numerical i n t e g r a t i o n f o r sam e rin g I********************************************************************, Z - ( N N X - I ) *2 ALIMO-ATN(1/SQR(Z*Z-1)) II n t e g r a t i o n l i m i t s . ALIMl-PI A S T E P - (AT,TMI - AT T M O ) /NSTEP !Increment for i n t e g r a t i o n . ALMO-ALIMO+ASTEP/2 !Middle of first i n c r e m e n t . SUM-O IZero the " p r o j ection" counter. F O R I-I TO N S T E P IL o o p for integration. A L F A - A L M O 4 (I-I)-ASTEP IA n g l e for i n t e g r a t i o n . F U N C - I / S Q R (I- C O S ( A L F A ) ) I" P r o j ection" f u n c t i o n . SUM-SUM4FUNC-ASTEP !S u m of " p rojection." NEXT I E X T — C O U L C *Q / P I / D R / D R / 2 . 8 2 8 4 2 7 - S U M !x - c o m p o n e n t of field. EY T - O !Field has no y - c o m p o n e n t . RETURN 2500 I****************************************************************************** !********************************-********************************************* !RINGIHT - s u b r o u t i n e !numerical i n t e g r a t i o n of t h e i n t e r a c t i o n w i t h c h a r g e d ring 2 550 ALIMO-O !Initial a n g l e for i n t e g r a t i o n ALIMl-PI !F i n a l angle for i n t e g r a t i o n A S T E P = (A L I M l - A L I M O )/NSTEP IA n g l e incr e m e n t for i n t e g r a t i o n A L M O -AL I M O +AS T E P /2 !Middle of first i n c r e m e n t TR=DR !x - c o o r d i n a t e of cell g i v i n g the field, ROFF=DS !x - c o o r d i n a t e of t h e cell w h i c h the f i e l d acts on. IF L=I T H E N G O T O 255 0 E N D IF !Mirror c h arge only? Y =DL Iy - c o m p o n e n t of d i s t n a c e b e t w e e n cells. G O S U B 2600 !RINTY EYT=-COULC-Q*Y/PI-SUM Iy - c o m p o n e n t of f i e l d f r o m t o r u s . G O S U B 270 0 IRINTX E X T — C O U L C - Q / P I - SUM !x-component of f i e l d f r o m t o r u s . Y-DL2 G O S U B 260 0 !RINTY EYM=-COULC*Q«Y/PI-SUM Iy - c o m p o n e n t of fi e l d f r o m m i r r o r c h a r g e . G O S U B 270 0 !RINTX Ix - c o m p o n e n t of fi e l d f r o m m i r r o r charge. E x M =COULC*Q / P I-SUM RETURN 2600 j****************************************************************************** J****************************************************************************** IRINTY - s u b r o u t i n e I I********************************************--******************************** SUM-O F O R I=I T O N S T E P !Loop for angle i n c r e m e n t i n g A L F A - A L M O 4 (I-I)-ASTEP !Angle for i n t e g r a t i o n F U N C = I / ( Y - Y + R O F F - R O F F + T R - T R - 2 - T R - R O F F - C O S ( A L F A ) )*(3/2) ly-proj e c t i o n for incr e m e n t SUM=SUMtFUNC-ASTEP !Total y - p r o j e c t i o n NEXT I RETURN 2700 l***********************************e»*******************«**-«*************»*** I****************************************************************************** !RINTX - s u b r o u t i n e I f****************************************************************************** 116 Figure 40. S P A C E .BAS-continued SUM-O F O R I-I TO N S T E P A L F A - A L M O + (I-I)1A S T E P !Loop for angle i n c r e m e n t i n g IA n g l e for i n t e g r a t i o n F U N C - (TR1C O S (ALFA) -ROFF)/ (VlYtRoFFlRoFFtTRlTR-Z1TR1ROFF1C O S (ALF A ) )A (3/2) Ix - p r o j e c t i o n for incr e m e n t S U M - S U M + F U N C 1A S T E P !Total x - p r o j e c t i o n A d e g -A l f a z p i 1ISO NEXT I RETURN 2750 ****************** ****************** !G R I D S Q - su b r o u t i n e !square g r i d s y s t e m ********** IF F I N P $ — "N" THEN INPUT "Plane t o p l a n e d i s t a n c e / m m ", DO D-D0/1000 INPUT " Number of cell lines p a r a l l e l to p l a n e s ", N C Y IN P U T " Number of cell lines p e r p e n d . to p l anes ” , N C X INPUT " D i s t a n c e b e t w e e n t h e s e cell l i n e s / m m ", DPO DP-DP0/1000 GRID$="SQ" E N D IF N C T - N C Y 1N C X P R I N T "Total n u m b e r of cells ", NCT F O R N Y-O TO NCYtl F O R N N X = O TO NC X t l X ( N n X i N Y ) - D P 1 (NNX-I) Ix - c o o r d i n a t e for eac h cell Y (NNX,N Y ) - (D/NCY)1 ( N Y - 0 .5) !y-coordinate for e a c h cell NEXT NNX N E X T NY RETURN 2800 I*********************************************************************+**,,**,* IGRID subroutine Ito set up p a r a b o l i c g r i d syst e m I********************************************************************,,,„,,*,,* I IF F I N P $ — "N" !Restart status THEN I N P U T "Tip t o p l a n e d i s t a n c e / m m D-DO/IOOO INPUT "Focal p o i n t to t i p Zmm FPO FP-FP0/1000 INPUT "Number of p a r a b o l a cell lines NCY I N P U T "Nu m b e r of radial g r i d cells NCX IN P U T " A n g u l a r range, fro m 0 d e g to ", R D E G ERASE QNUM E N D IF P - I Z (4*FP) YNEEC=DtFP N C T - N C Y 1N C X P R I N T "Total n u m b e r of cells NCT ASTEP-RDEGZ(NCX-I) IA n g l e i n c r e m e n t in d e g r e e s . ASTEPR=ASTEP/180*PI IA n g l e i n c r e m e n t in r a d i a n s . !Find p a r a b o l a c o n s t a n t s for an e q u a t i o n y a x A2 + b. F O R NY=I TO N C Y B ( N Y ) - D / N C Y 1 (NY-0.5) 117 Figure 40. S P A C E .B A S -continued A ( N Y ) - 1 / 4 / (D+FP-B(NY)) NEXT NY I ! A(O)-O B(O)-O B (NCY + 1 )— D A ( N C Y + 1 )— 1 / 4 /FP F O R N N X = O T O NCX-I I A N G (NNX) - (NNX-I)*ASTEP !Angle in degrees. A N G R ( N N X ) - A N G ( N N X ) /180*PI !Angle in radians. NEXT NNX G O S U B 285 0 G R O U T !cell c o o r d i n a t e s F O R N N X - O TO N C X + 1 IIncr e m e n t a n g l e . O-TAN(ANGR(NNX)) F O R NY- I TO N C Y + 1 !Incr e m e n t p a r a b o l a b e i n g described. IF A B S ( Q ) C l E - I O THEN Y ( N N X 1N Y ) - B (NY) !y - c o o r d i n a t e for e a c h cell X ( N N X 1N Y ) - O I x - coordinate for e a c h cell ELSE C - A ( N Y ) *Q*Q G-D+FP ITotal d i s t a n c e f r o m focal p t . t o plane. Q l “ '(1/C+2*G) 11st c o n s t a n t in q u a d r a t i c e q u a t i o n . Q 2 — G * G + B ( N Y ) /C 12 n d c o n s t a n t in q u a d r a t i c e q u a t i o n . !y-coo r d i n a t e is d e t e r m i n e d by s o l v i n g a q u a d r a t i c equation. Y - - Q l / 2 - S Q R (01*01/4-Q2) !y-coordinate for e a c h cell !x-coo r d i n a t e is d e t e r m i n e d b y s u b s t i t u t i n g the y - c o o r d i n a t e !into the e q u a t i o n y - ax'2 + b. X = S Q R ( ( Y - B ( N Y ) )/ A (NY)) !x-coordinate for e a c h cell Y ( N N X 1N Y ) - Y X ( N N X 1N Y ) = X E N D IF N E X T NY NEXT NNX F O R NY=I TO N C Y + 1 Y ( O fN Y ) - Y (2,NY) X (0fNY) — -X (2, NY) N E X T NY F O R N N X - O TO N C X + I Y ( N N X f0)-0 X (NNX, 0) - T A N (ANGR (NNX) ) * (D+FP) NEXT NNX G R I D S - nPARA" RETURN 2820 I****************************************************************************** I****************************************************************************** IDIST - s u b r o u t i n e !"CAt.UI.ATES I N T E R - C E L L D I S T A N C E S " PRINT "CALCULATES INTER-CELL DISTANCES" F O R NY=I TO N C Y F O R NNX-I T O N C X R D ( N N X fN Y f0 , O i - X ( N N X fN Y - I ) - X ( N N X fNY) R D ( N N X fN Y f0 , I)- X ( N N X fN Y + ! ) - X ( N N X fNY) R D ( N N X fN Y f I , 0)- Y ( N N X fN Y - I ) - Y ( N N X fNY) R D ( N N X fN Y fI fI ) - Y (N N X fN Y + ! ) - Y ( N N X fNY) RD (NNX, N Y f 2, 0)- S Q R (RD (NNX, N Y f 0,0) "2+RD (NNXfN Y f I, 0) '2) RD (NNX, N Y f2, I) - S Q R (RD (NNXfN Y fO fI) A2 + R D (NNX, N Y f I, I) A2) A D (NNX, N Y f 0 , 0 ) - X (NNX - I fNY) -X (NNX, NY) A D (NNXfN Y f O fD - X (NNX + 1 ,NY) - X ( N N X 1NY) A D (NNX, N Y f I, 0) -Y (NNX - I 1NY) -Y (NNXfNY) A D ( N N X fN Y fI f I ) - Y ( N N X +1,NY)- Y ( N N X fNY) A D (NNX, N Y f2,0) - S Q R (AD (NNX, N Y f 0,0) A2+AD (NNXfN Y fI f 0) A2) 118 Figure 40. S P A C E .BAS-continued I A D (NNX, NY, 2, I)- S Q R (AD (NNX, N Y ,0,1) * 2 +AD (NNX, NY, I , I ) ''2) NEXT NNX N E X T NY NNX-3: N Y-3 RETURN 2900 |****************************************e***lllwlllllllllllllllllllllllJtl1t1tlltl !GOUT - a u b r o u t i n e Ioutp u t of g r i d - p o i n t s PRINT "PARABOLIC CONSTANTS" P R I N T " N U M B E R OF C E L L S ", N C X , " TI M E S ", N C Y PRINT " I A(I) B (I) " F O R NY- I T O N C Y P R I N T NY, A(NY) , B (NY) N E X T NY P R I N T "J A N G (J) T A N (ANG (J) ) " F O R NNX=I TO N C X P R I N T NNX, A N G (NNX) , T A N (A N G R (NNX) ) NEXT NNX PRINT P R I N T " P A R A B O L I C G R I D P O INTS " PRINT " J X L F O R NNX-I TO N C X F O R NY=I TO NCY Y M = Y ( N N X fN Y ) *1000 X M = X ( N N X 1N Y ) *1000 P R I N T NNX, XM, NY, YM N E X T NY NEXT NNX RETURN 3000 I 3001 IF W A R N S - "Y" T HEN P R I N T #1 "WARNING: E N D IF C L O S E #1 END Q M A X T O O HIGH" Y" 119 Figure 41. SPREAD.BAS: A program, written in VAX BASIC Version 3.3, used to read the data files created by SPACE.BAS. 1001 * * * * * * SPREAD. BAS READS A POINT-TO-PLANE PILE LIST OF VARIABLES * TIKE: T : Total t i m e of calculation. T S S : S e l e c t e d t i m e for e n a p - a h o t . TSNAP: TE: TSTEP: TTOT: VOLTAGE: V O L T : Integrated Potential CURRENT: CURRENT: C u r r e n t p e r m m A2 CURR: C: Total cu r r e n t CHARGE: 0: QNUM: QSUMNUM: QGAPNUM: QT: POSITION: XMIN: XMAX: D: DP: FIELD: EX: F i e l d s t r e n g t h E Y : Field strength (x-component). (y-component). AREA: COUNTERS: N N X : C o u n t e r in x-direction. NY: C o u n t e r in y - d i r e c t i o n . N C X : N u m b e r of x - g r i d s . N C Y : N u m b e r of y - g r i d s . MISC: ADIS: RDEG: PK$: C a l c u l a t i o n t y p e (PROF or SMALL) F I L E $ : F i l e to be read. G R I D S : S e l e c t e d g e o m e t r y (PARA or SO). C O N S TANTS: 120 Figure 41. S P R E A D .BAS-c ontinued Z K A P P A : Ion m o b i l i t y ************** I D I M X (15,15), y (15,15), E X (15,15) , E Y (15,15), QT (15, 15) D I M T ( I O O ) , V O L T ( I O O ) , C U R R ( I O O ) , QS(IOO), Q S G ( I O O ) , 0(15) D I M S U R F (15), C U R R E N T (15) 200 IN P U T "Name of f i l e ", FI L E S IN P U T "Cell p r i n t - o u t (Y/N) ", P2S IF (P25-"y" or P2$-"n") !ASSURE SH I F T L O C K THE N P R I N T "Set 'Caps L o c k ' " G O T O 200 E N D IF INPUT "Current p r o f i l e (Y/N) ", P3S INPUT "What c a l c u l a t i o n s ? (PROF/SMALL) ", PK$ ZK A P P A - I . O E -4 !Open a file for input. D i s p l a y i n t r o d u c t o r y information. G O S U B 2 800 !SNAPINI P R I N T "2-D space c h arge c a l c u l a t i o n " P R I N T "File nam e ", FILES P R I N T " G r i d - t y p e - ", GRIDS P R I N T "D= ", D P R I N T "DP= ", DP P R I N T "NCX ",- N C X , "NCY "; N C Y P R I N T "ADIS ", ADI S P R I N T "T S N A P - "; T S N A P , "TE- "; TE P R I N T "T S T E P T S T E P , "T T O T - "; TTOT NS = O IT=O !N E W S N 2 : 400 IN P U T "NEXT S N A P - S H O T ? ( Y / N ) ", TSS IF T SS="Y" THE N G O T O 500 ELSE G O T O 700 E N D IF !N E W S N 3 : 500 NS=NStl !Trap errors. ON E R R O R G O T O 600 G O S U B 290 0 !SNAP R e a d d a t a f r o m file. IF T(NS) < (TSS-1E-5) T HEN G O T O 500 E N D IF 1NEWSN3 G O S U B 2400 IWCALC D i r e c t t h e d e s i r e d p r o c e s s i n g of i n f o r m a t i o n . G O T O 400 !NEWSN2 600 650 690 700 IF E R R=Il T H E N R E S U M E 650 ID eal w i t h t r a p p e d E O F error. E L S E R E S U M E 690 !Deal w i t h other e r r o r s . E N D IF P R I N T "END OF F I L E (EOF) R E A C H E D " G O T O 700 PRINT "UNEXPECTED ERROR";ERR C L O S E #1 G O T O 3100 I***************************************,*,**,,,,,,,,,*,,,,,,.,,,,,,,.,,..,.,,, S U B R O U T I N E SEC T I O N 121 Figure 41. SPREAD.B A S -continued W C A L C : I n q u i r e s about a c h oice of a d e s i r e d calculation. A c c e s s e d b y G O S U B 2 400 PROF: C r e a t e s a c u r r e n t p r o f i l e on t h e c o u n t e r - e l e c t r o d e . A c c e s s e d b y G O S U B 2500 P S M A L L : D o e s a "small p r i n t - o u t " of the A c c e s s e d b y G O S U B 2600 "snap" result. S N A P I N I : R e a d s t h e d a t a - h e a d f r o m t h e SNAP-file. A c c e s s e d b y G O S U B 2600 SNAP: Inputs t h e e l e c t r i c f i e l d d i s t r i b u t i o n f r o m t h e A c c e s s e d b y G O S U B 2900 SNAP f i l e . C A L C : P e r f o r m s c u r r e n t c a l c u l a t i o n s b a s e d on f i e l d a n d c h a r g e d a t a . A c c e s s e d b y G O S U B 3000 ******************************************************************************* ******************************************************************************* S u b r o u t i n e W C A L C : Inquires about c h o i c e of a d e s i r e d calculation. A c c e s s e d by G O S U B 2400 ******************************************************************************* 2400 !which c a l c u l a t i o n ? IF P K $ « " P R 0 F " THEN G O S U B 2500 IPROF ELSE G O S U B 2600 !PSMALL E N D IF RETURN !Display c u r r e n t p r o f i l e data. !Display "small output" of S N A P - f i l e data. j******************************************************************************* I ! S u b r o u t i n e P R O F : D i s p l a y s c urrent p r o f i l e on c o u n t e r - e l e c t r o d e . A c c e s s e d b y G O S U B 250 0 2500 NY= I PRINT T P R I N T "S n a p n u m b e r ", NS P R I N T "Time ", T(NS) P R I N T "NNX", "AREA", "AMPS", " A M P S / m m A2" F O R NNX=I TO NCX IF NNX=I THEN XMIN=O ELSE X M I N = ( N N X - 1 .5)"DP E N D IF X M A X = ( N N X - 0 .5)"DP S U R F (NNX)= 3 . 1 4 1 5 * (XMAX*XMAX-XMIN«XMIN) C — Z K A P P A ' E Y (NNX1N Y ) / ( D / N C Y ) * Q T (NNXfNY) C U R R E N T ( N N X ) = C Z S U R F ( N N X ) "IE-6 !current p e r mm2 P R I N T NNX, SUR F (NNX), C, C U R R E N T (NNX) NEXT NNX RETURN I I S u b r o u t i n e P S M A L L : D i s p l a y a small p r i n t - o u t of the s nap r e s u l t . A c c e s s e d by G O S U B 2600 I******************************************************************************* ******************* l******«****»**«»»»»**«i>«*«**»*********«»*****»****«********»»»"""»***** 122 Figure 41. S P R E A D .BAS - continued 2 600 PRINT P R I N T "Snap n u m b e r ", NS P R I N T "Time ", T(NS) P R I N T "NNX", "NNY", "QT", "EX", "EY" F O R N Y - O TO N C Y + 1 CURR-O IF P2$ - " Y " THEN F O R N N X - O TO NC X + 1 IQ (NNX)-CSNG (QNUM (NNX,NY) ) IQ (NNX) - Q N U M (NNXfNY) P R I N T NNX, NY, Q T (NNX, NY), E X ( N N X fN Y ) , E Y ( N N X 1NY) NEXT NNX E N D IF F O R NNX=I T O N C X C U R R - C U R R + E Y (NNXfN Y ) * Z K A P P A * Q T (NNX, N Y ) / (D/NCY) NEXT NNX IF P3S-"Y" T HEN P R I N T " C u rrent at N Y - "; NY; " is "; C U R R E N D IF IF P 2 $ - " Y " T H E N IN P U T "Pause ", P E N D IF N E X T NY G O S U B 3000 !CALC PRINT "V,centerV O L T (NS), " ! , p l a t e "; CURR(NS) P R I N T "Q-a u m "; Q S (NS); " Q - g a p QSG(NS) RETURN ********************** S u b r o u t i n e S N A P I N I : Re a d s the d a t a - h e a d f r o m the SNAP-file. A c c e s s e d b y G O S U B 2800 *********** 2800 O P E N FILES F O R IN P U T AS #1 P R I N T "SN A P I N I subro u t i n e " IN P U T #1, GRIDS IN P U T #1, TlS !" p o i n t - t o - p l a n e corona" IF G R I D S — "SQ" THEN P R I N T "Sq u a r e c o o r d i n a t e system" I N P U T #1, D, DP, NCY, N C X , A D I S ELSE IF G R I D S — "PARA" THEN P R I N T " P a r a b o l i c c o o r d i n a t e system" I N P U T #1, D, DP, NCY, NCX, R D E G E N D IF E N D IF I N P U T #1, T S N A P , TE, T S T E P , T T O T IN P U T *1, ZJO F O R N N X - I TO N C X IN P U T *1, QD(NNX) NEXT NNX IS N A P I l : RETURN I S u b r o u t i n e SNAP; Inpu t s t h e e l e c t r i c fi e l d d i s t r i b u t i o n I f r o m the SNA P file. I A c c e s s e d by G O S U B 2900 I* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2900 INPUT #1, T2S, P R I N T T2S, NS, T (NS) T (NS) !"T- " 123 Figure 41. S P R E A D .BAS-continued I N P U T #1, T3$ I" E L E C T R I C F I E L D A N D C H A R G E D I S T R I B U T I O N S " I N P U T #1, T4S, Q S U M N U M !"Q,eum- ” INPUT #1, T5S, Q G A P N U M I"Q,gap- " OS(NS)-QSUMNUM Q S G (NS)- Q G A P N U M P R I N T "I", "J", "E x", "QT" F O R NY-I T O N C Y F O R NN X - I T O N C X I N P U T #1, I, J, E X ( N N X fNY) , E Y (NNXfNY) , Q T ( N N X fNY) P R I N T I fJ, E X ( N N X fN Y ) , Q T ( N N X fNY) NEXT NNX N E X T NY NNX-O P R I N T "I", "J", "QT" F O R NY-O TO NCY-H IN P U T *1, I f J f Q T ( N N X fNY) P R I N T I, J f Q T ( N N X fNY) N E X T NY NNX-NCX+I F O R N Y-O TO N C Y + I INPUT #1, N N X f N Y f Q T ( N N X fNY) P R I N T N N X f N Y f Q T ( N N X fNY) N E X T NY N Y-O F O R NN X = I TO N C X INPUT #1, N N X f N Y f Q T ( N N X fNY) P R I N T N N X f N Y f Q T ( N N X fNY) NEXT NNX N Y —N C Y + I F O R NN X - I TO N C X IN P U T *1, N N X f N Y f Q T ( N N X fNY) P R I N T N N X f N Y f Q T ( N N X fNY) NEXT NNX RETURN I******************************************************************************* I I Subroutine C A L C : Performs calculations A c c e s s e d b y G O S U B 3000 of p o t e n t i a l and c u r r e n t . 3000 NNX-I ESUM-O F O R NY=I T O N C Y E S U M - E S U M + E Y (NNXfNY) N E X T NY V O L T (NS)- E S U M * D / N C Y N Y-I CURR(NS)-O F O R NN X = I T O N C X C U R R (NS)- C U R R (NS)- E Y ( N N X fN Y ) * Z K A P P A * Q T (NNXfN Y ) / (D/NCY) NEXT NNX RETURN 3100 lend p r o g r a m P R I N T "THIS IS T H E END" (******************************************************************************* END 124 Figure 42. TUBE.M : A program, written for the command language of the MATLAB program, used to simulate ion flow through a drift tube. % % TUBE: A p r o g r a m t o s i m u l a t e the f l o w of Iona, t a d r ift tube. of one apeciesm, thr o u g h ’ % 4 % Input i n f o r m a t i o n ab o u t t h e drift t u b e a n d t h e ions p r o d u c e d in it. 4 Also, i n i t i a l i z e some of t h e variables, constants, etc. N - i n p ut ('no. of g r i d p o i n t s - '); steps - input('no. of t i m e s t e p s - '); t i m e (I)-0; p o « i n p u t ( ' s p a c e c h a r g e - '); rho - d i a g (zeros (N)); I - i n p u t ('l e n g t h ( m e t e r s )- '); c hg - i n p u t ( ' p l a t e c h a r g e - '); t h i c k - 1/N; a - i n p u t ('d i s t a n c e f r o m r e p e l l e r to m - a/thick; 4Tube is d i v i d e d int o N slices. 4N u m b e r of t i m e steps. 4 l n i t i a l time. 4Space c h arge p e r "slice." 4 S pace c h arge v e c t o r . 4L e n g t h of d r i f t t u b e . 4 D i f ference b e t w e e n c h a r g e s on plates. 4 T h i c k n e s s of a s l i c e . e (meters)- '); 4Number of slic e s on t h e source side 4of t h e g a t e . 4 % Set u p t h e i n i t i a l c o n d i t i o n s for the simulation. 4 for x = l : m rho (x) - po; end vo - v e l o c i t y (rho,m,N,chg); 4Fill t h e r e g i o n w i t h sp a c e c h a r g e . 4Call "velocity" to c a l c u l a t e the 4 v e l o c i t y of ions in t h e fastest slice, S D e t e r m i n a t i m e s t e p t o g ive m a n a geable 4d r i f t distance. t i m e s t e p - thic k / v o ; 4 4 M ove t h e ions a c c o r d i n g to fi e l d condtions. for t i m e _ i n c = 2 :steps r h o _ n e w = d i a g ( z e r o s (Ntl)); if s u m (rho) > p o / l e l O %"New" space c h a r g e vector. S C o n d i t i o n for t h e e n d of the S s i m u l a t i o n is the e xit of mos t of the S s p a c e c h a r g e to t h e c o l l e c t o r plate. for c=l:N if rho(c) v(c) - v e l o c i t y (rho,c , N , c h g ) ; S C a l c u l a t e t h e a v e r a g e v e l o c i t y of ion Sdri f t in a "slice," c . r h o _ a d d - d i s p l a c e m e n t ( v (c),r h o ( c ) ,t h i c k , timeste P,C,N); S T r a n s l a t e ion drift v e l o c t i y into S d i s t a n c e of m o v e m e n t d u r i n g a timestep. r h o _ n e w - r h o _ n e w + r h o _ a d d (I: N + 1 ) ; S Report t h e ion d i s p l a c e m e n t in terms Sof a space c h arge vector. end end 4 4 I n c r e m e n t time. 4 time( t i m e _ i n c ) t i m e ( t i m e _ i n c - l ) +timestep; S A c c u m u l a t e d time af t e r the gate is Sopened. 125 Figure 42. T U B E .M - continued % % Co u n t t h e c o l l e c t e d i o n s . % collect (time m e ) - rho n ew(N+l); ♦ C o l l e c t e d ions are ion s tha t mak e it to ♦the last cell of t h e dr i f t tube. r h o - r h o _ n e w (I: N ) ; ♦Th e n e w space c h a r g e vector, r esulting ♦ f r o m the s u m m i n g of t h e displacements, %is u s e d for t h e n ext t i m e step. tend en d clt ■= c o l l e c t ./timestep; ♦Collector c u r r e n t : % (number of ions c o l l e c t e d / ♦ l e n g t h of c o l l e c t i o n period. % % P l o t t h e c a l c u l a t e d data. % plot (time, clt) t i t l e ('C o l l e c t o r C u r r e n t as a f u n c t i o n y I a b e I ('C u r r e n t ( i o n s / s e c ) ') x l a b e l ( ' t i m e ( s e c .)') t i m e after p u l s e ' ) 126 Figure 43. TUB2.M: A program, written for the command language of the MATLAB program, used to simulated the flow of a group of ions, having two different ion mobilities, through a drift tube. % % TUB2: A p r o g r a m to s i m u l a t e the m o v e m e n t of t w o d i f f e r e n t k i n d s of ions, * differing m o b i l i t i e s , t h r o u g h a drift tube. of % % Input i n f o r m a t i o n about t h e drift tub e and the ions p r o d u c e d in it. % Also, i n i t i a l i z e some of the variables, constants, etc. N - in p ut('no. of g r i d p o i n t s - '); !Tube is d i v i d e d into N slices. steps - input ('no. of t i m e s t e p s - ' ); % N u m b e r of tim e steps. t i m e (I)-O; ! I n i t i a l time. p o a - i n p u t ( ' s p a c e c h a r g e of a- '); !Spa c e charge p e r "slice." p o b - input ('space c h a r g e of b - '); rho - d i a g (zeros (N)); ! S p a c e c h arge v e c t o r s . r hoa - d i a g (zeros (N)); r hob - d i a g (zeros (N)); ka « i n p u t ( ' m o b i l i t y of a- '); !Ion m o bilities. kb - i n p u t ('m o b i l i t y of b - '); I - i n p u t ('l e n g t h ( m e t e r s ) - '); ! L e n g t h of drift t u b e . chg - i n p u t ( ' p l a t e c h a r g e = '); ! D i f f e r e n c e b e t w e e n cha r g e s on plates. th i c k « 1/N; ! T h i c k n e s s of a slice, a - i n p u t ( ' d i s t a n c e f r o m r e p e l l e r to g a t e ( m e t e r s )- '); m = a/thick; !Nu m b e r of slices on t h e s o urce side !of t h e g a t e . % ! Set u p t h e ini t i a l c o n d i t i o n s % for t h e for x = l : m • r h o (x) - poa+pob; r h o a (x) - poa; r h o b (x) - pob; end !vo - v e l o c i t y (rho,m,N,chg); simulation. !Fill t h e r e gion w i t h space charge. !Call "velocity" to c a l c u l a t e the ! v e l o c i t y of ions in t h e fastest s l i c e . v oa - v e l _ i o n ( r h o a , m , N , c h g , k a ) ; v ob - v e l _ i o n ( r h o b , m , N , c h g , k b ) ; if v o a < v o b t i m e s t e p - th i c k / v o b ; else t i m e s t e p - th i c k / v o a ; end ! D e t e r m i n a t i m e s t e p t o g i v e m a n a geable ! d rift d i s t a n c e . ! ! M o v e t h e ions a c c o r d i n g to t h e f i e l d condi t i o n s . ! for t i m e _ i n c - 2 :steps r h o _ n e w - d i a g ( z e r o s ( N + l ) ); r h o a _ n e w - d i a g ( z e r o s ( N + l ) ); r h o b _ n e w - d i a g ( z e r o s ( N + l )) ; if s u m (rho) > p o a / l e l O !"New" space c h a r g e vector. ! C o n d i t i o n for t h e e n d of the ! s i m u l a t i o n is the exit of mos t of the ! s p a c e c h arge to the c o l l e c t o r plate. for c - 1 :N if rho(c) — 0 vb(c) - v e l _ i c n (rho, c, N, chg, kb) ; va(c) - vel i o n (rho,c,N,chg,ka); !CaTculate the average velocity of ion !drift in a "slice," c . rhoa_add - displacement(va(c),rhoa(c),thick,time step,c,N); 127 Figure 43. T U B 2 .M - continued r h o b _ a d d - d i e p l a c e m e n t ( v b (c),r h o b (c),thick,time step, c,N) ; ! T r a n s l a t e ion drift v e l o c t i y into ! d i s t a n c e of m o v e m e n t d u r i n g a timestep r h o a n e w - r h o a _ n e w + r h o a _ a d d (I: K + 1 ) ; r h o b _ n e w - r h o b _ n e w + r h o b _ a d d (I :N + 1 ) ; !Re p o r t the ion d i s p l a c e m e n t in terms !of a space char g e v e c t o r . end end end I I Increment time. ! time(time_inc) - t i m e < t i m e _ i n c - l )+timestep; ! A c c u m u l a t e d t i m e a f t e r t h e gate is !opened. ! % Count the ions as t h e y are collected, collect(time_inc) - rho a n e w ( N + l ) + r h o b n e w ( N + l ); ! C o l l e c t e d ions are ions t h a t mak e it to !the last cell of t h e dr i f t tube. rhoa - r h o a _ n e w (I: N ) ; !Th e n e w space c h a r g e vector, r esulting r h o b - r h o b _ n e w (I: N ) ; ! f r o m t h e s u m m i n g of t h e displacements, rho - rho a + rhob; !is u s e d for the n ext t i m e step. !end end clt = c o l l e c t ./timestep; !Collector cu r r e n t : ! (number of ions c o l l e c t e d / ! l e n g t h of c o l l e c t i o n period. I % P lot t he c a l c u l a t e d d a t a . % p l o t (time, clt) t i t l e ( ' C o l l e c t o r C u r r e n t as a f u n c t i o n of t i m e a f t e r p u l s e ' I y l a b e l ( ' C u r r e n t ( i o n s / s e c ) ') x l a b e l ( ' t i m e ( s e c . ) ') 128 Figure 44. VELOCITY.M : A function, called by both TUBE.M and TUB2.M, used to calculate ion velocities. function[z]-velocity(rho,b,N,chg,m o b i l i t y ) !velocity F u n c t i o n c a l c u l a t e s v e l o c i t i e s of ion drift in a cell b, % b a s e d on p l a t e charges, ap a c e char g e and ion mobility. r h o _ r t - 0; r h o _ l f - 0; eO - 8 . 85e-12; fo r k - b :N rho_rt - rho_rt + rho(k); ! S u m of apace char g e to t h e right !of a "slice." end for k - I :b r h o _ l f - r h o _ l f + rho(k) ; of ! S u m of ap a c e c h arge to t h e left of %a "slice." end E - (1/eO)* ( r h o _ l f - r h o _ r t + c h g ) ; z - mobility/E; ! F i e l d s t r e n g t h in an i n f i n i t e paralell !pla n e system. !Drift v e l o c i t y in a s l i c e as a result !of ion m o b i l i t y and f i e l d strength. 129 Figure 45. DISPLACEMENT.M : A function, called by both TUBE.M and TUB2.M, used to calculate ion movements from cell to ce l l . f u n c t i o n [ d _ p l a c e ]- d i s p l a c e m e n t ( v e l o c i t y , r h o , t h i c k , timestep,c,N) %d i s p l a c e m e n t C a l c u l a t e s the m o v e m e n t of s p a c e charge from, cell to cell, % b a s e d on gi v e n space c h a r g e densities, d e t e r m i n e d drift % v e l o c i t i e s and a g i v e n t i m e s t e p . d _ p l a c e - d i a g (zeros (Ntl)); % S p a c e c h a r g e v e c t o r as r e s u l t i n g from the %dr i f t f r o m a " s l i c e , " c . d i s t a n c e - v e l o c i t y * t i mestep; »The resu l t f r o m "velocity" is t r a n s l a t e d into ♦ d i s t a n c e of m o v e m e n t . disp - distance/thick; ♦ " d i s t a n c e " is r e p o r t e d in t e r m s of n u mber of ♦"slices" m o v e d . i f rho > 0 ♦If #0 if abs(disp) > -2 ♦If #1 ♦ V e r i f i c a t i o n is m a d e that " r e a s o n a b l e " amounts ♦ of m o v e m e n t p e r t i m e - s t e p a r e b e i n g m a d e . if d i s p < -I ♦ I f #2 d _ p l a c e (c-2) - r h o * ( d i s p - 1 ); d_ p l a c e ( c - 1 ) - rho - d _ p l a c e ( c - 2 ) ; else ♦ E l s e for if #2 if d i s p < 0 ♦If #3 d_place(c-1) - rho* d i s p ; d _ p l a c e (c) - r h o - d _ p l a c e ( c - 1 ) ; e lse ♦Else for if #3 if dis p < I ♦If 44 d _ p l a c e ( c + 1 ) - d i s p * rho; d _ p l a c e (c) - r h o - d _ p l a c e ( c + 1 ); else ♦ E l s e for if t4 if d i s p < 2 ♦If #5 d _ p l a c e (c+2) - (disp-1) » rho; d _ p l a c e ( c + 1 ) - rho - d _ p l a c e ( c + 2 ) ; end ♦End for if # 5 (No else for 5) end ♦ E n d f o r if #4 end ♦En d for if #3 end ♦En d for if #2 ♦ E l s e f o r if #1 e lse d i s p ('displacement of space c h a r g e t o o g r e a t ' ) ♦ w a r n i n g of too large ♦a m o v e m e n t from a c e l l . break ♦ E n d f o r if #1 end ♦ E n d for if #0 end ♦ R e t u r n v a l u e of d i s p l a c e m e n t v e c t o r d _ p l a c e - d _ p l a c e (I: N + 1 ) ; ♦ w i t h c o r r e c t l e n g t h stipulated. I MONTANA STATE UNIVERSITY LIBRARIES 3 1762 10098521 5 I HOUCHEI' BINDERY L UTICA/OMW NE.