Why ode45 can not solve while ode15s can solve?
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Jidapa Adam
il 18 Mar 2022
Commentato: Steven Lord
il 18 Mar 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 Commenti
Walter Roberson
il 18 Mar 2022
What happened when you tried with ode45?
Note: in order for us to test we would need your func_NiCo as well
Risposta accettata
Walter Roberson
il 18 Mar 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 Commenti
Walter Roberson
il 18 Mar 2022
Modificato: Walter Roberson
il 18 Mar 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
il 18 Mar 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.
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Ordinary Differential Equations in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!