How do I create a copy of ode15s that runs.

1 view (last 30 days)
I need to modify ode15s and so I am trying to produce a copy. I opened the code and then saved it with a new name, renamed the function ode15sJJB and changed line 110 to be consistent: solver_name = 'ode15sJJB';. I placed the copied version of the code, now ode15sJJB in the file with my main code that calls it and made no other changes. When I run the copied version, I get the following error:
Undefined function 'odearguments' for input arguments of type 'function_handle'.
Error in ode15sJJB (line 150) odearguments(FcnHandlesUsed, solver_name, ode, tspan, y0, options, varargin);
Error in ViscoelasticFlowDEM2 (line 124) [t,X] = ode15sJJB(@ViscoelasticFlowDEM2Fun,[0:.03:tf], Xo, OPTIONS); % Solves the differntial equation for the flow simulation
Please advise me on how to get a copied version of ode15s to run.
Thank you,
Joe Biernacki Professor Tennessee Technological University 931-372-3667.
  3 Comments
John D'Errico
John D'Errico on 8 Oct 2018
Modifying supplied code is a really bad idea. Why do you think you need to do that?
Joseph Biernacki
Joseph Biernacki on 8 Oct 2018
Dear John and Others,
The problem is somewhat complicated, I think. I am writing a Discrete Element Method (DEM) model for granular flows and so I am directly solving Newtons equations of motions for a number of particles. ode15s works very nicely for this problems and there is nothing wrong with what it does. However, this is only true if the boundaries are either "hard," i.e. the particles are trapped in a domain, or "opened," i.e. the particles can move as if there are no boundaries. What I need to do is to generate periodic boundary conditions. Here is where I feel the problem is. The DEM is an initial value problem. Yes, there are boundaries, but it is not a "boundary value problem." I recognize the MatLab has a number of boundary value solvers, but it is not clear how to use them for this problem. My problem is discrete, i.e. the "boundary conditions" are not continuous differentiable functions. In my case, I am tracking the motion of N particles. If in a given time-step a particle is to move outside of a given domain, that particle is to appear returning into the system at a prescribed location, e.g. at some transposed point. This form of discrete relocation is not a continuous function.
So, why do I need to get into ode15s? At this time it does not seem that I can change the vector of solution variables, i.e. “varargout” without getting inside ode15s. When a user calls ode15s, that user passes derivatives of the varargout values to ode15s. ode15s then calculates new values of varargout and moves forward. Since in my case, some of the varargout values are positions of particles within a domain, I need to interrogate where those points are and then apply a periodic conditional that moves them as necessary.
I recognize that this might be problematic in many ways, but I thought that starting with ode15s is better than starting from scratch with writing my own solver, which is still an option.
I also recognize that might be mistaken about how ode15s functions and am glad to be corrected. Furthermore, if this strategy will not work, that is fine as well; I will likely code my own solver.
I can send my code if you still think you can help, but understand that it is a work in progress and not annotated as well as it could be at this point.
I would be glad to discuss the problem further as you like or see fit.
Thank you for any way you can help,
Joe.

Sign in to comment.

Answers (1)

Steven Lord
Steven Lord on 8 Oct 2018
The ODE solvers use some private helpers, like odearguments, that are only accessible to files in the directory in which ode15s and the other solvers live.
While it would be possible to make copies of those helpers for your copy of ode15s to use, I don't recommend it. Instead I second John's question. Why do you want to make a modified version of ode15s?

Categories

Find more on Programming in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!