# Laplace equation for a trapezoidal domain

I want to solve Laplace equation over a Isosceles trapezoidal domain.

I need an analytical solution . would you please guide me writing the code in mathematica. how to add the boundary conditions for non-parallel sides of the trapezium ?

    regA = Polygon[{{0,0},{1, 1}, {2, 1},{3, 0}}]

Graphics[regA]

solV = DSolve[{D[u[x, y], x, x] + D[u[x, y], y, y] == 0,

DirichletCondition[u[x, y] == Exp[x]*Cos[y],0<=x<=1],

DirichletCondition[u[x, y] == Exp[x]*Cos[y], 2<=x<=3],

DirichletCondition[u[x, y] == Exp[x]*Cos[y], y == 0],

DirichletCondition[u[x, y] == Exp[x]*Cos[y], y == 1]},

u, {x, y} \[Element] regA]

• anyone with any idea ? please guide me on how to include boundary conditions for the non-parallel sides and how to extract an analytical solution. – Mohammad Nabil Jan 20 '19 at 10:21

I suspect that DSolve will be able to give you an analytical solution. Here is a numerical one, if you are interested.

regA = Polygon[{{0, 0}, {1, 1}, {2, 1}, {3, 0}}];

RegionPlot[regA, AspectRatio -> 0.5]


op = D[u[x, y], x, x] + D[u[x, y], y, y];

BCs = {DirichletCondition[u[x, y] == 0., 0 <= x <= 1 && y == 0.],
DirichletCondition[u[x, y] == Exp[x]*Cos[y], 1 < x < 2 && y == 0.],
DirichletCondition[u[x, y] == 0., 2 <= x <= 3 && y == 0],
DirichletCondition[u[x, y] == Exp[x]*Cos[y], 1 <= x <= 2 && y == 1],
DirichletCondition[u[x, y] == Exp[x]*Cos[y], 2 <= x <= 3 && y == -x + 3],
DirichletCondition[u[x, y] == Exp[x]*Cos[y], 0 <= x <= 1 && y == x]};

ufun = NDSolveValue[{op == 0, BCs}, u, {x, y} \[Element] regA]

ContourPlot[ufun[x, y], {x, y} \[Element] regA, AspectRatio -> 0.5] // Quiet


Is this a trick question?

pde = D[u[x, y], x, x] + D[u[x, y], y, y] == 0

u[x_, y_] = E^x Cos[y]

pde
(*True*)


Satisfies the pde and bc's.

reg = Polygon[{{0, 0}, {1, 1}, {2, 1}, {3, 0}}];

ContourPlot[u[x, y], {x, y} ∈ reg, AspectRatio -> 0.5]


• thanks Bill Watts. but could you help me with matlab? I actually did not solve pde in matlab. don't know how to insert dirichlet condition there – Mohammad Nabil Feb 4 '19 at 13:49
• Sorry, I don't have Matlab. – Bill Watts Feb 4 '19 at 18:41