Closed sseraj closed 3 months ago
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 41.02%. Comparing base (
7de267b
) to head (beb06fc
). Report is 2 commits behind head on main.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
After reviewing this a bit more, I noticed that we do not have the option to add iterative refinement with the AMG PC. Even though NK and ANK solvers default to no refinement, would it make sense to add a similar block like:
! Set the orthogonalization method for GMRES
select case (GMRESOrthogType)
case ('modified_gram_schmidt')
! Use modified Gram-Schmidt
call KSPGMRESSetOrthogonalization(kspObject, KSPGMRESModifiedGramSchmidtOrthogonalization, ierr)
case ('cgs_never_refine')
! Use classical Gram-Schmidt with no refinement
call KSPGMRESSetCGSRefinementType(kspObject, KSP_GMRES_CGS_REFINE_NEVER, ierr)
case ('cgs_refine_if_needed')
! Use classical Gram-Schmidt with refinement if needed
call KSPGMRESSetCGSRefinementType(kspObject, KSP_GMRES_CGS_REFINE_IFNEEDED, ierr)
case ('cgs_always_refine')
! Use classical Gram-Schmidt with refinement at every iteration
call KSPGMRESSetCGSRefinementType(kspObject, KSP_GMRES_CGS_REFINE_ALWAYS, ierr)
end select
call EChk(ierr, __FILE__, __LINE__)
to the AMG PC setup?
The new changes look good. I also want to add the option to enable iterative refinement to ANK and NK if desired. Default should be no refinement as that is what the code is doing for all cases now.
I want to add 2 python options that control this behavior: ANKUseGMRESRefinement
and NKUseGMRESRefinement
or we can replace GMRES with "Orthog" or something along those lines. Then these options can be added around the code where ANK and NK disables refinement (e.g. here for ANK: https://github.com/mdolab/adflow/blob/main/src/NKSolver/NKSolvers.F90#L2027-L2029)
Should we make this change in this PR or should I create a new PR for this? I can also make these changes here and push. Up to you @sseraj.
I think it would be better to make the ANK and NK changes in a separate PR
@eirikurj I think this is good to go, but we can wait to merge if you want to take a look.
Purpose
This PR adds separate ASM overlap, ILU fill level, and inner (ILU) iteration options for the coarse levels when using the AMG preconditioner. The motivation behind this is to allow for cheaper iterations at the coarse levels to speed up the overall solution time. The defaults for the coarse levels are set to the cheapest options possible (no ASM overlap, no ILU fill, 1 inner iteration). This changes the default behavior but should be advantageous for most cases.
Expected time until merged
2-3 weeks
Type of change
Testing
I added an AMG test with non-default options. The default options are used in the existing tests.
Checklist
flake8
andblack
to make sure the Python code adheres to PEP-8 and is consistently formattedfprettify
or C/C++ code withclang-format
as applicable