1.1.6 Pure diffusion. Left end nonhomogeneous time dependent Neumann, right end at zero temperature

This 1D heat PDE has one end with boundary condition that is time dependent.\begin{align*} \frac{\partial u}{\partial t} & =k\frac{\partial ^{2}u}{\partial x^{2}}\qquad 0<x<L;t>0\\ u_{x}\left ( 0,t\right ) & =e^{t}\\ u\left ( L,t\right ) & =0\\ u\left ( x,0\right ) & =0 \end{align*}

Solution

Let\begin{align*} r\left ( x,t\right ) & =e^{t}x-Le^{t}\\ & =e^{t}\left ( x-L\right ) \end{align*}

Be some reference temperature distribution that only needs to satisfy the nonhomogeneous boundary conditions given. i.e. \(\frac{\partial r}{\partial x}\left ( 0,t\right ) =e^{t},r\left ( L,t\right ) =0\). Then the difference temperature distribution is\begin{equation} w\left ( x,t\right ) =u\left ( x,t\right ) -r\left ( x,t\right ) \tag{1} \end{equation} Since \(r\left ( x,t\right ) \) satisfies the nonhomogeneous B.C’s, then \(w\) satisfies the homogeneous B.C \(\frac{\partial w}{\partial x}\left ( 0,t\right ) =0,w\left ( L,t\right ) =0\).

Substituting \(u\left ( x,t\right ) =w\left ( x,t\right ) +r\left ( x,t\right ) \) back into the PDE \(\frac{\partial u}{\partial t}=k\frac{\partial ^{2}u}{\partial x^{2}}\) gives\begin{align} w_{t}+r_{t} & =k\left ( w_{xx}+r_{xx}\right ) \nonumber \\ w_{t}+e^{t}\left ( x-L\right ) & =kw_{xx}\nonumber \\ w_{t} & =kw_{xx}+e^{t}\left ( L-x\right ) \nonumber \\ & =kw_{xx}+Q\left ( x,t\right ) \tag{2} \end{align}

Where \(Q\left ( x,t\right ) =e^{t}\left ( L-x\right ) \). The method of eigenfunction expansion is now used to solve (2). Let \[ w\left ( x,t\right ) =\sum _{n=1}^{\infty }a_{n}\left ( t\right ) \Phi _{n}\left ( x\right ) \] Substituting this back into (2) gives\[ \sum _{n=1}^{\infty }a_{n}^{\prime }\left ( t\right ) \Phi _{n}\left ( x\right ) =k\sum _{n=1}^{\infty }a_{n}\left ( t\right ) \Phi _{n}^{\prime \prime }\left ( x\right ) +\sum _{n=1}^{\infty }q_{n}\left ( t\right ) \Phi _{n}\left ( x\right ) \] But \(\Phi _{n}^{\prime \prime }\left ( x\right ) =-\lambda _{n}\Phi _{n}\left ( x\right ) \) and the above reduces to\begin{equation} a_{n}^{\prime }\left ( t\right ) +k\lambda _{n}a_{n}\left ( t\right ) =q_{n}\left ( t\right ) \tag{3} \end{equation} But \(Q\left ( x,t\right ) =\sum _{n=1}^{\infty }q_{n}\left ( t\right ) \Phi _{n}\left ( x\right ) \), where \(\Phi _{n}\left ( x\right ) =\cos \left ( \sqrt{\lambda _{n}}x\right ) \) and \(\lambda _{n}=\left ( \frac{n\pi }{2L}\right ) ^{2}\) for \(n=1,3,5,\cdots \). Therefore\[ e^{t}\left ( L-x\right ) =\sum _{n=1}^{\infty }q_{n}\left ( t\right ) \cos \left ( \frac{n\pi }{2L}x\right ) \] Applying orthogonality\begin{align*} e^{t}\int _{0}^{L}\left ( L-x\right ) \cos \left ( \frac{n\pi }{2L}x\right ) dx & =\frac{L}{2}q_{n}\left ( t\right ) \\ q_{n}\left ( t\right ) & =\frac{2e^{t}}{L}\int _{0}^{L}\left ( L-x\right ) \cos \left ( \frac{n\pi }{2L}x\right ) dx\\ & =\frac{16Le^{t}\sin \left ( \frac{n\pi }{4}\right ) ^{2}}{n^{2}\pi ^{2}} \end{align*}

