Sorry, I found minor issue actually after I verified with Maple. When breaking the problem into 4 problems, to make life easier for DSolve
, the top BC, should be
k*Derivative[0, 1][T][x, b] == h*(T[x, b] - T3)
when non homogeneous, but for the homogeneous case, it should be k*Derivative[0, 1][T][x, b] == h*(T[x, b])
and not k*Derivative[0, 1][T][x, b] == 0
as I had it below. i.e. only T3
should be set to zero.
I noticed this when I compared Maple's solution to Mathematica's and found very small difference in numerical values.
But now DSolve
now can't solve it any more :(
So will post Maple's solution below, and post the corrected Mathematica solution, which breaks the problems into 4, but now it does not solve it. So may be you can try NDSolve
in Mathematica for this. May be in V 12.2 DSolve
can do it.
Maple solution
restart;
pde := diff(T(x, y),x$2)+diff(T(x,y),y$2)=0;
bc := T(0, y) = T1, T(a, y) = T2, T(x, 0) =T2, k*D[2](T)(x,b)= h*(T(x, b) - T3);
sol1:=simplify(pdsolve([pde, bc], T(x, y)) assuming a>0,b>0);
which gives
T(x,y) = (Sum(-2*(-(-T1+T2)*(-Pi*k*n+a*h)*exp(n*Pi*(2*b-y)/a)+a*((T2-T3)*(-1)^n
-T1+T3)*h*exp(n*Pi*(b-y)/a)-a*((T2-T3)*(-1)^n-T1+T3)*h*exp(n*Pi*(y+b)/a)+exp(n/
a*Pi*y)*(-T1+T2)*(Pi*k*n+a*h))*sin(n/a*Pi*x)/Pi/n/((-Pi*k*n+a*h)*exp(2*n/a*Pi*b
)-Pi*n*k-a*h),n = 1 .. infinity)*a+T1*a+x*(-T1+T2))/a
Corrected Mathematica solution
ClearAll[T, x, y, T1, T2, T3, k, h];
pde = Laplacian[T[x, y], {x, y}] == 0;
bc = {T[0, y] == 0, T[a, y] == 0, T[x, 0] == 0, k*Derivative[0, 1][T][x, b] - h*T[x, b] == -h*T3}
sol1 = DSolve[{pde, bc}, T[x, y], {x, y}, Assumptions -> {a > 0, b > 0}]
bc = {T[0, y] == 0, T[a, y] == 0, T[x, 0] == T2, k*Derivative[0, 1][T][x, b] - h*T[x, b] == 0}
sol2 = DSolve[{pde, bc}, T[x, y], {x, y}, Assumptions -> {a > 0, b > 0}]
bc = {T[0, y] == 0, T[a, y] == T2, T[x, 0] == 0, k*Derivative[0, 1][T][x, b] - h*T[x, b] == 0}
sol3 = DSolve[{pde, bc}, T[x, y], {x, y}, Assumptions -> {a > 0, b > 0}]
(* no solution *)
bc = {T[0, y] == T1, T[a, y] == 0, T[x, 0] == 0, k*Derivative[0, 1][T][x, b] - h*T[x, b] == 0}
sol4 = DSolve[{pde, bc}, T[x, y], {x, y}, Assumptions -> {a > 0, b > 0}]
(* no solution *)
So can't add them, since 2 solutions could not be found. need all 4.
Original answer below (but contain error in BC)
You can solve it as follows.
DSolve
can not handle more than one edge in Laplacian in 2D being non homogeneous at same time.
Due to linearity, the problem is broken into 4 problems, were one edge is non homogeneous at time. Then the 4 solutions are added.
So instead of doing
ClearAll[T, x, y, T1, T2, T3, k, h];
pde = Laplacian[T[x, y], {x, y}] == 0;
bc = {T[0, y] == T1, T[a, y] == T2, T[x, 0] == T2, k*Derivative[0, 1][T][x, b] == h*(T[x, b] - T3)}
sol1 = DSolve[{pde, bc}, T[x, y], {x, y}, Assumptions -> {a > 0, b > 0}]
Where DSolve
does not solve it, do the following
bc = {T[0, y] == 0, T[a, y] == 0, T[x, 0] == 0, k*Derivative[0, 1][T][x, b] == h*(T[x, b] - T3)}
sol1 = DSolve[{pde, bc}, T[x, y], {x, y}, Assumptions -> {a > 0, b > 0}];
bc = {T[0, y] == 0, T[a, y] == 0, T[x, 0] == T2,k*Derivative[0, 1][T][x, b] == 0}
sol2 = DSolve[{pde, bc}, T[x, y], {x, y}, Assumptions -> {a > 0, b > 0}]
bc = {T[0, y] == 0, T[a, y] == T2, T[x, 0] == 0, k*Derivative[0, 1][T][x, b] == 0}
sol3 = DSolve[{pde, bc}, T[x, y], {x, y}, Assumptions -> {a > 0, b > 0}]
bc = {T[0, y] == T1, T[a, y] == 0, T[x, 0] == 0, k*Derivative[0, 1][T][x, b] == 0}
sol4 = DSolve[{pde, bc}, T[x, y], {x, y}, Assumptions -> {a > 0, b > 0}]
And the solution is
sol = First[(T[x, y] /. sol1)
+ (T[x, y] /. sol2)
+ (T[x, y] /. sol3)
+ (T[x, y] /. sol4)]
DSolve
will use separation of variables internally for this pde. You do not have to implement it yourself. $\endgroup$