Skip to content

Adaptive stepsize#654

Merged
RemDelaporteMathurin merged 18 commits into
festim-dev:fenicsxfrom
RemDelaporteMathurin:stepsize
Dec 6, 2023
Merged

Adaptive stepsize#654
RemDelaporteMathurin merged 18 commits into
festim-dev:fenicsxfrom
RemDelaporteMathurin:stepsize

Conversation

@RemDelaporteMathurin
Copy link
Copy Markdown
Collaborator

@RemDelaporteMathurin RemDelaporteMathurin commented Nov 28, 2023

Proposed changes

This is an attempt at adding adaptive timestepping.

I've taken a similar approach to MOOSE where the users give a target number of iterations and a growth factor and a cutback factor.

If the number of newton iterations is larger than the target number, the stepsize is reduced (multiplied by cutback factor). Inversely when it's lower than the target, the stepsize is increased (growth factor).

@jhdark I've noticed we have the concept of the stepsize living in different places.
First we have HTransportProblem.settings.stepsize AND HTransportProblem.dt (which is just the fenicsx.Constant object).
I feel like we should remove this redundancy to improve clarity. Doesn't have to be in this PR but I felt like we could kick off the discussion now

Types of changes

What types of changes does your code introduce to FESTIM?

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Code refactoring
  • Documentation Update (if none of the other choices apply)
  • New tests

Checklist

  • Black formatted
  • Unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

@RemDelaporteMathurin RemDelaporteMathurin added the fenicsx Issue that is related to the fenicsx support label Nov 28, 2023
@codecov
Copy link
Copy Markdown

codecov Bot commented Dec 3, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (d601d06) 98.87% compared to head (a816839) 98.90%.

Additional details and impacted files
@@             Coverage Diff             @@
##           fenicsx     #654      +/-   ##
===========================================
+ Coverage    98.87%   98.90%   +0.03%     
===========================================
  Files           23       23              
  Lines          974     1009      +35     
===========================================
+ Hits           963      998      +35     
  Misses          11       11              

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

@RemDelaporteMathurin RemDelaporteMathurin marked this pull request as ready for review December 5, 2023 11:50
Copy link
Copy Markdown
Collaborator

@jhdark jhdark left a comment

Choose a reason for hiding this comment

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

Think we can change a few small things here, but otherwise, its looking good and will be incredibly useful

Comment thread festim/stepsize.py
Comment thread festim/stepsize.py
Comment thread festim/stepsize.py
Comment thread festim/stepsize.py
Comment thread festim/stepsize.py
Copy link
Copy Markdown
Collaborator

@jhdark jhdark left a comment

Choose a reason for hiding this comment

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

Looks good

Comment thread festim/stepsize.py Outdated
Co-authored-by: James Dark <65899899+jhdark@users.noreply.github.com>
@RemDelaporteMathurin RemDelaporteMathurin merged commit 728c23a into festim-dev:fenicsx Dec 6, 2023
@RemDelaporteMathurin RemDelaporteMathurin deleted the stepsize branch December 6, 2023 10:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fenicsx Issue that is related to the fenicsx support

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants