Hi,
I am interested in integrating a pde on a 2d domain that has a u_x term in it. As a test, I tried to add such a term to the Gray--Scott example from the documentation.
----------------------------------------------------
ep1 = 0.00002; ep2 = 0.00001;
b = 0.04; d = 0.1;
c=0.000001;
dom = [-1 1 -1 1]; x = chebfun('x',dom(1:2)); tspan = [0 3500];
S = spinop2(dom,tspan);
%S.linearPart = @(u,v) [ep1*lap(u); ep2*lap(v)];
S.linearPart = @(u,v) [ep1*lap(u)+c*diffx(u); ep2*lap(v)];
S.nonlinearPart = @(u,v) [b*(1-u)-u.*v.^2;-d*v+u.*v.^2];
S.init = chebfun2v(@(x,y) 1-exp(-80*((x+.05).^2+(y+.02).^2)), ...
@(x,y) exp(-80*((x-.05).^2+(y-.02).^2)),dom);
pause off
tic, u = spin2(S,'N',200,'dt',2,'plot','off');
plot(u{2}), view(0,90), axis equal, axis off
time_in_seconds = toc
---------------------------------------------------
I get the following errors when I run it:
----------------------------------------------------
Undefined function 'diffx' for input arguments of type 'double'.
Error in spinop2/discretize/@(u,v)[ep1*(u)+c*diffx(u);ep2*(v)]
Error in spinop2/discretize (line 143)
A = feval(func, inputs{:});
Error in spinoperator.solvepde (line 216)
[L, Nc] = discretize(S, N);
Error in spin2 (line 142)
[uout, tout] = spinoperator.solvepde(varargin{:});
----------------------------------------------------
I also tried diff(u,1,2) instead of diffx(u) and got the errors:
----------------------------------------------------
Attempted to access A(2); index out of bounds because numel(A)=1.
Error in spinop2/discretize (line 203)
L = [L; A(k)*lapmat + B(k)*bihmat + C(k)*trihmat + D(k)*quadhmat + ...
Error in spinoperator.solvepde (line 216)
[L, Nc] = discretize(S, N);
Error in spin2 (line 142)
[uout, tout] = spinoperator.solvepde(varargin{:});
----------------------------------------------------
I'm also curious if there is a reason why the terms -b*u and -d*v are included in S.nonlinearPart instead of S.linearPart? This is my first time playing with chebfun, so any help would be appreciated. Thanks!
Punit