I want to know how to implement the (nonhomogeneous) initial boundary value problem for a heat equation; $$u_{xx}=u_t ~~~x\in (-1,1),~t\in(0,1)$$ $$u(0,x)=u_0(x)$$ $$u(t,-1)=f(t), ~u_x(t,1)=0$$

Many text books only introduce the scheme $\frac{u^n(\mathbf x)-u^{n-1}(\mathbf x)}{k_n} - \left[ (1-\theta)\Delta u^{n-1}(\mathbf x) + \theta\Delta u^n(\mathbf x) \right] = 0$ for the homogeneous cases and it reperesents Crank Nicolson's when $\theta = 0.5$.

Could anybody give me a conscise example or a good reference for the above when the basis function is given by a (piecewise linear) 1D hat function?

Any help will be appreciated.


1 Answer 1


This is such a basic problem that basically everyone does in PDE classes. Do not get distracted if Crank-Nicholson is not showing up, the temporal integrator is not that important in the first place. You can start your journey by looking into this, this or this, for instance. But there has to be plenty much more out there, also already pre-coded examples.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .