Question:Coupled pde & ode solution in maple

Question:Coupled pde & ode solution in maple

Maple 14

Hi everyone,

I have been  trying to solve a coupled system of 2 differencial equations, 1 PDEs with 1 ODE.

The code is below.

> restart;

> with(linalg):with(plots):
> PDE:=[diff(x(z,t),t)=(a/Pe)*diff(x(z,t),z\$2)-a*diff(x(z,t),z)-(1-epsilon)/epsilon*3*Bi*(x(z,t)-1)/(1-Bi*(1-1/ksi(z,t)))]:
> a=2:Pe=3:Bi=5:epsilon=0.85:

> ODE := [diff(ksi(z,t),t) = (b*Bi*x(z,t)-1)/ksi(z,t)^2/(1-Bi*(1-1/ksi(z,t)))]:
> IC1:=c(z,0)=0:
> IC2:=ksi(z,0)=1:
> bc2:=diff(x(z,t),z):
> bc1:=x(z,t)-1/pe*diff(x(z,t),z):
> N:=10:
> L:=1:
> dyduf:=1/2*(-x[2](t)-3*x[0](t)+4*x[1](t))/h:
> dydub:=1/2*(-x[N-1](t)+3*x[N+1](t)+4*x[N](t))/h:
> dydu:=1/2/h*(x[m+1](t)-x[m-1](t)):
> d2ydu2:=1/h^2*(x[m-1](t)-2*x[m](t)+x[m+1](t)):
> bc1:=subs(diff(x(z,t),z)=dyduf,x(z,t)=x[0](t),z=1,bc1):
> bc2:=subs(x(z,t)-1/pe*diff(x(z,t),z)=dydub,x(z,t)=x[N+1](t),t=0,bc2):
> eq[0]:=bc1:
> eq[N+1]:=bc2:
> eq[m]:=subs(diff(x(z,t),z\$2)=d2ydu2,diff(x(z,t),z)=dydu,diff(x(z,t),t)=dydu,x(z,t)=x[m](t),z=m*h,PDE):
> for i from 1 to N do eq[i]:=subs (m=i,eq[m]);od:
> x[0](t):=(solve(eq[0],x[0](t)));

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

> for i from 1 to N do eq[i]:=eval(eq[i]);od:
> eqs:=[seq((eq[i]),i=1..N)]:
> Y:=[seq(x[i](t),i=1..N)];

> A:=genmatrix(eqs,Y,'B1'):
Error, (in linalg:-genmatrix) equations are not linear

> evalm(B1);

[B1[1], B1[2], B1[3], B1[4], B1[5], B1[6], B1[7], B1[8], B1[9],

B1[10]]

> B:=matrix(N,1):for i to N do B[i,1]:=B1[i]:od:evalm(B);

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

> A:=map(eval,A);

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

> mat:=exponential(A,t);
Error, (in linalg:-matfunc) input must be a matrix

> mat:=map(evalf,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);
Error, invalid input: rhs received IC, which is not valid for its 1st argument, expr

> s1:=evalm(Y0+inverse(A)&*b):
Error, (in linalg:-inverse) expecting a matrix

> Y:=evalm(mat&*s1-inverse(A)&*b):
Error, (in linalg:-inverse) expecting a matrix

> Y:=map(simplify,Y):
> Digits:=5;

Digits := 5

> for i from 1 to N do x[i](t):=evalf((Y[i,1]));od:
Error, invalid subscript selector

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

> setcolors(["Red", "Blue", "LimeGreen", "Goldenrod", "maroon",
> "DarkTurquoise", "coral", "aquamarine", "magenta", "khaki", "sienna",
> "orange", "yellow", "gray"]);

["Red", "LimeGreen", "Goldenrod", "Blue", "MediumOrchid",

"DarkTurquoise"]

> pp:=plot([seq(x[i](t),i=0..N+1)],t=0..10,thickness=4);pt:=textplot([[0.28,0.15,typeset("Follow the arrow: ",x[0],"(t), ..., ",
> x[N+1],"(t).")]]):
Warning, unable to evaluate the functions to numeric values in the region; see the plotting command's help page to ensure the calling sequence is correct

pp := PLOT(THICKNESS(4), AXESLABELS(t, ""),

VIEW(0. .. 10., DEFAULT))

> display([pp,pt,arw],title="Figure 5.13",axes=boxed,labels=[t,"x"]);
Error, (in plots:-display) expecting plot structures but received: [arw]