I am finding issues in PDEPe which shows time integration failure again and again
Ältere Kommentare anzeigen
"Warning: Failure at t=2.088125e-04. Unable to meet integration tolerances without reducing the step size
below the smallest value allowed (4.336809e-19) at time t. "
This message is being shown for running my code. I am uploading my code below.
clear all
clc
close all
m=0;
x=linspace(0,1,1001);
t=linspace(0,1,1001);
options = odeset('RelTol', 1e-3, 'AbsTol', 1e-6,'MaxStep', 0.1);
sol=pdepe(m,@coupledpde_BACD,@coupledic_BACD,@coupledbc_BACD,x,t,options);
b=sol(:,:,1);
figure(1)
surf(x,t,b)
xlabel('x')
ylabel('t')
zlabel('b(x,t)')
grid on
title('Bacterial distribution');
view([150 25])
colorbar
colormap jet
for j=[1 11 101]
ylim([0,1.2])
figure(2)
hold on
plot(x,b(j,:),LineWidth=2)
title("Particle Concentration Profile at t= (1, 11, 101)*td")
xlabel("Characteristic length")
ylabel('bacteria Concentration')
end
function [c,f,s]= coupledpde_BACD(x,t,u, dudx)
Db=10^-12;
Dc=10^-9;
X0=10^-9;
% X0=linspace(10^-11,10^-9,100);
% Db=linspace(10^-13,10^-12,100);
c=1;
s=0;
l=[pi/2 3*pi/2 5*pi/2];
A=4.*(cos(l)-1)./(2.*l-sin(2.*l));
mob_ratio=X0/Dc;
d_ratio=Db/Dc;
f=(d_ratio).*dudx-u*(mob_ratio)./(1+exp(-l(1)^2.*t).*A(1).*sin(l(1).*x)).*(exp(-l(1)^2.*t).*A(1).*cos(l(1).*x).*l(1));
end
function u0 = coupledic_BACD(x)
u0=1;
end
function [pl,ql,pr,qr]= coupledbc_BACD(xl,ul,xr,ur,t)
pl=ul;
ql=0;
pr=0;
qr=1;
end
please help me find the issue in the code
4 Kommentare
Torsten
am 21 Jun. 2024
Which boundary condition do you try to set at the right end of your spatial interval ?
Aadityaamlan
am 22 Jun. 2024
At the moment, you set
(d_ratio).*dudx(@x=1)-u(@x=1)*(mob_ratio)./(1+exp(-l(1)^2.*t).*A(1).*sin(l(1))).*(exp(-l(1)^2.*t).*A(1).*cos(l(1)).*l(1)) = 0
Is this what you mean by "zero neumann boundary condition" ?
Aadityaamlan
am 25 Jun. 2024
Antworten (1)
Umang Pandey
am 16 Jul. 2024
0 Stimmen
Hi Aaditya,
This error message indicates that the problem you are trying to solve is too stiff for the ODE solver you are trying to use, or that it includes a singularity.
It has been explained by the MathWorks Support Staff in the following MATLAB answer:
Hope this helps!
Best,
Umang
Kategorien
Mehr zu Debugging and Improving Code finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!