Boundaries in heat equation

I have this heat equation:

$u_t = 9u_{xx} - 7u + f(x,t),$

$f(x,t) = 1; 0 < x < l; 0 < t < T $

$u(x,0) = 6x^2 - 5x +2$

$u(0,t) = 3t + 2$

$u(l,t) = t + 3$

$l = 1$

My problem is that I know how to solve when IC and BC are zeros. Maybe someone knows (or can point me to) a detailed method to transform(?) my equation and what to do then?
Thank you very much.


Solution 1:

Find any function $h(x,t)$ such that $h(0,t)=u(0,t)$ and $h(l,t)=u(l,t)$. Then make the change of variables $u=v+h$. This will give you an equation for $v$ with homogeneous boundary conditions (but a different initial value $v(x,0)$).

Solution 2:

Approach $1$:

Let $u(x,t)=U(x,t)+\dfrac{1}{7}$ ,

Then $u_t(x,t)=U_t(x,t)$

$u_x(x,t)=U_x(x,t)$

$u_{xx}(x,t)=U_{xx}(x,t)$

$\therefore U_t(x,t)=9U_{xx}(x,t)-7\left(U(x,t)+\dfrac{1}{7}\right)+1$

$U_t(x,t)=9U_{xx}(x,t)-7U(x,t)$

Of course we use separation of variables:

Let $U(x,t)=X(x)T(t)$ ,

Then $X(x)T'(t)=9X''(x)T(t)-7X(x)T(t)$

$X(x)T'(t)=(9X''(x)-7X(x))T(t)$

