Analytical and numerical solution to the Diffusion Equation

Consider the following diffusion equation: $$\frac{\partial}{\partial t}y(x,t)=D\frac{\partial^2}{\partial x^2}y(x,t)+Cy(x,t)$$ where both $$D$$ and $$C$$ are constants

Solve the equation over the interval, $$\frac{L}{2}\le x \le \frac{L}{2}$$ subjected to the following boundary conditions: $$y(-\frac{L}{2},t)=y(\frac{L}{2},t)=0$$

1) Analytically, determine the critical length of the system ($$C,D=1.0$$), beyond which always lead to an exponentially increasing solution.

2) Implement a numerical finte difference method in order to solve this equation.

For the analytical part, i tried solving this using the separations of variables:

$$y(x,t)=v(x)q(t)$$ Substitute $$C,D=1$$ into the diffusion equation and substituting the separation of variable into the diffusion equation and dividing though by $$v(x)q(t)$$:

$$\frac{1}{q(t)}\frac{\partial q}{\partial t}=\frac{1}{v(x)}\frac{\partial^2v}{\partial x^2}+1$$

I am quite confused at this part, and do not know if this is the correct method to solve this equation, if so, how do i proceed.

• Generally, you can perform separation of variables if you can bring your equation into a following form $$f_2(x_1)+f_2(x_2)+\dots +f_n(x_n)=0$$ because the functions of different variables are linearly dependent, they could only be constant functions. So you pick some constants with the condition $$c_1+c_2+\dots+c_n=0$$ and your PDE becomes a system of ODEs $$f_k(x_k)=c_k$$ where $f_k$ of course contains derivatives too Nov 12, 2018 at 17:10

1 Answer

Before applying separation of variables, make the substitution $$y(x,t)=u(x,t)e^{t}$$. Then the PDE is $$\frac{\partial (ue^t)}{\partial t}=\frac{\partial^2 (ue^t)}{\partial x}^2+ue^t,$$ which is $$\frac{\partial u}{\partial t}e^t+ue^t=e^t \frac{\partial^2 u}{\partial x^2}+ue^t,$$ and so $$\frac{\partial u}{\partial t}=\frac{\partial^2 u}{\partial x^2}.$$ We now recognize that $$u$$ solves the heat equation, whose solutions are well-understood and can be solved by separation of variables if necessary. Then multiply by $$e^t$$ to get $$y$$.

• I have actually tried to went on using the separation of variable and obtained $$y(x,t)=ce^{-\lambda t}[Acos(\sqrt(\lambda-1) x)+Bsin(\sqrt(\lambda-1) x)]$$ is this the correct general solution for the pde i should have obtained
– J T
Nov 13, 2018 at 14:07