I'm trying to get my feet wet with finite elements and I'm solving the following equation on the unit square in $\mathbb{R}^2$
$-u_{xx} - u_{yy} + au_x + bu_y + u + c = 0$
where $u = 0$ on the boundary and $a,b,c$ are constants.
However, now I want to compare my numerical solution with an analytic solution, and I'm relatively inexperienced when it comes to the analytical solutions of PDEs.
I'm looking for a push in the right direction in terms of solution technique. Since it's a simple domain should I try separation of variables? How do I deal with the nonhomogeneity (the constant $c$)?
The easiest way to obtain an exact solution is for non homogeneous equation. For example $$-u_{xx} - u_{yy} + au_x + bu_y + u +c= f(x,y)$$ Assume $u=\sin(A x)\cos(B y)$ then $$f(x,y)=A^2 u + B^2 u + a A \cos(A x)\cos(B y) + b B\sin(A x)\cos(B y) + u +c $$ So, solve it and you have what you need. Similarly you can do it with $u=e^{Ax+By}$
$u= e^{x}e^{y}$ Solves $$-u_{xx} - u_{yy} + u_x + u =0\quad\text{and}\quad -u_{xx} - u_{yy} + u_y + u =0$$
For a very partial test $u=y e^{x}$ as well as $u=x e^{y}$ solves $$-u_{xx} - u_{yy} + u =0$$
Slightly different equation which may be suitable change to you is $$-u_{xx} - u_{yy} + 2 u =0$$ Its solution is $e^{x-y}$.