PDE Discovery : Heat equations

Similar to the discovery of ODE and DAE systems, sparse regression can be used to discover the underlying equations for partial differential equations as well as proposed by PDEFind. The following example shows how this can be achieved with DataDrivenDiffEq.jl, using the heat equation with Dirichlet boundary conditions with the analytical soultion $u(x,t) = sin(2\pi x) exp^{-(2\pi t)^2t}$. We start by defining the system and generate some data.

using DataDrivenDiffEq
using LinearAlgebra
using ModelingToolkit
using OrdinaryDiffEq
using DiffEqOperators
using Plots

u_analytic(x, t) = sin(2*π*x) * exp(-t*(2*π)^2)
nknots = 100
h = 1.0/(nknots+1)
knots = range(h, step=h, length=nknots)
ord_deriv = 2
ord_approx = 2

const bc = Dirichlet0BC(Float64)
const Δ = CenteredDifference(ord_deriv, ord_approx, h, nknots)

t0 = 0.0
t1 = 1.0
u0 = u_analytic.(knots, t0)

step(u,p,t) = Δ*bc*u
prob = ODEProblem(step, u0, (t0, t1))
alg = KenCarp4()
de_solution = solve(prob, alg);

plot(de_solution, legend = nothing)