I need some assistance with the following problem.
I am trying to find the exact solution of a convection-diffusion equation as follows:
$$-Du''(x)+0.5u'(x)=1, 0<x<\pi$$ $$u(0)=u(\pi)=0$$ where $$D>0.$$
I would be incredibly grateful if someone could help me with this problem and provide me with a solution. Thank you so much for your time and expertise.
Renaming $f(x) = u'(x)$, the equation becomes $-Df'(x) + \frac{1}{2}f(x) = 1$, which is an inhomogeneous first-order linear ODE with constant coefficients.
The homogeneous solution is given by $-Df_h'(x) + \frac{1}{2}f_h(x) = 0$, which leads to $f_h(x) = Ae^{x/2D}$, with $A$ a constant. As the source term is constant, the particular solution can be guessed to be a constant itself, i.e. $f_p(x) = \alpha$, hence $-D\cdot0 + \frac{1}{2}\alpha = 1$ and $f_p(x) = 2$. One has finally $f(x) = f_h(x) + f_p(x) = Ae^{x/2D} + 2$.
We get $u(x)$ by integrating this last solution, i.e. $u(x) = 2DAe^{x/2D} + 2x + B$, with $B$ another constant. The boundary conditions imply : $$ \begin{cases} u(0) = 0 = 2DA + B \\ u(\pi) = 0 = 2DAe^{\pi/2D} + 2\pi + B \end{cases} \quad\Longrightarrow\quad \begin{cases} A = \frac{\pi}{D}\frac{1}{1-e^{\pi/2D}} \\ B = -2DA = -\frac{2\pi}{1-e^{\pi/2D}} \end{cases} $$