1 2 #include "src/ksp/pc/pcimpl.h" /*I "petscpc.h" I*/ 3 4 /* Options Database Keys: ??? 5 . -pc_ilu_damping - add damping to diagonal to prevent zero (or very small) pivots 6 . -pc_ilu_shift - apply Manteuffel shift to diagonal to force positive definite preconditioner 7 . -pc_ilu_zeropivot <tol> - set tolerance for what is considered a zero pivot 8 */ 9 10 #undef __FUNCT__ 11 #define __FUNCT__ "PCFactorSetZeroPivot" 12 /*@ 13 PCFactorSetZeroPivot - Sets the size at which smaller pivots are declared to be zero 14 15 Collective on PC 16 17 Input Parameters: 18 + zero - all pivots smaller than this will be considered zero 19 - info - options for factorization 20 21 Options Database Key: 22 . -pc_factor_zeropivot <zero> - Sets tolerance for what is considered a zero pivot 23 24 Level: intermediate 25 26 .keywords: PC, set, factorization, direct, fill 27 28 .seealso: PCFactorSetShiftNonzero(), PCFactorSetShiftPd() 29 @*/ 30 PetscErrorCode PCFactorSetZeroPivot(PetscReal zero,MatFactorInfo *info) 31 { 32 PetscFunctionBegin; 33 info->zeropivot = zero; 34 PetscFunctionReturn(0); 35 } 36 37 #undef __FUNCT__ 38 #define __FUNCT__ "PCFactorSetShiftNonzero" 39 /*@ 40 PCFactorSetShiftNonzero - adds this quantity to the diagonal of the matrix during 41 numerical factorization, thus the matrix has nonzero pivots 42 43 Collective on PC 44 45 Input Parameters: 46 + shift - amount of shift 47 - info - options for factorization 48 49 Options Database Key: 50 . -pc_factor_shiftnonzero <shift> - Sets shift amount or PETSC_DECIDE for the default 51 52 Note: If 0.0 is given, then no shift is used. If a diagonal element is classified as a zero 53 pivot, then the shift is doubled until this is alleviated. 54 55 Level: intermediate 56 57 .keywords: PC, set, factorization, direct, fill 58 59 .seealso: PCFactorSetZeroPivot(), PCFactorSetShiftPd() 60 @*/ 61 PetscErrorCode PCFactorSetShiftNonzero(PetscReal shift,MatFactorInfo *info) 62 { 63 PetscFunctionBegin; 64 if (shift == (PetscReal) PETSC_DECIDE) { 65 info->shiftnz = 1.e-12; 66 } else { 67 info->shiftnz = shift; 68 } 69 PetscFunctionReturn(0); 70 } 71 72 #undef __FUNCT__ 73 #define __FUNCT__ "PCFactorSetShiftPd" 74 /*@ 75 PCFactorSetShiftPd - specify whether to use Manteuffel shifting. 76 If a matrix factorisation breaks down because of nonpositive pivots, 77 adding sufficient identity to the diagonal will remedy this. 78 Setting this causes a bisection method to find the minimum shift that 79 will lead to a well-defined matrix factor. 80 81 Collective on PC 82 83 Input parameters: 84 + shifting - PETSC_TRUE to set shift else PETSC_FALSE 85 - info - options for factorization 86 87 Options Database Key: 88 . -pc_factor_shiftpd [1/0] - Activate/Deactivate PCFactorSetShiftPd(); the value 89 is optional with 1 being the default 90 91 Level: intermediate 92 93 .keywords: PC, indefinite, factorization 94 95 .seealso: PCFactorSetZeroPivot(), PCFactorSetShiftNonzero() 96 @*/ 97 PetscErrorCode PCFactorSetShiftPd(PetscTruth shifting,MatFactorInfo *info) 98 { 99 PetscFunctionBegin; 100 info->shiftpd = shifting; 101 PetscFunctionReturn(0); 102 } 103 104 105