[petsc-users] Dmplex+PetscFe+KSP

Barry Smith bsmith at petsc.dev
Tue Mar 14 10:17:36 CDT 2023

  KSP/SNES do not automatically assemble the linear system, that is the responsibility of DMPLEX in this case. Thus the process for assembling the matrix is largely the same whether done with KSP or SNES and DMPLEX. The difference is, of course, that constructing the linear matrix does not depend on some “solution” vector as with SNES. 

Note also you can simply use SNES for a linear problem by selecting the SNESType of SNESKSP; this will just as efficient as using KSP directly.

  You should be able to locate a SNES example and extract the calls for defining the mesh and building the matrix but using them with KSP.


> On Mar 14, 2023, at 8:48 AM, Jonathan Davud Razi Seyed Mirpourian via petsc-users <petsc-users at mcs.anl.gov> wrote:
> Dear Petsc team,
> I am trying to use DMplex in combination with PetscFE and KSP to solve a linear system.
> I have struggled to do so, as all the examples I found ( for example:https://petsc.org/release/src/snes/tutorials/ex26.c.html) use SNES.
> Is there a way to avoid this? Optimally I would like to use dmplex for the mesh management, then create the discretization with PetscFE and then get KSP to automatically
> assemble the system matrix A.  
> I hope my questions is reasonable.
> All the best,
> Jonathan 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20230314/4e0e57b5/attachment.html>

More information about the petsc-users mailing list