Conversation
Copy-paste error in calculation of neighboring timesteps.
Modify dt_vec PETSc Vec, pseudo_timestep Field3D and pseudo_alpha on SNES failure. When dt_vec was modified but pseudo_alpha was not, the PID controller would become saturated so that timestep increases were determined by caps on increases.
ZedThree
previously approved these changes
Sep 18, 2026
ZedThree
left a comment
Member
There was a problem hiding this comment.
LGTM, couple of minor suggestions
One cause of solver failure can be very large variation of the timestep between cells. When SNES repeatedly fails the pseudo timestep can therefore be "squashed" to reduce variation. This adds options to tune this process: - `pseudo_squash_failure_threshold` is an integer (default 5). Once the number of snes failures reaches this threshold squashing is performed (subsequent failures will be squashed again). When snes succeeds the counter is reset to zero. - `pseudo_squash_method` is an enum, `affine` or `log` to determine whether the squashing is linear or logarithmic. - `pseudo_squash_lambda` is a float between 0 and 1. It determines how much of the variation to keep.
Document the new timestep squashing options. Simplify descriptions of the method and timestep adjustment in the PTC method.
| case BoutPseudoSquashMethod::log: | ||
| // Log squash | ||
| // dt_vec <- timestep * (dt_vec / timestep)^lambda | ||
| PetscInt size; |
Contributor
There was a problem hiding this comment.
warning: variable 'size' is not initialized [cppcoreguidelines-init-variables]
src/solver/impls/snes/snes.cxx:1066:
- ;
+ = 0;
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.
min_neighboring_dt. This is used to cap the cell-to-cell variation of timesteps.