[petsc-users] Dmplex+PetscFe+KSP
Barry Smith
bsmith at petsc.dev
Tue Mar 14 11:11:11 CDT 2023
Matt can help you more directly.
Barry
> On Mar 14, 2023, at 11:40 AM, Jonathan Davud Razi Seyed Mirpourian <jdara at dtu.dk> wrote:
>
> Dear Barry,
>
> Thank you very much for the quick answer!
>
> To my understanding, in the snes examples, it is the call: DMPlexSetSnesLocalFEM that takes care of computing the identities important for snes (jacobian, residual, boundary values).
> Is there an equivalent for KSP (just computing the system Matrix A and the rhs b)? I cannot find any DMPlexSetKSPLocalFEM in the docs or am I missing something?
>
> Also, I was not aware of SNESKSP, so thank you very much for that, it will be my fallback strategy.
>
> All the best,
> Jonathan
>
> From: Barry Smith <bsmith at petsc.dev <mailto:bsmith at petsc.dev>>
> Sent: 14. marts 2023 16:18
> To: Jonathan Davud Razi Seyed Mirpourian <jdara at dtu.dk <mailto:jdara at dtu.dk>>
> Cc: petsc-users at mcs.anl.gov <mailto:petsc-users at mcs.anl.gov>
> Subject: Re: [petsc-users] Dmplex+PetscFe+KSP
>
>
> 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.
>
> Barry
>
>
>
>
>
>
> On Mar 14, 2023, at 8:48 AM, Jonathan Davud Razi Seyed Mirpourian via petsc-users <petsc-users at mcs.anl.gov <mailto: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/26084db3/attachment.html>
More information about the petsc-users
mailing list