an embedding method for the numerical solution of the cathode design problem in electrochemical...

16
INTERNATIONAL JOURNAL FOR NUMERICAL METHODS IN ENGINEERING, VOL. 29, 1177-1 192 (1990) AN EMBEDDING METHOD FOR THE NUMERICAL SOLUTION OF THE CATHODE DESIGN PROBLEM IN ELECTROCHEMICAL MACHINING ROLAND HUNT Department of Mathematics, University of Strathclyde, Glasgow, GI IXH Scotland SUMMARY An embedding method is considered for the numerical determination of the cathode shape for a given anode shape in a two-dimensional electrolytic cell. Reference is made to an analytic solution to illustrate the difficulties which have to be overcome by any numerical method applied to this ill-posed problem. The embedding method searches amongst the direct solutions (i.e. anodes for given cathodes) since these, resulting from a well-posed problem, are less troublesome to compute. For anodes of the form BC(x), x the transverse direction, the embedding method gives good results for less than 30-60 percent of the B for which the cathode first contains cusps or becomes triple-valued. It is shown that the embedding method performs better than some other numerical methods in overcoming the error growth difficulties associated with the ill- posedness of the problem. 1. INTRODUCTION In electrochemical machining, the piece of metal to be shaped forms the anode of an electrolytic cell (see Figure 1). An electric potential is applied across the electrodes which causes the anode to erode. In order to maintain a steady situation the cathode is moved towards the anode with constant velocity. The resulting shape of the anode is determined by the shape of the cathode, which is made of material unaffected by the electrolyte. The technique can be used to shape any metal but is particularly useful for tough metals or geometries which prove difficult with more conventional machining (see McGeough'). The direct problem, that is, determining the shape of the anode for a given cathode shape, is well-posed. The anode can be represented by a locally analytic function (see, for example, Elliott and Ockendon4) and is readily found numerically (for example Sloan," Hunt'). However, the inverse problem, of designing a cathode to give a required anode shape, is ill-posed in the sense that there are no solutions in general. This ill-posedness is similar to that found in contracting Hele-Shaw flows'*2 in which a small high frequency perturbation will dominate the solution in a finite time. In fact it is always possible to choose this frequency such that 'blow-up' will occur no matter how small the initial amplitude or how short the time. However, solutions do exist, namely those cathodes which are the solution of a direct problem, and further, the engineering problem is less stringent in that what is required is not the solution but a solution to within some prescribed tolerance. These solutions to the inverse problem do not vary continuously with anode shape, with the result that very different cathodes can produce similar anodes. This last property can be useful to an engineer since he can choose a shape which suits him. 0029-598 1/90/061177-16$08.00 0 1990 by John Wiley & Sons, Ltd. Received 20 March I989 Revised I September 1989

Upload: roland-hunt

Post on 15-Jun-2016

217 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: An embedding method for the numerical solution of the cathode design problem in electrochemical machining

INTERNATIONAL JOURNAL FOR NUMERICAL METHODS IN ENGINEERING, VOL. 29, 1177-1 192 (1990)

AN EMBEDDING METHOD FOR THE NUMERICAL SOLUTION OF THE CATHODE DESIGN PROBLEM IN

ELECTROCHEMICAL MACHINING

ROLAND HUNT

Department of Mathematics, University of Strathclyde, Glasgow, GI IXH Scotland

SUMMARY

An embedding method is considered for the numerical determination of the cathode shape for a given anode shape in a two-dimensional electrolytic cell. Reference is made to an analytic solution to illustrate the difficulties which have to be overcome by any numerical method applied to this ill-posed problem. The embedding method searches amongst the direct solutions (i.e. anodes for given cathodes) since these, resulting from a well-posed problem, are less troublesome to compute. For anodes of the form BC(x), x the transverse direction, the embedding method gives good results for less than 30-60 percent of the B for which the cathode first contains cusps or becomes triple-valued. It is shown that the embedding method performs better than some other numerical methods in overcoming the error growth difficulties associated with the ill- posedness of the problem.

1. INTRODUCTION

