フィルターのクリア

How to solve error in pdepe

2 ビュー (過去 30 日間)
María Jesús
María Jesús 2016 年 6 月 3 日
編集済み: Torsten 2016 年 6 月 6 日
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 日
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 日
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.

カテゴリ

Help Center および File ExchangeEigenvalue Problems についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by