3
$\begingroup$

What is the exact analytical solution of a 1D thermal conductivity PDE:

$\dfrac{\partial T}{\partial t} = \alpha\cdot \dfrac{\partial^2 T}{\partial x^2}$,

where $T$ = temperature, $\alpha$ = thermal conductivity coefficient, $x\in\left(0,\ldots,L\right)$ = distance coordinate, $t$ = time.

with mixed B.C.

  • Dirichlet type B.C.: $\:\:T\left(x=0, t\right)\:=\: 30$
  • Neumann type B.C.: $\:\:\dfrac{\partial T}{\partial x} \left(x=L, t\right)\:=\: 0$

I would like to implement the analytical solution into my code to compare an error of numerical schemes I used to numerically solve this eq. I have found that this equation has a numerical solution, but only as an information, not the solution itself.

$\endgroup$
22
  • 6
    $\begingroup$ You can find this discussed here, for example, as well as in nearly any heat transfer textbook or handbook. $\endgroup$ Apr 3 at 18:43
  • 3
    $\begingroup$ There is no one single analytic solution. The solutions to this equation vary with the imposed boundary conditions and initial conditions. $\endgroup$ Apr 3 at 18:50
  • $\begingroup$ @ChetMiller Thanks, I think that I came by some source saying that. I also read that the geometry may play certain role (however, not in case of a 1D heat transfer without radial gradients, I assumed). I have updated my post with the I.C. and B.C.. $\endgroup$
    – Josh E.
    Apr 3 at 19:33
  • $\begingroup$ @Chemomechanics, I will look into the paper, thanks. $\endgroup$
    – Josh E.
    Apr 3 at 19:36
  • $\begingroup$ The term initial condition refers to the specified temperature profile at time zero. $\endgroup$ Apr 3 at 19:45
5
$\begingroup$

Our partial differential equation (PDE) and boundary conditions (BCs) are: $$T_t=\alpha T_{xx};$$ $$T(0,t)=30\text{ and }T_x(L,t)=0.$$ Let's use a generic initial condition (IC): $$T(x,0)=f(x).$$ First, we transform the dependent variable $T(x,t)$: $$u(x,t)=T(x,t)-30.$$ This means that: $$\Rightarrow u(0,t)=30-30=0.$$ The derivative $T_x(L,t)$ isn't affected, so: $$u_x(L,t)=T_x(L,t)=0.$$ Calculate the derivatives: $$u_t=T_t\text{ and }T_{xx}=u_{xx}.$$ So we've transformed our PDE to: $$u_t=\alpha u_{xx};$$ $$u(0,t)=0\text{ and }u_x(L,t)=0;$$ $$u(x,0)=f(x)-30.$$


Now the solving process starts. We use separation of variables.

