@@ -685,6 +685,32 @@ const SNESASPIN = "aspin"
685
685
const SNESCOMPOSITE = " composite"
686
686
const SNESPATCH = " patch"
687
687
688
+ """
689
+ Julia alias to `SNESConvergedReason` C enum.
690
+
691
+ See [PETSc manual](https://petsc.org/release/manualpages/SNES/SNESConvergedReason/).
692
+ """
693
+ @enum SNESConvergedReason begin
694
+ SNES_CONVERGED_FNORM_ABS = 2 # ||F|| < atol
695
+ SNES_CONVERGED_FNORM_RELATIVE = 3 # ||F|| < rtol*||F_initial||
696
+ SNES_CONVERGED_SNORM_RELATIVE = 4 # Newton computed step size small; || delta x || < stol || x ||
697
+ SNES_CONVERGED_ITS = 5 # maximum iterations reached
698
+ SNES_BREAKOUT_INNER_ITER = 6 # Flag to break out of inner loop after checking custom convergence.
699
+ # it is used in multi-phase flow when state changes diverged
700
+ SNES_DIVERGED_FUNCTION_DOMAIN = - 1 # the new x location passed the function is not in the domain of F
701
+ SNES_DIVERGED_FUNCTION_COUNT = - 2
702
+ SNES_DIVERGED_LINEAR_SOLVE = - 3 # the linear solve failed
703
+ SNES_DIVERGED_FNORM_NAN = - 4
704
+ SNES_DIVERGED_MAX_IT = - 5
705
+ SNES_DIVERGED_LINE_SEARCH = - 6 # the line search failed
706
+ SNES_DIVERGED_INNER = - 7 # inner solve failed
707
+ SNES_DIVERGED_LOCAL_MIN = - 8 # || J^T b || is small, implies converged to local minimum of F()
708
+ SNES_DIVERGED_DTOL = - 9 # || F || > divtol*||F_initial||
709
+ SNES_DIVERGED_JACOBIAN_DOMAIN = - 10 # Jacobian calculation does not make sense
710
+ SNES_DIVERGED_TR_DELTA = - 11
711
+
712
+ SNES_CONVERGED_ITERATING = 0
713
+ end
688
714
689
715
@wrapper (:SNESCreate ,PetscErrorCode,(MPI. Comm,Ptr{SNES}),(comm,snes)," https://petsc.org/release/docs/manualpages/SNES/SNESCreate.html" )
690
716
@wrapper (:SNESSetFunction ,PetscErrorCode,(SNES,Vec,Ptr{Cvoid},Ptr{Cvoid}),(snes,vec,fptr,ctx)," https://petsc.org/release/docs/manualpages/SNES/SNESSetFunction.html" )
@@ -700,6 +726,9 @@ const SNESPATCH = "patch"
700
726
@wrapper (:SNESSetCountersReset ,PetscErrorCode,(SNES,PetscBool),(snes,reset)," https://petsc.org/release/docs/manualpages/SNES/SNESSetCountersReset.html" )
701
727
@wrapper (:SNESGetNumberFunctionEvals ,PetscErrorCode,(SNES,Ptr{PetscInt}),(snes,nfuncs)," https://petsc.org/release/docs/manualpages/SNES/SNESGetNumberFunctionEvals.html" )
702
728
@wrapper (:SNESGetLinearSolveFailures ,PetscErrorCode,(SNES,Ptr{PetscInt}),(snes,nfails)," https://petsc.org/release/docs/manualpages/SNES/SNESGetLinearSolveFailures.html" )
729
+ @wrapper (:SNESSetConvergenceTest ,PetscErrorCode,(SNES,Ptr{Cvoid},Ptr{Cvoid},Ptr{Cvoid}),(snes,convtest,cctx,destroy)," https://petsc.org/release/manualpages/SNES/SNESSetConvergenceTest/" )
730
+ @wrapper (:SNESConvergedDefault ,PetscErrorCode,(SNES,PetscInt,PetscReal,PetscReal,PetscReal,Ptr{SNESConvergedReason},Ptr{Cvoid}),(snes,it,xnorm,gnorm,f,reason,user)," https://petsc.org/release/manualpages/SNES/SNESConvergedDefault/" )
731
+
703
732
704
733
# Garbage collection of PETSc objects
705
734
@wrapper (:PetscObjectRegisterDestroy ,PetscErrorCode,(Ptr{Cvoid},),(obj,)," https://petsc.org/release/docs/manualpages/Sys/PetscObjectRegisterDestroy.html" )
0 commit comments