Skip to content

Commit

Permalink
Merge branch 'fsbc-SPfix' of github.com:gang525/adflow into fsbc-SPfix
Browse files Browse the repository at this point in the history
  • Loading branch information
gawng committed Sep 21, 2023
2 parents bc947c3 + b65e697 commit 6525adb
Show file tree
Hide file tree
Showing 11 changed files with 747 additions and 511 deletions.
32 changes: 25 additions & 7 deletions adflow/pyADflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -5625,19 +5625,19 @@ def _getDefaultOptions():
"NKUseEW": [bool, True],
"NKADPC": [bool, False],
"NKViscPC": [bool, False],
"NKGlobalPreconditioner": [str, ["additive Schwarz", "multigrid"]],
"NKASMOverlap": [int, 1],
"NKPCILUFill": [int, 2],
"NKJacobianLag": [int, 20],
"applyPCSubspaceSize": [int, 10],
"NKInnerPreconIts": [int, 1],
"NKOuterPreconIts": [int, 1],
"NKAMGLevels": [int, 2],
"NKAMGNSmooth": [int, 1],
"NKLS": [str, ["cubic", "none", "non-monotone"]],
"NKFixedStep": [float, 0.25],
"RKReset": [bool, False],
"nRKReset": [int, 5],
# MG PC
"AGMGLevels": [int, 1],
"AGMGNSmooth": [int, 3],
# Approximate Newton-Krylov Parameters
"useANKSolver": [bool, True],
"ANKUseTurbDADI": [bool, True],
Expand All @@ -5648,11 +5648,14 @@ def _getDefaultOptions():
"ANKLinearSolveTol": [float, 0.05],
"ANKLinearSolveBuffer": [float, 0.01],
"ANKLinResMax": [float, 0.1],
"ANKGlobalPreconditioner": [str, ["additive Schwarz", "multigrid"]],
"ANKASMOverlap": [int, 1],
"ANKPCILUFill": [int, 2],
"ANKJacobianLag": [int, 10],
"ANKInnerPreconIts": [int, 1],
"ANKOuterPreconIts": [int, 1],
"ANKAMGLevels": [int, 2],
"ANKAMGNSmooth": [int, 1],
"ANKCFL0": [float, 5.0],
"ANKCFLMin": [float, 1.0],
"ANKCFLLimit": [float, 1e5],
Expand Down Expand Up @@ -5730,6 +5733,8 @@ def _getDefaultOptions():
"ASMOverlap": [int, 1],
"innerPreconIts": [int, 1],
"outerPreconIts": [int, 3],
"adjointAMGLevels": [int, 2],
"adjointAMGNSmooth": [int, 1],
"applyAdjointPCSubspaceSize": [int, 20],
"frozenTurbulence": [bool, False],
"useMatrixFreedrdw": [bool, True],
Expand Down Expand Up @@ -5791,7 +5796,7 @@ def _getOptionMap(self):
"stab": self.adflow.inputtsstabderiv,
"nk": self.adflow.nksolver,
"ank": self.adflow.anksolver,
"agmg": self.adflow.agmg,
"amg": self.adflow.amg,
"adjoint": self.adflow.inputadjoint,
"cost": self.adflow.inputcostfunctions,
"unsteady": self.adflow.inputunsteady,
Expand Down Expand Up @@ -6005,6 +6010,11 @@ def _getOptionMap(self):
"nkswitchtol": ["nk", "nk_switchtol"],
"nksubspacesize": ["nk", "nk_subspace"],
"nklinearsolvetol": ["nk", "nk_rtolinit"],
"nkglobalpreconditioner": {
"additive schwarz": "asm",
"multigrid": "mg",
"location": ["nk", "nk_precondtype"],
},
"nkasmoverlap": ["nk", "nk_asmoverlap"],
"nkpcilufill": ["nk", "nk_ilufill"],
"nkjacobianlag": ["nk", "nk_jacobianlag"],
Expand All @@ -6013,6 +6023,8 @@ def _getOptionMap(self):
"applypcsubspacesize": ["nk", "applypcsubspacesize"],
"nkinnerpreconits": ["nk", "nk_innerpreconits"],
"nkouterpreconits": ["nk", "nk_outerpreconits"],
"nkamglevels": ["nk", "nk_amglevels"],
"nkamgnsmooth": ["nk", "nk_amgnsmooth"],
"nkls": {
"none": self.adflow.constants.nolinesearch,
"cubic": self.adflow.constants.cubiclinesearch,
Expand All @@ -6022,9 +6034,6 @@ def _getOptionMap(self):
"nkfixedstep": ["nk", "nk_fixedstep"],
"rkreset": ["iter", "rkreset"],
"nrkreset": ["iter", "miniternum"],
# MG PC
"agmglevels": ["agmg", "agmglevels"],
"agmgnsmooth": ["agmg", "agmgnsmooth"],
# Approximate Newton-Krylov Parameters
"useanksolver": ["ank", "useanksolver"],
"ankuseturbdadi": ["ank", "ank_useturbdadi"],
Expand All @@ -6035,11 +6044,18 @@ def _getOptionMap(self):
"anklinearsolvetol": ["ank", "ank_rtol"],
"anklinearsolvebuffer": ["ank", "ank_atol_buffer"],
"anklinresmax": ["ank", "ank_linresmax"],
"ankglobalpreconditioner": {
"additive schwarz": "asm",
"multigrid": "mg",
"location": ["ank", "ank_precondtype"],
},
"ankasmoverlap": ["ank", "ank_asmoverlap"],
"ankpcilufill": ["ank", "ank_ilufill"],
"ankjacobianlag": ["ank", "ank_jacobianlag"],
"ankinnerpreconits": ["ank", "ank_innerpreconits"],
"ankouterpreconits": ["ank", "ank_outerpreconits"],
"ankamglevels": ["ank", "ank_amglevels"],
"ankamgnsmooth": ["ank", "ank_amgnsmooth"],
"ankcfl0": ["ank", "ank_cfl0"],
"ankcflmin": ["ank", "ank_cflmin0"],
"ankcfllimit": ["ank", "ank_cfllimit"],
Expand Down Expand Up @@ -6132,6 +6148,8 @@ def _getOptionMap(self):
"asmoverlap": ["adjoint", "overlap"],
"innerpreconits": ["adjoint", "innerpreconits"],
"outerpreconits": ["adjoint", "outerpreconits"],
"adjointamglevels": ["adjoint", "adjamglevels"],
"adjointamgnsmooth": ["adjoint", "adjamgnsmooth"],
"firstrun": ["adjoint", "firstrun"],
"verifystate": ["adjoint", "verifystate"],
"verifyspatial": ["adjoint", "verifyspatial"],
Expand Down
49 changes: 38 additions & 11 deletions doc/options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -878,6 +878,11 @@ NKViscPC:
This will have a memory and cost penalty, but the resulting preconditioner will be more accurate.
Users should experiment with other linear solver options as a smaller stencil preconditioner is usually good enough.
NKGlobalPreconditioner:
desc: Similar to the :py:data:`globalPreconditioner` option but for the NK solver.
additive Schwarz: Restricted additive Schwarz method (ASM)
multigrid: Algebraic multigrid (AMG)

NKASMOverlap:
desc: >
The number of overlap levels in the additive Schwarz preconditioner for the NK solver.
Expand Down Expand Up @@ -915,6 +920,14 @@ NKOuterPreconIts:
More iterations may help converge the linear system faster.
Typical values are from 1 to 3.
NKAMGLevels:
desc: >
Similar to the :py:data:`adjointAMGLevels` option but for the NK solver.
NKAMGNSmooth:
desc: >
Similar to the :py:data:`adjointAMGNSmooth` option but for the NK solver.
NKLS:
desc: >
The type of line search used with the NK solver.
Expand All @@ -935,16 +948,6 @@ nRKReset:
desc: >
The number of Runge-Kutta startup iterations to run when :py:data:`RKReset` is True.
AGMGLevels:
desc: >
Agglomerated multigrid preconditioner levels.
Experimental; should not be modified.
AGMGNSmooth:
desc: >
Agglomerated multigrid preconditioner parameter.
Experimental; should not be modified.
useANKSolver:
desc: >
Flag to enable the ANK solver.
Expand Down Expand Up @@ -999,6 +1002,11 @@ ANKLinResMax:
However, we want to manage the CFL number so that the linear residual after we run out of linear iterations is still below this target value.
This can be seen as the maximum allowed linear residual at each iteration.
ANKGlobalPreconditioner:
desc: Similar to the :py:data:`globalPreconditioner` option but for the ANK solver.
additive Schwarz: Restricted additive Schwarz method (ASM)
multigrid: Algebraic multigrid (AMG)

ANKASMOverlap:
desc: >
Similar to the :py:data:`NKASMOverlap` option but for the ANK solver.
Expand All @@ -1022,6 +1030,14 @@ ANKOuterPreconIts:
desc: >
Similar to the :py:data:`NKOuterPreconIts` option but for the ANK solver.
ANKAMGLevels:
desc: >
Similar to the :py:data:`adjointAMGLevels` option but for the ANK solver.
ANKAMGNSmooth:
desc: >
Similar to the :py:data:`adjointAMGNSmooth` option but for the ANK solver.
ANKCFL0:
desc: >
The initial CFL number for the ANK solver.
Expand Down Expand Up @@ -1408,7 +1424,10 @@ matrixOrdering:
globalPreconditioner:
desc: The type of (global) preconditioner to use for the adjoint system.
additive Schwarz: Restricted additive Schwarz method (ASM)
multigrid: Agglomerated multigrid (AGMG)
multigrid: >
Algebraic multigrid (AMG).
This method can be much faster than ASM for large meshes.
The smoothing iterations and coarse level solutions are done with the standard ASM and ILU combination.
localPreconditioner:
desc: The type of preconditioner to use for the local preconditioning iteration in the adjoint solution.
Expand Down Expand Up @@ -1441,6 +1460,14 @@ outerPreconIts:
However, each iteration will take more time.
The default should be sufficient for most problems.
adjointAMGLevels:
desc: >
The number of levels to use for the adjoint solver's algebraic multigrid preconditioner.
adjointAMGNSmooth:
desc: >
The number of smoothing iterations at each level for the adjoint solver's algebraic multigrid preconditioner.
applyAdjointPCSubspaceSize:
desc: >
The Krylov subspace size for the adjoint preconditioner.
Expand Down

0 comments on commit 6525adb

Please sign in to comment.