[petsc-users] Dmplex+PetscFe+KSP

Matthew Knepley knepley at gmail.com
Tue Mar 14 15:52:12 CDT 2023


On Tue, Mar 14, 2023 at 12:11 PM Barry Smith <bsmith at petsc.dev> wrote:

>
>   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.
>
> There are no KSP analogues. The intent is for you to use -snes_type ksp
for truly linear problems.

  Thanks,

     Matt

> All the best,
> Jonathan
>
> *From:* Barry Smith <bsmith at petsc.dev>
> *Sent:* 14. marts 2023 16:18
> *To:* Jonathan Davud Razi Seyed Mirpourian <jdara at dtu.dk>
> *Cc:* 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> 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
>
>
>

-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener

https://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20230314/0a394d3f/attachment.html>


More information about the petsc-users mailing list