Example 5.3 rev 1 b.mw

Example 5.3 

Consider the electrochemical discharge of a planar electrode.[5]  

 

Typesetting:-mrow(Typesetting:-mfrac(Typesetting:-mrow(Typesetting:-mo( 

 

                                                                                        u(x,0) = 1                                                               (5.1.20)             

              

Typesetting:-mfrac(Typesetting:-mrow(Typesetting:-mo((0,t) = 0 and Typesetting:-mfrac(Typesetting:-mrow(Typesetting:-mo((1,t) = -δ 

 

 

where u is the dimensionless concentration and  is the dimensionless applied current density at the surface.  The electrochemical performance of the electrode depends on the concentration (u) at the surface.  When this problem is cast into finite differences we arrive at the matrix differential equation (equation (5.1.16) with a constant b vector.  Hence, we can use equation (5.1.18) to arrive at the semianalytical solution.  However, because of flux boundary conditions at both the ends, the A matrix becomes singular.  Hence, A cannot be inverted and equation (5.1.18) cannot be used.  It should be noted that if A is singular that does not mean that equation (5.1.16) does not have a solution.  One can prove that the solution (equation (5.1.18)) is independent of A-1 by using the series expansion for the exponential matrix[7]  [8] 

                                                                Image                              (5.1.21) 

Now the exponential matrix in the second term is represented as an infinite series: 

                                   Image     ( 5.1.22) 

where I is the identity matrix of order N x N.  Equation (5.1.22) can be further simplified by factoring out A-1b from the second and third terms. 

                                    Image(5.1.23) 

The identity matrices inside the parenthesis get cancelled.  Next, A-1 outside the parenthesis is taken inside the parenthesis to obtain: 

                                                     Image                         (5.1.24) 

We observe that equation (5.1.24) is independent of A-1 and, hence, we can obtain a solution for equation (5.1.16) even when A is singular.  The infinite series in equation (5.1.23) is difficult to calculate.  Alternatively, we use equation (5.1.17), which is valid even when A is singular to obtain the semianalytical solutions.  Equation (5.1.19) is solved below in Maple using the procedure described above with equation (5.1.17)a for the nonhomogeneous part. 

 

> restart;
 

> with(linalg):with(plots):
 

> ge:=diff(u(x,t),t)=diff(u(x,t),x$2);
 

diff(u(x, t), t) = diff(diff(u(x, t), x), x) (1)
 

> bc1:=diff(u(x,t),x);
 

diff(u(x, t), x) (2)
 

> bc2:=diff(u(x,t),x)+delta;
 

`+`(diff(u(x, t), x), delta) (3)
 

> #Digits:=50;
 

> IC:=u(x,0)=1;
 

u(x, 0) = 1 (4)
 

> N:=10;
 

10 (5)
 

> L:=1;
 

1 (6)
 

> dydxf:=1/2*(-u[2](t)-3*u[0](t)+4*u[1](t))/h:
 

> dydxb:=1/2*(u[N-1](t)+3*u[N+1](t)-4*u[N](t))/h:
 

> dydx:=1/2/h*(u[m+1](t)-u[m-1](t)):
 

> d2ydx2:=1/h^2*(u[m-1](t)-2*u[m](t)+u[m+1](t)):
 

> bc1:=subs(diff(u(x,t),x)=dydxf,u(x,t)=u[0](t),x=0,bc1):
 

> bc2:=subs(diff(u(x,t),x)=dydxb,u(x,t)=u[N+1](t),x=1,bc2):
 

> eq[0]:=bc1;
 

`+`(`/`(`*`(`/`(1, 2), `*`(`+`(`-`(u[2](t)), `-`(`*`(3, `*`(u[0](t)))), `*`(4, `*`(u[1](t)))))), `*`(h))) (7)
 

> eq[N+1]:=bc2;
 

`+`(`/`(`*`(`/`(1, 2), `*`(`+`(u[9](t), `*`(3, `*`(u[11](t))), `-`(`*`(4, `*`(u[10](t))))))), `*`(h)), delta) (8)
 

> for i from 1 to N do eq[i]:=diff(u[i](t),t)= subs(diff(u(x,t),x$2) = subs(m=i,d2ydx2),diff(u(x,t),x) = subs(m=i,dydx),u(x,t)=u[i](t),x=i*h,rhs(ge));od:
 

> u[0](t):=(solve(eq[0],u[0](t)));
 

`+`(`-`(`*`(`/`(1, 3), `*`(u[2](t)))), `*`(`/`(4, 3), `*`(u[1](t)))) (9)
 

> u[N+1](t):=solve(eq[N+1],u[N+1](t));
 

`+`(`-`(`*`(`/`(1, 3), `*`(u[9](t)))), `*`(`/`(4, 3), `*`(u[10](t))), `-`(`*`(`/`(2, 3), `*`(delta, `*`(h))))) (10)
 

> for i from 1 to N do eq[i]:=eval(eq[i]);od;
 

 

 

 

 

 

 

 

 

 

diff(u[1](t), t) = `/`(`*`(`+`(`*`(`/`(2, 3), `*`(u[2](t))), `-`(`*`(`/`(2, 3), `*`(u[1](t)))))), `*`(`^`(h, 2)))
diff(u[2](t), t) = `/`(`*`(`+`(u[1](t), `-`(`*`(2, `*`(u[2](t)))), u[3](t))), `*`(`^`(h, 2)))
diff(u[3](t), t) = `/`(`*`(`+`(u[2](t), `-`(`*`(2, `*`(u[3](t)))), u[4](t))), `*`(`^`(h, 2)))
diff(u[4](t), t) = `/`(`*`(`+`(u[3](t), `-`(`*`(2, `*`(u[4](t)))), u[5](t))), `*`(`^`(h, 2)))
diff(u[5](t), t) = `/`(`*`(`+`(u[4](t), `-`(`*`(2, `*`(u[5](t)))), u[6](t))), `*`(`^`(h, 2)))
diff(u[6](t), t) = `/`(`*`(`+`(u[5](t), `-`(`*`(2, `*`(u[6](t)))), u[7](t))), `*`(`^`(h, 2)))
diff(u[7](t), t) = `/`(`*`(`+`(u[6](t), `-`(`*`(2, `*`(u[7](t)))), u[8](t))), `*`(`^`(h, 2)))
diff(u[8](t), t) = `/`(`*`(`+`(u[7](t), `-`(`*`(2, `*`(u[8](t)))), u[9](t))), `*`(`^`(h, 2)))
diff(u[9](t), t) = `/`(`*`(`+`(u[8](t), `-`(`*`(2, `*`(u[9](t)))), u[10](t))), `*`(`^`(h, 2)))
diff(u[10](t), t) = `/`(`*`(`+`(`*`(`/`(2, 3), `*`(u[9](t))), `-`(`*`(`/`(2, 3), `*`(u[10](t)))), `-`(`*`(`/`(2, 3), `*`(delta, `*`(h)))))), `*`(`^`(h, 2))) (11)
 

> eqs:=[seq(rhs(eq[j]),j=1..N)]:
 

> Y:=[seq(u[i](t),i=1..N)];
 

[u[1](t), u[2](t), u[3](t), u[4](t), u[5](t), u[6](t), u[7](t), u[8](t), u[9](t), u[10](t)] (12)
 

> A:=genmatrix(eqs,Y,'b1'):
 

> b:=matrix(N,1):for i to N do b[i,1]:=-eval(b1[i]);od:evalm(b);
 

array( 1 .. 10, 1 .. 1, [( 5, 1 ) = 0, ( 7, 1 ) = 0, ( 9, 1 ) = 0, ( 8, 1 ) = 0, ( 1, 1 ) = 0, ( 4, 1 ) = 0, ( 6, 1 ) = 0, ( 2, 1 ) = 0, ( 10, 1 ) = `+`(`-`(`/`(`*`(`/`(2, 3), `*`(delta)), `*`(h)))), ... (13)
 

> h:=eval(L/(N+1));
 

`/`(1, 11) (14)
 

> A:=map(eval,A):
 

> if N > 4 then A:=map(evalf,A);end:
 

> evalm(A);
 

array( 1 .. 10, 1 .. 10, [( 2, 5 ) = 0., ( 5, 4 ) = 121., ( 6, 10 ) = 0., ( 7, 10 ) = 0., ( 7, 2 ) = 0., ( 9, 2 ) = 0., ( 6, 3 ) = 0., ( 2, 10 ) = 0., ( 3, 5 ) = 0., ( 9, 3 ) = 0., ( 1, 8 ) = 0., ( 5,... (15)
 

> det(A);
 

-0. (16)
 

We observe that the A matrix is singular. 

> mat:=exponential(A,t):
 

> mat:=map(evalf,mat):
 

> mat:=map(simplify,mat):
 

> Y0:=matrix(N,1):for i from 1 to N do Y0[i,1]:=evalf(subs(x=i*h,rhs(IC)));od:evalm(Y0);
 

array( 1 .. 10, 1 .. 1, [( 5, 1 ) = 1., ( 7, 1 ) = 1., ( 9, 1 ) = 1., ( 8, 1 ) = 1., ( 1, 1 ) = 1., ( 4, 1 ) = 1., ( 6, 1 ) = 1., ( 2, 1 ) = 1., ( 10, 1 ) = 1., ( 3, 1 ) = 1. ] ) (17)
 

> b2:=subs(t=tau,evalm(b));
 

array( 1 .. 10, 1 .. 1, [( 5, 1 ) = 0, ( 7, 1 ) = 0, ( 9, 1 ) = 0, ( 8, 1 ) = 0, ( 1, 1 ) = 0, ( 4, 1 ) = 0, ( 6, 1 ) = 0, ( 2, 1 ) = 0, ( 10, 1 ) = `+`(`-`(`/`(`*`(`/`(2, 3), `*`(delta)), `*`(h)))), ... (18)
 

> mat2:=subs(t=tau,evalm(mat)):
 

> mat3:=evalm(mat2&*b2):
 

> mat4:=map(int,mat3,tau=0..t):
 

> Y:=evalm(mat&*Y0+mat4):
 

> #Y:=map(simplify,Y):
 

> #Digits:=20;
 

> for i from 1 to N do u[i](t):=evalf((Y[i,1]));od:
 

> for i from 0 to N+1 do u[i](t):=eval(u[i](t));od;
 

 

 

 

 

 

 

 

 

 

 

 

`+`(`-`(`*`(0.3350892583e13, `*`(delta))), `*`(0.4212333334e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t))))))), `*`(0.2955133334e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `-`(`*`(0.5178666667e...
`+`(`-`(`*`(0.3350892583e13, `*`(delta))), `*`(0.4212333334e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t))))))), `*`(0.2955133334e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `-`(`*`(0.5178666667e...
`+`(`-`(`*`(0.3350892583e13, `*`(delta))), `*`(0.4212333334e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t))))))), `*`(0.2955133334e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `-`(`*`(0.5178666667e...
`+`(`-`(`*`(0.3350892583e13, `*`(delta))), `*`(0.4212333334e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t))))))), `*`(0.2955133334e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `-`(`*`(0.5178666667e...
`+`(`-`(`*`(0.3350892583e13, `*`(delta))), `*`(0.4212333334e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t))))))), `*`(0.2955133334e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `-`(`*`(0.5178666667e...
`+`(`-`(`*`(0.3350892583e13, `*`(delta))), `*`(0.4212333334e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t))))))), `*`(0.2955133334e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `-`(`*`(0.5178666667e...
`+`(`-`(`*`(0.3350892583e13, `*`(delta))), `*`(0.4212333334e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t))))))), `*`(0.2955133334e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `-`(`*`(0.5178666667e...
`+`(`-`(`*`(0.3350892583e13, `*`(delta))), `*`(0.4212333334e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t))))))), `*`(0.2955133334e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `-`(`*`(0.5178666667e...
`+`(`*`(0.3599e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t))))))), `*`(0.28871e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `-`(`*`(0.6069e-7, `*`(exp(`+`(`-`(`*`(375.0459122, `*`(t)))))))), `*`(...
`+`(`*`(0.3599e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t))))))), `*`(0.28871e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `-`(`*`(0.6069e-7, `*`(exp(`+`(`-`(`*`(375.0459122, `*`(t)))))))), `*`(...
`+`(`*`(0.3599e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t))))))), `*`(0.28871e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `-`(`*`(0.6069e-7, `*`(exp(`+`(`-`(`*`(375.0459122, `*`(t)))))))), `*`(...
`+`(`*`(0.3599e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t))))))), `*`(0.28871e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `-`(`*`(0.6069e-7, `*`(exp(`+`(`-`(`*`(375.0459122, `*`(t)))))))), `*`(...
`+`(`*`(0.3599e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t))))))), `*`(0.28871e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `-`(`*`(0.6069e-7, `*`(exp(`+`(`-`(`*`(375.0459122, `*`(t)))))))), `*`(...
`+`(`*`(0.3599e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t))))))), `*`(0.28871e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `-`(`*`(0.6069e-7, `*`(exp(`+`(`-`(`*`(375.0459122, `*`(t)))))))), `*`(...
`+`(`*`(0.3599e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t))))))), `*`(0.28871e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `-`(`*`(0.6069e-7, `*`(exp(`+`(`-`(`*`(375.0459122, `*`(t)))))))), `*`(...
`+`(`*`(0.1759e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t))))))), `*`(0.2683e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `-`(`*`(0.874e-7, `*`(exp(`+`(`-`(`*`(375.0459122, `*`(t)))))))), `*`(0....
`+`(`*`(0.1759e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t))))))), `*`(0.2683e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `-`(`*`(0.874e-7, `*`(exp(`+`(`-`(`*`(375.0459122, `*`(t)))))))), `*`(0....
`+`(`*`(0.1759e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t))))))), `*`(0.2683e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `-`(`*`(0.874e-7, `*`(exp(`+`(`-`(`*`(375.0459122, `*`(t)))))))), `*`(0....
`+`(`*`(0.1759e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t))))))), `*`(0.2683e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `-`(`*`(0.874e-7, `*`(exp(`+`(`-`(`*`(375.0459122, `*`(t)))))))), `*`(0....
`+`(`*`(0.1759e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t))))))), `*`(0.2683e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `-`(`*`(0.874e-7, `*`(exp(`+`(`-`(`*`(375.0459122, `*`(t)))))))), `*`(0....
`+`(`*`(0.1759e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t))))))), `*`(0.2683e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `-`(`*`(0.874e-7, `*`(exp(`+`(`-`(`*`(375.0459122, `*`(t)))))))), `*`(0....
`+`(`*`(0.1759e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t))))))), `*`(0.2683e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `-`(`*`(0.874e-7, `*`(exp(`+`(`-`(`*`(375.0459122, `*`(t)))))))), `*`(0....
`+`(`-`(`*`(0.438e-8, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t)))))))), `*`(0.2148e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `-`(`*`(0.1030e-6, `*`(exp(`+`(`-`(`*`(375.0459122, `*`(t)))))))), `...
`+`(`-`(`*`(0.438e-8, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t)))))))), `*`(0.2148e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `-`(`*`(0.1030e-6, `*`(exp(`+`(`-`(`*`(375.0459122, `*`(t)))))))), `...
`+`(`-`(`*`(0.438e-8, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t)))))))), `*`(0.2148e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `-`(`*`(0.1030e-6, `*`(exp(`+`(`-`(`*`(375.0459122, `*`(t)))))))), `...
`+`(`-`(`*`(0.438e-8, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t)))))))), `*`(0.2148e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `-`(`*`(0.1030e-6, `*`(exp(`+`(`-`(`*`(375.0459122, `*`(t)))))))), `...
`+`(`-`(`*`(0.438e-8, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t)))))))), `*`(0.2148e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `-`(`*`(0.1030e-6, `*`(exp(`+`(`-`(`*`(375.0459122, `*`(t)))))))), `...
`+`(`-`(`*`(0.438e-8, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t)))))))), `*`(0.2148e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `-`(`*`(0.1030e-6, `*`(exp(`+`(`-`(`*`(375.0459122, `*`(t)))))))), `...
`+`(`-`(`*`(0.438e-8, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t)))))))), `*`(0.2148e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `-`(`*`(0.1030e-6, `*`(exp(`+`(`-`(`*`(375.0459122, `*`(t)))))))), `...
`+`(`-`(`*`(0.148e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t)))))))), `*`(0.1302e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `-`(`*`(0.897e-7, `*`(exp(`+`(`-`(`*`(375.0459122, `*`(t)))))))), `*...
`+`(`-`(`*`(0.148e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t)))))))), `*`(0.1302e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `-`(`*`(0.897e-7, `*`(exp(`+`(`-`(`*`(375.0459122, `*`(t)))))))), `*...
`+`(`-`(`*`(0.148e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t)))))))), `*`(0.1302e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `-`(`*`(0.897e-7, `*`(exp(`+`(`-`(`*`(375.0459122, `*`(t)))))))), `*...
`+`(`-`(`*`(0.148e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t)))))))), `*`(0.1302e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `-`(`*`(0.897e-7, `*`(exp(`+`(`-`(`*`(375.0459122, `*`(t)))))))), `*...
`+`(`-`(`*`(0.148e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t)))))))), `*`(0.1302e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `-`(`*`(0.897e-7, `*`(exp(`+`(`-`(`*`(375.0459122, `*`(t)))))))), `*...
`+`(`-`(`*`(0.148e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t)))))))), `*`(0.1302e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `-`(`*`(0.897e-7, `*`(exp(`+`(`-`(`*`(375.0459122, `*`(t)))))))), `*...
`+`(`-`(`*`(0.148e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t)))))))), `*`(0.1302e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `-`(`*`(0.897e-7, `*`(exp(`+`(`-`(`*`(375.0459122, `*`(t)))))))), `*...
`+`(`-`(`*`(0.138e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t)))))))), `*`(0.589e-7, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `-`(`*`(0.406e-7, `*`(exp(`+`(`-`(`*`(375.0459122, `*`(t)))))))), `*`...
`+`(`-`(`*`(0.138e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t)))))))), `*`(0.589e-7, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `-`(`*`(0.406e-7, `*`(exp(`+`(`-`(`*`(375.0459122, `*`(t)))))))), `*`...
`+`(`-`(`*`(0.138e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t)))))))), `*`(0.589e-7, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `-`(`*`(0.406e-7, `*`(exp(`+`(`-`(`*`(375.0459122, `*`(t)))))))), `*`...
`+`(`-`(`*`(0.138e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t)))))))), `*`(0.589e-7, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `-`(`*`(0.406e-7, `*`(exp(`+`(`-`(`*`(375.0459122, `*`(t)))))))), `*`...
`+`(`-`(`*`(0.138e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t)))))))), `*`(0.589e-7, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `-`(`*`(0.406e-7, `*`(exp(`+`(`-`(`*`(375.0459122, `*`(t)))))))), `*`...
`+`(`-`(`*`(0.138e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t)))))))), `*`(0.589e-7, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `-`(`*`(0.406e-7, `*`(exp(`+`(`-`(`*`(375.0459122, `*`(t)))))))), `*`...
`+`(`-`(`*`(0.138e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t)))))))), `*`(0.589e-7, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `-`(`*`(0.406e-7, `*`(exp(`+`(`-`(`*`(375.0459122, `*`(t)))))))), `*`...
`+`(`-`(`*`(0.51e-8, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t)))))))), `*`(0.435e-7, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `-`(`*`(0.72e-8, `*`(exp(`+`(`-`(`*`(375.0459122, `*`(t)))))))), `*`(0...
`+`(`-`(`*`(0.51e-8, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t)))))))), `*`(0.435e-7, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `-`(`*`(0.72e-8, `*`(exp(`+`(`-`(`*`(375.0459122, `*`(t)))))))), `*`(0...
`+`(`-`(`*`(0.51e-8, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t)))))))), `*`(0.435e-7, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `-`(`*`(0.72e-8, `*`(exp(`+`(`-`(`*`(375.0459122, `*`(t)))))))), `*`(0...
`+`(`-`(`*`(0.51e-8, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t)))))))), `*`(0.435e-7, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `-`(`*`(0.72e-8, `*`(exp(`+`(`-`(`*`(375.0459122, `*`(t)))))))), `*`(0...
`+`(`-`(`*`(0.51e-8, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t)))))))), `*`(0.435e-7, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `-`(`*`(0.72e-8, `*`(exp(`+`(`-`(`*`(375.0459122, `*`(t)))))))), `*`(0...
`+`(`-`(`*`(0.51e-8, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t)))))))), `*`(0.435e-7, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `-`(`*`(0.72e-8, `*`(exp(`+`(`-`(`*`(375.0459122, `*`(t)))))))), `*`(0...
`+`(`-`(`*`(0.51e-8, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t)))))))), `*`(0.435e-7, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `-`(`*`(0.72e-8, `*`(exp(`+`(`-`(`*`(375.0459122, `*`(t)))))))), `*`(0...
`+`(`*`(0.481e-8, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t))))))), `*`(0.728e-7, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `*`(0.132e-7, `*`(exp(`+`(`-`(`*`(375.0459122, `*`(t))))))), `*`(0.6478e-6...
`+`(`*`(0.481e-8, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t))))))), `*`(0.728e-7, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `*`(0.132e-7, `*`(exp(`+`(`-`(`*`(375.0459122, `*`(t))))))), `*`(0.6478e-6...
`+`(`*`(0.481e-8, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t))))))), `*`(0.728e-7, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `*`(0.132e-7, `*`(exp(`+`(`-`(`*`(375.0459122, `*`(t))))))), `*`(0.6478e-6...
`+`(`*`(0.481e-8, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t))))))), `*`(0.728e-7, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `*`(0.132e-7, `*`(exp(`+`(`-`(`*`(375.0459122, `*`(t))))))), `*`(0.6478e-6...
`+`(`*`(0.481e-8, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t))))))), `*`(0.728e-7, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `*`(0.132e-7, `*`(exp(`+`(`-`(`*`(375.0459122, `*`(t))))))), `*`(0.6478e-6...
`+`(`*`(0.481e-8, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t))))))), `*`(0.728e-7, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `*`(0.132e-7, `*`(exp(`+`(`-`(`*`(375.0459122, `*`(t))))))), `*`(0.6478e-6...
`+`(`*`(0.481e-8, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t))))))), `*`(0.728e-7, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `*`(0.132e-7, `*`(exp(`+`(`-`(`*`(375.0459122, `*`(t))))))), `*`(0.6478e-6...
`+`(`*`(0.1093e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t))))))), `*`(0.1193e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `*`(0.383e-7, `*`(exp(`+`(`-`(`*`(375.0459122, `*`(t))))))), `*`(0.54411...
`+`(`*`(0.1093e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t))))))), `*`(0.1193e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `*`(0.383e-7, `*`(exp(`+`(`-`(`*`(375.0459122, `*`(t))))))), `*`(0.54411...
`+`(`*`(0.1093e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t))))))), `*`(0.1193e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `*`(0.383e-7, `*`(exp(`+`(`-`(`*`(375.0459122, `*`(t))))))), `*`(0.54411...
`+`(`*`(0.1093e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t))))))), `*`(0.1193e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `*`(0.383e-7, `*`(exp(`+`(`-`(`*`(375.0459122, `*`(t))))))), `*`(0.54411...
`+`(`*`(0.1093e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t))))))), `*`(0.1193e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `*`(0.383e-7, `*`(exp(`+`(`-`(`*`(375.0459122, `*`(t))))))), `*`(0.54411...
`+`(`*`(0.1093e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t))))))), `*`(0.1193e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `*`(0.383e-7, `*`(exp(`+`(`-`(`*`(375.0459122, `*`(t))))))), `*`(0.54411...
`+`(`*`(0.1093e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t))))))), `*`(0.1193e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `*`(0.383e-7, `*`(exp(`+`(`-`(`*`(375.0459122, `*`(t))))))), `*`(0.54411...
`+`(`*`(0.3086e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t))))))), `*`(0.1434e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `*`(0.744e-7, `*`(exp(`+`(`-`(`*`(375.0459122, `*`(t))))))), `*`(0.4097e...
`+`(`*`(0.3086e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t))))))), `*`(0.1434e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `*`(0.744e-7, `*`(exp(`+`(`-`(`*`(375.0459122, `*`(t))))))), `*`(0.4097e...
`+`(`*`(0.3086e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t))))))), `*`(0.1434e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `*`(0.744e-7, `*`(exp(`+`(`-`(`*`(375.0459122, `*`(t))))))), `*`(0.4097e...
`+`(`*`(0.3086e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t))))))), `*`(0.1434e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `*`(0.744e-7, `*`(exp(`+`(`-`(`*`(375.0459122, `*`(t))))))), `*`(0.4097e...
`+`(`*`(0.3086e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t))))))), `*`(0.1434e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `*`(0.744e-7, `*`(exp(`+`(`-`(`*`(375.0459122, `*`(t))))))), `*`(0.4097e...
`+`(`*`(0.3086e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t))))))), `*`(0.1434e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `*`(0.744e-7, `*`(exp(`+`(`-`(`*`(375.0459122, `*`(t))))))), `*`(0.4097e...
`+`(`*`(0.3086e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t))))))), `*`(0.1434e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `*`(0.744e-7, `*`(exp(`+`(`-`(`*`(375.0459122, `*`(t))))))), `*`(0.4097e...
`+`(`*`(0.5018e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t))))))), `*`(0.15151e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `*`(0.10967e-6, `*`(exp(`+`(`-`(`*`(375.0459122, `*`(t))))))), `*`(0.29...
`+`(`*`(0.5018e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t))))))), `*`(0.15151e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `*`(0.10967e-6, `*`(exp(`+`(`-`(`*`(375.0459122, `*`(t))))))), `*`(0.29...
`+`(`*`(0.5018e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t))))))), `*`(0.15151e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `*`(0.10967e-6, `*`(exp(`+`(`-`(`*`(375.0459122, `*`(t))))))), `*`(0.29...
`+`(`*`(0.5018e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t))))))), `*`(0.15151e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `*`(0.10967e-6, `*`(exp(`+`(`-`(`*`(375.0459122, `*`(t))))))), `*`(0.29...
`+`(`*`(0.5018e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t))))))), `*`(0.15151e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `*`(0.10967e-6, `*`(exp(`+`(`-`(`*`(375.0459122, `*`(t))))))), `*`(0.29...
`+`(`*`(0.5018e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t))))))), `*`(0.15151e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `*`(0.10967e-6, `*`(exp(`+`(`-`(`*`(375.0459122, `*`(t))))))), `*`(0.29...
`+`(`*`(0.5018e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t))))))), `*`(0.15151e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `*`(0.10967e-6, `*`(exp(`+`(`-`(`*`(375.0459122, `*`(t))))))), `*`(0.29...
`+`(`*`(0.5018e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t))))))), `*`(0.15151e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `*`(0.10967e-6, `*`(exp(`+`(`-`(`*`(375.0459122, `*`(t))))))), `*`(0.29...
`+`(`-`(`*`(0.3350891648e13, `*`(delta))), `*`(0.5661999999e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t))))))), `*`(0.1542133333e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `*`(0.1214266667e-6, ...
`+`(`-`(`*`(0.3350891648e13, `*`(delta))), `*`(0.5661999999e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t))))))), `*`(0.1542133333e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `*`(0.1214266667e-6, ...
`+`(`-`(`*`(0.3350891648e13, `*`(delta))), `*`(0.5661999999e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t))))))), `*`(0.1542133333e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `*`(0.1214266667e-6, ...
`+`(`-`(`*`(0.3350891648e13, `*`(delta))), `*`(0.5661999999e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t))))))), `*`(0.1542133333e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `*`(0.1214266667e-6, ...
`+`(`-`(`*`(0.3350891648e13, `*`(delta))), `*`(0.5661999999e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t))))))), `*`(0.1542133333e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `*`(0.1214266667e-6, ...
`+`(`-`(`*`(0.3350891648e13, `*`(delta))), `*`(0.5661999999e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t))))))), `*`(0.1542133333e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `*`(0.1214266667e-6, ...
`+`(`-`(`*`(0.3350891648e13, `*`(delta))), `*`(0.5661999999e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t))))))), `*`(0.1542133333e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `*`(0.1214266667e-6, ...
`+`(`-`(`*`(0.3350891648e13, `*`(delta))), `*`(0.5661999999e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t))))))), `*`(0.1542133333e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `*`(0.1214266667e-6, ...
(19)
 

We obtain the semianalytical solution for the concentration profile as a function of dimensionless current density, δ.  Concentration profiles can be plotted specifying values for δ. 

> pp:=plot([seq(subs(delta=1,u[i](t)),i=0..N+1)],t=0..0.4);
 

PLOT(CURVES([[0., -.163574218750000000], [0.871886166666666594e-2, -.163574218750000000], [0.163050965833333346e-1, -.164062500000000000], [0.248366111666666682e-1, -.163574218750000000], [0.334246781... (20)
 

> pt:=textplot([[0.25,evalf(subs(t=0.25,delta=1,u[0](t))),typeset(u[0],"(t)"),align=above],seq([0.25,evalf(subs(t=0.25,delta=1,u[i](t))),typeset(u[i],"(t)"),align=below],i=1..N+1)]);
 

PLOT(TEXT([.25, 0.], _TYPESET(u[0], (21)
 

> display([pp,pt],thickness=4,title="Figure Exp. 5.7",axes=boxed,labels=[t,"u"]);
 

Plot_2d
 

> pp:=plot([seq(subs(delta=0.1,u[i](t)),i=0..N+1)],t=0..0.4);
 

PLOT(CURVES([[0., -0.162963867187500000e-1], [0.871886166666666594e-2, -0.163574218750000000e-1], [0.163050965833333346e-1, -0.163574218750000000e-1], [0.248366111666666682e-1, -0.163574218750000000e-... (22)
 

> pt:=textplot([[0.25,evalf(subs(t=0.25,delta=0.1,u[0](t))),typeset(u[0],"(t)"),align=above],seq([0.25,evalf(subs(t=0.25,delta=0.1,u[i](t))),typeset(u[i],"(t)"),align=below],i=1..N+1)]);
 

PLOT(TEXT([.25, 0.], _TYPESET(u[0], (23)
 

> display([pp,pt],thickness=4,title="Figure Exp. 5.8",axes=boxed,labels=[t,"u"]);
 

Plot_2d
 

> tf:=0.4;
 

.4 (24)
 

We observe that as δ decreases, the time taken for discharge (the concentration to decrease from 1 to 0) increases.  A three dimensional plot for the concentration profile can be made as follows: 

> M:=30;
 

30 (25)
 

> T1:=[seq(tf*i/M,i=0..M)];
 

[0., 0.1333333333e-1, 0.2666666667e-1, 0.4000000000e-1, 0.5333333333e-1, 0.6666666667e-1, 0.8000000000e-1, 0.9333333333e-1, .1066666667, .1200000000, .1333333333, .1466666667, .1600000000, .1733333333...
[0., 0.1333333333e-1, 0.2666666667e-1, 0.4000000000e-1, 0.5333333333e-1, 0.6666666667e-1, 0.8000000000e-1, 0.9333333333e-1, .1066666667, .1200000000, .1333333333, .1466666667, .1600000000, .1733333333...
[0., 0.1333333333e-1, 0.2666666667e-1, 0.4000000000e-1, 0.5333333333e-1, 0.6666666667e-1, 0.8000000000e-1, 0.9333333333e-1, .1066666667, .1200000000, .1333333333, .1466666667, .1600000000, .1733333333...
[0., 0.1333333333e-1, 0.2666666667e-1, 0.4000000000e-1, 0.5333333333e-1, 0.6666666667e-1, 0.8000000000e-1, 0.9333333333e-1, .1066666667, .1200000000, .1333333333, .1466666667, .1600000000, .1733333333...
[0., 0.1333333333e-1, 0.2666666667e-1, 0.4000000000e-1, 0.5333333333e-1, 0.6666666667e-1, 0.8000000000e-1, 0.9333333333e-1, .1066666667, .1200000000, .1333333333, .1466666667, .1600000000, .1733333333...
(26)
 

> PP:=matrix(N+2,M+1);
 

array( 1 .. 12, 1 .. 31, [ ] ) (27)
 

> for i from 1 to N+2 do PP[i,1]:=evalf(subs(x=(i-1)*h,rhs(IC)));od:
 

> for i from 1 to N+2 do for j from 2 to M+1 do PP[i,j]:=evalf(subs(t=T1[j],subs(delta=1,u[i-1](t))));od;od:
 

> plotdata := [seq([ seq([(i-1)*h,T1[j],PP[i,j]], i=1..N+2)], j=1..M+1)]:
 

> surfdata( plotdata, axes=boxed, title="Figure Exp. 5.9",labels=[x,t,u],orientation=[45,45]);
 

Plot
 

Electrochemical behavior of the electrode depends on the surface concentration given by: 

> u[N+1](t);
 

`+`(`-`(`*`(0.3350891648e13, `*`(delta))), `*`(0.5661999999e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t))))))), `*`(0.1542133333e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `*`(0.1214266667e-6, ...
`+`(`-`(`*`(0.3350891648e13, `*`(delta))), `*`(0.5661999999e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t))))))), `*`(0.1542133333e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `*`(0.1214266667e-6, ...
`+`(`-`(`*`(0.3350891648e13, `*`(delta))), `*`(0.5661999999e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t))))))), `*`(0.1542133333e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `*`(0.1214266667e-6, ...
`+`(`-`(`*`(0.3350891648e13, `*`(delta))), `*`(0.5661999999e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t))))))), `*`(0.1542133333e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `*`(0.1214266667e-6, ...
`+`(`-`(`*`(0.3350891648e13, `*`(delta))), `*`(0.5661999999e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t))))))), `*`(0.1542133333e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `*`(0.1214266667e-6, ...
`+`(`-`(`*`(0.3350891648e13, `*`(delta))), `*`(0.5661999999e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t))))))), `*`(0.1542133333e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `*`(0.1214266667e-6, ...
`+`(`-`(`*`(0.3350891648e13, `*`(delta))), `*`(0.5661999999e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t))))))), `*`(0.1542133333e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `*`(0.1214266667e-6, ...
`+`(`-`(`*`(0.3350891648e13, `*`(delta))), `*`(0.5661999999e-7, `*`(exp(`+`(`-`(`*`(470.8971724, `*`(t))))))), `*`(0.1542133333e-6, `*`(exp(`+`(`-`(`*`(433.1166635, `*`(t))))))), `*`(0.1214266667e-6, ...
(28)
 

> plot3d(u[N+1](t),delta=0..1,t=0..1,axes=boxed,title="Figure Exp. 5.10",view=[0..5,0..1,0..1],orientation=[0,90],labels=[delta,t,"us"]);
 

Plot
 

For low values of δ, the surface concentration remains close to 1, and as δ decrease, the surface concentration depletes faster.  Accuracy can be increased by increasing the number of node points. 

>