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

Issue 759 non smooth dae #808

Merged
merged 20 commits into from
Feb 9, 2020
Merged

Issue 759 non smooth dae #808

merged 20 commits into from
Feb 9, 2020

Conversation

martinjrobins
Copy link
Contributor

@martinjrobins martinjrobins commented Feb 6, 2020

Description

Fixes #759

  • adds pybamm.Event class for holding information about events
  • added a new class of event that returns the time that a discontinuity in the solution occurs
  • changed the BaseSolver to filter out the discontinuity events. Integration is split over multiple segments of the time series, new time points are added just before and just after the discontinuity and added to the solution object
  • for models using heavyside functions in certain patterns, the discretisation class automatically adds in discontinuity events required

Type of change

  • New feature (non-breaking change which adds functionality)

Key checklist:

  • No style issues: $ flake8
  • All tests pass: $ python run-tests.py --unit
  • The documentation builds: $ cd docs and then $ make clean; make html

You can run all three at once, using $ python run-tests.py --quick.

Further checks:

  • Code is commented, particularly in hard-to-understand areas
  • Tests added that prove fix is effective or that feature works

@codecov
Copy link

codecov bot commented Feb 6, 2020

Codecov Report

Merging #808 into master will increase coverage by 0.00%.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #808   +/-   ##
=======================================
  Coverage   98.14%   98.14%           
=======================================
  Files         179      180    +1     
  Lines        9919     9987   +68     
=======================================
+ Hits         9735     9802   +67     
- Misses        184      185    +1     
Impacted Files Coverage Δ
pybamm/models/event.py 90.47% <0.00%> (ø)
pybamm/expression_tree/functions.py 100.00% <0.00%> (+0.58%) ⬆️

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 8f417cb...89595a5. Read the comment docs.

Copy link
Member

@valentinsulzer valentinsulzer left a comment

Choose a reason for hiding this comment

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

Thanks @martinjrobins , looks great as is! Can you add this to changelog? We will need to check that the DFN works with discontinuous current input now, but I think this can be something for a separate issue (and also setting up interpolants with heaviside)

pybamm/models/base_model.py Outdated Show resolved Hide resolved
@martinjrobins martinjrobins merged commit ffd0d37 into master Feb 9, 2020
@martinjrobins martinjrobins deleted the issue-759-non-smooth-dae branch February 9, 2020 16:11
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.

DAE solver for non-smooth currents
2 participants