I'm using pdepe to solve a parabolic pde in (x,t). I'm getting an error for times bigger than 0.3, though it works fine for smaller values. Is there a way to fix this?
function [c, b, a, D] = reac1(r, t, C, DCDr)
n = 1;
D_0 = 1;
C_0 = 100;
c = 1;
b = D_0*((C/C_0)^n)*DCDr;
a = -C*(1-C); %reaction term f(C)
%-----------------------
function value = ic2(r)
value = dirac_approx(r);
%-------------------------
function [d] = dirac_approx(x)
epsilon = 0.01;
d = epsilon^(-1)*max(1 - abs(x/epsilon), 0);
%--------------------------
function [pl, ql, pr, qr] = bc2(rl, Cl, rr, Cr, t)
pl = 0;
ql = 1;
pr = 0;
qr = 1;
%------------------------
clear all
m = 0;
r = linspace(0, 0.2, 100);
t = linspace(0, 0.4, 100);
C = pdepe(m, @reac1, @ic2, @bc2, r, t);
Warning: Failure at t=3.243157e-01. Unable to meet integration tolerances without reducing the step size below the
smallest value allowed (8.881784e-16) at time t.
> In ode15s (line 730)
In pdepe (line 289)
In reaction1 (line 9)
Warning: Time integration has failed. Solution is available at requested time points up to t=3.232323e-01.
> In pdepe (line 303)
In reaction1 (line 9)
Thanks!

댓글 수: 4

Torsten
Torsten 2016년 6월 6일
Without seeing your code, the only thing we can say is: Check your equations and their implementation in pdepe.
Best wishes
Torsten.
María Jesús
María Jesús 2016년 6월 6일
I've edited the code into the question
Torsten
Torsten 2016년 6월 6일
You missed to include "dirac_approx".
Best wishes
Torsten.
María Jesús
María Jesús 2016년 6월 6일
Sorry; it is there now.

댓글을 달려면 로그인하십시오.

답변 (1개)

Torsten
Torsten 2016년 6월 6일
편집: Torsten 2016년 6월 6일

0 개 추천

More and more of C is produced within the domain according to the sourceterm -C*(1-C).
This causes the solution C to become larger and larger and in the end approach infinity as t->00.
So back to my first advice: Check your model for physical sensefulness.
Best wishes
Torsten.

질문:

2016년 6월 3일

편집:

2016년 6월 6일

Community Treasure Hunt

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

Start Hunting!

Translated by