$\dfrac{T'(t)}{T(t)}=\dfrac{9X''(x)-7X(x)}{X(x)}=-9\pi^2s^2-7$

$\begin{cases}\dfrac{T'(t)}{T(t)}=-9\pi^2s^2-7\\X''(x)+\pi^2s^2X(x)=0\end{cases}$

$\begin{cases}T(t)=c_3(s)e^{-t(9\pi^2s^2+7)}\\X(x)=\begin{cases}c_1(s)\sin\pi xs+c_2(s)\cos\pi xs&\text{when}~s\neq0\\c_1x+c_2&\text{when}~s=0\end{cases}\end{cases}$

$\therefore u(x,t)=c_1xe^{-7t}+c_2e^{-7t}+\dfrac{1}{7}+\sum\limits_{s=0}^\infty C_3(s)e^{-t(9\pi^2s^2+7)}\sin\pi xs+\sum\limits_{s=0}^\infty C_4(s)e^{-t(9\pi^2s^2+7)}\cos\pi xs$

In fact we cannot coordinate $u(0,t)=3t+2$ and $u(1,t)=t+3$ both unless they are both belongs to constant$\times e^{-7t}$ . So this approach fails.

Approach $2$:

Apply the method in http://maths.swan.ac.uk/staff/vl/pdes-course.pdf#page=38 , i.e. let $u(x,t)=v(x,t)+3t+2+x(1-2t)$ ,

Then $u_t(x,t)=v_t(x,t)+3-2x$

$u_x(x,t)=v_x(x,t)+1-2t$

$u_{xx}(x,t)=v_{xx}(x,t)$

$\therefore v_t(x,t)+3-2x=9v_{xx}(x,t)-7(v(x,t)+3t+2+x(1-2t))+1$

$v_t(x,t)+3-2x=9v_{xx}(x,t)-7v(x,t)-21t-14+14xt-7x+1$

$v_t(x,t)-9v_{xx}(x,t)+7v(x,t)=(14t-5)x-21t-16$

with $v(0,t)=0$ , $v(1,t)=0$ and $v(x,0)=6x^2-6x$

Let $v(x,t)=\sum\limits_{s=1}^\infty C(s,t)\sin\pi xs$ so that it automatically satisfies $v(0,t)=0$ and $v(1,t)=0$ ,

Then $\sum\limits_{s=1}^\infty C_t(s,t)\sin\pi xs+9\sum\limits_{s=1}^\infty\pi^2s^2C(s,t)\sin\pi xs+7\sum\limits_{s=1}^\infty C(s,t)\sin\pi xs=(14t-5)x-21t-16$

$\sum\limits_{s=1}^\infty(C_t(s,t)+(9\pi^2s^2+7)C(s,t))\sin\pi xs=(14t-5)x-21t-16$

For $0<x<1$ ,

$\sum\limits_{s=1}^\infty(C_t(s,t)+(9\pi^2s^2+7)C(s,t))\sin\pi xs=\sum\limits_{s=1}^\infty2\int_0^1((14t-5)x-21t-16)\sin\pi sx~dx~\sin\pi xs$

$\sum\limits_{s=1}^\infty(C_t(s,t)+(9\pi^2s^2+7)C(s,t))\sin\pi xs=\sum\limits_{s=1}^\infty\dfrac{(14(-1)^s-42)t+42(-1)^s-32}{\pi s}\sin\pi xs$

$\therefore C_t(s,t)+(9\pi^2s^2+7)C(s,t)=\dfrac{(14(-1)^s-42)t+42(-1)^s-32}{\pi s}$

$(e^{(9\pi^2s^2+7)t}C(s,t))_t=\dfrac{((14(-1)^s-42)t+42(-1)^s-32)e^{(9\pi^2s^2+7)t}}{\pi s}$

$e^{(9\pi^2s^2+7)t}C(s,t)=\int\dfrac{((14(-1)^s-42)t+42(-1)^s-32)e^{(9\pi^2s^2+7)t}}{\pi s}dt$

$e^{(9\pi^2s^2+7)t}C(s,t)=F(s)+\dfrac{((14(-1)^s-42)t+42(-1)^s-32)e^{(9\pi^2s^2+7)t}}{\pi s(9\pi^2s^2+7)}-\dfrac{(14(-1)^s-42)e^{(9\pi^2s^2+7)t}}{\pi s(9\pi^2s^2+7)^2}$

$C(s,t)=F(s)e^{-t(9\pi^2s^2+7)}+\dfrac{(14(-1)^s-42)t+42(-1)^s-32}{\pi s(9\pi^2s^2+7)}-\dfrac{14(-1)^s-42}{\pi s(9\pi^2s^2+7)^2}$

$\therefore v(x,t)=\sum\limits_{s=1}^\infty\biggl(F(s)e^{-t(9\pi^2s^2+7)}+\dfrac{(14(-1)^s-42)t+42(-1)^s-32}{\pi s(9\pi^2s^2+7)}-\dfrac{14(-1)^s-42}{\pi s(9\pi^2s^2+7)^2}\biggr)\sin\pi xs$

$v(x,0)=6x^2-6x$ :

$\sum\limits_{s=1}^\infty\biggl(F(s)+\dfrac{42(-1)^s-32}{\pi s(9\pi^2s^2+7)}-\dfrac{14(-1)^s-42}{\pi s(9\pi^2s^2+7)^2}\biggr)\sin\pi xs=6x^2-6x$

$F(s)+\dfrac{42(-1)^s-32}{\pi s(9\pi^2s^2+7)}-\dfrac{14(-1)^s-42}{\pi s(9\pi^2s^2+7)^2}=2\int_0^1(6x^2-6x)\sin\pi sx~dx=\dfrac{24(-1)^s-24}{\pi^3s^3}$

$F(s)=\dfrac{24(-1)^s-24}{\pi^3s^3}-\dfrac{42(-1)^s-32}{\pi s(9\pi^2s^2+7)}+\dfrac{14(-1)^s-42}{\pi s(9\pi^2s^2+7)^2}$

$\therefore v(x,t)=\sum\limits_{s=1}^\infty\biggl(\biggl(\dfrac{24(-1)^s-24}{\pi^3s^3}-\dfrac{42(-1)^s-32}{\pi s(9\pi^2s^2+7)}+\dfrac{14(-1)^s-42}{\pi s(9\pi^2s^2+7)^2}\biggr)e^{-t(9\pi^2s^2+7)}+\dfrac{(14(-1)^s-42)t+42(-1)^s-32}{\pi s(9\pi^2s^2+7)}-\dfrac{14(-1)^s-42}{\pi s(9\pi^2s^2+7)^2}\biggr)\sin\pi xs$

Hence $u(x,t)=3t+2+x(1-2t)+\sum\limits_{s=1}^\infty\biggl(\biggl(\dfrac{24(-1)^s-24}{\pi^3s^3}-\dfrac{42(-1)^s-32}{\pi s(9\pi^2s^2+7)}+\dfrac{14(-1)^s-42}{\pi s(9\pi^2s^2+7)^2}\biggr)e^{-t(9\pi^2s^2+7)}+\dfrac{(14(-1)^s-42)t+42(-1)^s-32}{\pi s(9\pi^2s^2+7)}-\dfrac{14(-1)^s-42}{\pi s(9\pi^2s^2+7)^2}\biggr)\sin\pi xs$