Assume (make an Ansatz) that: $$u(x,t)=X(x)\Theta(t),$$ where $X(x)$ and $\Theta(t)$ are functions in $x$ and $t$ only, respectively. Insert into the PDE: $$X\Theta'=\alpha\Theta X''.$$ Divide both sides by $XT$ to get: $$\frac{\Theta'}{\alpha \Theta}=\frac{X''}{X}=-k^2,$$ where $k^2\in\mathbb{R}$ and $k^2>0$, called the separation constant. The PDE is now 'broken up' into two ordinary differential equations (ODEs): $$\frac{\Theta'}{\alpha \Theta}=-k^2\tag{1};$$ $$\frac{X''}{X}=-k^2\tag{2}.$$ Let's start with the second one. Its solution process is: $$X(x)=A\sin kx+B\cos kx;$$ $$u(0,t)=0\Rightarrow X(x)=0;$$ $$0=A\sin 0+B\cos 0\Rightarrow B=0;$$ $$X(x)=A\sin kx;$$ $$u_x(L,t)=0\Rightarrow X'(L)=0;$$ $$0=kA\cos kL\Rightarrow \cos kL=0;$$ $$\Rightarrow k=\frac{(n+1/2)\pi}{L};$$ $$k=\frac{(1+2n)\pi}{2L}.$$ The $k$ terms are the eigenvalues of the PDE. So we have:

$$X_n(x)=A_n\sin\left(\frac{(1+2n)\pi x}{2L}\right).$$ for $n=0,1,2,3,...$


From $(1)$, we glean easily that:

$$\Theta_n(t)=\exp{(-\alpha k^2t)}=\exp{\left[-\alpha\left(\frac{(1+2n)\pi}{2L}\right)^2t\right]};$$ Thus: $$u_n(x,t)=A_n\exp{\left[-\alpha\left(\frac{(1+2n)\pi}{2L}\right)^2t\right]}\sin\left(\frac{(1+2n)\pi x}{2L}\right).$$ With the superposition principle, we get:

$$\boxed{u(x,t)=\displaystyle\sum_{n=0}^{\infty}A_n\exp{\left[-\alpha\left(\frac{(1+2n)\pi}{2L}\right)^2t\right]}\sin\left(\frac{(1+2n)\pi x}{2L}\right)}$$ for $n=0,1,2,3,...$

At $t=0$, we have: $$f(x)-30=\displaystyle\sum_{n=1}^{\infty}A_n\sin\left(\frac{(1+2n)\pi x}{2L}\right).$$ We can then use the Fourier series to determine the coefficients $A_n$:

$$\boxed{A_n=\frac{2}{L}\int_0^L\mathrm{d}x\left[\big(f(x)-30\big)\sin\left(\frac{(1+2n)\pi x}{2L}\right)\right].}$$ Finally, don't forget that $T(x,t)=u(x,t)+30$.

$\endgroup$
5
  • $\begingroup$ Awesome, it works, the code nicely plots the curve. Finally, I have a nice comparison, thanks. Thanks for writing it in words of one syllable, I highly appreciate it. $\endgroup$
    – Josh E.
    Apr 4 at 16:18
  • 1
    $\begingroup$ Great! I'm now going to make a small simplification. $\endgroup$
    – Gert
    Apr 4 at 16:21
  • $\begingroup$ I've simplified the use of $n$ a little. $\endgroup$
    – Gert
    Apr 4 at 16:46
  • $\begingroup$ I edited what seemed to be some typos involving $n$. Please check, and I apologize if I've introduced any errors into this fine answer. $\endgroup$ Apr 4 at 20:49
  • $\begingroup$ @Chemomechanics Thank you! $\endgroup$
    – Gert
    Apr 4 at 22:01
2
$\begingroup$

The general solution for $$\partial_t T(x,t)=\alpha\Delta T(x,t) \,\,\,\text{with}\,\,\, T(0,t)=T(L,t)=0$$ is $$u(x,t)=\sum_{k\in\mathbb{N}}a_k e^{-\alpha\lambda_kt}f_k(x),$$ where the functions $f_k$ are eigenfunctions of the La-Place-Operator to the eigenvalue $\lambda_k$ $$\Delta f_k=\lambda_k f_k,\,\,\,\,\,\,\,(1)$$ with boundary conditions $f_k(0,t)=f_k(L,t)=0$. Because this implies $$\partial_t u(x,t)=\sum_{k\in\mathbb{N}}a_k (-\alpha\lambda_k)e^{-\alpha\lambda_kt}f_k(x)\stackrel{(1)}{=}-\alpha\sum_{k\in\mathbb{N}}a_k e^{-\lambda_kt}\Delta f_k(x)=-\alpha\Delta u(x,t)$$ and $$u(0,t)=u(L,t)=0.$$

The eigenvalue problem (1) is easy to solve with the exponential function: $$f_k(x)=C\sin(k\pi x/L)\,\,\,\,\text{and}\,\,\,\,\lambda_k=-\left(\frac{k\pi}{L}\right)^2.$$ The constant $C$ is defined by the inicial condition $T(x,0)$, after plugged in in $u(x,t)$.

For other boundary conditions add linear terms in $x$ to $u(x,t)$, as it will still solve the PDE. For example $$v(x,t)=u(x,t)+30$$ solves your Dirichlet B.C.. For more difficult B.C., solve the eigenvalue problem with according boundary conditions.

$\endgroup$
6
  • $\begingroup$ What does $u'(x,t)=u(x,t)+30$ mean? Looks like abuse of notation to me. $\endgroup$
    – Gert
    Apr 4 at 16:53
  • $\begingroup$ @Gert as it says explicitly in my answer: I used $u(x,t)$ for the solution with boundary conditions $u(0,t)=u(L,t)=0$ and $u'(x,t)$ for the solution with boundary conditions $u'(0,t)=u'(L,t)=30$. $\endgroup$
    – Roger
    Apr 4 at 17:03
  • $\begingroup$ So $u'(x,t)$ is u prime? If so, it's clearer to use $v(x,t)=u(x,t)+30$, IMHO... $\endgroup$
    – Gert
    Apr 4 at 17:05
  • $\begingroup$ @Gert depends on the notation you use. I don't think the prime notation is misleading, as this is the physics stack exchange and the prime notation for derivatives is more of a mathematical one. Nevertheless I will change my notation then. $\endgroup$
    – Roger
    Apr 4 at 17:08
  • $\begingroup$ I use (e.g.) $y'$ here all the time (also $\dot{y}$ and others). There's no convention that tells us what notation to use here or there. $\endgroup$
    – Gert
    Apr 4 at 17:13

Not the answer you're looking for? Browse other questions tagged or ask your own question.