Users equations.

This option allows users to define the shapes of electrodes by using their own equations.

This is a powerful option that can be used for a wide variety of shapes (see the list below).

It also essentially replaces all the ‘regular’ shapes provided in the CPO programs, and for 3D shapes it is usually easier to set up and edit.

(The only time that it might be better to use a ‘regular’ shape is when a 3D electrode is defined as a cathode and when the ray currents are required to be approximately the same. This is because the ‘regular’ 3D electrodes are usually subdivided into segments of approximately the same area, while the ‘users equations’ option does not attempt to do this.)

An easy way of setting up the equations is given below.

Here are some examples of data files that use the new option:

test2d27 2D Parabolic mirror, electrodes defined by users equations.

test3d33 3D Parabolic mirror, defined by users equations.

test3d34 Ideal quadrupole ion trap, defined by users equations.

xmpl3d95 Quadrupole filter , defined by users equations.

shap2d04 A parabola, using option for users equations.

shap2d05 A hyperbolic surface created by users equations.

shap3d33 A toroidal surface, with users equations.

shap3d34 A complete torus, with users equations.

shap3d35 A magnetic field inside a torus, with users equations.

shap3d36 Elliptical electrode, by users equations.

shap3d37 Elliptical hole in circular electrode, by users equations.

shap3d38 Cylinder cut at an angle, by users equations.

shap3d39 Square hole in round disc, by users equations.

shap3d40 Round hole in a square disc, by users equations.

shap3d41 A helical coil, by users equations.

shap3d42 A small hole in a circular disc, by users equations.

shap3d43 Sectors of a cone, by users equations.

shap3d44 Corrugated cylinder, by users equations.

shap3d46 Cylinder with parallel angled ends, by users equations.

shap3d47 Square hole in a sphere, by users equations.

shap3d48 Cone, segments concentrated at tip, by users equations.

shap3d49 5 holes in circular disc, by users equations.

shap3d50 5 holes in disc, details, by users equations.

shap3d51 5 holes in square plate, by users equations.

shap3d52 Rectangular hole in rectangular plate, by users equations.

shap3d53 Rectangular hole in a sphere, by users equations.

Introduction.

In 3D, and sometimes in 2D, it is helpful if the electrode can be subdivided into parts that have 4 distinct edges, an ‘inner’ edge that might be curved, an ‘outer’ edge that might also be curved, and 2 straight side connecting edges

An example is shap3d39, a square hole in a round disc.

The equations, say g1(x,y,z), for the inner square edge of side s are

x = s, y = s*tan(phi), z = 0, where phi = 0 to pi/4 (pi/4 because 3 symmetry planes are in use).

The equations, say g2(x,y,z), for the outer circular edge of radius r are

x = r*cos(phi), y = r*sin(phi), z = 0.

We can combine these by using the general equation

g(x,y,z) = (1 - f)*g1 + f*g2, where f goes from 0 to 1.

This reproduces g1 when f = 0, and g2 when f = 1.

In the present example this gives:

x = s*(1-f)+r*cos(phi)*f, y = s*tan(phi)*(1-f)+r*sin(phi)*f, z = 0.

In 3D simulations it is therefore important to try to subdivide into parts that satisfy the above requirements, namely that each part has 4 distinct edges, an ‘inner’ edge that might be curved, an ‘outer’ edge that might also be curved, and 2 straight side connecting edges. If this subdivision is not possible then one or more of the ordinary types of electrode shapes might be added, as in shap3d51.

To concentrate the segments near the inner edge, we can use f^n instead of f, where n is typically 2.

When the electrode is not flat then z would be a function of f.

Subdivision numbers are asked for, so for important advice on subdividing please look at section 3.4 of the Users Guide or the general advice on segmentation.

Notes on the 2D option:

2 equations are needed, for r and z respectively.

One variable is used in these equations, plus up to 4 fixed parameters.

(Strictly the fixed parameters are not necessary, but can be useful for equations that have repeated constants.)

The variable is stepped. The user defines its minimum and maximum limits and the number of steps. All the usual options can be used to give unevenly divided steps, clipping and stretching. Only the 'inscribing' option cannot be used. Limits that are within 0.5% of n*pi or pi/n, where n = 2 to 10, are reset to the exact values.

The user defines the names of the variable and the fixed parameters (up to 6 characters each). Variables that are not defined are not used.

The 2 equations can use up to 100 characters each (and spaces should be avoided).

The recognised operators are:

'+', '-', '*', '/', '^'

The recognised functions are:

abs, exp, log10, log, sqrt, sinh, cosh, tanh, sin, cos, tan, asin, acos, atan.

Warning messages are given for obvious errors such as division by zero but no guarantee is given that all errors will be spotted. For example, if you define the limits of a variable u as 0 to 1 and if you put z = sqrt(1 - u^2), then the program might fail to evaluate z when u = 1, and will then show an error with no explanation. The solution here would be to put z = sqrt(1.000001 - u^2).

Warning: for ordinary electrodes tests are made at high print levels to see if ends of electrodes are too close to each other, but this is not done for electrodes defined by users equations.

CPO Ltd would be grateful for any failures of this option to be reported to us, so that we can correct errors or try to improve the option.

One error that we have noticed is that for expressions such as (a-b)^2, a failure sometimes occurs if b > a.

Notes on the 3D option:

3 equations are needed, for x, y and z respectively.

2 variables are used in these equations, together with up to 5 parameters of fixed values.

The 2 variables are named by the user (up to 6 characters each), who also specifies the limits and numbers of subdivisions for each variable.

The user also defines the names and values of the fixed parameters.

Limits and parameters that are within 0.5% of pi*n or pi/n, where n = 2 to 10, are reset to the exact values.

Parameters that are not defined are not used (strictly the fixed parameters are not necessary, but can be useful for equations that have repeated constants).

The 3 equations can each use up to 100 characters (and spaces should be avoided).

The recognised operators are:

'+', '-', '*', '/', '^'

The recognised functions are:

abs, exp, log10, log, sqrt, sinh, cosh, tanh, sin, cos, tan, asin, acos, atan.

Warning messages are given for obvious errors such as division by zero but no guarantee is given that all errors will be spotted. For example, if you define the limits of a variable u as 0 to 1 and if you put z = sqrt(1 - u^2), then the program might fail to evaluate z when u = 1, and will then show an error with no explanation. The solution here would be to put z = sqrt(1.000001 - u^2).

The usual option for clipping can be used. The dielectric option can also be used.

Warning for 2D and 3D:

If you use a quadratic (or higher order) form of any variable in the equations, then you should make sure that the function of that variable does not have a minimum or maximum in the given interval. Otherwise the electrode will fold back on itself.

Do not put spaces in the equations (because the part after a space will not be saved).

CPO Ltd would be grateful for any failures of this option to be reported to us, so that we can correct errors or try to improve the option.

One error that we have noticed is that for expressions such as (a-b)^2, a failure sometimes occurs if b > a.