Heat Equation

1-D heat equation

The heat equation in 1D space is a partial differential equation that governs the flow of heat in a homogeneous and isotropic medium with \(u(x,t)\) being the temperature at the point \(x\) at time t. Denoting the thermal conductivity by \(a\), the governing equation is given by

\[u_t - au_{xx} = b(x,t) \;\; \text{ in } \; [x_{start},x_{end}]\times(t_0,t_{end}] \;\text{ with }\; u(x, t_0) = u_0(x)\]

and subject to some boundary conditions in space.

In example_heat_1d.py, the heat equation in the domain \([0,1]\times[0,2]\) is considered with a thermal conductivity of \(a = 1\), right-hand-side \(b(x,t)=-\sin(\pi x) (\sin(t) - \pi^2 \cos(t))\), homogeneous Dirichlet boundary conditions in space, and subject to the initial condition \(u(x,0) = \sin(\pi x)\).

Look at example_heat_1d_bdf2.py for using a combination of BDF2 and backward Euler time integration.

2-D heat equation

  • source: heat_2d.py

  • example code: example_heat_2d.py

  • scalar PDE with unknown function \(u(x, y, t)\) of three independent variables

  • discretization:

    • second-order central finite differences in space

    • time integration:

      • backward Euler

      • forward Euler

      • Crank-Nicolson

The heat equation in 2D space is a partial differential equation that governs the flow of heat in a homogeneous and isotropic medium with \(u(x, y, t)\) being the temperature at the point \((x,y)\) at time \(t\). Denoting the thermal conductivity by \(a\), the governing equation is given by

\[u_t - a(u_{xx}+u_{yy}) = b(x,y,t) \;\; \text{ in } \; [0,x_{end}]\times[0,y_{end}]\times(t_0,t_{end}] \;\text{ with }\; u(x,y, t_0) = u_0(x,y)\]

and subject to some boundary conditions in space.

In example_heat_2d.py, the heat equation in the domain \([0,0.75]\times[0,1.5]\times[0,2]\) is considered with a thermal conductivity of \(a = 3.5\), right-hand-side \(b(x,t) = 5x(x_{end}-x)y(y_{end}-y) + 10at(y(y_{end}-y) + x(x_{end} - x)\), homogeneous Dirichlet boundary conditions in space, and subject to the initial condition \(u(x,y,0) = 0\).