[petsc-users] Which type of matrix do I use to define my own interpolation operators in PCMG?
Barry Smith
bsmith at mcs.anl.gov
Tue Aug 22 17:07:09 CDT 2017
You definitely want to use MPIAIJ. You don't want to use MPIMAIJ because it isn't as general as you need.
Barry
> On Aug 22, 2017, at 2:04 PM, Ben Yee <bcyee at umich.edu> wrote:
>
> Thank you for the reply.
>
> If I understand the example correctly, you are suggesting that I define my interpolation matrix implicitly by defining the MATOP_MULT and
> MATOP_MULT_TRANSPOSE_ADD operations. In my case, I want the coarse grid operators defined via the Galerkin process, so would I also have to define the MATOP_PTAP operation?
>
> Also, is there a more convenient PETSc matrix type that I can use? My interpolation operators can easily be represented in matrix form, and it seems a bit unusual to have to define the matrix operations
> MATOP_MULT, MATOP_MULT_TRANSPOSE_ADD, and MATOP_PTAP myself. (Perhaps you are suggesting that defining these operations without explicitly constructing the matrix is more computationally efficient?)
>
> On Mon, Aug 21, 2017 at 6:00 PM, Jed Brown <jed at jedbrown.org> wrote:
> Ben Yee <bcyee at umich.edu> writes:
>
> > Hi,
> >
> > I was wondering what type of matrix I should use if I want to define my own
> > interpolation matrix in PCMG.
> >
> > I don't have any DM objects, and I wanted to provide the matrix entries to
> > the interpolation matrix manually. Moreover, I want the coarse grid
> > operators to be defined via the Galerkin process, so I only need to define
> > the interpolation operator. The fine grid problem/operator is defined as a
> > parallel sparse matrix using MATMPIAIJ. My interpolation operator is also
> > parallel and sparse -- does that mean I should also use MATMPIAIJ for my
> > interpolation operator?
> >
> > I did some digging but I couldn't find any examples where the
> > interpolation/restriction operators in PETSc were defined explicitly by the
> > user.
>
> src/ksp/pc/examples/tests/ex5.c
>
> > I also found the documentation for the matrix type MATMAIJ (
> > http://www.mcs.anl.gov/petsc/petsc-current/docs/
> > manualpages/Mat/MATMAIJ.html#MATMAIJ), which indicates that it is a
> > specialized matrix for interpolation/restriction operations. However,
> > I also noticed that the description for MATMAIJ indicates that it will
> > interpolate each component the same way independently. I do have a
> > multicomponent problem, but I was hoping to interpolate each component
> > differently -- does that mean I can't use the MATMAIJ matrix type?
>
> Correct, MAIJ applies the Kronecker product of a scalar interpolation
> with the identity so it acts the same on each component. It's more
> efficient if you want each component treated the same way.
>
> > If it is recommended that I use the MATMAIJ matrix type, I would like some
> > clarification regarding the MatCreateMAIJ function. In particular, I'm not
> > really sure how the input matrix "A" (first argument of MatCreateMAIJ) is
> > supposed to be -- the description of MatCreateMAIJ says "the AIJ matrix
> > describing the action on blocks," but I don't know what that means. The
> > use of MatCreateMAIJ in ex48.c is not really clear to me.
> >
> > Any guidance would be much appreciated. Thanks!
> >
> > --
> > Ben Yee
> >
> > NERS PhD Candidate, University of Michigan
> > B.S. Mech. & Nuclear Eng., U.C. Berkeley
>
>
>
> --
> Ben Yee
>
> NERS PhD Candidate, University of Michigan
> B.S. Mech. & Nuclear Eng., U.C. Berkeley
More information about the petsc-users
mailing list