# The Semi-Homogeneous Heat Problem

In this lecture, we study how to solve the semi-homogeneous heat problem:
\begin{aligned} &u_t=\alpha^2 u_{xx}+F(x,t),\ 0<x<L,\ t>0\\ &{\rm BCs:}\ \left\{\begin{aligned} -k_1u_x(0,t)+h_1u(0,t)&=0,\ t>0\\ k_2u_x(L,t)+h_2u(L,t)&=0, \end{aligned} \right.\\ &{\rm IC:}\ u(x,0)=\phi(x),\ 0<x<L\ \ \ \ \ (1) \end{aligned}

We consider a solution of the form
$$u(x,t)=\sum_{n=0}^\infty T_n(t)X_n(x)$$
$$F(x,t)=\sum_{n=0}^\infty F_n(t)X_n(x)$$
Let $A_n:=T_n(0)$. Then
$$\phi(x)=\sum_{n=0}^\infty A_nX_n(x)$$
For each $n=0,1,2,\cdots$, $X_n(x)$ is the solution of the Sturm-Liouville problem:
\begin{aligned} &X_n^{\prime\prime}=-\lambda_n^2X_n\\ &{\rm BCs:}\ \left\{\begin{aligned} -k_1X_n'(0)+h_1X_n(0)&=0\\ k_2X_n'(L)+h_2X_n(L)&=0 \end{aligned} \right.\ \ \ \ \ (2) \end{aligned}
and $T_n(t)$ satisfies the first order ODE with initial condition:
\left\{\begin{aligned} \dot{T}_n+\lambda_n^2\alpha^2T_n=F_n\\ T_n(0)=A_n. \end{aligned} \right.\ \ \ \ \ (3)
Then $T_n(t)$ is given by
$$T_n(t)=\left[A_n+\int_0^t F_n(s)e^{\lambda_n^2\alpha^2 s}ds\right]e^{-\lambda_n^2\alpha^2 t}.$$
Finally, $F_n(t)$ and $A_n$ are to be determined by
\begin{align*}
F_n(t)&=\frac{1}{L_n}\int_0^L F(x,t)X_n(x)dx\ \ \ \ \ (3)\\
A_n&=\frac{1}{L_n}\int_0^L\phi(x)X_n(x)dx\ \ \ \ \ (4)
\end{align*}
As a summary we have the recipe for solving the semi-homogeneous heat IBVP (1):

1. Find the eigenvalue $\lambda_n$ and the corresponding eigenfunction $X_n$ by solving the Sturm-Liouville problem (2)
2. Find the coefficients $F_n(t)$ and $A_n$ using the formulae (4) and (5) respectively.
3. For each $n=0,1,2,\cdots$, find $T_n(t)$ using the formula (3)
4. Put all things together as $$u(x,t)=\sum_{n=0}^\infty T_n(t)X_n(x)$$

Example. Solve the semi-homogeneous heat IBVP:
\begin{align*}
&u_t=\alpha^2 u_{xx}+b\sin\pi x,\ 0<x<1,\ 0<t<\infty\\
&{\rm BCs:}\ \left\{\begin{aligned}
u(0,t)&=0,\ 0<t<\infty\\
u(1,t)&=0,
\end{aligned}
\right.\\
&{\rm IC:}\ u(x,0)=1,\ 0<x<1
\end{align*}

Solution:

Step 1. The eigenfunctions are
$$X_n(x)=\sin n\pi x,\ n=1,2,3,\cdot.$$

Step 2. \begin{align*}
F_n(t)&=2b\int_0^1\sin\pi x\sin n\pi xdx\\
&=\left\{\begin{array}{ccc}
b & {\rm if} & n=1\\
0 & {\rm otherwise}.\end{array}\right.\\
A_n&=2\int_0^1\sin n\pi xdx\\
&=\frac{2[1-(-1)^n]}{n\pi}
\end{align*}
For $n=1,2,3,\cdots$, $A_{2n}=0$ and $A_{2n-1}=\frac{4}{2(n-1)\pi}$

Step 3. \begin{align*}
T_1(t)&=\left[\frac{4}{\pi}+\int_0^t be^{\alpha^2\pi^2s}ds\right]e^{-\alpha^2\pi^2t}\\
&=\frac{b}{\alpha^2\pi^2}+\left(\frac{4}{\pi}-\frac{b}{a^2\pi^2}\right)e^{-\alpha^2\pi^2t}
\end{align*}
For $n=2,3,\cdots,$
$$T_{2n-1}(t)=\frac{4}{(2n-1)\pi}e^{-\alpha^2(2n-1)^2\pi^2t}$$

Step 4. The solution is therefore
\begin{align*}
u(x,t)=\left[\frac{b}{\alpha^2\pi^2}+\left(\frac{4}{\pi}-\frac{b}{a^2\pi^2}\right)e^{-\alpha^2\pi^2t}\right]\sin\pi x\\
+\sum_{n=2}^\infty \frac{4}{(2n-1)\pi}e^{-\alpha^2(2n-1)^2\pi^2t}\sin(2n-1)\pi x
\end{align*}

The eventual temperature is
$$\lim_{t\to\infty}u(x,t)=\frac{b}{\alpha^2\pi^2}\sin\pi x$$

References:

David Betounes, Partial Differential Equations for Computational Science with Maple and Vector Analysis, TELOS, Springer-Verlag