I am trying to solve the Poisson equation on a cylindrical grid.
$$ \frac{1}{r^2} \frac{\partial}{\partial r} r^2 \frac{\partial f(r, \theta)}{\partial r} = n(r, \theta) $$
Analytically, there is no angular dependence to the function $n(r, \theta)$, which is why I'm working in cylindrical coordinates. I would like to define a Dirichlet boundary condition for which $f(r_{max}(\theta), \theta) = 0$, but where $r_{max}(\theta)$ determines the distance from the origin to the boundary of a cylindrical box containing the simulation space.
Succinctly, I'd like to ask how to define a Dirichlet boundary condition on one variable which depends on the other variable for a 2D PDE.
The code I have tried is simple, but most likely naive:
sol =
NDSolve[
{1/r^2 D[r^2*D[f[r, θ], r], r] == n[r],
Derivative[1, 0][f][0, θ] == 0,
DirichletCondition[f[r, θ] == 0, r == RRMAX[θ]]},
f, {r, θ}]
RRMAX
is defined elsewhere, although I suspect it isn't important exactly what for it has for the purpose of the question. For example,
RRMAX[θ_] := 60 (1 - 0.1 Cos[θ])
I get an error message which says the following:
The dependent variable in TemporaryVariable$xxxxxxxx[0] == 0 in the boundary condition DirichletCondition[...] needs to be linear
If anyone could help me, I'll give my firstborn to you.
n[r]
. $\endgroup$