I'm trying to numerically solve Poisson's equation for the following scenario: The potential inside a cylinder of radius R=1 and height H=2 with uniform charge density(which I'll set to 1). Poisson's equation, in cylindrical form, is apparently $$\frac{\partial}{\partial r}(r\frac{\partial V}{\partial r})+\frac{\partial^2 V}{\partial z^2} = -\frac{\rho}{\varepsilon}.$$
In this case the charge density is obviously a bunch of dirac deltas, which Mathematica cannot handle. How should I numerically solve the equation then?
I assume referencing this discussion on a similar problem in magnetostatics will be helpful. However, I was unable to understand the spherical boundary trick and I'm looking for some help there as well.
Thanks in advance!
Edit: I should note that I know an analytic solution is possible; in fact, I have constructed an approximate solution using the following code(edited; I made some typos in the first version):
(*Initialize*) R = 1; H = 2; (*Analytic solution:*) U[r_, z_] := 1/(2 Pi) (NIntegrate[R/Sqrt[ R^2 + r^2 - 2 R r Cos[\[Theta]] + (\[Zeta] - z)^2], {\[Theta], 0, 2 \[Pi]}, {\[Zeta], -H, H}] + NIntegrate[\[Rho]/ Sqrt[\[Rho]^2 + r^2 - 2 \[Rho] r Cos[\[Theta]] + (H - z)^2], {\[Rho], 0, R}, {\[Theta], 0, 2 \[Pi]}] + NIntegrate[\[Rho]/ Sqrt[\[Rho]^2 + r^2 - 2 \[Rho] r Cos[\[Theta]] + (H + z)^2], {\[Rho], 0, R}, {\[Theta], 0, 2 \[Pi]}]); (*Plotting the field over a discrete set of points:*) u = Table[U[r, z], {r, 0.05, R-0.05, 0.05}, {z, -H+0.1, H-0.1, 0.1}]; field = Table[{u[[nr]][[nz]] - u[[nr + 1]][[nz]], u[[nr]][[nz]] - u[[nr]][[nz + 1]]}, {nr, 1, 18}, {nz, 1, 38}]; ListVectorPlot[field] 


NIntegrateand that slowed down the calculation. I was able to analytically calculate the potential over a set of discrete points as a rough approximation, but I expect that there is a better solution. $\endgroup$r==R? What isV, perhaps a Charge distribution? $\endgroup$