# Solving poisson's equation with boundary conditions

I am Gopal Koya.I have a problem in solving a PDE that is needed in my research work. I need to solve a laplace equation with the boundary conditions as shown in the image that is attached to this post. I seek help in solving this.

-

## migrated from mathematica.stackexchange.comJun 5 at 4:59

This question came from our site for users of Mathematica.

This can in principle be solved easily using my answer to Poisson solver using Mathematica, especially since that code was intended to be used with visual representations of the boundary conditions and inhomogeneities. So I'll illustrate that here. I am using the terminology from electrostatics, but I hope the analogies are clear. The conductor shape is the boundary on which Dirichlet boundary conditions are enforced. The inhomogeneous term in your equation is a constant which I incorporate in the variable chargePlus. There is no need to worry about the absolute quantitative size of the terms because your equation can be rescaled to whatever length scales are needed, and similarly the function $\phi$ can be rescaled arbitrarily by choosing appropriate units for the inhomogeneous term.

conductors =
Graphics[{{GrayLevel[.5],
Rectangle[1.1 {-1, -1}, 1.1 {1, 1}]}, {Black,
Disk[{0, 0}, 1]}, {GrayLevel[.5],
Disk[{0, 1.1}, .9, {Pi, 2 Pi}],
Disk[{0, -1.1}, .9, {0, Pi}]}}, PlotRangePadding -> 0,


chargePlus =
Graphics[{{GrayLevel[0],
Rectangle[1.1 {-1, -1}, 1.1 {1, 1}]}, {GrayLevel[.5],
Disk[{0, 0}, 1]}, {GrayLevel[0],
Disk[{0, 1.1}, .9, {Pi, 2 Pi}],
Disk[{0, -1.1}, .9, {0, Pi}]}}, PlotRangePadding -> 0,


chargeMinus =
Graphics[{}, PlotRange -> (PlotRange /. FullOptions[conductors])];

susceptibility =
Graphics[{}, PlotRange -> (PlotRange /. FullOptions[conductors])];

Timing[potential =
poissonSolver[conductors, chargePlus, chargeMinus, susceptibility];]

ListPlot3D[potential, PlotRange -> All,
PlotStyle -> {Orange, Specularity[White, 10]}]


The variables chargeMinus and susceptibility contain empty graphics so I don't show them. You can essentially draw any shape you like instead of the "batman" outline. I just eyeballed a rough approximation of the shape you sketched in the question.

-