In electrochemical machining, the piece of metal to be shaped forms the anode of an electrolytic cell (see Figure 1). An electric potential is applied across the electrodes which causes the anode to erode. In order to maintain a steady situation the cathode is moved towards the anode with constant velocity. The resulting shape of the anode is determined by the shape of the cathode, which is made of material unaffected by the electrolyte. The technique can be used to shape any metal but is particularly useful for tough metals o r geometries which prove difficult with more conventional machining (see McGeough').

The direct problem, that is, determining the shape of the anode for a given cathode shape, is well-posed. The anode can be represented by a locally analytic function (see, for example, Elliott and Ockendon4) and is readily found numerically (for example Sloan," Hunt'). However, the inverse problem, of designing a cathode to give a required anode shape, is ill-posed in the sense that there are no solutions in general. This ill-posedness is similar to that found in contracting Hele-Shaw flows'*2 in which a small high frequency perturbation will dominate the solution in a finite time. In fact it is always possible to choose this frequency such that 'blow-up' will occur no matter how small the initial amplitude or how short the time. However, solutions do exist, namely those cathodes which are the solution of a direct problem, and further, the engineering problem is less stringent in that what is required is not the solution but a solution to within some prescribed tolerance. These solutions to the inverse problem do not vary continuously with anode shape, with the result that very different cathodes can produce similar anodes. This last property can be useful to an engineer since he can choose a shape which suits him.

0029-598 1/90/061177-16$08.00 0 1990 by John Wiley & Sons, Ltd.

Received 20 March I989 Revised I September 1989

Page 2: An embedding method for the numerical solution of the cathode design problem in electrochemical machining

1178 R. HUNT

t’

Figure 1. The electrolytic cell. The electrolyte is bounded by the anode y=g(x), the cathode y = f ( x ) and the lines x=O and x = 1

Because of the ill-posed nature of the inverse problem, its numerical solution is also difficult and very ill-conditioned. However, since the direct solution is relatively straightforward, we seek in this paper to solve the inverse problem numerically by searching through the family of direct solutions until an anode shape is found to within a specified tolerance of the required shape. We compare this method to the method of lines9 and an iteration of the finite difference equations using multigrid techniques.’ The results are compared with the analytical solution of Lacey.6

2. GOVERNING EQUATIONS

For the two-dimensional cell (Figure 1) we place co-ordinates such that the width of the cell lies on the interval O<x < 1 with the cathode and anode being given by the curves y = f ( x ) and y = g ( x ) respectively. If j is the current density in the electrolyte then conservation of charge gives V.j=O. Assuming that any bubbles formed or heat generated are quickly dispersed, and that turbulence gives good mixing, the current j obeys Ohm’s law,’ that is j= -aVCp, where 4 is the electric potential and IJ the conductivity. Thus, the potential in the electrolyte is given by Laplace’s equation V 2 4 =O. Neglecting overpotentials we can take Cp = O on the cathode and (p = V on the anode, and if there is no current flowing across the boundaries x=O and x = 1 we have the condition aCp/dx=O.

The rate of recession of the anode surface is proportional to j . n in the direction of outward normal n. If 8 is the angle the normal makes with the y-axis, and supposing the cathode is moving in the y-direction with velocity u, then the recession rate u cos 8 is given by the equation

where k is the erosion rate. Setting (p= Vu and using y’(x)= tan 0 gives the set of governing

Page 3: An embedding method for the numerical solution of the cathode design problem in electrochemical machining

EMBEDDING METHOD IN ELECTROCHEMICAL MACHINING

equations as V2u = 0 inf(x) < y < g(x), 0 < x < 1

on y=g(x) I au ax

u = O on y = f ( x )

-=0 on x = 0 and 1 u= 1

au au ax a y

-g’(x)- + - = v

1179

(2)

where v = u/kV. The problem to be solved is that, for given g (x) and v , what is the corresponding f(x) (and u) that satisfies (2).

3. DIFFICULTIES ASSOCIATED WITH A NUMERICAL METHOD

To illustrate some of the numerical difficulties associated with the problem under discussion we mention two techniques which might be employed. We later show that the embedding method goes some way towards coping with these difficulties.

3.1. The method of lines

Since equations (2) are second order and we have two known boundary conditions at y = g (x), it is possible to march in the negative y-direction using the method of lines. The cathode shapef(x) is then determined as the curve that passes through u=O. We first formulate the problem in terms of the independent variables x and q, where 4 = g (x) - y, which transform equations (2) to

a2u a2u ,,au a2U att axaq aq ax

(1 + g’2)_-i. + 29’- + g - + i = o (3)

au ax on q = O au

u=O on q=g(x)-f(x) -=-

-=0 on x = O and 1

We then divide O < x < 1 into N strips defining ui(q)=u(ih, q), gi=g(ih), i=O, 1, . . . , N, where h = 1/N. Setting tii = dui/dq for each i and using central differences to replace derivatives in the x- direction we have the following set of 2 (N + 1) coupled first order ordinary differential equations:

du. g: 1 (1+g’2 ) -+h(u i+ l -u i - , )+g ;u i+ - (u i+ , -

d? h2 2ui + ui -

dui - = u i i = O , 1, . . . , N d?

subject to starting conditions ui= 1, ui= - v/( 1 + gi2) at q = 0. Here we have incorporated fictitious nodes at x = - h and x = 1 + h; the boundary condition &/ax = 0 at x =0, 1 then yields u - = ul, uN + =uN - ,, U- = u l , and uN + = uN - 1, which completes the system.

Equations (4) can be integrated numerically using a computer initial value problem solver as a slave routine. Equations generated by the method of lines are often stiff and we used DO2EBF of the NAG library which employs Gear’s method and is suitable for such systems. Results for the ui are output at regular intervals in y, and each ui is checked to see if it has become negative for the

Page 4: An embedding method for the numerical solution of the cathode design problem in electrochemical machining

1180 R. HUNT

first time. If it has, then the value of y at which ui=O is estimated using the last three values for ui and quadratic interpolation. This gives the curve y = g ( x ) - f ( x ) from which f ( x ) is found.

Results have been obtained for g (x) =Bcos RX for v = 510 and 20 using N = 32 with p increasing in steps of 0.1 until the program aborted. These are compared with the analytical result6 (see Appendix) and the maximum errors incurred are listed in Table I. The results are shown graphically in Figure 2 for f l= 0.3. For small values of fl the results are in very good agreement with the analytical result but for larger values unstable modes generate oscillations in the solution. For even larger values of fl these modes dominate, making the solution impossible.

Table I. Maximum errors incurred using the method of lines with g(x)=Pcosnx for various values of v. '-' indicates the

program aborted

B 0 1 0 2 0 3 0.4 05 0.6 0.7 0 8 0 9

V = 5

3 x 4 x 10-4 0.3

v = 10

8 x 3 x

7 x 1.4 x 10-4

0.2 0.2 0.3

v=20

5 x 10-6

3 x 1.2 x 10-

i .ox 10-4 2 x 10-4 2~ 10-3

005 0.1 -

0.4-

0.2

0.0.

T a

-0.2.

-0.4.

-0.6.

0.0 0.2 0.4 0.6 0.8 1 .o 2-4

Figure 2. Results for g(x)=O.3 cos nx using the method ollines for v = 5, 10.20. The dashed curve is :he analytical result for v = 5

Page 5: An embedding method for the numerical solution of the cathode design problem in electrochemical machining

EMBEDDING METHOD IN ELECTROCHEMICAL MACHINING 1181

Page 6: An embedding method for the numerical solution of the cathode design problem in electrochemical machining

1182 R. HUNT

The source of these errors is two-fold. Firstly, as fl increases/(x) can develop cusps or become multi-valued. In Figure 3 are plotted the analytical solutions off(x) for (a) g(x)=fl cos nx and (b) g (x) = - fl exp ( - cos nx) with v = 5 for various fl. In (a) a cusp has developed at x = 0 when fl - 0.5 (actually 0.475 with 0.997, 2.018 for v = 10, 20 respectively), and in (b) the solution has become triple-valued for fl20.4 (actually 0.407 with 0.963, 2.002 for v = 10,20 respectively). Hence, it will be impossible to computef(x) for f l greater than these limits-in case (a) for any method and in (b) for any method using vertical grid lines, as do all the methods in this paper.

The second source of error is due to the growth of high frequency Fourier modes which is a consequence of the ill-posed nature of the problem. To see this consider equations (4) with g (x) = 0, and suppose that the boundary condition u = 1 has an error ECOS nnx. The problem then is

which is easily solved using separation of variables to give

u = 1 - v q + Ecoshnnxcosnnx (6)

Thus, the nth Fourier mode exhibits exponential growth with an e-folding interval of nn, where n is restricted to 1 < n < N when solved numerically on a grid of size N . Hence the introduction of an error, no matter how small, will ultimately dominate the solution. This is also reflected in the fact that a small change in g (x) often requires a large change inf(x). In this method the stability of the IVP slave routine will help to dampen these errors, and if they are kept in check until u <O over the range 0 < x < 1 then we have a solution. This occurs for small fl, but for larger f l , as we approach the cusp, truncation errors will be much larger and these unstable modes will dominate the solution. This is the familiar ill-posedness of an elliptic problem when subjected to pure Cauchy data.

3.2. Multigrid solution on the unit square

Here the problem is formulated in terms of the independent variables x and q, where q = { y -,f(x)}/{f(x) - g(.u)), which transforms the domain of equations (2) onto the unit square to give

au -=0 on x=O and 1 ax

u=1

u=O on v = O (7)

where

with ij = 1 - v. To solve (7) and (8) numerically we place an N x N mesh on the unit square where a typical mesh point (xi, q j ) is (ih, jh ) . Using central differences to represent derivatives the resulting

Page 7: An embedding method for the numerical solution of the cathode design problem in electrochemical machining

EMBEDDING METHOD IN ELECTROCHEMICAL MACHINING 1183

C . . 2h

+ A ( u i , j + l - t4i . j- Dij l ) + + u i + , , j - 2 u i j + u i - h

j = l , 2 , . .., N i = O , 1,. .., N

j = O , 1,. . . , N + l

uio = 0, U i N = 1

1 i=o, 1,. . . , N (Ui ,N + 1 - Ui.N - 1

1 . j ) = 0

(9)

where uij, A,,, Bi j , C i j and Dij are u, A, B, C, D evaluated at (xi, q j ) , with derivatives offand g being represented by central differences. Fictitious nodes are introduced whenever we have a derivative boundary condition. System (9) is solved iteratively using a multigrid algorithm described in a previous paper.5 The algorithm uses q-zebra line iteration in which {A, uij , j = 0,1,. . . , N + 1) are relaxed simultaneously employing a single Newton iterate, coarsenin'g is in the x-direction only, restriction uses full weighting and prolongation uses bilinear interpolation.

For the algorithm to converge it is imperative that we have a good initial solution (another indication that the problem is ill-conditioned) and the following continuation procedure is adopted. Let g(x)=flC(x) with b = k A b , k=O, 1 , 2 , . . . , then fork= 1, a solution is obtained on 4 x 4,8 x 8, . . . , N x N grids ( N is a power of 2 for the multigrid to operate efficiently), where the previous grid is employed as a starter for the next grid with linear interpolation used to estimate intermediate points. The starter for the 4 x 4 grid is the solution to the problem when k = 0, namely u = q , f = - v. For k = 2 the starter solution is the linear extrapolation of the results for k = 0 and k = 1 on N x N grids, and for k 2 3 quadratic extrapolation is adopted using the results for k - 3, k - 2 and k-1.

Results have been obtained for g(x)=Bcosnx for v = 5 , 10 and 20 on grids of size 16 x 16, 32 x 32 and 64 x 64. The maximum value of fl for which the iteration converged is given in Table 11, together with the size of A b used and the maximum error incurred. It is observed that the maximum value of /3 decreases significantly as the grid size increases. This is due to the destabilizing effect of higher frequency Fourier modes on the larger grids which are not present on

Table 11. Results for y(x)=fi cos ICX using multigrid iteration after the problem has been transformed onto the unit square. Maximum B for which the iteration converges, AD and the error incurred are given for various v and grid sizes. '+' indicates iteration converges with ABcO.01 and '-' that no convergence is

possible

Maximum p (Ap) Error at maximum fl

v = 5 v = 10 v-20 v=5 v = 10 v=20 -.

Grid size

16x 16 0.14 (0.02) 0.4 (0.05)* 0.8 (0.1) 1.0 x 5 x 8 x lo- ' ___

32 x 32 + 0.16 (0.02) 0.5 (005) + 1.0 10-4 5 x 64 x 64 - + 0.2 (002) - + 2 x 10-5

~~

*/I= 0.45 converges but the solution has unacceptable errors

Page 8: An embedding method for the numerical solution of the cathode design problem in electrochemical machining

1184 R. HUNT

the smaller grids. The errors are at the level of the local truncation error and the oscillations encountered in the method of lines are not present here (except for 8=0.45 at v = 10). However, apart from the 16 x 16 case, the maximum value of 8 is significantly less than that obtained using the method of lines, and from this point of view the method of lines seems preferable, especially since, in this case, the breakdown is independent of N .

4. EMBEDDING IN THE FAMILY O F DIRECT SOLUTIONS

The solution to the direct problem, in whichf(x) is known and g (x) is required, is much easier than the inverse problem. For example, the multigrid procedure outlined in the last section, in which the1;. are known and the gi are to be found, can be employed successfully for quite complex functions with, say, steep gradients and/or corners, particularly if the continuation procedure is adopted (see Hunt')). For this reason we can contemplate an embedding method which searches amongst the set of direct solutions for various cathodesf(x) until a match for the required anode g(x) is found. Since equations (9) were derived using simple central differences the error in the solution is O ( h - ') and hence it is only necessary to match g(x) to within this tolerance. Further the 'engineering problem' does not require g (x) to be exact, but to some tolerance determined by the use the resulting shaped material is to be employed. For these reasons we will seek anf(x) which gives a g (x) to within some tolerance. Since N = 32 is used in the numerical calculations we will set the tolerance to be

Since f(x) and g (x) are required only to such a tolerance we can represent them by a few parameters, m say (where m typically lies in the range 4<m<8), such as the coefficients of their interpolating polynomials, the first few coefficients of their Fourier series or any other suitable representation. Suppose a,, a,, . . . , a, are the parameters associated with any givenf(x), let b , , b,, . . . , b, be associated with the g(x) resulting from solving the direct problem with this choice of .f(x) and, finally, c,, c,, . . . , c, are the parameters associated with the required g(x). The numerical procedure involves the following calculations.

1. Given a,, a,, . . . , a, we calculateL, i = O , 1, . . . , N . 2. Solve equations (9) with these givenh for the unknowns uij and gi using the multigrid

3. From the gi, i=O, 1,. . . , N calculate b, , b,, . . . , b,. algorithm described in Section 3.

Hence we can regard b , , b,, . . . , b, as functions of a,, a,,. . . , a, and therefore we require to solve the set of equations

b , ( a , , a23 . . . 9 a m ) = ~1

bm(a1, a,,. . . 3 a m ) = C m

which are solved iteratively using Newton's method as follows. If a = @ , , a,, . . . , a,)T with similar expressions for b and c, then the iteration can be written as

where s is the iteration counter and J is the Jacobian whose (i,j)th element is 2bi/daj. The elements

Page 9: An embedding method for the numerical solution of the cathode design problem in electrochemical machining

EMBEDDING METHOD IN ELECTROCHEMICAL MACHINING 1185

of J need to be calculated numerically and we use the formula

abi 1 - N - - [bi(a?), . . daj E

. , a:'+&, . . . , a:') - bi(a',"', . . . , a!"' , , .

where E is small but not too small is used in the program.). Thus for each iteration the direct problem needed to be solved (m + 1) times for (a?), a$), . . . , a:)) and (a?', . . . , a?) + c, . . . , a$'), j = 1,2,. . . , m, and hence for large m the procedure could be very costly. In order to obtain good initial iterates at each stage in the calculation, a continuation procedure similar to that described

in Section 3 is adopted. The iteration was terminated when max I Aai 1 < and it was observed

that 2 or 3 iterations are usually sufficient.

their first m Fourier coefficients, e.g.

i

Two representations off(x) and g (x) are considered. Firstly, the functions are represented by

1 f(x) - a, + 5 a, cos rnx

r = 1

where a, can be disregarded since it merely translates the whole problem in the y-direction by an amount fa,. Secondly, 0 d x d 1 is interpolated into m equally spaced intervals and the functions are represented by their cubic splines. This is particularly straightforward sincef"(x) and g'(x) are known at the end-points. Again since y-translation does not affect the problem, we need consider only the differencesf(x,) - f ( x , - r = 1,2 , . . . , m, where x,=r/m, r=O, I , . . . , m. Thus in both cases the functions are represented by m parameters.

Results have been obtained for g(x)=B cos nx with v = 5 for m = 4 , 5 , 6 and 8 for both Fourier coefficients and splines, in which fi is increased in steps of 0.05 until the multigrid algorithm failed to converge. The maximum errors incurred inf(x) and g(x) are listed in Table 111 giving 2, where

g(x,) - g ( x -

Table 111. Maximum errors (in the form lo-') for g(x) andf(x) using the embedding method for g(x)=pcosnx with v = 5 using Fourier coefficients and splines. '-' indicates that the

multigrid iteration does not converge

M = 4 M = 5 M = 6 M = 8

0.05 6.0 4.6 6.0 4.6 6.0 4 6 6.0 4.6 F 0.10 5.1 3.8 6 0 4.0 60 4.0 6.0 4.0 0 0 1 5 4.2 3.0 4.9 3.4 5.4 3.5 6.0 3.5 U 0.20 3 3 2.2 4.1 2.5 4.6 2.8 5.2 2.8 R 0.25 3.0 1.7 3.5 1.8 4.0 2.1 4.4 1.9 I 030 2.6 1.1 3.0 1.1 3.6 1.4 4.0 1.4 E 0.35 2.3 0.5 2.7 0.5 3.4 0 9 R 0.40 2.2 0.0 2.5 0.1 3. I 0.9

0.05 5-1 4.0 6.0 4.4 6.0 4.6 6.0 4.6 S 0.10 4.3 3.4 5.0 3.6 5.7 3.9 6.0 3.9 P 0.15 4.1 3.0 4.3 3.1 4.8 3.3 6.0 3.5 L 0.20 4.2 3.0 4.2 2.8 4.3 2.6 5.0 2.1 I 0.25 3.0 1.8 3.7 2.2 4.5 2.6 3,7 1 .o N 0.30 2-4 0-9 2.8 1 .o 3.5 1.5 2.8 0.3 E 0.35 2.0 Q2 2.4 0.2 3.2 1.1

- -

- -

- -

- - - - - 2.2 0.0 0.40 -

Page 10: An embedding method for the numerical solution of the cathode design problem in electrochemical machining

1186 R. HUNT

0.0 0 .2 , 0.4 0.6 0.8 1.0

I-+

Figure 4. Results for y(.x)=O~35costrx with v = 5 using the embedding method. The curves are (a) m = 5 using Fourier coefficients, (b) m = 4 with Fourier coefficients and (c) m = 5 with splines. The dashed curve is the analytical result

lo-" is the error. In every case the fit to g(x) is substantially better than that tof(x) by usually 1 or 2 magnitudes. This is a reflection that small changes in g (x) quite often require larger ones inf(x). A s m increases, the accuracy of f(x) increases, until the level of the local truncation error of equations (13) is attained. For example, the values of a for P = O . l S using Fourier coefficients are 3.0,3.4, 3.5 and 3.5 for the four values of m respectively. Thus the local error imposes a maximum value for m beyond which no further accuracy is obtainable. Hence€or this problem, which uses a ;2 x 32 grid, m = 6 seems an appropriate value to use. In terms of accuracy, there is little to choose between using Fourier coefficients and using splines. Fourier coefficients appear marginally better but this is specific to the problem.

Although, for the larger p,f(x) deviates considerably from the theoretical result, it has a fit to g(x) to within the tolerance set by the level of the local error. For example, at 8=0.35 with m = 5 using Fourier coefficients the maximum deviation from the theoreticalffx) is 0.35 but produces a fit for g (x) to within 0.002, only twice the tolerance set for g(x) earlier. This is illustrated in Figure 4 along with the rn = 4 Fourier and m = 5 spline results. All three curves deviate considerably from the theoreticalf(x) and yet produce fits to g(x) to within thickness ofthe line shown for g(x) in the diagram. However, having a cathode with such oscillations would be very difficult to manufacture and hence we set a tolerance of onf(x) and lo-) on g(x). Hence the method gives an

Page 11: An embedding method for the numerical solution of the cathode design problem in electrochemical machining

EMBEDDING METHOD IN ELECTROCHEMICAL MACHINING 1187

Table IV. As in Table I11 for v = 10 and 20 with m=6

v = 10 v=20

Fourier Spline Fourier Spline

B

0. I 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 .o 1 . 1 1.2 1.3

6.0 4.4 5.4 4.4 6.0 4.8 5.1 4.6 5.7 3.8 4.5 3.6 6.0 4.2 4.5 4.1 4.5 3.4 3.4 2.7 5.7 3.8 4.1 3.6 3.6 2.8 2.6 1.9 5.0 3.5 3.6 3.2 3.0 2.1 2.1 1.2 4.5 3.3 3.0 2.1

- 3.9 3.1 2.4 2.1 2.4 1.3 - - 3.5 2.9 1.9 1.6 2.1 0.6 - - 3.0 2.7 1.5 1 . 1 - 2.6 2.2 1.3 0.7 - 2.2 1.8 - 1.9 1.4

- 1 5 0.5

- - -

- - - - - - - - - - - - -

- - - - 1 -6 0.9 - - - - - - -

acceptable solution for 0 Q p < 0.25 and is comparable, and perhaps marginally better, than the method of lines. The cause of the oscillations in Figure 4 is that p is approaching the value at which the cusp appears.

Similar comments can be made for v = 10 and 20; the errors for m = 6 are shown in Table IV. For these values of v the use of Fourier coefficients is significantly better than splines. The maximum /? values giving 10-3/10-2 tolerance fits are 0.5 and 0.9 respectively, which is marginally better than the method of lines.

5. OTHER RESULTS USING THE EMBEDDING METHODS WITH X-TRANSFORMATION

Up till now we have only considered the anode g (x)= fi cos nx with a uniform discretization in the x-direction. We now consider other functions and non-uniform discretizations with the embed- ding method.

5.1. Transformation in the x-direction

The main difficulty in obtaining a solution for g (x)= p cos nx is the steepness of the gradient of f ( x ) near x = 0. Hence we require more grid points near x = 0 than elsewhere and this can be best effected by a suitable transformation in x. Suppose the interval OSx Q 1 is mapped monotonically onto O < r < 1 by x=x(t) , then the governing equations (8) and (9) remain the same except that a/ax and a2/dx2 are replaced by the formulae

a 2 . a - v2- + vv- a a a 2

a X - u a t ' ~ - a t 2 at - 114)

everywhere they occur. Here u = u (2) = dt/dx and d = dv/dt. To effect many grid points near x = 0

Page 12: An embedding method for the numerical solution of the cathode design problem in electrochemical machining

1188 R. HUNT

a suitable transformation is

where k is a positive constant. By numerical experimentation it was found that & = 1 is the best value for the above g(x). Using Fourier coefficients with m=6, and requiring a 10-3/10-2 tolerance, acceptable results were obtained for 0 GjGO.35 for v = 5. This is a significant improvement considering that the cusp occurs at /?=0.475. However, v = 10 and 20 showed only marginal improvement with a maximum j of 0.6 and 1.0 respectively. The transformation given by equation (16) with k = 2 and to = 0 gave similar results. The other two methods considered were not as successful; the method of lines did not work and the direct iteration method worked only on a 16 x 16 grid.

5.2. g(x)= -jexp(-cosnx)

As we saw earlier, f(x) becomes triple-valued when g (x) = - /3 exp ( - cos nx). For smaller fl, .f(x) remains single-valued but has a steep gradient within the interval O<x< 1. At the point of greatest steepness it is desirable to have many grid points and a suitable transformation is

sinh k ( t - t o ) + sinh k t , sinh k ( 1 - t o ) + sinh k t ,

X =

which is of the form x = A sinh k ( t - t o ) + B, with A and B being chosen so that OGx < 1 maps onto 0 < t < 1. The closest spacing of grid points occurs at t = to. For v = 5 the steepest gradients inf(x) occur near x -03, and it was found that to = 0.4 gave a suitable transformation in this case. The results for p= 0.25 are shown in Figure 5 using splines with m = 6. The interpolation points forf(x)

0.0 '

-0.2 '

-0.4 .

1 a

-0.6

-0.8 '

-1.0 '

I

0.0 0.2 0.4 ' 0.6 0.8 1.0

I -

Figure S. Results for g[x)= - O ~ Z S e ~ ' " * 'Ifor v = S , 10, 20. The dashed curve is the analytical result for v = S

Page 13: An embedding method for the numerical solution of the cathode design problem in electrochemical machining

EMBEDDING METHOD IN ELECTROCHEMICAL MACHINING 1189

are equally spaced on O < t < 1, but for g(x) they are equally spaced on O<x < 1. The latter is chosen because g (x) does not have steep gradients and hence an even spacing in x better represents the function, which has the result of making the Newton iteration more robust. As usual N = 3 2 and k is set to 4,3,2 for j= 5,10,20 respectively. Requiring a 10-3/10-2 tolerance gave maximum values for p of 0.15,0.3,0.5 for v = 5, 10,20 respectively, which is 25-37 per cent of the value of p at which f(x) first becomes triple-valued.

5.3. Non-periodic problems

consider two functions, namely Both the functions g (x) we have considered reflect about the abscissae x=O and x = 1. We now

(a) g (x) = j x ' (2x - 3) (17)

(b) g(x)=px2(18-32x + 1 5 ~ ' ) (18)

which do not reflect about these lines and hence the analytic solution is not directly applicable. These have been solved numerically using the transformation ( I 5) for (a) with k = 1 since there are steep gradients inf(x) near x = 0 and using (16) for (b) with k = 4, 3, 2 for v = 5, 10, 20 respectively and t,=0.55 to cater for the steep gradient near x=O.6. In both cases splines were used with m=6, the interpolation points being equally spaced with respect to t forf(x) and with respect to x for g(x). The results are shown in Figure 6 for /?=0.6 in case (a) and 8=0.2 in (b).

Since the functions g(x) given by (17) and (18) do not reflect about the lines .w=O and x = 1 the analytic solution, given by (19), in the Appendix, will not have au/c?x = 0 on x = 0 and 1. Since for given g (x) this solution is unique and since it does not satisfy the above boundary conditions, there are no solutions at all for these anode profiles. This is contrary to the numerical results in which a solution clearly exists for small p. However, since g (x) is defined only on 0 < x < 1 we are free to define it for x < O and x > 1 by reflection in the lines x=O and x = 1. Hence g(x) can now be approximated by a truncated Fourier series, which being periodic, has a corresponding analytic solution. It is clear that it is this solution that the numerical code is finding.

For v = 5 in both cases the solution forj'(x) has an undulating or 'wiggly' nature compared to that for v = 10 or 20, all of which are smooth. These undulating solutions are perfectly acceptable numerically in that they produce a g(x) to within of the required anode. However, from an engineering point they would be unacceptable since such a shape would be difficult to manufacture. We will define an undulating solution as one which has too many points of inflexion. In case (a) we expect a solution with one point of inflexion and (b) with two. If the resulting solution has more than these in number we regard it as undulating or non-smooth. To find the number of points of inflexion, we estimate,r(x) at each nodal point using divided differences and then count the number of sign changes. In Table V we give the maximum value of for which we

Table V. Maximum values for p for which (i) the iteration converges, ( i i ) the maximum error in g(x) is less than and (i i i ) the solution is smooth, for two cases of g(x)

P.K' (2X - 3) fix2 (18 - 32x + I 5x2) .r! i .4

v 5 10 20 5 10 20 0.05 0.1 0.2 0.05 0.05 0.05 Afi

Iteration converges 0.75 1.4 2.6 0.2 0.4 0.7 IError in y(.u)1<10-" 0.65 1 .o 2.0 0.2 0.35 0 4 Smooth 0.2 0.9 20 0.0 0.35 0.55

-. . . . . . . . . . ~- ~ ..

~~~ ~ -. ~ .. ~~~~

Page 14: An embedding method for the numerical solution of the cathode design problem in electrochemical machining

1190

0.2.

0.0

t a

-0.2

-0.4

-0.6.

-0.8

R. HUNT

.

- 0.0 0.2 0.4 0.6 0.8 1 .O

z-+

0.0 0.2 0.4 0.6 0.8 1.0

2 -

( W Figure 6. Results for (a)g(x)=0.6nZ (2x- 3) and (b)g(x) =0.2x2 (15-32x + 1 8 ~ ' ) for Y = 5, 10.20. The dashed curve is the

analytical result for Y = 5

Page 15: An embedding method for the numerical solution of the cathode design problem in electrochemical machining

EMBEDDING METHOD IN ELECTROCHEMICAL MACHINING 1191

have a ‘smooth’ solution, together with details of accuracy and convergence. In case (a) quite large values for have a satisfactory solution (i.e. the accuracy and smoothness criteria are satisfied) when v = 10 or 20. In case (b) only smaller values of fi are possible, reflecting the more complex nature of this anode.

6. CONCLUSION

In this paper we have sought to solve the cathode design problem numerically by methods whose transformations keep vertical lines vertical. The numerical difficulties encountered reflect the ill- posed nature of the problem. Of the traditional techniques, the method of lines gives good results for modest /3 provided there is no scaling in the x-direction, and transforming the problem onto the unit square and using direct iteration is successful only for small grid sizes (typically 16 x 16). However, the embedding method is more successful and gives good results for modest B, including cases which are scaled in the x-direction. This means problems which contain steep gradients can be tackled. For larger p the solutions often contain undulations which, although being a correct numerical solution, would present engineering difficulties. Although solutions are possible only for modest fi, it should be remembered that this is mainly due to the appearance of cusps or triple- valued solutions at larger 8. We have, however, considered only transformations in which vertical lines are not distorted, but more general transformations could enable us to obtain solutions for larger fi , particularly those that become triple-valued. Particularly attractive would be orthogonal transformations since these would cope with steep gradients naturally. Another approach would be to use a variational inequality formulation, as suggested by Elliott and J a n o v ~ k y . ~

APPENDIX

Theoretical solution for cathode

cathode given by

where z=x-i/v and g(z) is the analytic continuation of g(x) into the complex plane.6 Hence the locus of ( X , Y ) points defines the shape of the cathode f via Y = f ( X ) . This solution is itSricitd to functions which are analytic and, owing to the boundary condition du/dx=O on =O and 1. to functions which reflect about the lines x =O and x = 1. Thus, we are restricted to analytic functions of the form F (cos nz). Equation (19) is ideal for plotting the locus of a cathode since it is explicit and can deal with cusps and multi-valued functions forf(see Figure 3). However, for testing the accuracy of results we need Y foi given X . In this case the unknowns are x and Y, and (19) needs to be solved numerically, Newton’s method being chosen as a suitable iteration. If

From a point (x, y) on the anode, where y=g(x), there corresponds a point ( X , Y ) on the

X + i Y = z + ig(z) (19)

g(x + id = u(x, y ) + iu(x, y)

and 4 + i$ = X + i Y - z - ig(z)

then the equations to be solved are

$ = Y + - - u x, - - =o Y ( 3

Page 16: An embedding method for the numerical solution of the cathode design problem in electrochemical machining

1192 R. HUNT

Newton’s iteration then is

. Y , + ~ = X , , + A X , , , Y , , + l = Y , , + A Y , , n = 0 , 1 , 2 , . . . where Ax,, and AY,, are the solution of

evaluated at (x, , , Y,,). This is solved for AYn to give

where again the right hand side is evaluated at (x,,, Y,,). Equation (21) is evaluated using Fortran complex arithmetic in which du/i?x and du/dx are simply the real and imaginary parts of g’(x + iy). A suitable starting iterate is xo = X and Yo = g ( X ) - I / v . The iteration works well except whenfis a multi-valued function of X .

REFERENCES

I . J. M. Aitchison and S. D. Howison, ‘Computation of Hele-Shaw flows with free boundaries’. J . Comp. Phys.. 60,

2. E. Di Benedetto and A. Friedman, ‘The ill-posed Hele-Shaw model and Stefan problem for supercooled water’. Trans.

3. C . M. Elliott and J. Janovsky, ‘A variational inequality approach to the Hele-Shaw flow with a moving boundary’.

4. C . M. Elliott and J. R. Ockendon, Weak and Variational Methods,for Moriny Boundary Problems, Pitman, London,

5 . R. Hunt, T h e numerical solution of elliptic free boundary problems using multigrid techniques’. J . Conip. Phys.. 65.

6. A. A. Lacey, ‘Design of a cathode for an electromachining process’, J . Ins:. Math. Applic., 34, 259-267 (1985). 7. J. A. McGeough, Principles 01 Elertrochniical Machining. Chapinan and Hall, London, 1914. 8. J. A. McGeough and H. R. Rasmussen, ‘On the deviation of the quasi-steady madel in electrochemical machining’.

9. G. X. Meyer, ‘An application of the method of lines to multi dimensional free boundary problems’. J . Inst. Murh.

10. D. M. Sloan. ‘Numerical solution of a free boundary problem by continuation’, J . Comp. Appl. Mark . 14. 279-288

376-390 (1985).

Anl. Malh. SOC., 282, 183-204 (1985).

Proc. R . Soc.. Edin., 88A, 93-i07 (1981).

1982.

+ I S 4 6 1 (1 986).

J . I n s t . Murh. Applic., 13, 13-21 (1974).

Applir., 20, 317-329 (1977).

(1986).