Skip to content

SNES pseudo-timestepping fixes & improvements - #3492

Open
bendudson wants to merge 2 commits into
nextfrom
snes-ptc
Open

SNES pseudo-timestepping fixes & improvements#3492
bendudson wants to merge 2 commits into
nextfrom
snes-ptc

Conversation

@bendudson

Copy link
Copy Markdown
Contributor
  • Fix typo in calculating min_neighboring_dt. This is used to cap the cell-to-cell variation of timesteps.
  • Improve handling of failures, to try to prevent the PID controller from becoming saturated.

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.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

clang-tidy made some suggestions

} else {
// Log squash
// dt_vec <- timestep * (dt_vec / timestep)^lambda
PetscInt size;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

warning: variable 'size' is not initialized [cppcoreguidelines-init-variables]

src/solver/impls/snes/snes.cxx:1049:

- ;
+  = 0;

}

// Anti-windup: Calculate the effective alpha parameter
Field3D pseudo_alpha_effective = local_residual * pseudo_timestep;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

warning: variable 'pseudo_alpha_effective' of type 'Field3D' can be declared 'const' [misc-const-correctness]

Suggested change
Field3D pseudo_alpha_effective = local_residual * pseudo_timestep;
rconst

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant