# Given boundary conditions and initial condition, solve the PDE

Question, solve the given PDE :

$$\frac{\partial C}{\partial t} = a \frac{\partial^2 C}{\partial x^2} -kC$$ where a, k are constants.

boundary conditions : $$C= C_0$$ at $$x=0$$, $$C=0$$ at $$x =$$ infinitum

initial condition : $$C=0$$ at $$t=0$$

My attempt :

$$C(x,t) = X(x)~T(t)$$ $$C = X~T$$ $$\tag{1}\boxed{ \frac{\partial C}{\partial t} = T^{\prime} X,~ \space \frac{\partial C}{\partial x}= X^{\prime}T, ~ \frac{\partial^2 C}{\partial x^2} = X^{\prime \prime } T}$$ replacing the partial derivatives into the Original equation : $$T^{\prime}X = a ~X^{\prime \prime}T-k(X~T)$$ $$X (T^{\prime} +KT)=a ~X^{\prime \prime}T$$ $$\frac{T^{\prime}}{T} = a ~\frac{ X^{\prime \prime}}{X} -k$$ $$\tag{2}\boxed{\frac{T^{\prime}}{T} = J, ~\frac{ X^{\prime \prime}}{X} -k = J}$$ equating each side to a constant $$J = -\lambda^2$$ $$\tag{3}\boxed{\frac{d T}{d t} = -\lambda^2 T ,~ \frac{d^2 X}{d x^2} = \left (\frac{-\lambda^2 + k}{a} \right) X}$$ solving each differential equation : $$T(t) = Ae^{- \lambda t} , ~ ~~~X(x) = B ~e^{\left (x \sqrt{\frac{ k - \lambda^2}{a}} \right)} + C ~e^{\left (-x \sqrt{\frac{ k - \lambda^2}{a}} \right) }$$ Note : D = AB and E = AC

Corrected equation : $$\tag{4} \boxed{{C(x,t) = \left(D \ e^ {x \sqrt{\frac{k-\lambda^2}{a}}} + E e^ {-x \sqrt{\frac{k-\lambda^2}{a}}} \right) e^{-\lambda t}}}$$

confused with Boundary conditions and initial condition, could you guys help please

• Have you plugged in your solution into the equation and conditions to check it? I guess not, because as it is now you have: 1) $C(0,t)=0 \ne C_0$ 2) $C(\infty,t) \sim \sin{x} \ne 0$ May 29, 2021 at 23:22
• @RolazaroAzeveires hey appreciate the response. I did plug in the condition values after evaluating $C(x,t)$. I will do it again May 30, 2021 at 0:03
• @RolazaroAzeveires how is $C(\infty,t)$~$\sin x$? And I think first I should follow the boundary conditions and then initial. I might be wrong on that, do correct me May 30, 2021 at 0:10
• @RolazaroAzeveires also $C = C_0$ at $x=0$ That’s a boundary condition May 30, 2021 at 0:19
• Hi. You asked to check your solution, I pointed that your solution does not fit your problem in, at least, two cases: your solution does not obey the boundary conditions. Neither at $x=0$ nor $x\rightarrow\infty$ Your method looks fine but something is wrong. I would redo it, knowing that I was losing the boundary conditions on the way. May 30, 2021 at 11:03

Using the Laplace transform

$$sC(s,x) - a C_{xx}(s,x)+ k C(s,x) = c(0,x)$$

here $$c(0,x) = 0$$ so we follow with

$$(s+k)C(s,x) - a C_{xx}(s,x)=0$$

now solving for $$x$$ we have

$$C(s,x) = \phi_1(s) e^{\sqrt{\frac{s+k}{a}}x}+\phi_2(s) e^{-\sqrt{\frac{s+k}{a}}x}$$

and due to the boundary conditions $$\phi_1(s) = 0,\phi_2(s) = c_0$$ so

$$C(s,x) = c_0e^{-\sqrt{\frac{s+k}{a}}x}$$

and finally

$$c(t,x) = \mathcal{L}^{-1}\left[C(s,x)\right]=\frac{c_0 x e^{-\left(\frac{x^2}{4 a t}+k t\right)}}{2 \sqrt{a\pi } t^{3/2}},\ \ \ \frac {x}{\sqrt{a}}\gt 0$$

NOTE

The answer above considers the boundary conditions at $$x = 0$$ as initial conditions (Dirac impulses). To consider a step at $$x = 0$$ with amplitude $$c_0$$ then the boundary conditions should be $$\phi_1(s) = \frac{c_0}{s}$$ and then

$$C(s,x) = \frac{c_0}{s}e^{-\sqrt{\frac{s+k}{a}}x}$$

with inverse Laplace transform

$$c(t,x) = \frac{1}{2} c_0 e^{x \left(-\sqrt{\frac{k}{a}}\right)} \left(2-\text{erfc}\left(\frac{2 t \sqrt{a k}-x}{2 \sqrt{a t}}\right)+e^{2 x \sqrt{\frac{k}{a}}} \text{erfc}\left(\frac{2 t \sqrt{a k}+x}{2 \sqrt{a t}}\right)\right)$$

Follows a plot for $$k=a=1, c_0=2,\ \ 0\le x\le 1, \ \ 0 \le t\le 2$$. • Hey thanks for the response. How did you use the boundary condition could you explain please, And verify wheather my last step $(4)$ is correct or not? May 31, 2021 at 14:29
• Boundary condition for time version* May 31, 2021 at 14:35
• The $c(t,x)$ can be obtained from a transform table. May 31, 2021 at 15:40
• Yes. This is the reason behind the choice for $\phi_1, \phi_2$ Jun 1, 2021 at 6:43
• We can use the initial value theorem from Laplace which states. $c(0,x) = \lim_{s\to \infty}s C(s,x)$ giving $0$. Jun 1, 2021 at 14:59