Qin: PCFactorReorderForNonzeroDiagonal() Hong ________________________________ From: petsc-users <petsc-users-boun...@mcs.anl.gov> on behalf of Qin Lu via petsc-users <petsc-users@mcs.anl.gov> Sent: Thursday, July 9, 2020 10:05 AM To: Mark Adams <mfad...@lbl.gov>; Barry Smith <bsm...@petsc.dev>; nathaniel.coll...@gmail.com <nathaniel.coll...@gmail.com> Cc: PETSc Users List <petsc-users@mcs.anl.gov> Subject: Re: [petsc-users] Zero diagonal term for direct solver
Thanks for all your input! How can I set these options in the program instead of as runtime options (in the .petsc file)? For example, which subroutine shall I call to set '-pc_factor_nonzeros_along_diagonal", and what is corresponding argument value? Thanks, Qin On Wednesday, July 8, 2020, 02:15:11 PM CDT, Barry Smith <bsm...@petsc.dev> wrote: There is also -pc_factor_nonzeros_along_diagonal which reorders to move the zeros off the diagonal before the numerical factorization But if having 0 leads to a factorization without error then it will produce the correct answer (this means that zero got filled in during the factorization) On Jul 8, 2020, at 2:11 PM, Mark Adams <mfad...@lbl.gov<mailto:mfad...@lbl.gov>> wrote: On Wed, Jul 8, 2020 at 2:43 PM Qin Lu via petsc-users <petsc-users@mcs.anl.gov<mailto:petsc-users@mcs.anl.gov>> wrote: Hello, I am using the Petsc native direct solver (with KSPPREONLY and PCLU) to solver a small Linear equation system. The matrix has a couple of diagonal terms with value 0, which makes the solver fail. Then I set a very small value (e.g., 1e-10) at these terms and the solver works. Can this cause noticeable errors in the solution? Can't say. Are there any options in Petsc to make the direct solver do row/column pivoting so that all the diagonal terms are non-zero? I see: -pc_factor_pivot_in_blocks <true,false>- allow pivoting within the small blocks during factorization (may increase stability of factorization. and -pc_factor_shift_type <shifttype>- Sets shift type or PETSC_DECIDE for the default; use '-help' for a list of available types -pc_factor_shift_amount <shiftamount>- Sets shift amount or PETSC_DECIDE for the default Thanks for any suggestions. Regards, Qin