16 Poisson PDE in Cartesian coordinates

16.1 Poisson equation in a rectangle, all boundaries are zero
16.2 Dirichlet problem for the Poisson equation in a rectangle

____________________________________________________________________________________

16.1 Poisson equation in a rectangle, all boundaries are zero

problem number 124

Added March 13, 2019.

Solve for u(x,y)

uxxA+uxxB=2θ

Where A,B,θ are constants, and the boundary conditions are

u(x,b)=0u(x,b)=0u(a,y)=0u(a,y)=0

Mathematica

ClearAll[a, b, A, B, theta, x, y, u]; 
 pde = D[u[x, y], {x, 2}]/A + D[u[x, y], {y, 2}]/B == -2*theta; 
 bc = {u[x, -b] == 0, u[x, b] == 0, u[-a, y] == 0, u[a, y] == 0}; 
 sol = AbsoluteTiming[TimeConstrained[DSolve[{pde, bc}, u[x, y], {x, y}], 60*10]];
 

Failed

Maple

 
x:='x'; y:='y'; u:='u';A:='A';B:='B';theta:='theta';a:='a';b:='b'; 
pde:=diff(u(x,y),x$2)/A+diff(u(x,y),y$2)/B=-2*theta; 
bc:=u(x,-b)=0, 
    u(x,b)=0, 
    u(-a,y)=0, 
    u(a,y)=0; 
cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol',pdsolve([pde,bc],u(x,y))),output='realtime'));
 

 sol=() 

Hand solution

solve uxxA+uyyB=2θBuxx+Auyy=2θAB=C

Where C=2θAB is a new constant. With boundary conditionsu(x,b)=0u(x,b)=0u(a,y)=0u(a,y)=0

To simplify solution, shift the rectangle so its lower left corner on the origin. Let x~=x+a, and y~=y+b. The boundary conditions becomesu(x~,0)=0u(x~,2b)=0u(0,y~)=0u(2a,y~)=0

And the pde becomes Bux~x~+Auy~y~=C. Instead of keep writing x~,y~, will use x,y, but remember that these are shifted version. At the end, we shift back.

Hence the PDE to solve is  Buxx+Auyy=C with BCu(x,0)=0u(x,2b)=0u(0,y)=0u(2a,y)=0

Using eigenfunction expansion method. Let (1)u(x,y)=n=1bn(y)Xn(x) Where Xn(x) is eigenfunctions for X(x)+λnX(x)=0 with boundary conditions X(0)=X(2a)=0. This has eigenfunctions as Xn(x)=sin(λnx) with eigenvalues λn=(nπ2a)2  for n=1,2,.

Substituting (1) into the PDE Buxx+Auyy=C givesBn=1bn(y)Xn(x)+An=1bn(y)Xn(x)=C Expanding C (a constant) as Fourier sine series the above becomesBn=1bn(y)Xn(x)+An=1bn(y)Xn(x)=n=1qnXn(x) But Xn(x)=λnXn(x), hence the above becomesBn=1λnbn(y)Xn(x)+An=1bn(y)Xn(x)=n=1qnXn(x)(1A)Abn(y)Bλnbn(y)=qn

But C=n=1qnXn(x)02aCXn(x)dx=qn02aXn2(x)dx02aCsin(λnx)dx=qn02asin2(λnx)dxCλn((1)n1)=qnaqn=Caλn((1)n1)

Hence (1A) becomesAbn(y)Bλnbn(y)=Caλn((1)n1) This is standard second order linear ODE. The solution isbn(y)=DneBAλny+EneBAλny+CaBλn32((1)n1) Using the above in (1) gives the solution(1A)u(x,y)=n=1(DneBAλny+EneBAλny+CaBλn32((1)n1))Xn(x) We now need to find Dn,En.

Case n even

When n is even ((1)n1)=0 and the solution (1A) becomesu(x,y)=n=1(DneBAλny+EneBAλny)Xn(x) At y=0 the above gives0=n=1(Dn+En)sin(λnx) Therefore(2)Dn+En=0 And at y=2b0=n=1(DneBAλn2b+EneBAλn2b)sin(λnx) Therefore(3)DneBAλn2b+EneBAλn2b=0 From (2,3) we see that Dn=En=0, Hence u(x,y)=0 when n even.

Case n odd

When n is odd ((1)n1)=2 and the solution (1A) becomesu(x,y)=n=1(DneBAλny+EneBAλny2CaBλn32)Xn(x) At y=0 the above gives0=n=1(Dn+En2CaBλn32)sin(λnx) Therefore(4)Dn+En2CaBλn32=0 And at y=2b0=n=1(DneBAλn2b+EneBAλn2b2CaBλn32)sin(λnx) Therefore(5)DneBAλn2b+EneBAλn2b2CaBλn32=0 Solving (4,5) for Dn,En givesDn=2CaBλn3211+eBAλn2bEn=2CaBλn32eBAλn2b1+eBAλn2b

Therefore the final solution from (1A) becomesu(x,y)=n=1,3,5,(DneBAλny+EneBAλny2CaBλn32)Xn(x)=n=1,3,5,((2CaBλn3211+eBAλn2b)eBAλny+(2CaBλn32eBAλn2b1+eBAλn2b)eBAλny2CaBλn32)sin(λnx)

Where λn=(nπ2a)2. Switching back to original coordinates using x~=x+a, and y~=y+b, then the above isu(x,y)=n=1,3,5,((2CaBλn3211+eBAλn2b)eBAλn(y+b)+(2CaBλn32eBAλn2b1+eBAλn2b)e(BAλny+b)2CaBλn32)sin(λn(x+a)) Where C=2θAB, henceu(x,y)=n=1,3,5,((4θABaBλn3211+eBAλn2b)eBAλn(y+b)+(4θABaBλn32eBAλn2b1+eBAλn2b)eBAλn(y+b)+4θABaBλn32)sin(λn(x+a))=n=1,3,5,((4θAaλn3211+eBAλn2b)eBAλn(y+b)+(4θAaλn32eBAλn2b1+eBAλn2b)eBAλn(y+b)+4θAaλn32)sin(λn(x+a))

____________________________________________________________________________________

16.2 Dirichlet problem for the Poisson equation in a rectangle

problem number 125

Taken from Mathematica DSolve help pages.

Solve for u(x,y)

2ux2+2uy2=6x6y

Boundary conditions

u(x,0)=1+11x+x3u(x,2)=7+11x+x3u(0,y)=1y3u(4,y)=109y3

Mathematica

ClearAll[u, x, y]; 
 pde = Laplacian[u[x, y], {x, y}] == 6*x - 6*y; 
 bc = {u[x, 0] == 1 + 11*x + x^3, u[x, 2] == -7 + 11*x + x^3, u[0, y] == 1 - y^3, u[4, y] == 109 - y^3}; 
 sol = AbsoluteTiming[TimeConstrained[DSolve[{pde, bc}, u[x, y], {x, y}], 60*10]];
 

{{u(x,y)x3+11xy3+1}}

Maple

 
x:='x'; y:='y'; u:='u'; 
pde:=diff(u(x,y),x$2)+diff(u(x,y),y$2)=6*x-6*y; 
bc:=u(x,0)=1+11*x+x^3, 
    u(x,2)=-7+11*x+x^3, 
    u(0,y)=1-y^3, 
    u(4,y)=109-y^3; 
cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol',pdsolve([pde,bc],u(x,y))),output='realtime'));
 

u(x,y)=x3y3+11x+1