Skip to content

Archive and compare iterations.log for implicit coupling#743

Open
PranjalManhgaye wants to merge 9 commits into
precice:developfrom
PranjalManhgaye:issue-440-archive-compare-iterations-log
Open

Archive and compare iterations.log for implicit coupling#743
PranjalManhgaye wants to merge 9 commits into
precice:developfrom
PranjalManhgaye:issue-440-archive-compare-iterations-log

Conversation

@PranjalManhgaye

@PranjalManhgaye PranjalManhgaye commented Mar 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

Implicit coupling tutorials write precice-*-iterations.log files that show how many coupling iterations each time step needed. This PR adds system-test support to save those logs and check them against reference copies, so we notice when coupling behaviour changes unexpectedly. Closes #440.

Changes

  • Systemtest.py: After a tutorial run, collect precice-*-iterations.log files into iterations-logs/ and compare them by SHA-256 hash against archived reference copies in a *.iterations-logs/ directory next to each reference .tar.gz. A successful check is logged at INFO; a mismatch fails the test.
  • generate_reference_results.py: When you regenerate reference results, the iterations logs are copied into that *.iterations-logs/ folder so future runs have something to compare against.
  • README.md: Documents the behaviour.
  • changelog-entries/743.md: Changelog entry for this PR.

test (local)

image

Notes

  • Tests without reference iterations logs skip comparison (unchanged tutorials).
  • Explicit coupling (no iterations logs) is unaffected.

Checklist

  • Changelog entry in changelog-entries/743.md

@precice-bot

Copy link
Copy Markdown
Collaborator

This pull request has been mentioned on preCICE Forum on Discourse. There might be relevant details there:

https://precice.discourse.group/t/gsoc-2026-pranjal-manhgaye/2769/5

@MakisH MakisH added GSoC Contributed in the context of the Google Summer of Code systemtests labels Mar 13, 2026
@MakisH

MakisH commented May 17, 2026

Copy link
Copy Markdown
Member

@PranjalManhgaye could you please resolve the merge conflicts and prepare this PR for reviewing?

@MakisH MakisH left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Some first comments. I have not yet looked at the complete PR or tested it.

