heat1-6.mws Poisson's Equation - 4 non-homogeneous boundary conditions (Dirichlet)
> | restart; |
boundaries: y=0 f1, y=M f2, x=0 f3, x=L f4
> | f[1](x):=x*(L-x);f[2](x):=x*(L-x);f[3](y):=y*(M-y);f[4](y):=y*(M-y); |
Volumetric sorce function:
> | F(x,y):=-x*y*(L-x)*(M-y)/50; |
Fourier coefficients:
> | b1[n]:=2/L*int(f[1](x)*sin(n*Pi*x/L),x=0..L); |
> | b2[n]:=2/L*int(f[2](x)*sin(n*Pi*x/L),x=0..L); |
> | b3[n]:=2/M*int(f[3](y)*sin(n*Pi*y/M),y=0..M); |
> | b4[n]:=2/M*int(f[4](y)*sin(n*Pi*y/M),y=0..M); |
> | b5[n,m]:=factor(int(int(F(x,y)*sin(n*Pi*x/L)*sin(m*Pi*y/M),x=0..L),y=0..M)); |
> | b5[n,m]:=factor(subs({sin(n*Pi)=0,cos(n*Pi)=(-1)^n,sin(m*Pi)=0,cos(m*Pi)=(-1)^m},b5[n,m])); |
> | b1[n]:=simplify(factor(subs({sin(n*Pi)=0,cos(n*Pi)=(-1)^n},b1[n]))); |
> | b2[n]:=simplify(factor(subs({sin(n*Pi)=0,cos(n*Pi)=(-1)^n},b2[n]))); |
> | b3[n]:=simplify(factor(subs({sin(n*Pi)=0,cos(n*Pi)=(-1)^n},b3[n]))); |
> | b4[n]:=simplify(factor(subs({sin(n*Pi)=0,cos(n*Pi)=(-1)^n},b4[n]))); |
> | a1[n]:=-b1[n]/sinh(n*Pi*M/L); |
> | a2[n]:=b2[n]/sinh(n*Pi*M/L); |
> | a3[n]:=-b3[n]/sinh(n*Pi*L/M); |
> | a4[n]:=b4[n]/sinh(n*Pi*L/M); |
> | a5[n,m]:=-4*b5[n,m]/Pi^2/(n^2/L^2+m^2/M^2); |
Fourier series terms:
> | u1[n](x,y):=a1[n]*sin(n*Pi*x/L)*sinh(n*Pi*(y-M)/L); |
> | u2[n](x,y):=a2[n]*sin(n*Pi*x/L)*sinh(n*Pi*y/L); |
> | u3[n](x,y):=a3[n]*sinh(n*Pi*(x-L)/M)*sin(n*Pi*y/M); |
> | u4[n](x,y):=a4[n]*sinh(n*Pi*x/M)*sin(n*Pi*y/M); |
> | u5[n,m](x,y):=a5[n,m]*sin(n*Pi*x/L)*sin(m*Pi*y/M); |
> | L:=4;M:=3; |
Solution of supplemental problems:
> | u1(x,y):=sum(u1[n](x,y),n=1..40): |
> | u2(x,y):=sum(u2[n](x,y),n=1..40): |
> | u3(x,y):=sum(u3[n](x,y),n=1..40): |
> | u4(x,y):=sum(u4[n](x,y),n=1..40): |
> | u5(x,y):=sum(sum(u5[n,m](x,y),n=1..4),m=1..40): |
SOLUTION:
> | u(x,y):=u1(x,y)+u2(x,y)+u3(x,y)+u4(x,y)+u5(x,y): |
> | plot3d(u(x,y),x=0..L,y=0..M,axes=boxed,projection=0.9); |
> | plot3d(F(x,y),x=0..L,y=0..M,axes=boxed,projection=0.9); |
> | with(plots): |
Warning, the name changecoords has been redefined
> | densityplot(u(x,y),x=0..L,y=0..M,grid=[50,50],scaling=constrained,axes=none,style=patchnogrid); |
> | contourplot(u(x,y),x=0..L,y=0..M,grid=[50,50],scaling=constrained,axes=boxed,filled=true,contours=10,coloring=[white,blue],grid=[100,100]); |
> |
> |