I'm attempting to mathematically model thermal energy storage within a packed bed sensible heat storage system. The key equation is the following second order PDE, which captures the change in temperature (T) with respect to both time (t) and displacement through the tank (x):
$\left(\rho C_p\right)_m\frac{{\partial T}_m}{\partial t}+G.C_{p,f}\frac{{\partial T}_m}{\partial x}=\frac{\partial}{\partial x}\left(k_m\frac{{\partial T}_m}{\partial x}\right)$
Which I have better written as:
$A\frac{\partial T}{\partial t}+B\frac{\partial T}{\partial x}=C\frac{\partial^2T}{{\partial x}^2}$
Where the following Initial and Boundary Conditions are given:
Intial condition:
$T(x,0)=20°C$
Boundary conditions:
$\frac{\partial T}{\partial x}(0,t)=0$
$\frac{\partial T}{\partial x}(L,t)=0$
After many days of trying, I have made the following attempt to solve the problem. If anyone out there can see where I've gone wrong, please comment below.
In accordance with the separation of variables method,
$Let\ T\ =\ XU\ be\ a\ solution\ to\ this\ equation$
Applying this to the PDE:
$AX\frac{dU}{dt}+BU\frac{dX}{dx}=CU\frac{d^2X}{{dx}^2}$
Dividing both sides by XU:
$\frac{A}{U}\frac{dU}{dt}=\frac{1}{X}(C\frac{d^2X}{{dx}^2}-B\frac{dX}{dx})$
Recognising that both sides are equal and therefore must be equal to the same constant:
$\frac{A}{U}\frac{dU}{dt}=-\lambda=\frac{1}{X}(C\frac{d^2X}{{dx}^2}-B\frac{dX}{dx})$
Now assessing these terms individually:
$\frac{dU}{dt}=\frac{-\lambda}{A}U$
$C\frac{d^2X}{{dx}^2}-B\frac{dX}{dx}+\lambda\ x=0$
We have now separated the original PDE into two separate ODE’s
The time derivative can now be solved at this stage with relative ease:
$\frac{dU}{dt}=\frac{-\lambda}{A}U$
$\therefore\frac{1}{U}dU=\frac{-\lambda}{A}dt$
$\therefore\int{\frac{1}{U}dU}=\frac{-\lambda}{A}\int d\ t$
$\therefore\ lnU=\frac{-\lambda}{A}t\ +c_1$
$\therefore\ U=e^{\frac{-\lambda}{A}t\ +c_1}$
$\therefore\ U=e^{\frac{-\lambda}{A}t\ }\bullet\ e^{c_1}$
Recognising that $e^{c_1}$ is merely a constant:
$U=G\bullet\ e^{\frac{-\lambda}{A}t\ }$
Where G is the integrating constant.
Now solving displacement from:
$C\frac{d^2X}{{dx}^2}-B\frac{dX}{dx}+\lambda\ x=0$
Solving Eigenvalues:
Take $X=e^{mx}$
$\therefore(Cm^2-Bm+\lambda)e^{mx}=0$
To obtain a non-trivial solution:
$Cm^2-Bm+\lambda=0$
$m=\frac{-b\pm\sqrt{b^2-4ac}}{2a}=\frac{B\pm\sqrt{B^2-4\lambda C}}{2C}$
Again, to force non-trivial solutions:
$B^2-4\lambda\ C<0$
$\therefore\lambda>\frac{B^2}{4C}$
Then:
$m=\frac{B\pm i\sqrt{4\lambda C-B^2}}{2C}$
These will be complex roots and so:
$X=e^{\alpha x}[c_2cos(\beta\ x)+c_3sin(\beta\ x)]$
$X=e^{(\frac{B}{2C})x}[c_2cos(\frac{\sqrt{4\lambda C-B^2}}{2C}x)+c_3sin(\frac{\sqrt{4\lambda C-B^2}}{2C}x)]$
The complete solution is therefore now:
$T=XU=e^{(\frac{B}{2C})x-\frac{-\lambda}{A}t\ }[Gc_2cos(\frac{\sqrt{4\lambda C-B^2}}{2C}x)+Gc_3sin(\frac{\sqrt{4\lambda C-B^2}}{2C}x)]$
$=e^{(\frac{B}{2C})x-\frac{-\lambda}{A}t\ }[Ecos(\frac{\sqrt{4\lambda C-B^2}}{2C}x)+Dsin(\frac{\sqrt{4\lambda C-B^2}}{2C}x)]$ (Equation 1)
Now applying boundary conditions:
$e^{(\frac{B}{2C})x-\frac{-\lambda}{A}t\ }[-E\frac{\sqrt{4\lambda C-B^2}}{2C}sin(\frac{\sqrt{4\lambda C-B^2}}{2C}x)+D\frac{\sqrt{4\lambda C-B^2}}{2C}cos(\frac{\sqrt{4\lambda C-B^2}}{2C}x)]+e^{(\frac{B}{2C})x-\frac{-\lambda}{A}t\ }\frac{B}{2C}[Ecos(\frac{\sqrt{4\lambda C-B^2}}{2C}x)+Dsin(\frac{\sqrt{4\lambda C-B^2}}{2C}x)]$
$x=0,\frac{\partial T}{\partial x}=0\:$
$0=e^{\frac{\lambda}{A}t}(\frac{D\sqrt{4\lambda C-B^2}}{2C}+\frac{BE}{2C})$
$\therefore\ BE=\ D\sqrt{4\lambda C-B^2}\ \ \ \ \ \ \ \ \ \ Equation\ A$
$x=L,\frac{\partial T}{\partial x}=0\:$
$e^{(\frac{B}{2C})L-\frac{-\lambda}{A}t\ }[\frac{-E}{2C}\sqrt{4\lambda C-B^2}sin(\frac{\sqrt{4\lambda C-B^2}}{2C}L)+\frac{BE}{2C}cos(\frac{\sqrt{4\lambda C-B^2}}{2C}L)+D\frac{\sqrt{4\lambda C-B^2}}{2C}cos(\frac{\sqrt{4\lambda C-B^2}}{2C}L)+\frac{BD}{2C}sin(\frac{\sqrt{4\lambda C-B^2}}{2C}L)]=0$
Now applying Equation A:
$(\frac{-E}{2C}+\frac{BD}{2C})sin(\frac{\sqrt{4\lambda C-B^2}}{2C}L)=0$
Noting from Equation A that $BD\neq\ E$:
$sin(\frac{\sqrt{4\lambda C-B^2}}{2C}L)=0$
Recognising that $sin(m\pi)=0$:
$\frac{\sqrt{4\lambda C-B^2}}{2C}L=m\pi\ \ \ \ \ \ \ \ \ \ where\ m=0,\pm1,\pm2,...$
$\lambda=\frac{1}{4C}[B^2+\frac{4m^2\pi^2C^2}{L^2}] \ \ \ \ \ \ where\ m=0,±1,±2,...$
This can now be applied to Equation 1:
$\sum_{m=0}^{\infty}{[E_m\{cos(\frac{m\pi}{L}x)+D_m\{sin(\frac{m\pi}{L}x)]}e^{(\frac{B}{2C})x-\frac{1}{4AC}[B^2+\frac{4m^2\pi^2C^2}{L^2}t]\ }$
Where $D_m$ and $E_m$ are related by Equation A.
Now applying initial conditions:
T(x,0)=20°C
$\therefore20=\sum_{m=0}^{\infty}{[E_m\cos(\frac{m\pi}{L}x)+D_m\sin(\frac{m\pi}{L}x)]}e^{(\frac{B}{2C})x}$
$\therefore20e^{\frac{-B}{2C}x}=\sum_{m=0}^{\infty}{[E_m\cos(\frac{m\pi}{L}x)+D_m\sin(\frac{m\pi}{L}x)]}$ (Equation 2)
Now multiplying by $cos(\frac{n\pi}{L}x)$ and integrating for 0 to L:
$\sum_{m=0}^{\infty}{[E_m\int_{0}^{L}{cos(\frac{m\pi}{L}x)cos(\frac{n\pi}{L}x)dx+D_m\int_{0}^{L}{sin(\frac{m\pi}{L}x)cos(\frac{n\pi}{L}x)dx=20\int_{0}^{L}{e^{\frac{-B}{2C}x}cos(\frac{n\pi}{L}x)dx}}}}$
$\therefore\ E_n\frac{L}{2}+0=20[\frac{e^{\frac{-B}{2C}x}}{\frac{B^2}{4C^2}+\frac{n^2\pi^2}{L^2}}\frac{-B}{2C}\cos(\frac{n\pi}{L}x)+\frac{n\pi}{L}\sin(\frac{n\pi}{L}x)]$ Evaluated between 0 and L
$\therefore\ E_n=\frac{40}{L}\left[\frac{e^{\frac{-B}{2C}L}\left(\frac{-B}{2C}\cos{\left(n\pi\right)}\right)+\frac{B}{2C}}{\frac{B^2}{4C^2}+\frac{n^2\pi^2}{L^2}}\right]\ \ \ \ \ \ \ \ \ Equation\ B$
Again, take Equation 2, this time multiplying by $sin(\frac{n\pi}{L}x)$ and integrating for 0 to L:
$\sum_{m=0}^{\infty}{[E_m\int_{0}^{L}{cos(\frac{m\pi}{L}x)sin(\frac{n\pi}{L}x)dx+D_m\int_{0}^{L}{sin(\frac{m\pi}{L}x)sin(\frac{n\pi}{L}x)dx=20\int_{0}^{L}{e^{\frac{-B}{2C}x}sin(\frac{n\pi}{L}x)dx}}}}$
$\therefore\ D_n\frac{L}{2}+0=20[\frac{e^{\frac{-B}{2C}x}}{\frac{B^2}{4C^2}+\frac{n^2\pi^2}{L^2}}\frac{B}{2C}\sin(\frac{n\pi}{L}x)+\frac{n\pi}{L}\cos(\frac{n\pi}{L}x)]$ Evaluated between 0 and L
$\therefore\ D_n=\frac{40}{L}\left[\frac{e^{\frac{-B}{2C}L}\left(\frac{n\pi}{L}\cos{\left(n\pi\right)}\right)+\frac{n\pi}{L}}{\frac{B^2}{4C^2}+\frac{n^2\pi^2}{L^2}}\right]\ \ \ \ \ \ \ \ \ Equation\ C$
Therefore, the final solution is:
$T\left(x,t\right)=\sum_{n=0}^{\infty}{\left[E_n\cos{\left(\frac{n\pi}{L}x\right)}+D_n\sin{\left(\frac{n\pi}{L}x\right)}\right]e^{\left[\frac{B}{2C}x-\frac{1}{4AC}\left(B^2+\frac{4n^2\pi^2C^2}{L^2}\right)t\right]}}$
Where $E_n$ and $D_n$ can be found from Equations B and C respectively.
When I evaluate this solution to find a temperature, T, I get completely incorrect outputs. I know its a long shot - but please can someone tell me where I'm going wrong?
Your $E_n$ and $D_n$ are of order $1/n$, so the series converges so slowly that it would be difficult to calculate from it. That warrants a second look at the problem. The answer to your problem is $T(x,t) = 20$.