Skip to content
This repository has been archived by the owner on Mar 18, 2023. It is now read-only.

Added ProgressMeter functionality [Experimental/RFC] #27

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

obiajulu
Copy link

@obiajulu obiajulu commented Sep 9, 2016

This is a small PR (which may be more of a proof of concept than anything else) in which Tim Holy's ProgressMeter package is used to show how much of a ODE problem a solver has already solved.

I found that the iterator formulation of ODE.jl allowed for very easy integration of the ProgressMeter package. All of the code is implemented at the top level interface, using the iteration loop over the iterate object that is created for the solver and problem combination. In order to enable the progress meter on a given run, I added a new keyword agrument to the fixed and adaptive solver options called progressmeter. When set to true, a bar showing how far along the time span the solver has already solved for is displayed. It is set to false as a default. Below is a screenshot of it all in action:
ode iterator progressmeter screen shot

Here is the script run in the above screenshot.

using ODE;
function f(t, y)
   # Extract the components of the y vector
   (x, v) = y
   # Our system of differential equations
   x_prime = v
   v_prime = -x
   # Return the derivatives as a vector
   [x_prime; v_prime]
end;
time = 0:0.001:40000;
starty = [0.0; 0.1];
t,y = ODE.ode23(f,starty,time,progressmeter=true);

Also a cool upshot of this is, because the ODE solvers do have a somewhat uniform running time, the predicted "ETA" does give an appropriate estimate.

All of this is just one of the many pluses for a general iterator framework!

Thanks a million to @mauro3 for the idea and thoughts for how to get started.

prog = Progress(round(Int,1000*tdir*(tf-t0)), "Solving:")

for (t,y) in prob
push!(to,t)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4-indent

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants