Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/fenicsx' into change-of-var-me…
Browse files Browse the repository at this point in the history
…thod
  • Loading branch information
RemDelaporteMathurin committed Nov 19, 2024
2 parents 92be8a9 + effcbac commit f5f4753
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ jobs:
run-tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
container_version: [v0.9.0, nightly]
container: dolfinx/dolfinx:${{ matrix.container_version }}
Expand Down
2 changes: 1 addition & 1 deletion src/festim/stepsize.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def modify_value(self, value, nb_iterations, t=None):
if updated_value > time_to_milestone and not np.isclose(
t, next_milestone, atol=0
):
updated_value = next_milestone
updated_value = time_to_milestone

return updated_value

Expand Down
14 changes: 6 additions & 8 deletions test/test_stepsize.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,23 +169,21 @@ def test_next_milestone(milestones, current_time, expected_value):
assert expected_value == next_milestone


def test_overshoot_milestone(nb_its=1, target=4):
def test_overshoot_milestone():
"""Test that stepsize is modified
when going to overshoot a milestone.
"""

my_stepsize = F.Stepsize(initial_value=0.1)
my_stepsize.growth_factor = 2.0
my_stepsize.target_nb_iterations = target
my_stepsize.growth_factor = 1
my_stepsize.target_nb_iterations = 4

my_stepsize.milestones = [1.3]

current_value = 0.5
new_value = my_stepsize.modify_value(
value=current_value, nb_iterations=nb_its, t=0.9
)
current_value = 100000
new_value = my_stepsize.modify_value(value=current_value, nb_iterations=1, t=1)

expected_value = 1.3
expected_value = 1.3 - 1

assert new_value == expected_value

Expand Down

0 comments on commit f5f4753

Please sign in to comment.