dde23: Stiff time-delay set of differential eqns

3 views (last 30 days)
Sylvia
Sylvia on 17 Jul 2015
Edited: Sylvia on 20 Jul 2015
I have a set of 11 differential equations that I want to solve. So far, I have solved the first 3 together using dde23 because they have time delays, and I have solved the last 8 together using ode15s because they're stiff. I don't think I can now solve them as a coupled set because MATLAB has no stiff time-delay solver (correct me if I'm wrong please). So here is my proposed solution:
1. Define a time point array over which to iterate. For the time span associated with each iteration, solve the first three equations with dde23. 2. Plug the solution of the first three equations at the later time point into the last 10 equations and solve with ode15s. I suppose this is a backward Euler-esque approach. 3. Update the history file for the first three equations with the solution from 1.
In the help page for dde23, it says that the history file can be specified as "The solution sol from a previous integration, if this call continues that integration." I'm not sure how this looks in practice. Here is the structure that I have:
function [soln, soln2] = fullSScollHM
...
timepts = linspace(0,1000,1000);
for tt = 1:length(timepts)-1
t0 = timepts(tt); tf = timepts(tt+1);
sol = dde23(@collHMfunc,lags,@coll2hist,[t0,tf],opts);
Ni = sol.y(1,end) + sol.y(2,end) + sol.y(3,end);
sol2 = ode15s(@(t,y) fullSSfunc(t,y,Ni),[t0,tf],...
[P0 qw0 qi0 T0 rw0 ri0 Sw0 qv0]);
...
end
function dnidt = collHMfunc(t,ni,Z)
...
nilag1 = Z(:,1); nilag2 = Z(:,2); nilag3 = Z(:,3);
dnidt(1) = ..
dnidt(2) = ..
dnidt(3) = ..
dnidt = dnidt';
end
function s = coll2hist(~,~,~)
if(counter ~= 1)
s = sol;
else
s = [0; 0; 0;];
end
end
function dy = fullSSfunc(~,y,Ni)
dy(1) = ..
dy(2) = ..
dy(3) = ..
dy(4) = ..
dy(5) = ..
dy(6) = ..
dy(7) = ..
dy(8) = ..
dy = dy';
end
end
Does the proposed solution seem reasonable? Has anyone used the solution of dde23 as the history file for the next run? Thank you for any help. - Sylvia
  1 Comment
Sylvia
Sylvia on 20 Jul 2015
Edited: Sylvia on 20 Jul 2015
This works but I'm not sure whether I am using the last point of sol as my constant history or the actual structure of sol as my time-varying history:
function [sol, sol2] = fullSScollHM
...
timepts = linspace(0,1000,1000);
sol = dde23(@collHMfunc,lags,@coll2hist,[0,timepts(2)],dqwdt,dqidt);
for tt = 2:length(timepts)-1
t0 = timepts(tt); tf = timepts(tt+1);
sol = dde23(@collHMfunc,lags,sol,[t0,tf],opts);
Ni = sol.y(1,end) + sol.y(2,end) + sol.y(3,end);
sol2 = ode15s(@(t,y) fullSSfunc(t,y,Ni),[t0,tf],...
[P0 qw0 qi0 T0 rw0 ri0 Sw0 qv0]);
...
end
function dnidt = collHMfunc(t,ni,Z)
function s = coll2hist(~,~,~)
s = [0; 0; 0;];
end
function dy = fullSSfunc(~,y,Ni)
end

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!