ApproxFun and Burgers' equation

DanielVandH
Sat, 23 Jul 2022 03:35:03 +0000
Numerics

I am trying to use ApproxFun to solve Burgers’ equation, u_t + uu_x = \mu u_{xx}, on the interval -L \leq x \leq L with initial condition u(x, 0) = f(x) = 1/(1+x^2) and boundary conditions u(\pm L, t) = 0. I was trying to modify some of the code here Burgers Pseudospectral Methods Work-Precision Diagrams for my case, but it doesn’t explain how to incorporate boundary conditions / what to do in the non-periodic case where I’d assume ChebyshevInterval would be used instead.

Does anyone know of an example for my case, or have any guidance for incorporating such boundary conditions / setting up the differential operators required? Thank you. I’m trying to replicate the following Chebfun code from MATLAB:

M = 250;
N = 100;
mu = 0.05;
L = 40;
T = 8/sqrt(27);
t = linspace(0, T, N);
a = -L;
b = L;
xvals = linspace(a, b, M);
d = [a b];
pdefun = @(t, x, u) mu * diff(u, 2) - diff(u.^2/2);
bc.left = @(u) u;
bc.right = @(u) u;
x = chebfun(@(x) x, d);
f = 1/(1+x^2);
opts = pdeset('Eps', 1e-4);
[t, u_num] = pde15s(pdefun, t, f, bc, opts);

into ApproxFun.

7 posts - 4 participants