I am having some trouble solving what the potential field looks like for a finite cylinder along the $z$ direction.
Physical Scenario
Consider a cylindrical electrode with radius $R_0$ that extends along $z$ from $z = 0$ to $ z= z_0$. This electrode is at a fixed potential $\phi_0$. The electrode is an empty shell.
What have I tried
I want to solve Laplace's equation: $$\nabla ^2\phi(r,z) = 0$$
with boundary conditions: $$\phi(R_0, z) = \phi_0, z \in [0,z_0]$$
and $$\lim_{z \to \pm\infty} \phi(r,z) = 0.$$
Given the azimuthal symmetry in my configuration then Laplace equation is: $$\frac{\partial ^2 \phi}{\partial r^2} + \frac{1}{r}\frac{\partial \phi}{\partial r} + \frac{\partial ^2 \phi}{\partial z^2} = 0$$
And after separation of variables the problem reduces to: $$\frac{d^2Z}{dz^2} - k^2Z = 0$$ $$\frac{d^2R}{dr^2} + \frac{1}{r}\frac{dR}{dr} + k^2R = 0$$ where $k$ is just a constant.
The solutions would then be of the form: $$Z(z) = A\exp(kz)+B\exp(-kz)$$ $$R(r) = J_0(kr)$$
where $J_0$ is a Bessel function of first kind.
What is my Problem?
As $\phi$ vanishes when $z$ tends to infinity and minus infinity, wouldn't these conditions set both $A$ and $B$ in $Z(z)$ to zero?
I am also very confused as to how the value of $k$ is dealt with. Is the solution $Z \times R$ summed over values of $k$? How do the set of boundary conditions come into place, would they restrict $k$?
My end goal is to take advantage of the in-built C++ Bessel functions to get the solution for the potential.
EDIT
The potential $\phi_0$ is a constant on the surface of the electrode. My end goal is to simulate the electrostatic potential caused in a Penning-Malmberg Trap. As of this question I am only interested in a single electrode.