Skip to content

Allow overwriting solutions#1041

Open
LasNikas wants to merge 5 commits intotrixi-framework:mainfrom
LasNikas:allow-overwriting
Open

Allow overwriting solutions#1041
LasNikas wants to merge 5 commits intotrixi-framework:mainfrom
LasNikas:allow-overwriting

Conversation

@LasNikas
Copy link
Collaborator

@LasNikas LasNikas commented Jan 11, 2026

At first glance, this keyword does not really make sense.
Since one would achieve the same result with save_final_solution=true and save_times=[tspan[end]], right?
However, one would then not have regular backups of the results.
As I mention in the docs:

Useful for memory efficiency in large simulations where only
the final result matters. The difference to simply setting
save_final_solution=true is that this provides regular checkpoint
backups at each save interval.

@LasNikas LasNikas requested review from efaulhaber and svchb January 11, 2026 12:40
@LasNikas LasNikas self-assigned this Jan 11, 2026
@LasNikas LasNikas mentioned this pull request Jan 11, 2026
19 tasks
@codecov
Copy link

codecov bot commented Jan 11, 2026

Codecov Report

❌ Patch coverage is 80.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 89.63%. Comparing base (acaf860) to head (f17871a).
⚠️ Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
src/io/write_vtk.jl 75.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1041   +/-   ##
=======================================
  Coverage   89.63%   89.63%           
=======================================
  Files         121      121           
  Lines        8763     8764    +1     
=======================================
+ Hits         7855     7856    +1     
  Misses        908      908           
Flag Coverage Δ
total 89.63% <80.00%> (+<0.01%) ⬆️
unit 65.77% <40.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@LasNikas
Copy link
Collaborator Author

/run-gpu-tests


"""
trixi2vtk(vu_ode, semi, t; iter=nothing, output_directory="out", prefix="",
trixi2vtk(vu_ode, semi, t; iter=-1, output_directory="out", prefix="",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you just use nothing here?

* add_underscore_to_optional_postfix(iter))
file_ = joinpath(output_directory,
add_underscore_to_optional_prefix(prefix) * "$system_name")
file = iter < 0 ? file_ : file_ * add_underscore_to_optional_postfix(iter)
Copy link
Collaborator

Choose a reason for hiding this comment

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

if you modify 'add_underscore_to_optional_postfix' and 'add_underscore_to_optional_prefix' to return '' for nothing as well you can keep the original code

Copy link
Collaborator

Choose a reason for hiding this comment

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

Or this does already work? I am not sure.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hmm but then it is not consistent with pvd = paraview_collection(collection_file; append=iter > 0).
What's wrong with -1?

Copy link
Collaborator

Choose a reason for hiding this comment

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

But if you overwrite there shouldn't be a collection anyway?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Here, the collection consists only of the current solution. Is this wrong?
What is wrong with iter=-1?

Copy link
Collaborator

Choose a reason for hiding this comment

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

No its not wrong but you could skip writing the collection file since with one timestep in it it doesn't really make sense.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

From a usage perspective, I think it doesn't make sense to have a PVD file if we already know there is only ever going to be one VTK file in the collection.

But I also don't think it makes sense to just omit the iteration number. Say we want to use a regular saving callback (with very large intervals) and one specifically for restarts (the purpose of this PR, no?). First issue would be that both generate fluid_1.pvd, so we definitely don't want a PVD from the overwriting callback. Second, we would get fluid_1_0.vtu, fluid_1_1.vtu etc. and fluid_1.pvd from the regular callback plus one fluid_1.vtu from the overwriting callback. This is confusing. I would prefer adding a suffix like "current" or so. Then we get fluid_1.pvd from the regular callback and fluid_1_current.vtu from this callback.

@LasNikas LasNikas requested a review from svchb January 14, 2026 17:49
@svchb svchb added the enhancement New feature or request label Jan 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants