[petsc-users] using fieldsplit for matrix assembled using aij

Barry Smith bsmith at petsc.dev
Fri Jul 31 20:43:38 CDT 2020



> On Jul 31, 2020, at 7:31 PM, Raju Mandhapati <mandhapati.raju at convergecfd.com> wrote:
> 
> Barry,
> 
> Thank you for the reply. I am a beginner. I was confused with the following statement in the manual
> 
> "  If the matrices are stored as interlaced then PCFieldSplitSetFields() can be called repeatedly to indicate which fields belong to each block. " 
> 
> Does it mean that we need to set each row number which field does it belong to? 
> 
> If I set the block size to 3 and set
>   -pc_fieldsplit_0_fields 0,1
>   -pc_fieldsplit_1_fields 2
> 
> In what format is Petsc expecting for the matrix to be assembled?  In other words, how does Petsc know where the entries of A00, A01, A10 and A11 are located?

   The use of PCFieldSplitSetFields() or the command line options -pc_fieldsplit_0_fields  assumes and requires that the variables are stored interlaced. 

   Generally for each interlaced variable you want to make sure that it is included in at least one fieldplit (yes, the same interlaced variable can go into multiple fields but this is uncommon). 

   All you need to define the split in your case is -pc_fieldsplit_0_fields 0,1 -pc_fieldsplit_1_fields 2


  Barry

> 
> thanks,
> Raju.
> 
> 
> 
> 
> On Fri, Jul 31, 2020 at 7:21 PM Barry Smith <bsmith at petsc.dev <mailto:bsmith at petsc.dev>> wrote:
> 
>   -pc_fieldsplit_block_size  3 (you may not need this if the code sets the block size to 3).
> 
>   -pc_fieldsplit_0_fields 0,1
>   -pc_fieldsplit_1_fields 2
> 
> 
> 
> 
> 
> > On Jul 31, 2020, at 7:05 PM, Raju Mandhapati via petsc-users <petsc-users at mcs.anl.gov <mailto:petsc-users at mcs.anl.gov>> wrote:
> > 
> > Hello,
> > 
> > I have a matrix assembled in interlaced format. I am not able to follow how to use fieldsplit. Is there a good example to show how to do this.  My variable are in this format [ {u1,v1,p1}, {u2,v2,p2}, ....,{un,vn,pn}], where n is the number of grid points and u,v,p are the velocity and pressure components. The matrix is assembled as
> > 
> > [ uu11 uv11 up11  uu12 uv12 up12 ......
> >   vu11 vv11 vp11  vu12 vv12 vp12 .......
> >   pu11 pv11 pp11 pu12 pv12 pp12 ......
> > 
> >   uu21 uv21 up21  uu22 uv22 up22 ......
> >   vu21 vv21 vp21  vu22 vv22 vp22 .......
> >   pu21 pv21 pp21 pu22 pv22 pp22 ......
> >   
> >   .
> >   .
> >  
> > ]
> > 
> > I want to split u and v fields as one block and p field as another block.
> > 
> > Any help would be appreciated.
> > 
> > Raju.
> >  
> >   
> > 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20200731/69be451f/attachment-0001.html>


More information about the petsc-users mailing list