Comment thread tools/tests/generate_reference_results.py Outdated
Comment thread tools/tests/systemtests/Systemtest.py Outdated
Comment thread changelog-entries/440.md Outdated
@MakisH MakisH changed the title Archive and compare iterations.log for implicit coupling (fixes #440) Archive and compare iterations.log for implicit coupling May 17, 2026
@PranjalManhgaye

Copy link
Copy Markdown
Collaborator Author

thanks @MakisH for your review , i will make this pr review ready and also resolve conflicts .

Archive precice-*-iterations.log files during system tests and compare
them against reference copies for implicit-coupling regression checks.
@PranjalManhgaye PranjalManhgaye force-pushed the issue-440-archive-compare-iterations-log branch from 4ed9d9f to 4a1885d Compare May 18, 2026 07:19
@PranjalManhgaye

Copy link
Copy Markdown
Collaborator Author

Hi @MakisH , rebased onto develop, updated the PR description, and replied on your review threads. ready for another look when you have time.

@PranjalManhgaye PranjalManhgaye requested a review from MakisH May 18, 2026 07:41

@MakisH MakisH left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I have not yet completed my review, but here is already a first comment on something to check.

Tests I have executed locally:

  • python3 systemtests.py --suites="openfoam_adapter_release" (no iterations in the reference results) succeeds
  • python3 generate_reference_results.py --suites="openfoam_adapter_release" worked and generated results in an (uncompressed) folder flow-over-heated-plate/reference-results/fluid-openfoam_solid-openfoam.iterations-logs with fluid-openfoam/precice-Fluid-iterations.log and solid-openfoam/precice-Solid-iterations.log.
  • after updating the reference results: python3 systemtests.py --suites="openfoam_adapter_release" worked, but I don't see sha256 or iterations in the output to confirm.

Comment thread tools/tests/systemtests/Systemtest.py Outdated
Comment thread tools/tests/systemtests/Systemtest.py
Remove legacy .iterations-hashes.json support and log INFO when
iterations.log SHA-256 comparison passes so reviewers can confirm it ran.
@PranjalManhgaye

Copy link
Copy Markdown
Collaborator Author

Hi @MakisH , pushed 095502d ; removed the JSON sidecar fallback and added INFO output when the iterations hash check passes.
Re-tested openfoam_adapter_release locally => same steps as you, and the second run now shows the INFO line.readme updated ,
Ready for another look when you can.

@MakisH MakisH left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Here are some first comments. Even though I would hope for a simpler/shorter solution, this is also fine, as it is rather clear.

You could merge back from develop now, I am through with the larger changes I wanted to do for now. And I think this would then be rather easy to merge and it would make sense to do it soon.

Comment thread tools/tests/README.md
Comment thread changelog-entries/743.md Outdated
Comment thread tools/tests/systemtests/Systemtest.py
Merge upstream/develop, run fieldcompare before iterations.log hash
checks, append iterations results to system-tests-compare.log, and
document iterations log artifacts under numerical regressions.
@PranjalManhgaye

Copy link
Copy Markdown
Collaborator Author

@MakisH i have resolved your initial comments and also merged develop , it is ready for another review thanks ,,

@PranjalManhgaye PranjalManhgaye requested a review from MakisH June 16, 2026 19:36

@MakisH MakisH left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

A test run to see what happens for the current cases: https://github.com/precice/tutorials/actions/runs/28050285585/job/83038819578

Other than that, the documentation needs another look.

Comment thread tools/tests/README.md
Comment thread tools/tests/README.md Outdated
@PranjalManhgaye PranjalManhgaye requested a review from MakisH June 24, 2026 02:50
@MakisH

MakisH commented Jun 24, 2026

Copy link
Copy Markdown
Member

Testing locally partially works, but it seems like the reference files are not added to the branch.

Testing on GHA

(not that important for now, read first the local testing)

A run without the iterations in the reference results shows that the check is correctly skipped when iterations logs are not in the reference data.

A run adding reference results logs that the iterations logs are archived in reference-results/fluid-cpp_solid-cpp.iterations-logs, and I see those in the runner.

A subsequent run still reports that iterations files are not found.

Testing locally

Testing locally, again with the elastic-tube-1d fluid-cpp/solid-cpp, I do see the the directory:

..../tutorials/elastic-tube-1d/reference-results [test-743]$ tree
.
├── fluid-cpp_solid-cpp.iterations-logs
│   ├── fluid-cpp
│   │   └── precice-Fluid-iterations.log
│   └── solid-cpp
│       └── precice-Solid-iterations.log
├── ...
└── reference_results.metadata

which is excluded by the .gitignore rules.

Why not place this directory directly in the respective fluid-cpp_solid-cpp.tar.gz? It could be a separate directory inside it than the one with the vtu files, in case that helps.

@PranjalManhgaye

Copy link
Copy Markdown
Collaborator Author

thanks for checking @MakisH , its correct if *.iterations-logs/ dirs are gitignored by *.log , so i will do it as you suggested and update the comparison logic accordingly

Bundle precice-*-iterations.log into the reference .tar.gz instead of
gitignored sidecar dirs, and regenerate elastic-tube-1d fluid-cpp_solid-cpp
reference data.
Comment thread elastic-tube-1d/reference-results/fluid-cpp_solid-cpp.tar.gz
Reference tars will be generated on the runner via generate-reference-results.
@PranjalManhgaye PranjalManhgaye requested a review from MakisH June 24, 2026 10:56
@MakisH

MakisH commented Jun 24, 2026

Copy link
Copy Markdown
Member

Now the files are in the reference result archives, but fieldcompare fails:

field-compare-1  | [ FAILED  ] 2 file comparisons, listed below:
field-compare-1  | [ FAILED  ] iterations-logs/fluid-python/precice-Fluid-iterations.log: (Missing source file)
field-compare-1  | [ FAILED  ] iterations-logs/solid-python/precice-Solid-iterations.log: (Missing source file)

GHA run: https://github.com/precice/tutorials/actions/runs/28097293364

I think that having two separate directories in the archive would help. Ignoring specifically the iterations-logs/ directory in fieldcompare would also be fine, as it would be moving the iterations-logs/ outside the directory before running fieldcompare.

@PranjalManhgaye

Copy link
Copy Markdown
Collaborator Author

VTUs and iteration logs are now separate top-level tar members ({case}/ and {case}.iterations-logs/) ,so fieldcompare no longer hits log files in the VTU reference dir , verified locally , fieldcompare and hash check both pass ,refs will be regenerated on GHA ,,

Comment thread tools/tests/systemtests/Systemtest.py Outdated
@PranjalManhgaye PranjalManhgaye requested a review from MakisH June 24, 2026 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

GSoC Contributed in the context of the Google Summer of Code systemtests

Projects

Status: Needs review

Development

Successfully merging this pull request may close these issues.

Archive and compare iterations.log

3 participants