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);

[Maple Math]

> 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;

[Maple Math]

Separation of nonhomogeneous PDE into nonhomgeneous ODE and homogeneous PDE.

> theta(x,t):= v(x) + w(x,t);

[Maple Math]

> PDE2:= PDE;

[Maple Math]

Steady-state solution.

> ode:= diff(v(x),x$2) + S/k=0;

[Maple Math]

> solode:= dsolve(ode, v(x));

[Maple Math]

> bc1:= simplify(subs(x=0, diff(rhs(solode),x)))=0;

[Maple Math]

> bc2:=subs(x=L, rhs(solode)) = thetaL;

[Maple Math]

> consts:= solve({bc1,bc2},{_C1,_C2});

[Maple Math]

> assign(consts):

> expand(solode);

[Maple Math]

Solution of homogeneous PDE.

> PDE2:= diff(w(x,t),x$2) -1/alpha*diff(w(x,t),t) = 0;

[Maple Math]

Separation of Variables Method.

> w(x,t):= X(x)*T(t);

[Maple Math]

> PDE3:= expand(PDE2/w(x,t));

[Maple Math]

Solution of separated spatial ODE.

> odeX:= diff(X(x),x$2) + lambda^2*X(x) = 0;

[Maple Math]

> assume(lambda>0):

> solodeX:= dsolve(odeX, X(x));

[Maple Math]

> bc0:= simplify(subs(x=0, diff(rhs(solodeX),x)))=0;

[Maple Math]

> _C4:= 0;

[Maple Math]

> solodeX;

[Maple Math]

> subs(x=L, rhs(solodeX)) = 0;

[Maple Math]

Since the constant of integration cannot be set to zero (this gives a trivial solution), we must set [Maple Math] . This relation gives us the eigenvalues [Maple Math] , 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;

[Maple Math]

> solodeT:= dsolve(odeT, T(t));

[Maple Math]

Auxiliary transient solution.

> w:= C*exp(-lambda^2*alpha*t)*cos(lambda*x);

[Maple Math]

Fourier coefficients for temperature are based on the initial condition.

> v:= expand(rhs(solode));

[Maple Math]

> Cn:= 2/L*Int(-v*cos(lambda*x),x=0..L);

[Maple Math]

> #thetaL:= TL-Tinfty;

> Cn:= expand(value(Cn));

[Maple Math]

Set [Maple Math] .

> Cn:= subs(cos(lambda*L)=0, Cn);

[Maple Math]

Compute the first two Fourier coefficients.

> C1:= subs(lambda = (2*n-1)*Pi/(2*L),thetaL = TL - Tinfty,syspar, n=1, Cn): evalf(%);

[Maple Math]

> C2:= subs(lambda = (2*n-1)*Pi/(2*L),thetaL = TL - Tinfty,syspar, n=2, Cn): evalf(%);

[Maple Math]

Fourier coefficients for instantaneous heat flow rate through boundary at [Maple Math] .

The Fourier coefficients are found from [Maple Math] .

> En:= -lambda*Cn*sin(lambda*L);

[Maple Math]

Heat flow rates.

Steady-state heat flow rate through [Maple Math] .

> QL1:= -k*A*subs(x=L, diff(v,x));

[Maple Math]

Transient heat flow rate through [Maple Math] .

> QL2:= -k*A*En*exp(-(lambda*L)^2*tau);

[Maple Math]

> A:= Pi*D^2/4;

[Maple Math]

Calculation of steady-state heat flow rate for given system parameter values.

> QL11:= evalf(subs(syspar, QL1));

[Maple Math]

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));

[Maple Math]

> Q2:= QL11+evalf(subs(tau=0.1, QL22));

[Maple Math]

> Q3:= QL11+evalf(subs(tau=1, QL22));

[Maple Math]

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];

[Maple Math]

[Maple Math]

Steady-state solution.

> v;

[Maple Math]

Steady-state temperature for given system parameter values.

> v:=subs(thetaL = TL- Tinfty, syspar, subs(x=L*xi, v));

[Maple Math]

> plot(v,xi=0..1);

[Maple Plot]

Transient temperature distributions [Maple Math] .

> 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);

[Maple Plot]