An archived instance of discourse for discussion in undergraduate PDE.

Poisson on an L-Shaped region with NDSolve

Mark

Use NDSolve to solve Poisson's equation $u_{xx}+u_{yy}=-1$ on the L-shaped region shown below subject to zero Dirichlet boundary conditions.

wbartoli

Using Mathematica, here is my solution to this Poisson's equation problem. First, we need to define the L-shaped region using the following code (I plotted the domain to double-check).

domain = ImplicitRegion[
-1 <= x <= 0 && -1 <= y <= 1 ||
-1 <= x <= 1 && -1 <= y <= 0,
{x, y}];
RegionPlot[domain]



This makes the following plot:

Next, I'll plot the given PDE $(u_{xx}+u_{yy}=-1)$, with a Dirichlet boundary condition for the perimeter of the domain $(u[x,y]=0)$.

Clear[u];
u = NDSolveValue[{D[u[x, y], x, x] + D[u[x, y], y, y] == -1,
DirichletCondition[u[x, y] == 0, True]}, u,
Element[{x, y}, domain]];
Plot3D[u[x, y], Element[{x, y}, domain], ColorFunction -> "Rainbow",
PlotRange -> All, PlotPoints -> 50,
MeshFunctions -> {Function[{x, y, z}, z]}]





This produces the following graph:

These Mathematica problems are fun to plot and rotate!

dwillia2

Try replacing those with

Element[{x,y},domain]
wbartoli

Thanks, that's a good fix for displaying that Mathematica code here on Discourse! I've changed my original post.