Info

This question is closed. Reopen it to edit or answer.

Spatial discretization has failed. Discretization supports only parabolic and elliptic equations, with flux term involving spatial derivative.

1 view (last 30 days)
Hello,
Could you guys tell me what's wrong with the code. I'm trying to solve a Becker-Doring equation with diffusion. I am allowing only 4 clusters u1, u2, u3, u4 and the number of particles to be 9 which makes my Initial condition. Here is the code:
_________________________________
function [c,b,s] = eqn2(x,t,u,DuDx)
c = [1; 1; 1; 1]; b = [1; 1; 1; 1].*DuDx; s=[ -u(1)*u(1) -u(1)*u(2) -u(1)*u(3) - u(1)*u(4) + 2*(10^-6)*u(2) + (10^-6)*u(3) +(10^-6)*u(4); -u(1)*u(2) + (u(1)^2)/2 +(10^-6)*u(3); -u(1)*u(3) +u(1)*u(2) - (10^-6)*u(3) + (10^-6)*u(4);u(1)*u(3) - (10^-6)*u(4)];
______________________________________________
function value = initial2(x) %INITIAL2: MATLAB function M-file that defines initial conditions %for a system of two PDE in time and one space variable. value = [9; 0; 0; 0]; _________________________________________________
function [pl,ql,pr,qr] = bc2(xl,ul,xr,ur,t) %BC2: MATLAB function M-file that defines boundary conditions %for a system of two PDE in time and one space dimension. pl = [0; ul(2);ul(3);0]; ql = [1; 0;0;1]; pr = [ur(1)-1; 0;0;0]; qr = [0; 1;0;1];
___________________________
m = 0; x = linspace(0,1,100); t = linspace(0,1,100); sol = pdepe(m,@eqn2,@initial2,@bc2,x,t); u1 = sol(:,:,1); u2 = sol(:,:,2); u3 = sol(:,:,3); u4 = sol(:,:,4); subplot(2,1,1) surf(x,t,u1); subplot(2,1,2) surf(x,t,u2);

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!