# Solving Heat Equation with Non-Homogeneous BCs 2: Time-Dependent BCs

Consider the heat IBVP:
\begin{align*}
&u_t=\alpha^2 u_{xx},\ 0<x<L,\ t>0\\
&{\rm BCs:}\ \left\{\begin{aligned}
&u(0,t)=g_1(t),\ t>0\\
&u_x(L,t)+hu(L,t)=g_2(t),
\end{aligned}
\right.\\
&{\rm IC:}\ u(x,0)=\phi(x),\ 0<x<L.
\end{align*}
Again we seek a solution of the form:
$$u(x,t)=S(x,t)+U(x,t)$$
where $S(x,t)$ satisfies the non-homogeneous BCs:
\begin{align*}
S(0,t)&=g_1(t)\ \ \ \ \ (1)\\
S_x(L,t)+hS(L,t)&=g_2(t)
\end{align*}
Suppose that
$$S(x,t)=A(t)x+B(t)$$
From the BCs (1) we obtain
$$S(x,t)=\frac{g_2(t)-hg_1(t)}{1+hL}x+g_1(t)$$
$U(x,t)$ satisfies the semi-homogeneous heat IBVP:
\begin{align*}
&U_t=\alpha^2 U_{xx}-S_t,\ 0<x<L,\ t>0\\
&{\rm BCs:}\ \left\{\begin{aligned}
&U(0,t)=0,\ t>0\\
&U_x(L,t)+hU(L,t)=0,
\end{aligned}
\right.\\
&{\rm IC:}\ U(x,0)=\phi(x)-S(x,0),\ 0<x<L.
\end{align*}
Since $u(x,t)\approx S(x,t)$ for large time, the eventual temperature is $\lim_{t\to\infty}S(x,t)$. The homogeneous BCs are pretty much similar to the ones we studied here but the heat equation is non-homogeneous. Such a problem (non-homogeneous heat equation + homogeneous BCs) is called a semi-homogeneous IBVP. Unfortunately, we cannot solve the semi-homogenous heat IBVP yet. We will discuss how to solve semi-homogeneous IBVPs later.

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

Solution: Let $u(x,t)=S(x,t)+U(x,t)$
where $S(x,t)=A(t)x+B(t)$ satisfies the BCs. Then
$S(x,t)=(ae^{-t}-1)x+1$. $U(x,t)$ satisfies the homogeneous heat IBVP:
\begin{align*}
&U_t=\alpha^2 U_{xx},\ 0<x<1,\ t>0\\
&{\rm BCs:}\ \left\{\begin{aligned}
&U(0,t)=0,\ t>0\\
&U(1,t)=0,
\end{aligned}
\right.\\
&{\rm IC:}\ U(x,0)=-(a-1)x-1,\ 0<x<1.
\end{align*}
We know how to solve this problem and the solution $U(x,t)$ is given by
$$U(x,t)=\sum_{n=1}^\infty A_n e^{-\alpha^2n^2\pi^2t}\sin n\pi x$$
where for each $n=1,2,\cdots$
\begin{align*}
A_n&=2\int_0^1[-(a-1)x-1]\sin n\pi xdx\\
&=2\frac{a(-1)^n-1}{n\pi}
\end{align*}
That is,
$$U(x,t)=2\sum_{n=1}^\infty\frac{a(-1)^n-1}{n\pi}e^{-\alpha^2n^2\pi^2t}\sin n\pi x$$
Therefore, the solution to the original heat problem is
$$u(x,t)=(ae^{-t}-1)x+1+2\sum_{n=1}^\infty\frac{[a(-1)^n-1]}{n\pi}e^{-\alpha^2 n^2\pi^2 t}\sin n\pi x.$$
The eventual temperature is
$$\lim_{t\to\infty}S(x,t)=-x+1$$

References:

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