# How to use 2D DSolve over unit disk with Dirichlet boundary?

I'm trying to solve a 2D PDE with homogeneous Dirichlet boundary condition.

The problem I'm actually trying to solve is a bit more complicated, but I came up with a reduced version just to get DSolve "up and running":

\begin{aligned}\mathbf{x} \cdot \nabla f(\mathbf{x})&=f(\mathbf{x}) ~~~~~~~ \mathbf{x} \in D \\ f(\mathbf{x}) &= 0, ~~~~~~~~~~~ \mathbf{x} \in \partial D\end{aligned}

where $$D$$ is the (open) unit disk in $$\mathbb{R}^2$$.

In Mathematica, I have tried

DSolve[{Dot[{x, y}, Grad[f[x, y], {x, y}]] == f[x, y],
DirichletCondition[f[x, y] == 0, True]},
f[x, y], {x, y} \[Element] Disk[{0, 0}, 1]]


but this simply just prints

DSolve[{y
\!$$\*SuperscriptBox[\(f$$,
TagBox[
RowBox[{"(",
RowBox[{"0", ",", "1"}], ")"}],
Derivative],
MultilineFunction->None]\)[x, y] + x
\!$$\*SuperscriptBox[\(f$$,
TagBox[
RowBox[{"(",
RowBox[{"1", ",", "0"}], ")"}],
Derivative],
MultilineFunction->None]\)[x, y] == f[x, y],
DirichletCondition[f[x, y] == 0, True]},
f[x, y], {x, y} \[Element] Disk[{0, 0}, 1]]


immediately without any apparent attempt to solve the system.

• I do not think you can use dirichletcondition with DSolve. see how-to-use-dirichletcondition-with-dsolve-and-not-just-ndsolvevalue I also do not think you can use \[Element] Disk[{0, 0}, 1] with DSolve. These work with NDSolve. I have not seen a DSolve example that works with them so far. Also, you might have better chance writing/converting the PDE to polar coordinates since you are on a disk geometry. Commented Apr 28, 2022 at 19:54
• btw, if the solution is zero at boundary (edge of the disk) as you say, then the solution will be zero everywhere. Nothing to solve. I verified this by solving the pde in polar coordinates and that Mathematica says also. One can see that f=0 satisfies the PDE and the BC also. Commented Apr 28, 2022 at 22:44
• Point is, changing to polar coordinates, and giving an explicit value of f at boundary at specific distance (i.e. specific value of r), DSolve was now able to solve the PDE. Commented Apr 28, 2022 at 22:49
• if numerical solution is sufficient NDSolve works as expected. Commented Apr 29, 2022 at 6:23

Here is the analytical solution for the PDE you show. The PDE is converted to polar. Used Maple since I do not feel like doing this by hand now.

Since

 Dot[{x, y}, Grad[f[x, y], {x, y}]]


is

Then:

restart;
PDE:=y*diff(f(x,y),y)+x*diff(f(x,y),x)=f(x,y);
tranform:={x=r*cos(theta),y=r*sin(theta)};
PDEtools:-dchange(tranform,PDE)


Which gives

sin(theta)*(diff(f(r,theta),r)*sin(theta)*r+diff(f(r,theta),theta)*cos(theta))+
cos(theta)*(diff(f(r,theta),r)*cos(theta)*r-diff(f(r,theta),theta)*sin(theta))
= f(r,theta)


In Latex, the above is

$$\sin \! \left(\theta \right) \left(\left(\frac{\partial}{\partial r}f \! \left(r , \theta \right)\right) \sin \! \left(\theta \right) r +\left(\frac{\partial}{\partial \theta}f \! \left(r , \theta \right)\right) \cos \! \left(\theta \right)\right)+\cos \! \left(\theta \right) \left(\left(\frac{\partial}{\partial r}f \! \left(r , \theta \right)\right) \cos \! \left(\theta \right) r -\left(\frac{\partial}{\partial \theta}f \! \left(r , \theta \right)\right) \sin \! \left(\theta \right)\right) = f \! \left(r , \theta \right)$$

Entered this into Mathematica DSolve, for unit disk (i.e. $$r=1$$) and got

ClearAll[r, theta, f]
pdeInPolar =
Sin[theta]*(D[f[r, theta], r]*Sin[theta]*r +
D[f[r, theta], theta]*Cos[theta]) +
Cos[theta]*(D[f[r, theta], r]*Cos[theta]*r -
D[f[r, theta], theta]*Sin[theta]) == f[r, theta];
bc = f[1, theta] == 0;
DSolve[{pdeInPolar, bc}, f[r, theta], {r, theta},
Assumptions -> 0 < r < 1]


Compare to numerical

ClearAll[x, y, f];
pde = Dot[{x, y}, Grad[f[x, y], {x, y}]] == f[x, y];
bc = DirichletCondition[f[x, y] == 0, True];
sol = NDSolveValue[{pde, bc}, f, {x, y} \[Element] Disk[{0, 0}, 1]];
Plot3D[sol[x, y], {x, -1, 1}, {y, -1, 1}]


• Thank you, I will try to apply this to my real problem (that does not have a trivial solution!). Commented Apr 29, 2022 at 14:17