Heat Equation¶
1-D heat equation¶
source:
heat_1d.py (basic)
vector_heat_1d_2pts.py, heat_1d_2pts_bdf1.py, heat_1d_2pts_bdf2.py (advanced)
example codes: example_heat_1d.py, example_heat_1d_bdf2.py
scalar PDE with unknown function \(u(x,t)\) of two independent variables
discretization:
second-order central finite differences in space
time integration:
backward Euler
BDF2
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
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
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\).