ME 303 Project 2 Solution
M.M. Yovanovich
PROJ2S99SOL2.MWS
Project 2 Solution.
Alternative solution of the problem of Project 2.
The Maple worksheet follows closely the procedure one would use to get the solution by paper and pencil.
> restart:
System parameter values.
> syspar:= (D=5/1000, L=100/1000, k=80, S=2e6, TL=70, Tinfty=20, alpha=12e-6);
> assume(S>0, k>0, alpha>0):
Nonhomogeneous PDE.
> PDE:= diff(theta(x,t),x$2)+ S/k - 1/alpha*diff(theta(x,t),t) = 0;
Separation of nonhomogeneous PDE into nonhomgeneous ODE and homogeneous PDE.
> theta(x,t):= v(x) + w(x,t);
> PDE2:= PDE;
Steady-state solution.
> ode:= diff(v(x),x$2) + S/k=0;
> solode:= dsolve(ode, v(x));
> bc1:= simplify(subs(x=0, diff(rhs(solode),x)))=0;
> bc2:=subs(x=L, rhs(solode)) = thetaL;
> consts:= solve({bc1,bc2},{_C1,_C2});
> assign(consts):
> expand(solode);
Solution of homogeneous PDE.
> PDE2:= diff(w(x,t),x$2) -1/alpha*diff(w(x,t),t) = 0;
Separation of Variables Method.
> w(x,t):= X(x)*T(t);
> PDE3:= expand(PDE2/w(x,t));
Solution of separated spatial ODE.
> odeX:= diff(X(x),x$2) + lambda^2*X(x) = 0;
> assume(lambda>0):
> solodeX:= dsolve(odeX, X(x));
> bc0:= simplify(subs(x=0, diff(rhs(solodeX),x)))=0;
> _C4:= 0;
> solodeX;
> subs(x=L, rhs(solodeX)) = 0;
Since the constant of integration cannot be set to zero (this gives a trivial solution), we must set . This relation gives us the eigenvalues , for all positive integers.
The spatial solution consists of cosines.
Solution of the time ODE.
> odeT:= diff(T(t),t) + lambda^2*alpha*T(t)=0;
> solodeT:= dsolve(odeT, T(t));
Auxiliary transient solution.
> w:= C*exp(-lambda^2*alpha*t)*cos(lambda*x);
Fourier coefficients for temperature are based on the initial condition.
> v:= expand(rhs(solode));
> Cn:= 2/L*Int(-v*cos(lambda*x),x=0..L);
> #thetaL:= TL-Tinfty;
> Cn:= expand(value(Cn));
Set .
> Cn:= subs(cos(lambda*L)=0, Cn);
Compute the first two Fourier coefficients.
> C1:= subs(lambda = (2*n-1)*Pi/(2*L),thetaL = TL - Tinfty,syspar, n=1, Cn): evalf(%);
> C2:= subs(lambda = (2*n-1)*Pi/(2*L),thetaL = TL - Tinfty,syspar, n=2, Cn): evalf(%);
Fourier coefficients for instantaneous heat flow rate through boundary at .
The Fourier coefficients are found from .
> En:= -lambda*Cn*sin(lambda*L);
Heat flow rates.
Steady-state heat flow rate through .
> QL1:= -k*A*subs(x=L, diff(v,x));
Transient heat flow rate through .
> QL2:= -k*A*En*exp(-(lambda*L)^2*tau);
> A:= Pi*D^2/4;
Calculation of steady-state heat flow rate for given system parameter values.
> QL11:= evalf(subs(syspar, QL1));
Calculation of transient heat flow rate for given system parameter values.
Use the first 200 terms for the summation. Also set the dimensionless time.
>
nmax:= 200:
QL22:= sum(evalf(subs(lambda = (2*n-1)*Pi/(2*L), thetaL = TL - Tinfty, syspar, QL2)),n=1..nmax):
Compute the heat transfer rates for the three dimensionless times.
> Q1:= QL11+ evalf(subs(tau=0.01, QL22));
> Q2:= QL11+evalf(subs(tau=0.1, QL22));
> Q3:= QL11+evalf(subs(tau=1, QL22));
Computation of the Fourier coefficients.
> Cns:= evalf([seq(subs(thetaL=TL-Tinfty, lambda = (2*n-1)*Pi/(2*L), syspar, Cn),n=1..nmax)]):
> Cns[1]; Cns[nmax];
Steady-state solution.
> v;
Steady-state temperature for given system parameter values.
> v:=subs(thetaL = TL- Tinfty, syspar, subs(x=L*xi, v));
> plot(v,xi=0..1);
Transient temperature distributions .
>
tau:= 'tau':
theta:= v + sum( Cns[n]*exp(-((2*n-1)*Pi/2)^2*tau)*cos((2*n-1)*Pi/2*xi), n=1..nmax):
Define the temperature distribution for the three dimensionless times.
> nmax:= 200:
>
T1:= subs(tau=0.01, thetaL = TL-Tinfty, syspar, v+
sum(subs( lambda = (2*n-1)*Pi/(2*L), Cn*exp(-lambda^2*L^2*tau)*cos(lambda*L*xi)), n=1..nmax)) + 20:
>
T2:= subs(tau=0.1, thetaL = TL-Tinfty, syspar, v+
sum(subs( lambda = (2*n-1)*Pi/(2*L), Cn*exp(-lambda^2*L^2*tau)*cos(lambda*L*xi)), n=1..nmax)) + 20:
>
T3:= subs(tau=1, thetaL = TL-Tinfty, syspar, v+
sum(subs(lambda = (2*n-1)*Pi/(2*L), Cn*exp(-lambda^2*L^2*tau)*cos(lambda*L*xi)), n=1..nmax)) + 20:
Plot of transient and steady-state temperature distributions.
Plot the three transient solutions and the steady-state solution..
> plot({T1, T2, T3, v+20}, xi=0..1);