Hence (3) becomes\[ a_{n}^{\prime }\left ( t\right ) +k\left ( \frac{n\pi }{2L}\right ) ^{2}a_{n}\left ( t\right ) =\frac{16Le^{t}\sin \left ( \frac{n\pi }{4}\right ) ^{2}}{n^{2}\pi ^{2}}\] Solving for \(a_{n}\left ( t\right ) \) gives\[ a_{n}\left ( t\right ) =a_{n}\left ( 0\right ) e^{-k\left ( \frac{n\pi }{2L}\right ) ^{2}t}+\frac{64e^{t}L^{3}\sin \left ( \frac{n\pi }{4}\right ) ^{2}}{4L^{2}n^{2}\pi ^{2}+kn^{4}\pi ^{4}}\] Hence\begin{align*} w\left ( x,t\right ) & =\sum _{n=1}^{\infty }a_{n}\left ( t\right ) \Phi _{n}\left ( x\right ) \\ & =\sum _{n=1,3,5,\cdots }^{\infty }\left ( a_{n}\left ( 0\right ) e^{-k\left ( \frac{n\pi }{2L}\right ) ^{2}t}+\frac{64e^{t}L^{3}\sin \left ( \frac{n\pi }{4}\right ) ^{2}}{4L^{2}n^{2}\pi ^{2}+kn^{4}\pi ^{4}}\right ) \cos \left ( \frac{n\pi }{2L}x\right ) \end{align*}

At \(t=0\), the above becomes\[ w\left ( x,0\right ) =\sum _{n=1,3,5,\cdots }^{\infty }\left ( a_{n}\left ( 0\right ) +\frac{64L^{3}\sin \left ( \frac{n\pi }{4}\right ) ^{2}}{4L^{2}n^{2}\pi ^{2}+kn^{4}\pi ^{4}}\right ) \cos \left ( \frac{n\pi }{2L}x\right ) \] But \begin{align*} w\left ( x,0\right ) & =u\left ( x,0\right ) -r\left ( x,0\right ) \\ & =0-\left ( x-L\right ) \\ & =L-x \end{align*}

Therefore\[ L-x=\sum _{n=1,3,5,\cdots }^{\infty }\left ( a_{n}\left ( 0\right ) +\frac{64L^{3}\sin \left ( \frac{n\pi }{4}\right ) ^{2}}{4L^{2}n^{2}\pi ^{2}+kn^{4}\pi ^{4}}\right ) \cos \left ( \frac{n\pi }{2L}x\right ) \] Applying orthogonality\begin{align*} \int _{0}^{L}\left ( L-x\right ) \cos \left ( \frac{n\pi }{2L}x\right ) dx & =\left ( a_{n}\left ( 0\right ) +\frac{64L^{3}\sin \left ( \frac{n\pi }{4}\right ) ^{2}}{4L^{2}n^{2}\pi ^{2}+kn^{4}\pi ^{4}}\right ) \frac{L}{2}\\ a_{n}\left ( 0\right ) & =\frac{2}{L}\int _{0}^{L}\left ( L-x\right ) \cos \left ( \frac{n\pi }{2L}x\right ) dx-\frac{64L^{3}\sin \left ( \frac{n\pi }{4}\right ) ^{2}}{4L^{2}n^{2}\pi ^{2}+kn^{4}\pi ^{4}}\\ & =\frac{16L\sin \left ( \frac{n\pi }{4}\right ) ^{2}}{n^{2}\pi ^{2}}-\frac{64L^{3}\sin \left ( \frac{n\pi }{4}\right ) ^{2}}{4L^{2}n^{2}\pi ^{2}+kn^{4}\pi ^{4}} \end{align*}

Therefore the solution is\[ w\left ( x,t\right ) =\sum _{n=1,3,5,\cdots }^{\infty }\left ( \left ( \frac{16L\sin \left ( \frac{n\pi }{4}\right ) ^{2}}{n^{2}\pi ^{2}}-\frac{64L^{3}\sin \left ( \frac{n\pi }{4}\right ) ^{2}}{4L^{2}n^{2}\pi ^{2}+kn^{4}\pi ^{4}}\right ) e^{-k\left ( \frac{n\pi }{2L}\right ) ^{2}t}+\frac{64e^{t}L^{3}\sin \left ( \frac{n\pi }{4}\right ) ^{2}}{4L^{2}n^{2}\pi ^{2}+kn^{4}\pi ^{4}}\right ) \cos \left ( \frac{n\pi }{2L}x\right ) \] And the final solution is\[ u\left ( x,t\right ) =e^{t}\left ( x-L\right ) +w\left ( x,t\right ) \]

Example

Here is animation using Mathematica, for \(L=1,k=1\) for 3 seconds.

Source code is