Analytical solution of 2D Transient Heat conduction with Neumann condition I want to know the analytical solution of a transient heat equation in a 2D square with inhomogeneous Neumann Boundary.
The transient heat conduction equation in a 2D square cavity :
$$\frac{dT}{dt}=\nabla^2T$$
and the boundary are: 
$$\cases{T(0,y)=T_1\\T(L,y)=T_0\\\frac{\partial T(x,0)}{\partial y}=a\\\frac{\partial T(x,L)}{\partial y}=a}$$
The initial Temperature inside is $T_0$
If there is no analytical solution, then what is the solution of steady heat conduction (with $\nabla^2T=0$)?
Really appreciate anyone who can help!

This is very involved problem. To solve, you'll need to break the solution into successively smaller pieces. First, separate the steady-state and transient solutions, then split up the boundary conditions in order to use separation of variables.
To start off, I'm going to label
$$ T(x,y,t) = u(x,y,t) + v(x,y) $$
where $v(x,y)$ is the time-independent, steady-state solution, and $u(x,y,t)$ is the decaying, transient solution.

The steady-state solution should satisfy $\nabla^2v = 0$ and all the boundary conditions as listed. Since all boundaries are inhomogeneous, we need so split it up further
$$ v(x,y) = v_1(x,y) + v_2(x,y) $$
such that
\begin{matrix} 
\begin{cases} 
\nabla^2 v_1 = 0 \\ \\
v_1(0,y) = T_1,\  v_1(L,y) = T_0 \\ \\
\dfrac{\partial}{\partial y}v_1(x,0) = \dfrac{\partial}{\partial y}v_1(x,L) = 0
\end{cases} 
&&& 
\begin{cases}
\nabla^2v_2 = 0  \\ \\
v_2(0,y) = v_2(L,y) = 0 \\ \\
\dfrac{\partial}{\partial y}v_2(x,0) = \dfrac{\partial}{\partial y}v_2(x,L) = a
\end{cases} 
\end{matrix}
The homogeneous boundaries allow us to use separation of variables to solve each individual problem


*

*The first one is easier since you can intuitively guess that it's constant in $y$ and linear in $x$. This turns out to be 


$$ v_1(x,y) = T_0\frac{x}{L} + T_1\frac{L-x}{L} = \frac{(T_0-T_1)x}{L} + T_1 $$ 


*

*For the second problem, the homogeneous boundary condition on $x$ returns a series solution of the form


$$ v_2(x,y) = \sum_{n=1}^\infty \sin\left(\frac{n\pi x}{L}\right)\left[A_n\cosh\left(\frac{n\pi y}{L}\right) + B_n \cosh\left(\frac{n\pi(L-y)}{L}\right)\right] $$
Then, applying the remaining boundary conditions on $y$ will give
$$ A_n = -B_n = \begin{cases} \dfrac{4aL}{n^2\pi^2\sinh(n\pi)}, & n \text{ odd} \\ 0, & n \text{ even} \end{cases} $$
For a more thorough explanation of why I'm using hyperbolic functions instead of exponentials, check out my answer for this similar problem. Short answer: It makes the math easier

The remaining transient solution is homogeneous on all boundaries and has initial conditions that cancel out the steady-state:
\begin{cases} 
\dfrac{\partial u}{\partial t} = \nabla^2 u \\ \\
u(0,y,t) = u(L,y,t) = \dfrac{\partial}{\partial y}u(x,0,t) = \dfrac{\partial}{\partial y}u(x,L,t) = 0 \\ \\
u(x,y,0) = T_0 - v(x,y)
\end{cases}
Applying separation of variables once more and matching the homogeneous boundaries, we obtain
$$ u(x,y,t) = \sum_{n,m} c_{n,m} \sin\left(\frac{n\pi x}{L}\right)\cos\left(\frac{m\pi y}{L}\right)\exp \left[-(n^2+m^2)\frac{\pi^2}{L^2}t\right] $$
The initial condition for this last piece will have you solve a double Fourier series in $x$, $y$. You can use linearity to simplify calculations a bit, i.e.
\begin{align}
u_1(x,y,0) &= T_0 - T_1 - \frac{T_0-T_1}{L}x = \sum_{n,m} c_{1(n,m)} \sin\left(\frac{n\pi x}{L}\right)\cos\left(\frac{m\pi y}{L}\right) \\
u_2(x,y,0) &= -\sum_{n=2k+1} \frac{4aL}{n^2\pi^2\cosh(n\pi)} \sin\left(\frac{n\pi x}{L}\right)\left[\cosh\left(\frac{n\pi y}{L}\right) - \cosh\left(\frac{n\pi(L-y)}{L}\right)\right] \\ &\qquad = \sum_{n,m} c_{2(n,m)} \sin\left(\frac{n\pi x}{L}\right)\cos\left(\frac{m\pi y}{L}\right)
\end{align}
The first boundary function is constant in $y$ and the second is already a partial Fourier series, so they simplify to
\begin{align}
T_0 - T_1 - \frac{T_0-T_1}{L}x &= \sum_{n=1}^\infty c_{1(n,0)} \sin\left(\frac{n\pi x}{L}\right) \\
-\frac{4aL}{n^2\pi^2\sinh(n\pi)} \left[\cosh\left(\frac{n\pi y}{L}\right) - \cosh\left(\frac{n\pi(L-y)}{L}\right)\right] &= c_{2(n,0)} + \sum_{m=1}^\infty c_{2(n,m)}\cos\left(\frac{m\pi y}{L}\right)
\end{align}
The last round of integration finishes the job
