Potential and field accuracy, technical details.
When necessary CPO3D uses exact expressions for the potentials and fields. An example is given at the end of this note. Exact expressions are also available for thin segments in the CPO2D programs.
Setting up and solving the boundary charge equation.
The highest accuracy that is consistent with the available number of segments is always used to set up the equation -the user does not have a choice here (unless the accuracy level is changed by direct editing of the data file, which is nor recommended -it is called charge inacc and is reset if the databuilder is used). The boundary charge equation itself is solved in double precision.
The actual inaccuracy of the charges:
The actual inaccuracy of the calculated surface charges will depend on the geometry, the choice of subdivisions for the electrodes, the total number of segments into which the electrodes are subdivided, and other factors. It is particularly important to have a high density of subdivisions in critical regions.
The inaccuracy might occasionally be worse than expected when fields are required in a region that is very close to either the free end of a thin electrode (because the field is singular there and so has to be limited by the program) or to the surface of an electrode (because the field is discontinuous at the surface).
To get a more quantitative value for the inaccuracy, use a simulation with a known solution or select a similar simulation that has cylindrical or planar symmetry and compare the results of using CPO3D and CPO2D.
To find what a result would be for an infinite value of the number (n) of segments, vary n and plot the result against 1/n or 1/n squared, and then extrapolate to 1/n = 0 (see section 3.3 of chapter 3).
Elsewhere the user has a choice and then different types of approximation are used by the program to achieve the requested inaccuracy in the minimum time. The program carefully chooses the appropriate level of approximation for each individual segment. Whatever the level of approximation, double precision is always used.
Procedure followed in CPO3D for evaluating potentials:
(1) When the segment is far away from the point at which the potential or field is required then the segment is treated as a point charge situated at the centre of the segment and the Coulomb potential is used.
(2) When the segment is far away, but not far enough to be treated as a simple point charge, then the Coulomb potential is modified (by a first-order expansion) to take account of the size of the segment and its orientation to the line from the point to the segment.
(3) When the segment is not far enough away for the modified Coulomb potential to be used, and is also not near to the point, then Gaussian quadrature is used. 7 quadrature points are used for a triangle and 9 for a rectangle (unless the rectangle is long and thin, in which case 5 points are used). The modified Coulomb potential is used for each quadrature point.
(4) If the point is on or near the segment then the exact expression is used (see below). A simplified version of the exact expression is used if the point is at the centre of the segment.
Careful criteria are used to decide on the level of approximation that should be used for each individual segment, taking account of the requested inaccuracy for the potential.
A similar procedure is used in CPO3D for evaluating fields.
The evaluation of potentials in CPO2D tends to be more laborious (for rotational symmetry). There is a well-known expression, in terms of elliptic functions, for the potential due to an infinitely thin ring of charge and there are also expressions involving summations (sometimes over large numbers of terms) for the potential due to annular and cylindrical segments. Here is the procedure that is followed:
(1) When the segment is far away from the point at which the potential or field is required and that point is on the axis then the Coulomb potential is used, where the relevant distance is that between the middle of the surface of the segment and the axial point.
(2) When the segment is nearer to an axial point the Coulomb potential is modified to take account (to the first order) of the width and orientation of the segment surface.
(3) When the segment is near to an axial point and the width of the segment is comparable with the distance from the point then the segment is subdivided and the above procedure is followed for each subdivision.
(4) When the point is near to the axis then the above procedure is used but extra off-axis terms are added.
(5) When the segment is far away from a point that is not on or near the axis then the segment is treated as a point charge situated at the centre of the segment and the Coulomb potential is used.
(6) When the segment is far away, but not far enough to be treated as a simple point charge, then the electric multipole moments of the segment are used. The monopole moment is the total charge on the segment. Dipole, quadrupole, octupole and sextupole moments are pre-calculated for each segment (where the dipole and octupole moments are non-zero only for segments of conical shape). The number of multipole moments used for a potential calculation depends on the distance of the segment from the point.
(7) When the point is at the centre of the surface of a short segment then an expression is used that represents the integration of the elliptic form over the surface.
(8) Otherwise when the point is on the surface of a segment the surface is subdivided and the present procedure is applied to each subdivision.
(9) When the point is near to the surface of a segment, but not near an edge, then the segment is either subdivided or use is made of the near-surface expansion of the potential
(10) When the point is near an edge then the segment is usually subdivided and near-edge expansions are used for the subdivision that includes the edge.
(11) If none of the above apply then either (a) the segment is treated as a thin ring of charge and the elliptical expression is used or (b) 3-point gaussian quadrature is used to turn the segment into 3 thin rings, or (3) the segment is subdivided and the present procedure is applied to each of the subdivisions.
Careful criteria are used to decide on the level of approximation that should be used for each individual segment and the number of subdivisions if these are called, taking account of the requested inaccuracy for the potential. Special care is taken when the point is near to a segment that touches the axis.
A similar procedure is used in CPO2D for evaluating fields.
A similar but simpler procedure is used in CPO2D for evaluating the potentials and fields of planar systems.
Example of an exact calculation of a potential:
Exact expression for an out-of-plane potential at a point (x,y,z) due to a unit charge uniformly distributed over a triangular segment, where the point is not in the plane of the segment (taken from the program code):
The coordinate system is chosen so that its origin is at the centre-of-gravity of the triangle and the xy plane is the plane of the triangle.
Taking the coordinates of the three corners as (Xn,Yn), where n = 1, 2 and 3 respectively, the orientation of the triangle is chosen so that X2 > X1, Y1 = Y2, Y3 > Y1. Also Z > 0. Local coordinates xi and yi are then used for the point, where xi is the distance in the local x direction between the point and corner i, and y1 and y2 are the distances in the local y direction between the point and corners 1 and 3 respectively.
Then the required potential is the absolute value of
(z/area)*(I(a2,b2,u2) - I(a2,b2,u1) - I(a1,b1,u2) + I(a1,b1,u1)),
where y21 = y2 - y1, a1 = (x1*y2-x3*y1)/(y21*z), a2 = (x2*y2-x3*y1)/(y21*z),
b1 = (x3-x1)/y21, b2 = (x3-x2)/y21, u1 = y1/z, u2 = y2/z
and where I(a,b,u) = u*ln(g) + arctan((a*u-b)/v) + (a/bb)*ln(h),
where abu = a + b*u, bb = sqrt(1 + b**2), u2 = 1 + u**2, v = sqrt(u2+abu**2),
g = (abu+v)/sqrt(u2) and h = v + u*bb + a*b/bb.
An analogous expression exist for the in-plane potential due to a uniformly charged triangle. Differentiation gives the field components. Further expressions exist for the potential and field due to a uniformly charged rectangle.