Why ode45 can not solve while ode15s can solve?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Jidapa Adam
am 18 Mär. 2022
Kommentiert: Steven Lord
am 18 Mär. 2022
My code can solve with ode15s but I would like to try on ode45, So can I use RelTol with value 1e-8 or can you give me other value of RelTol?
P0 = [0.5] ;%bar (Intial pressure)
Ta0 = [873] ;%K (Intial air heat temperature)
repeat = [1] ;%Repeat condition Ta constant and Ta non constant
sheet = 0 ;%Sheet in excel
condition = 0 ;%Number of condition
for a = 1:length(repeat)
for i = 1:length(P0)
for j = 1:length(Ta0)
T0 = Ta0(j) ;%K (Intial temperature before entering bed)
pj0 = yj0.*P0(i) ;%bar (Partial pressure)
Fj0 = (pj0.*v0_feed)./(R_feed.*T0) ;%mol/s (Molar flowrate)
Lspan = [0:0.01:0.03] ;%m (Bed length range)
dep_var0 = [Fj0' T0 Ta0(j)] ;%[mol/s,K,K] (Intial dependent variable)
condition = condition + 1 ;
var = [P0(i) Ta0(j) condition T0] ;%[bar,K,-,K] (Another variable that nessery)
options = odeset('RelTol',1e-3);
[L ,dep_var] = ode45(@func_NiCo,Lspan,dep_var0,options,var) ;
2 Kommentare
Walter Roberson
am 18 Mär. 2022
What happened when you tried with ode45?
Note: in order for us to test we would need your func_NiCo as well
Akzeptierte Antwort
Walter Roberson
am 18 Mär. 2022
You have a "stiff" system of equations. The equations wobble a lot and ode45 has to take very small steps to try to follow the wobbles because they might be important.
4 Kommentare
Walter Roberson
am 18 Mär. 2022
Bearbeitet: Walter Roberson
am 18 Mär. 2022
You can fix the problem by stopping interrupting ode45 and let it run the several years it needs to calculate the system properly.
(It is not a bug.)
Steven Lord
am 18 Mär. 2022
If you're not familiar with stiffness in ODEs I recommend reading through this post on Cleve Moler's blog. Run at least the one example Cleve recommends running and read his explanation for its performance.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Ordinary Differential Equations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!