Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expose setting of max-steps to python interface & test #581

Merged
merged 1 commit into from
Jan 8, 2019

Conversation

skyreflectedinmirrors
Copy link
Contributor

Changes proposed in this pull request:

  • Expose the ability to set the maximum number of CVODEs steps to the python interface
  • Add test to ensure setting works correctly.

I am using Cantera (as typically) to validate other ODE solvers. As such I typically want to set the network reactor tolerances to very stringent values (e.g., atol=1e-20, rtol=1e-15) and run ignition problems over a wide range of conditions.

The issue I'm currently facing is that the default # of steps (appears to be 20k?) works for most cases, but not all. Rather than playing the game of trying to modify the tolerances to fit in the number of steps, it would be nice if we could just expose this property to the user via the python interface.

Let me know if there are any comments / concerns,

Best,

Nick

@codecov
Copy link

codecov bot commented Dec 6, 2018

Codecov Report

Merging #581 into master will increase coverage by 0.01%.
The diff coverage is 33.33%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #581      +/-   ##
=========================================
+ Coverage   67.69%   67.7%   +0.01%     
=========================================
  Files         362     362              
  Lines       38456   38459       +3     
=========================================
+ Hits        26031   26039       +8     
+ Misses      12425   12420       -5
Impacted Files Coverage Δ
include/cantera/zeroD/ReactorNet.h 0% <ø> (ø) ⬆️
include/cantera/numerics/CVodesIntegrator.h 0% <ø> (ø) ⬆️
include/cantera/numerics/Integrator.h 2.85% <0%> (-0.18%) ⬇️
src/numerics/CVodesIntegrator.cpp 73.54% <100%> (+2.83%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 19577ab...80ae4fe. Read the comment docs.

@bryanwweber
Copy link
Member

Hey @arghdos! Thanks for this. Can you also add a method to get the max steps as well? Does CVODES expose that information?

@skyreflectedinmirrors
Copy link
Contributor Author

@bryanwweber Hmm, it doesn't look like they allow you to query the maximum # of steps, however we should be able to just return whatever value is stored in the integrator.

@skyreflectedinmirrors
Copy link
Contributor Author

@bryanwweber -- implemented

Copy link
Member

@speth speth left a comment

Choose a reason for hiding this comment

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

I had just a few minor suggestions, but this generally looks fine to me.

interfaces/cython/cantera/test/test_reactor.py Outdated Show resolved Hide resolved
include/cantera/numerics/CVodesIntegrator.h Outdated Show resolved Hide resolved
include/cantera/zeroD/ReactorNet.h Outdated Show resolved Hide resolved
@skyreflectedinmirrors skyreflectedinmirrors force-pushed the expose_maxsteps branch 2 times, most recently from 56758bb to 834cc72 Compare December 10, 2018 19:20
@speth
Copy link
Member

speth commented Jan 8, 2019

Sorry, I didn't notice that you updated this. LGTM!

@speth speth merged commit e323080 into Cantera:master Jan 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants