Matt can help you more directly.

  Barry


> On Mar 14, 2023, at 11:40 AM, Jonathan Davud Razi Seyed Mirpourian 
> <[email protected]> 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 <[email protected] <mailto:[email protected]>> 
> Sent: 14. marts 2023 16:18
> To: Jonathan Davud Razi Seyed Mirpourian <[email protected] <mailto:[email protected]>>
> Cc: [email protected] <mailto:[email protected]>
> 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 <[email protected] <mailto:[email protected]>> 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

Reply via email to