Skip to content

Conversation

@MarcBerliner
Copy link
Member

Description

I removed a few unnecessary checks for minimum dt values to proceed with the simulation.

I also removed the start_step_offset = 1e-9 heuristic setting. For large t_start values, you can get floating point arithmetic errors like t == t + 1e-9 that cause duplicate t values in the solution. I replaced start_step_offset with np.nextafter(t, np.inf), which prevents these errors by giving the next largest floating point number. cc @valentinsulzer

Type of change

Please add a line in the relevant section of CHANGELOG.md to document the change (include PR #) - note reverse order of PR #s. If necessary, also add to the list of breaking changes.

  • Optimization (back-end change that speeds up the code)

Key checklist:

  • No style issues: $ pre-commit run (or $ nox -s pre-commit) (see CONTRIBUTING.md for how to set this up to run automatically when committing locally, in just two lines of code)
  • All tests pass: $ python run-tests.py --all (or $ nox -s tests)
  • The documentation builds: $ python run-tests.py --doctest (or $ nox -s doctests)

You can run integration tests, unit tests, and doctests together at once, using $ python run-tests.py --quick (or $ nox -s 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 Sep 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.41%. Comparing base (3898453) to head (5430aca).
Report is 206 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #4416      +/-   ##
===========================================
- Coverage    99.42%   99.41%   -0.01%     
===========================================
  Files          292      292              
  Lines        22215    22212       -3     
===========================================
- Hits         22087    22083       -4     
- Misses         128      129       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@MarcBerliner MarcBerliner marked this pull request as ready for review September 4, 2024 20:53
Copy link
Contributor

@rtimms rtimms left a comment

Choose a reason for hiding this comment

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

thanks, @MarcBerliner looks good to me!

@rtimms rtimms merged commit b073fc7 into pybamm-team:develop Sep 4, 2024
@MarcBerliner MarcBerliner deleted the remove-step-start-offset branch September 4, 2024 21:00
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.

2 participants