I am interested in solving a system of stiff pdes using spin. There are some nice examples given for 1D and 2D problems, but I cannot find one that gives sufficient details about how to set up a system of several one-dimensional PDEs.
In the examples section on PDES, the Gray-Scot PDEs in 2D is given, but I would like to see the 1D version in order to learn how to set the initial conditions for a system of PDEs using the command spin.
I am interested in solving the Kuramoto-Sivashinksy equation plus a second PDE whose evolution depends on the solution to the KS equation.
Here's the MATLAB code:
n=100;
m=n.^2;
s=1;
Ma=1;
Bo=-0.01;
Lambda=200*pi;
dom = [0 Lambda]; tspan = 0:10^3:10^6;
S = spinop(dom, tspan);
S.lin = @(u,v) [Bo.*diff(u,2)./12-diff(u,4)./12;...
-s*diff(v)/2+Ma*diff(v,2)./(4*n)-s*diff(u)./n]; % linear part of PDE
S.nonlin = @(u,v) [-s.*diff(u.^2)./(2*n);0]; % nonlinear part of PDE
rng('default'); rng(0);
nptsx=1024;
data=zeros(nptsx); % set up the initial condition (small amplitude random "noise")
data = data + 1e-4*randn(size(data));
% If solving for u only I can set S.init=chebfun(data,dom) and the code works
S.init=chebfun(data,dom); % How should this line be changed so that v's initial condition is also some random distribution?
u = spin(S, nptsx, 10.);
Any suggestions would be appreciated.
David Halpern