Borrar filtros
Borrar filtros

How to solve error in pdepe

2 visualizaciones (últimos 30 días)
María Jesús
María Jesús el 3 de Jun. de 2016
Editada: Torsten el 6 de Jun. de 2016
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 comentarios
Torsten
Torsten el 6 de Jun. de 2016
You missed to include "dirac_approx".
Best wishes
Torsten.
María Jesús
María Jesús el 6 de Jun. de 2016
Sorry; it is there now.

Iniciar sesión para comentar.

Respuestas (1)

Torsten
Torsten el 6 de Jun. de 2016
Editada: Torsten el 6 de Jun. de 2016
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.

Community Treasure Hunt

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

Start Hunting!

Translated by