-
Notifications
You must be signed in to change notification settings - Fork 8
Default Stokes velocity subsolve to FGMRES (#147) #149
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -3990,8 +3990,10 @@ class SNES_Stokes_SaddlePt(SolverBaseClass): | |||||
| p_name = "pressure" # pressureField.clean_name | ||||||
| v_name = "velocity" # velocityField.clean_name | ||||||
|
|
||||||
| # Works / mostly quick | ||||||
| # Pressure subsolve — flexible GMRES + GASM. (FGMRES is right- | ||||||
| # preconditioned by construction; no need to set pc_side explicitly.) | ||||||
| self.petsc_options[f"fieldsplit_{p_name}_ksp_type"] = "fgmres" | ||||||
| self.petsc_options[f"fieldsplit_{p_name}_ksp_max_it"] = 200 | ||||||
| self.petsc_options[f"fieldsplit_{p_name}_ksp_rtol"] = self._tolerance | ||||||
| self.petsc_options[f"fieldsplit_{p_name}_pc_type"] = "gasm" | ||||||
| # self.petsc_options[f"fieldsplit_{p_name}_pc_gasm_type"] = "basic" | ||||||
|
|
@@ -4003,8 +4005,20 @@ class SNES_Stokes_SaddlePt(SolverBaseClass): | |||||
| # self.petsc_options[f"fieldsplit_{p_name}_pc_gamg_type"] = "agg" | ||||||
| # self.petsc_options[f"fieldsplit_{p_name}_pc_gamg_repartition"] = True | ||||||
|
|
||||||
| # Great set of options for gamg | ||||||
| self.petsc_options[f"fieldsplit_{v_name}_ksp_type"] = "cg" | ||||||
| # Velocity subsolve — flexible GMRES + GAMG. | ||||||
| # | ||||||
| # FGMRES (not CG/FCG) is the default to remain robust under non-stationary | ||||||
| # preconditioning and weakly-indefinite coarse operators. The mg_levels | ||||||
| # KSP is bounded but variable-iteration (mg_levels_ksp_converged_maxits) | ||||||
| # so the GAMG application is non-linear; CG/FCG's residual recurrence | ||||||
| # cannot accommodate this, and at scale (large parallel partitions, sharp | ||||||
| # internal sources, free-slip Nitsche) PETSc reports DIVERGED_PC_FAILED | ||||||
| # / indefinite matrix or GMRES residual-recursion mismatch. See issue | ||||||
| # #147 for the spherical-Kramer benchmark on Gadi that drove this change; | ||||||
| # gthyagi's validated FGMRES configuration completed at np=144, | ||||||
| # cellsize=1/32 where CG/FCG and standard GMRES both failed. | ||||||
| self.petsc_options[f"fieldsplit_{v_name}_ksp_type"] = "fgmres" | ||||||
| self.petsc_options[f"fieldsplit_{v_name}_ksp_max_it"] = 200 | ||||||
| self.petsc_options[f"fieldsplit_{v_name}_ksp_rtol"] = self._tolerance * 0.1 | ||||||
|
||||||
| self.petsc_options[f"fieldsplit_{v_name}_ksp_rtol"] = self._tolerance * 0.1 | |
| self.petsc_options[f"fieldsplit_{v_name}_ksp_rtol"] = self._tolerance * 0.033 |
Copilot
AI
Apr 28, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In strategy setter, pressure subsolve rtol is reset to self._tolerance, which overrides the tolerance property’s documented behavior (fieldsplit_pressure_ksp_rtol = tolerance * 0.1). If users do solver.tolerance = ... and later solver.strategy = "default", they’ll silently get a different inner-solve tolerance. Suggest keeping strategy from clobbering tolerance-derived options (or recompute them using the same multipliers/call the tolerance setter at the end).
| self.petsc_options[f"fieldsplit_{p_name}_ksp_rtol"] = self._tolerance | |
| self.petsc_options[f"fieldsplit_{p_name}_ksp_rtol"] = self._tolerance * 0.1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In init,
fieldsplit_pressure_ksp_rtolis set toself._tolerance, but thetoleranceproperty setter/docstring later defines pressure subsolve rtol astolerance * 0.1. This creates inconsistent defaults depending on whether users touchtolerance. Consider deriving this fromtoleranceconsistently (e.g., use the same multiplier here or call thetolerancesetter after defaults are established).