Solving heat equation using Fourier-series with non-homogeneous assymetric bondary conditions

fourier analysisfourier serieslinear-pdeordinary differential equationspartial differential equations

Problem

I am having trouble with finding a solution which satisfies the boundary and initial conditions to this PDE:

$$\frac{\partial u}{\partial t} = \frac{\partial ^2 u}{\partial^2x}$$
where $u=u(x,t)$, $0 \leq x \leq L$
with boundary & initial conditions:

BC1: $u(x=0,t>0)=T_f$;
BC2: $u(x=L,t>0)=T_i$;
IC: $u(x,t=0)=f(x)$


Related but different posts


What I do get

Following the strategy outlined here, I do separation of variables:

$$u(x,t) = X(x)T(t)$$

The PDE becomes:

$$\frac{T'}{\alpha T}=\frac{X''}{X}$$

LHS only time dependence, RHS only x dependence, so they must be equal to a constant. Let this constant be $-\lambda$ (with $\lambda > 0$ so we get an exponential decay rather than growth for the temporal equation).

Temporal eq:

$$T'=-\lambda \alpha T$$

which implies:

$$T(t)=A e^{-\lambda \alpha t}$$

Spatial eq:

$$X''+\lambda X = 0$$

having a solution:

$$X(x) = B e^{\sqrt{-\lambda}x}+Ce^{-\sqrt{-\lambda}x}$$

which, since $\lambda>0$, can be rewritten to:

$$X(x) = B \sin(\sqrt{\lambda}x) + C \cos(\sqrt{\lambda}x)$$


Where issues begin

If we had $u(x=0,L;t) = 0$, I would be confident to use these to determine $\lambda$ & C to be:
$$\lambda = \frac{n^2 \pi^2}{L^2}$$
$$C=0$$

Then, proceed by setting $A=1$, so we have: $$u(x,t) = \sum_{n=0}^{\infty}B_{n} \sin\left(\frac{n\pi}{L}x\right) e^{-\frac{n^2 \pi^2}{L^2}\alpha t}$$

Then, determine $B_n$s using orthogonality of the different frequency sine functions:

$$B_n = \frac{2}{L}\int_0^Lf(x)\sin\left(\frac{n\pi}{L}x\right)dx$$


How do I attempt to tackle them

Despite my IC is not $u(x=0,L;t) = 0$, I have some hope for this path. Now my solution is:

$$u(x,t) = e^{-\frac{n^2 \pi^2}{L^2}\alpha t} \sum_{n=0}^{\infty}\frac{2}{L}\left(\int_0^Lf(x)\sin\left(\frac{n\pi}{L}x\right)dx\right)\sin\left(\frac{n\pi}{L}x\right)$$

Which I believe satisfies my IC but not my BCs. Don't worry, lets add to $X(x)$ a line which make it satisfy the BCs as well (which are: $u(x=0,t>0)=T_f$ & $u(x=L,t>0)=T_i$). Let's call this $X_p$:

$$X_p(x) = \frac{T_i-T_f}{L}x$$

Now if I just add this to the previously found $X$, I will obviously screw up the $B_n$s, which were calculated such a way that the weighted sum of sines will give me $f(x)$. If I just add $X_p$, the weighted sum of sines and $X_p$ will give me $f(x)+X_p$. Lets subtract $X_p$ from $f(x)$ when calculating the coefficeients of the sines, that way the weighted sum of the sines and $X_p$ will give me $f(x)-X_p+X_p = f(x)$ in $t=0$, which is good, and in $t>0$ I still satisfy my BCs because I have added $X_p$ to the general solution.


Where I arrive

So my final result is:

$$u(x,t) = e^{-\frac{n^2 \pi^2}{L^2}\alpha t} \left(\sum_{n=0}^{\infty}\frac{2}{L}\left(\int_0^L\left(f(x) – \frac{T_i-T_f}{L}x\right)\sin\left(\frac{n\pi}{L}x\right)dx\right)\sin\left(\frac{n\pi}{L}x\right)+\frac{T_i-T_f}{L}x\right)$$


Question

Is this a right way of obtaining the solution to the equation, or is it completely off track? Is there a name for the different steps I am using? If there is a standard way of solving these kind of equations which is not this way, I'd like to know.

(My guess would be that the $X_p$ is some kind of "particular solution", but I have used that term in different context, and my memory regarding terminology is pretty short.)

Best Answer

Reduce the problem by looking at the equation solved by $$ v(x,t)=u(x,t)-\left(1-\frac{x}{L}\right)T_f-\frac{x}{L}T_i $$ This function $v$ satisifes $$ v_t = v_{xx} \\ v(x=0,t > 0) = u(x=0,t)-T_f=0 \\ v(x=L,t > 0) = u(x=L,t)-T_i=0 \\ v(x,0)= f(x)-\left(1-\frac{x}{L}\right)T_f-\frac{x}{L}T_i $$ With the homogeneous conditions at $x=0,L$, the solution $v$ can be writte as a $\sin$ series in $x$: $$ v(x,t)= \sum_{n=1}^{\infty}A_n(t)\sin(n\pi x/L) $$ The functions $A_n(t)$ are determined by $v_t = v_{xx}$ and the initial conditions. $$ \sum_{n=1}^{\infty}A_n'(t)\sin(n\pi x/L)=-\sum_{n=1}^{\infty}A_n(t)\frac{n^2\pi^2}{L^2}\sin(n\pi x/L) \\ \implies A_n(t) = A_n(0)e^{-n^2\pi^2 t/L^2} $$ Then $v(x,0)=f(x)-(1-x/L)T_f-(x/L)T_i$ gives $$ f(x)-(1-x/L)T_f-(x/L)T_i = v(x,0)=\sum_{n=1}^{\infty}A_n(0)\sin(n\pi x/L) $$ This determines the coefficients $A_n(0)$ as Fourier $\sin$ coefficients, which completes the solution. (I'll leave it to you to find the $A_n(0)$ using the orthogonality of the functions $\sin(n\pi x/L)$.)

Related Question