Section 18.4 Diffusion with Homogeneous Chemical Reaction
>  restart;
The area for transport is constant: call it S as BS&L do.
>  WA:=z->NAz(z)*S; Mass flow at z
>  eq:=WA(z)-WA(z+dz)+R(z)*S*dz; Mass balance where R is the rate of production of A by chemical reaction: mols/(time*volume)
>  R:=z->-kppp*cA(z); the reaction rate. kppp is the reaction rate constant per volume.
>  deq:=-limit(eq/(S*dz),dz=0)=0; eq. 18.4-2
>  NAz:=z->-DAB*D(cA)(z); eq. 18.4-3 for c constant and NBz=0.
>  -deq; eq. 18.4-4
>  with(PDEtools,dchange);
>  tr:={cA=Gam*CA0,z=zeta*L};kppp:=phi^2/L^2*DAB;
>  deq:=simplify(deq,assume=positive);
>  newde:=-simplify(L^2*dchange(tr,deq,[Gam(zeta),zeta])/DAB/CA0); eq.18.4-7
[Maple Math]
>  s:=dsolve({newde,Gam(0)=1,D(Gam)(1)=0},Gam(zeta)):
>  assign(s);
>  Gam:=unapply(Gam(zeta),zeta); eq. 18.4-9
>  Gbook:=zeta->cosh(phi*(1-zeta))/cosh(phi);
>  simplify(Gam(zeta)-Gbook(zeta));
>  expand(%); The right hand form in eq. 18.4-9 is also correct.
[Maple Math]
>  AvgG:=int(Gam(zeta),zeta=0...1);
>  simplify(convert(AvgG,trig));
>  %-tanh(phi)/phi;  Subtracting off 18.4-11
>  simplify(%); The average value of cA/cA0 is tanh(phi)/phi.
[Maple Math]
>  cA:=cA0*Gam(z/L):cA:=unapply(cA,z); phi=sqrt(kppp*L^2/DAB)
>  D(cA)(0);
>  simplify(NAz(0)); This agrees with eq. 18.4-12
[Maple Math]
>  plot(AvgG,phi=0...2,title="Average value of cA/cA0 vs sqrt(kppp*L^2/DAB)");
[Maple Plot]
>  plot(NAz(0)*L/DAB/cA0,phi=0...2,title="L*NAz(0)/(CA0*DAB) vs sqrt(kppp*L^2/DAB)");
[Maple Plot]