I am getting error:Warning: Failure at t=0.000000e+00. Unable to ... (2025)

21 views (last 30 days)

Show older comments

Mandar Kadwekar on 21 Apr 2024

  • Link

    Direct link to this question

    https://www.mathworks.com/matlabcentral/answers/2109731-i-am-getting-error-warning-failure-at-t-0-000000e-00-unable-to-meet-integration-tolerances-witho

  • Link

    Direct link to this question

    https://www.mathworks.com/matlabcentral/answers/2109731-i-am-getting-error-warning-failure-at-t-0-000000e-00-unable-to-meet-integration-tolerances-witho

Edited: Torsten on 21 Apr 2024

Accepted Answer: Torsten

  • input_data.m

Open in MATLAB Online

This is my code

clc

clear

global datei Temp c0

datei='input_data.m';

run(datei);

zspan=[0 V/A_hc];

%intergration of the system

options=odeset('RelTol',1e-12,'AbsTol',1e-12);%,'NonNegative',2:7);

for n=1:size(c,1)

switch dataset

case 1

name=[experiment ' ' num2str(y0_nh3_scr(n,2)) ' ppm NH3 ' num2str(y0_nh3_scr(n,1)) ' vol NO ' num2str(y0_nh3_scr(n,5)) '% O2' ];

case 2

name=[experiment ' ' num2str(y0_nh3_ox(n,2)) ' ppm NH3 ' num2str(y0_nh3_ox(n,5)) ' vol O2'];

case 3

name=[experiment ' ' num2str(y0_hcho_ox(n,3)) ' ppm HCHO ' num2str(y0_hcho_ox(n,5)) ' vol O2'];

end

results=zeros(length(T),size(c,2)+2);

for m=1:length(T)

c0=c(n,1:4).*T_N./T(m);

c_o2=c0_o2(n).*T_N./T(m);

p_o2=p0_o2(n);

y0=[c0 0];

Temp=T(m);

disp(['Calculating Step ' num2str(m) ' of ' num2str(length(T))])

[t,y]=ode15s(@massbalance,zspan,y0,options);

toc

results(m,:)=[T(m)-273.15 y(end,:)];

end

end

Calculating Step 1 of 10

Warning: Failure at t=0.000000e+00. Unable to meet integration tolerances without reducing the step size below the smallest value allowed (7.905050e-323) at time t.

Elapsed time is 8.653056 seconds.

Calculating Step 2 of 10

Warning: Failure at t=0.000000e+00. Unable to meet integration tolerances without reducing the step size below the smallest value allowed (7.905050e-323) at time t.

Elapsed time is 8.252577 seconds.

Calculating Step 3 of 10

Warning: Failure at t=0.000000e+00. Unable to meet integration tolerances without reducing the step size below the smallest value allowed (7.905050e-323) at time t.

Elapsed time is 8.240095 seconds.

Calculating Step 4 of 10

Warning: Failure at t=0.000000e+00. Unable to meet integration tolerances without reducing the step size below the smallest value allowed (7.905050e-323) at time t.

Elapsed time is 8.303395 seconds.

Calculating Step 5 of 10

Warning: Failure at t=0.000000e+00. Unable to meet integration tolerances without reducing the step size below the smallest value allowed (7.905050e-323) at time t.

Elapsed time is 8.329335 seconds.

Calculating Step 6 of 10

Warning: Failure at t=0.000000e+00. Unable to meet integration tolerances without reducing the step size below the smallest value allowed (7.905050e-323) at time t.

Elapsed time is 8.261818 seconds.

Calculating Step 7 of 10

Warning: Failure at t=0.000000e+00. Unable to meet integration tolerances without reducing the step size below the smallest value allowed (7.905050e-323) at time t.

Elapsed time is 8.208911 seconds.

Calculating Step 8 of 10

Warning: Failure at t=0.000000e+00. Unable to meet integration tolerances without reducing the step size below the smallest value allowed (7.905050e-323) at time t.

Elapsed time is 8.235031 seconds.

Calculating Step 9 of 10

Warning: Failure at t=0.000000e+00. Unable to meet integration tolerances without reducing the step size below the smallest value allowed (7.905050e-323) at time t.

Elapsed time is 8.199416 seconds.

Calculating Step 10 of 10

Warning: Failure at t=0.000000e+00. Unable to meet integration tolerances without reducing the step size below the smallest value allowed (7.905050e-323) at time t.

Elapsed time is 8.179562 seconds.

results(:,2:5)=results(:,2:5).*Vm.*1e6.*(results(:,1)+273.15)./T_N;

switch dataset

case 1

results(:,2:3)=(1-results(:,2:3)./y0_nh3_scr(n,1:2)).*100;

case 2

results(:,3)=(1-results(:,3)./y0_nh3_ox(n,2)).*100;

case 3

results(:,4)=(1-results(:,4)./y0_hcho_ox(n,3)).*100;

end

name=[name ' ' char(num2str(fix(clock)))];

save(name,'results','-double','-ascii')

plot(results(:,1),results(:,2),'b',results(:,1),results(:,3),'r',results(:,1),results(:,6),'g')

xlabel('T / ^oC')

ylabel('y / ppm')

legend('NO','NH3','N2O')

I am getting error:Warning: Failure at t=0.000000e+00. Unable to ... (2)

function dy_dz = massbalance(takt,y)

global datei Temp c0

run(datei)

F=F*Temp/T_N;

u=F/A_hc;

if c0(1)==0

kin=kin_ox;

