Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restart simulation fixes #1047

Merged
merged 14 commits into from
Dec 4, 2023
Merged

Restart simulation fixes #1047

merged 14 commits into from
Dec 4, 2023

Conversation

MartinKarp
Copy link
Collaborator

@MartinKarp MartinKarp commented Nov 29, 2023

Adds various arrays to the restart such that a restart no longer starts the time integration with time integration of order 1, but rather exactly progresses the simulation exactly as if the simulation did not restart but simply ran for longer. Should be backwards compatible, but could use further testing.

Additions to the checkpoint file:

  • Lagged arrays for the scalar
  • Lagged extrapolated contributions (abx,aby,abz etc.) for both the scalar and fluid
  • Dt and tlag arrays

To be improved:

  • checkpoint should be moved out of fluid and perhaps restructured entirely.
  • each solver should add what it needs to restart into the checkpoint upon init, currently, I do this in the case file.
  • Feel like I did a lot of code cuplication
  • I did a test for debug message in the scalar solver, can we do this better?

To be noted:
There are two ways to restart in some sense, one is to save everything (like I do in this PR), and another is to recompute certain values from the field values at earlier stages (abx, aby, etc. can technically be calculated from the lagged u,v,w,s fields). However, due to the coupling with the forcing to calculate the abX arrays I chose to simply save everything. I feel this avoids a bunch of issues if someone would change the forcing or similar. We should just enforce that all new solvers add exactly what they need to the checkpoint upon init. The good thing about the recomputation part would be that one could restart easily from field files, but I think we can add some kind of reader for that as well in the future if it is necessary.

Copy link
Collaborator

@njansson njansson left a comment

Choose a reason for hiding this comment

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

Great stuff! 🍻
I'll cleanup the rest and also backport it to release/0.7

src/fluid/fluid_pnpn.f90 Show resolved Hide resolved
src/scalar/scalar_pnpn.f90 Outdated Show resolved Hide resolved
src/scalar/scalar_pnpn.f90 Show resolved Hide resolved
src/scalar/scalar_scheme.f90 Show resolved Hide resolved
src/simulation.f90 Outdated Show resolved Hide resolved
src/simulation.f90 Outdated Show resolved Hide resolved
@njansson njansson added the bug Something isn't working label Nov 30, 2023
src/scalar/scalar_pnpn.f90 Outdated Show resolved Hide resolved
src/scalar/scalar_pnpn.f90 Outdated Show resolved Hide resolved
src/scalar/scalar_pnpn.f90 Outdated Show resolved Hide resolved
src/scalar/scalar_pnpn.f90 Outdated Show resolved Hide resolved
src/scalar/scalar_pnpn.f90 Outdated Show resolved Hide resolved
src/scalar/scalar_pnpn.f90 Outdated Show resolved Hide resolved
src/scalar/scalar_pnpn.f90 Outdated Show resolved Hide resolved
src/scalar/scalar_scheme.f90 Outdated Show resolved Hide resolved
src/case.f90 Show resolved Hide resolved
@njansson njansson enabled auto-merge December 4, 2023 14:44
@njansson njansson merged commit e324259 into develop Dec 4, 2023
23 of 24 checks passed
@njansson njansson deleted the restart_fixes_galore branch April 29, 2024 06:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants