Fix adjustableRunTIme bug in the FoamTimeStepper#123
Open
mattfalcone1997 wants to merge 7 commits into
Open
Conversation
k-collie
reviewed
Jul 10, 2026
k-collie
left a comment
Collaborator
There was a problem hiding this comment.
First set of comments, looks good so far
| { | ||
| } | ||
|
|
||
| virtual ~mooseDeltaT() {}; |
Collaborator
There was a problem hiding this comment.
I think we can remove this now
Comment on lines
+180
to
+183
| // We need the adjustDeltaT function of Foam::Time to be called for adjustableRunTime | ||
| // writeControl to work properly. However, it is protected so we must do it through the public | ||
| // function setDeltaT. As a result, we save and then reset deltaT to its original value. | ||
| // |
Collaborator
There was a problem hiding this comment.
Can you explain a bit more what side effect of adjustableRunTime is needed for writeControl?
| void disable() { _enabled = false; } | ||
| Foam::scalar calculateDeltaTFactor(const Foam::scalar time) const | ||
| { | ||
| if (!_old_desired_dt) |
Collaborator
There was a problem hiding this comment.
Mildly more explicit:
Suggested change
| if (!_old_desired_dt) | |
| if (!_old_desired_dt.has_value()) |
Comment on lines
+77
to
+78
| Foam::functionObjects::mooseDeltaT * | ||
| findMooseDeltaT(Foam::Time & time) |
Collaborator
There was a problem hiding this comment.
Could this once again be my favourite type?
std::optional<std::reference_wrapper<Foam::functionObjects::mooseDeltaT>>
Comment on lines
-94
to
-98
| // The key idea is that runTime.functionObjects().maxDeltaT() in adjustDeltaT | ||
| // loops over the function objects and chooses the minimum, so by having | ||
| // a function Object that returns what MOOSE wants, OpenFOAM will use the | ||
| // MOOSE time step if it is smaller than what OpenFOAM wants. As a result, | ||
| // if MOOSE wants to add a synchronisation step OpenFOAM will also use it too. |
Collaborator
There was a problem hiding this comment.
This comment is still useful right? Maybe it could go in docstring for mooseDeltaT
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
mooseDeltaTfunction object is searfched in Foam::Time rather than a reference stored and it is now recreated if it is cleared byFoam::Time::adjustDeltaTRelated Issue
Resolves #122
Checklist