A semi finite closed tube contains a liquid. I am not sure what semifinite in this context means, but this is what the exercise says. In this tube, there is a color substance with concentration u(x,t) at time $t>0, x\geq0$. At time $t=0$ the concentration is:
\begin{equation} u(x,0)= \begin{cases} 2 \ \ \ \ 0\leq x \leq 1,\\ 0 \ \ \ \ x>1 \end{cases} \end{equation}
The total amount of color substance in the tube does not change with time. Determine the boundary conditions in the closed en of the tube, and solve the one-dimensional diffusion equation where the diffusion constant is D=1/4. The error function can be part of the answer.
My attempt:
I consider the diffusion problem of the color substance as spreading across the length of the tube, L at the given rate:
\begin{equation} u_{xx}=\frac{1}{4}u_t \end{equation}
The solutions by separation of variables are identified as:
\begin{equation} \begin{array} Fu_{xx}=\frac{1}{4}u_t\rightarrow u(x,t)=X(x)T(t)\\ 4X_{xx}T=T_tX\\ 4\frac{X_{xx}}{X}=\frac{T_t}{T}=k^2 \\ 4\frac{X_{xx}}{X}=k^2 , \frac{T_t}{T}=k^2 \\ \frac{T_t}{T}=k^2 \rightarrow T_{t}-k^2T=0 \rightarrow \frac{dT}{dt}=k^2T\rightarrow \frac{dT}{T}=k^2dt\rightarrow T(t)=Ce^{k^2t} \end{array} \end{equation}
For the spatial function, we have three cases of interest:
\begin{equation} \begin{array} xX_{xx}=0 \ \ \ (k=0) \\ X_{xx}-\frac{1}{4}k^2X=0 \ \ \ (k<0)\\ X_{xx}+\frac{1}{4}k^2X \ \ \ \ (k>0) \end{array} \end{equation}
We solve each case:
k=0 \begin{equation} \begin{array} xX_{xx}=0 \ \ \ (k=0) \\ X(x)=Ax+B \ \ \ I.C.: u(x,0)= 2, u(x,0)=0 \rightarrow \\ 0=Ax+B \rightarrow A,B=0 \end{array} \end{equation}
k>0
\begin{equation} \begin{array} xX_{xx}+\frac{1}{4}k^2X=0 \ \ \ \\ X(x)=e^{-\frac{1}{16}ikx}+e^{\frac{1}{16}ikx}\\ X(x)=A\sin(\frac{1}{16}kx)+B\cos(\frac{1}{16}kx) \end{array} \end{equation}
This solution gives an exponential growth of the color agent as time goes to infinity, however the total amount of tube does not change over time, so $k>0$ is not an allowed solution.
Solving for k<0
\begin{equation} \begin{array} xX_{xx}-\frac{1}{4}k^2X=0 \ \ \ \\ X(x)=e^{\frac{1}{16}kx}+e^{\frac{1}{16}kx}\\ X(x)=A\cosh(\frac{1}{16}kx) \ \ \ \end{array} \end{equation}
With $u(x,0)=0$,
$u(L,0)=A(e^{\frac{1}{16}kx}+e^{\frac{1}{16}kx})e^{-k^2t}\rightarrow A\cosh(\frac{1}{16}kx)=0 \rightarrow \cosh(\frac{1}{16}kx)=i\bigg(n\pi-\frac{\pi}{2}\bigg) \rightarrow (\frac{1}{16}kL)=i\bigg(n\pi-\frac{\pi}{2}\bigg) \rightarrow k= \frac{16i(n\pi-\frac{\pi}{2})}{L}$
Set $\alpha=\frac{16i(n\pi-\frac{\pi}{2})}{L} $
Finding A:
\begin{equation} \int_0^L (e^{\frac{1}{16}\alpha x}+e^{\frac{1}{16}\alpha x})\cos(\alpha x)=? \end{equation}
But I was tought that we should find a Fourier coefficient in this regard, but how?
Thanks