Skip to content

Reformating & Sanity Checks of Adaptive Test-cases#52

Open
imrishuvi wants to merge 6 commits intomainfrom
tests-for-adaptive-time-integration
Open

Reformating & Sanity Checks of Adaptive Test-cases#52
imrishuvi wants to merge 6 commits intomainfrom
tests-for-adaptive-time-integration

Conversation

@imrishuvi
Copy link
Copy Markdown
Collaborator

Reformatting and checks for Adaptive Test-Cases:

  • Reformatting
  • Test whether the time stepping is adaptive and not homogeneous.
  • Comparison of time step sizes with older versions

First version of reformatting; might be some errors.
@imrishuvi imrishuvi linked an issue Apr 16, 2026 that may be closed by this pull request
- Introduces a far less repeatitive code
- A test case, that verifies, that the integrator changes the time-step sizes, is added.
- a test case, that verifies code changes still produce identical time‑step sizes in the output data, is added.
@imrishuvi imrishuvi requested a review from F-Ross April 29, 2026 13:48
Copy link
Copy Markdown
Collaborator

@F-Ross F-Ross left a comment

Choose a reason for hiding this comment

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

Overall looks good already, but some things still need to be adapted (pun intended).

Comment thread tests/utils/callback.py Outdated
Comment thread tests/test_component_test_adaptive.py Outdated
Comment thread tests/utils/callback.py
Comment on lines +28 to +40
def after_iteration(
self,
iteration: int,
time_integration_state: TimeIntegrationState,
ode: DiscretizedODE,
discretization_scheme: TimeDiscretizationSchemeInterface,
):
step_size = time_integration_state.step_size_history[0]
print(f"Step size: {step_size}")

# Save Step size in a file
with open(self.write_file, "a") as file:
file.write(f"{step_size}\n")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is there any particular reason why you use a file and not e.g. a list or a set? Neither is the number of time steps expected to be so large that there could be a problem, you'd also have less problems fiddling with temporary paths later on. Furthermore, that gets you around the MPI-rank filter pattern.

Copy link
Copy Markdown
Collaborator Author

@imrishuvi imrishuvi Apr 30, 2026

Choose a reason for hiding this comment

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

Your words of wisdom ring true, my fellowship. Still, I favor the company of files, for they lend themselves more readily to later reflection. If there is something wicked in this nature, it is but the consequence of the environment that shaped me.

Comment thread tests/data/time_step_0.txt
Comment thread tests/test_component_test_adaptive.py Outdated
Comment thread tests/test_component_test_adaptive.py Outdated
Comment thread tests/test_component_test_adaptive.py
`HowToGenerateNewData` Created:
- A file explaining how to generated the data.
changes in `TimeStepsLog`:
- unnecessary lines removed
`test_component_test_adaptive.py`:
- Irrelevant comments removed
- test cases parametarization are now called from fixtures.
`HowToGenerateNewData` Created:
- A file explaining how to generated the data.
changes in `TimeStepsLog`:
- unnecessary lines removed
`test_component_test_adaptive.py`:
- Irrelevant comments removed
- test cases parametarization are now called from fixtures.
`HowToGenerateNewData` Created:
- A file explaining how to generated the data.
changes in `TimeStepsLog`:
- unnecessary lines removed
`test_component_test_adaptive.py`:
- Irrelevant comments removed
- test cases parametarization are now called from fixtures.
time_step_log wrong attribute. should be log.
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.

Tests for adaptive time integration insufficient

2 participants