Warning: Failure at t=1.663240e-07. Unable to meet integration tolerances without reducing the step size below the smallest value allowed (4.235165e-22) at time t.
1 view (last 30 days)
Show older comments
i am running this code ,
function file
function fn = plume5(t,Y)
global rho cp M R
fn(1) =((-1/((rho(1)-(rho(1)*M)/R*Y(1))*(1/cp)))*(760.91-(1608.08*Y(1))+(2449.22*Y(1)^2)-(2001.61*Y(1)^3)+(904.51*Y(1)^4)-(212.087*Y(1)^5)+(20.095*Y(1)^6) ));
fn(2) =((-1/((rho(2)-(rho(2)*M)/R*Y(1))*(1/cp)))*(760.91-(1608.08*Y(6))+(2449.22*Y(2)^2)-(2001.61*Y(2)^3)+(904.51*Y(2)^4)-(212.087*Y(2)^5)+(20.095*Y(2)^6) ));
fn(3)= ((-1/((rho(3)-(rho(3)*M)/R*Y(1))*(1/cp)))*(760.91-(1608.08*Y(7))+(2449.22*Y(3)^2)-(2001.61*Y(3)^3)+(904.51*Y(3)^4)-(212.087*Y(3)^5)+(20.095*Y(3)^6)));
fn(4)= ((-1/((rho(4)-(rho(4)*M)/R*Y(1))*(1/cp)))*(760.91-(1608.08*Y(8))+(2449.22*Y(4)^2)-(2001.61*Y(4)^3)+(904.51*Y(4)^4)-(212.087*Y(4)^5)+(20.095*Y(4)^6)));
fn(5) = (-1/(rho(5)*Y(5)))*(1.113-2.14*Y(5)+2.81*Y(5)^2-1.76*Y(5)^3+0.396*Y(5)^4+0.08694*Y(5)^5-0.0579*Y(5)^6 +0.0077*Y(5)^7);
fn(6) = (-1/(rho(6)*Y(6)))*(1.113-2.14*Y(6)+2.81*Y(6)^2-1.76*Y(6)^3+0.396*Y(6)^4+0.08694*Y(6)^5-0.0579*Y(6)^6 +0.0077*Y(6)^7);
fn(7) = (-1/(rho(7)*Y(7)))*(1.113-2.14*Y(7)+2.81*Y(7)^2-1.76*Y(7)^3+0.396*Y(7)^4+0.08694*Y(7)^5-0.0579*Y(7)^6 +0.0077*Y(7)^7);
fn(8) = (-1/(rho(8)*Y(8)))*(1.113-2.14*Y(8)+2.81*Y(8)^2-1.76*Y(8)^3+0.396*Y(8)^4+0.08694*Y(8)^5-0.0579*Y(8)^6 +0.0077*Y(8)^7);
fn = fn';
main file
clear all
close all
global rho cp M R
l = 2.8919
rho = [0.4586;0.7860;1.1449;1.1611;0.4586;0.7860;1.1449;1.1611]
x_CO2 = 0.5;
x_H2O = 0.5;
R = 8.314; %m3.Pa/mol/K
cp_CO2 = 1168; %J/kg/K
cp_H2O = 2147; %J/kg/K
cp = (x_CO2*cp_CO2)+(x_H2O*cp_H2O);
M_CO2 = 44*(10^-3); %kg/mol
M_H2O = 18*(10^-3); %kg/mol
M = (x_CO2*M_CO2) + (x_H2O*M_H2O);
t_span= 0:0.01:0.05
y = [0.0182;0.3105;1.2882;2.7341;0.0182;0.3105;1.2882;2.7341]
[A,P]= ode45('plume5',t_span,y);
but it states that its unable to meet the integration tolerances,without reducing the step size below the smallest value allowed (4.235165e-22) at time t.
1 Comment
Jayanth Bhimavarapu
on 24 Oct 2019
Edited: Jayanth Bhimavarapu
on 24 Oct 2019
Hi Sunetra
Try to relax the tolerance using odeset and then execute your script again.
>> my_opt = odeset('AbsTol',1E-5);
For more details refer:
However the value of tolerance depends on your data.
And pass this as an argument to your ode45 function as:
>> [A,P]= ode45('plume5',t_span,y,my_opt);
For more details refer:https://www.mathworks.com/help/matlab/ref/ode45.html#bu00_4l_sep_shared-options
Thanks
Jayanth
Answers (0)
See Also
Categories
Find more on Ordinary Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!