Example 8.1.mw

Example 8.1 

> restart:with(inttrans):with(plots):
 

The governing equation is entered here: 

>
 

> eq:=diff(u(x,t),t)+v*diff(u(x,t),x);
 

`+`(diff(u(x, t), t), `*`(v, `*`(diff(u(x, t), x)))) (1)
 

The initial and boundary conditions are entered here. 

> u(x,0):=1;
 

1 (2)
 

> bc1:=u(0,t)=0;
 

u(0, t) = 0 (3)
 

The governing equation and the boundary condition are converted to the Laplace domain: 

> eqs:=laplace(eq,t,s);
 

`+`(`*`(s, `*`(laplace(u(x, t), t, s))), `-`(1), `*`(v, `*`(diff(laplace(u(x, t), t, s), x)))) (4)
 

> eqs:=subs(laplace(u(x,t),t,s)=U(x),eqs);
 

`+`(`*`(s, `*`(U(x))), `-`(1), `*`(v, `*`(diff(U(x), x)))) (5)
 

> bc1:=laplace(bc1,t,s);
 

laplace(u(0, t), t, s) = 0 (6)
 

> bc1:=subs(laplace(u(0,t),t,s)=U(0),bc1);
 

U(0) = 0 (7)
 

> U(x):=rhs(dsolve({eqs,bc1},U(x)));
 

`+`(`/`(1, `*`(s)), `-`(`/`(`*`(exp(`+`(`-`(`/`(`*`(s, `*`(x)), `*`(v)))))), `*`(s)))) (8)
 

The solution obtained in the Laplace domain is converted to the time domain here: 

> u:=invlaplace(U(x),s,t);
 

`+`(1, `-`(invlaplace(`/`(`*`(exp(`+`(`-`(`/`(`*`(s, `*`(x)), `*`(v)))))), `*`(s)), s, t))) (9)
 

The following plots can be obtained: 

> plot3d(subs(v=1.,u),x=0..1,t=1e-6..1,axes=boxed,title="Figure Exp. 8.1.",labels=[x,t,"u"],orientation=[-137,50]);
 

Plot
 

> plot([subs(v=1,t=0.1,u),subs(v=1,t=0.25,u),subs(v=1,t=0.5,u),subs(v=1,t=1,u)],x=0..1,axes=boxed,title="Figure Exp. 8.2.",thickness=5,labels=[x,"u"]);
 

Plot_2d
 

>