Skip to main content
Corrected integration formula
Source Link

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.105}, {z, -HH+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, 1018}, {nz, 1, 4038}]; ListVectorPlot[field] 

Yields the following output:OutputOutput

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:

(*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, R, 0.1}, {z, -H, H, 0.1}]; field = Table[{u[[nr]][[nz]] - u[[nr + 1]][[nz]], u[[nr]][[nz]] - u[[nr]][[nz + 1]]}, {nr, 1, 10}, {nz, 1, 40}]; ListVectorPlot[field] 

Yields the following output:Output

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] 

Yields the following output:Output

added 1051 characters in body
Source Link

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:

(*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, R, 0.1}, {z, -H, H, 0.1}]; field = Table[{u[[nr]][[nz]] - u[[nr + 1]][[nz]], u[[nr]][[nz]] - u[[nr]][[nz + 1]]}, {nr, 1, 10}, {nz, 1, 40}]; ListVectorPlot[field] 

Yields the following output:Output

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!

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:

(*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, R, 0.1}, {z, -H, H, 0.1}]; field = Table[{u[[nr]][[nz]] - u[[nr + 1]][[nz]], u[[nr]][[nz]] - u[[nr]][[nz + 1]]}, {nr, 1, 10}, {nz, 1, 40}]; ListVectorPlot[field] 

Yields the following output:Output

added 22 characters in body
Source Link

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!

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.

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!

Source Link
Loading