Heat equation with a single stationary sine forcing (source code)

= Heat equation with a single stationary sine forcing

On $0<x<L$, let $u_t=\nu u_{xx}+G\sin(n\pi x/L)$, with $\nu>0$, zero <Dirichlet boundary conditions>, and zero initial data. Write $k_n=n\pi/L$. Its stationary solution is $u_s=G\sin(k_nx)/(\nu k_n^2)$. Subtracting it removes the forcing from the <partial differential equation> and leaves a <heat equation> with initial data $-u_s$.

Because the forcing is a single spatial <eigenfunction>, <separation of variables> gives the entire solution without mixing modes:
$$
u(x,t)=\frac{G}{\nu k_n^2}(1-e^{-\nu k_n^2t})\sin(k_nx).
$$
Its integral is $G[1-(-1)^n](1-e^{-\nu k_n^2t})/(\nu k_n^3)$; <even> modes have zero signed net integral. Removing forcing from the evolution equation does not remove its amplitude from the initial data for the transient.