:orphan: # SNESConvergedCorrectPressure Convergence test that adds a vector in the nullspace to make the continuum integral of the pressure field equal to zero. This is normally used only to evaluate convergence rates for the pressure accurately. The convergence test itself just mimics `SNESConvergedDefault()`. ## Synopsis ``` #include "petscdmplex.h" #include "petscsnes.h" PetscErrorCode SNESConvergedCorrectPressure(SNES snes, PetscInt it, PetscReal xnorm, PetscReal gnorm, PetscReal f, SNESConvergedReason *reason, void *ctx) ``` Logically Collective ## Input Parameters - ***snes -*** the `SNES` context - ***it -*** the iteration (0 indicates before any Newton steps) - ***xnorm -*** 2-norm of current iterate - ***snorm -*** 2-norm of current step - ***fnorm -*** 2-norm of function at current iterate - ***ctx -*** Optional user context ## Output Parameter - ***reason -*** `SNES_CONVERGED_ITERATING`, `SNES_CONVERGED_ITS`, or `SNES_DIVERGED_FNORM_NAN` ## Options Database Key - ***-snes_convergence_test correct_pressure -*** see `SNESSetFromOptions()` ## Notes In order to use this convergence test, you must set up several PETSc structures. First fields must be added to the `DM`, and a `PetscDS` must be created with discretizations of those fields. We currently assume that the pressure field has index 1. The pressure field must have a nullspace, likely created using the `DMSetNullSpaceConstructor()` interface. Last we must be able to integrate the pressure over the domain, so the `DM` attached to the SNES `must` be a `DMPLEX` at this time. ## See Also `SNES`, `DM`, `SNESConvergedDefault()`, `SNESSetConvergenceTest()`, `DMSetNullSpaceConstructor()`, `DMSetNullSpaceConstructor()` ## Level advanced ## Location src/snes/utils/dmplexsnes.c --- [Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/snes/utils/dmplexsnes.c) [Index of all SNES routines](index.md) [Table of Contents for all manual pages](/manualpages/index.md) [Index of all manual pages](/manualpages/singleindex.md)