else

kin=kin_scr;

end

r1=kin(1,1).*exp(-kin(1,2)./R.*(1/Temp-1/kin(1,3))).*y(2).*(1-y(5));

r2=kin(2,1).*exp(-(kin(2,2)-y(5).*kin(2,3))./(R.*Temp)).*y(5);

r3=kin(3,1).*exp(-kin(3,2)./(R.*Temp)).*y(1).*y(5);

r4=kin(4,1).*exp(-kin(4,2)./(R.*Temp)).*y(5);

r5=kin(5,1).*exp(-kin(5,2)./(R.*Temp)).*y(4);

r6=kin(6,1).*exp(-kin(6,2.)/(R.*Temp)).*y(3);

%% mass balances

dy_dz=[1/u*(-r3)

1/u*(-r1+r2)

1/u*(-r6)

1/u*(-r5)

(r1-r2-r3-r4)/(u*gam)];

end

I am not able to figure out where I am making a mistake. I appricate all the help in advance.

0 Comments

Show -2 older commentsHide -2 older comments

Sign in to comment.

Sign in to answer this question.

Accepted Answer

Torsten on 21 Apr 2024

  • Link

    Direct link to this answer

    https://www.mathworks.com/matlabcentral/answers/2109731-i-am-getting-error-warning-failure-at-t-0-000000e-00-unable-to-meet-integration-tolerances-witho#answer_1445176

  • Link

    Direct link to this answer

    https://www.mathworks.com/matlabcentral/answers/2109731-i-am-getting-error-warning-failure-at-t-0-000000e-00-unable-to-meet-integration-tolerances-witho#answer_1445176

Edited: Torsten on 21 Apr 2024

Open in MATLAB Online

If you remove the semicolon behind

%% mass balances

dy_dz=[1/u*(-r3)

1/u*(-r1+r2)

1/u*(-r6)

1/u*(-r5)

(r1-r2-r3-r4)/(u*gam)];

and execute the code, you will see from what MATLAB writes to screen that the vector dy_dz contains NaN values right from the beginning of the integration.

And remember the time MATLAB needs to run "input_data.m" each time the function "massbalance" is called. Run "input_data.m" once as you already do in your script and pass the necessary parameters and arrays to "massbalance" via your call to ode15s:

[t,y] = ode15s(@(t,y)massbalance(t,y,parameter1,parameter2,...,array1,array2,...),zspan,y0,options);

...

function dy = massbalance(t,y,parameter1,parameter2,...,array1,array2,...)

...

end

0 Comments

Show -2 older commentsHide -2 older comments

Sign in to comment.

More Answers (1)

Joshua Levin Kurniawan on 21 Apr 2024

  • Link

    Direct link to this answer

    https://www.mathworks.com/matlabcentral/answers/2109731-i-am-getting-error-warning-failure-at-t-0-000000e-00-unable-to-meet-integration-tolerances-witho#answer_1445166

  • Link

    Direct link to this answer

    https://www.mathworks.com/matlabcentral/answers/2109731-i-am-getting-error-warning-failure-at-t-0-000000e-00-unable-to-meet-integration-tolerances-witho#answer_1445166

Error "Unable to meet integration tolerances without reducing the step size below the smallest value allowed " usually appears when there is a sudden discontinuities/sharp profile in the reference signal. We cannot avoid this error unless you set the relative and absolute tolerance to a bigger value.

0 Comments

Show -2 older commentsHide -2 older comments

Sign in to comment.

Sign in to answer this question.

See Also

Categories

MATLABProgramming

Find more on Programming in Help Center and File Exchange

Tags

  • ode
  • function

Products

  • MATLAB

Release

R2023b

Community Treasure Hunt

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

Start Hunting!

An Error Occurred

Unable to complete the action because of changes made to the page. Reload the page to see its updated state.


I am getting error:Warning: Failure at t=0.000000e+00. Unable to ... (5)

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list

Americas

  • América Latina (Español)
  • Canada (English)
  • United States (English)

Europe

  • Belgium (English)
  • Denmark (English)
  • Deutschland (Deutsch)
  • España (Español)
  • Finland (English)
  • France (Français)
  • Ireland (English)
  • Italia (Italiano)
  • Luxembourg (English)
  • Netherlands (English)
  • Norway (English)
  • Österreich (Deutsch)
  • Portugal (English)
  • Sweden (English)
  • Switzerland
    • Deutsch
    • English
    • Français
  • United Kingdom(English)

Asia Pacific

  • Australia (English)
  • India (English)
  • New Zealand (English)
  • 中国
  • 日本Japanese (日本語)
  • 한국Korean (한국어)

Contact your local office

I am getting error:Warning: Failure at t=0.000000e+00.  Unable to ... (2025)

References

Top Articles
Latest Posts
Recommended Articles
Article information

Author: Horacio Brakus JD

Last Updated:

Views: 5527

Rating: 4 / 5 (71 voted)

Reviews: 86% of readers found this page helpful

Author information

Name: Horacio Brakus JD

Birthday: 1999-08-21

Address: Apt. 524 43384 Minnie Prairie, South Edda, MA 62804

Phone: +5931039998219

Job: Sales Strategist

Hobby: Sculling, Kitesurfing, Orienteering, Painting, Computer programming, Creative writing, Scuba diving

Introduction: My name is Horacio Brakus JD, I am a lively, splendid, jolly, vivacious, vast, cheerful, agreeable person who loves writing and wants to share my knowledge and understanding with you.