[petsc-users] How to obtain the local matrix from a global matrix in DMDA?
liluo
liluo at um.edu.mo
Mon Mar 14 11:35:14 CDT 2022
Thank you!
Bests,
LI
________________________________
From: Matthew Knepley <knepley at gmail.com>
Sent: Monday, 14 March, 2022 23:44:06
To: liluo
Cc: Mark Adams; jed at jedbrown.org; petsc-users at mcs.anl.gov
Subject: Re: [petsc-users] How to obtain the local matrix from a global matrix in DMDA?
On Mon, Mar 14, 2022 at 11:05 AM liluo <liluo at um.edu.mo<mailto:liluo at um.edu.mo>> wrote:
Dear developers,
I defined subdomain problems that have some layers of ghost points, which are exactly of the "local" size of a DA.
And I want to generate the corresponding submatrix in each subdomain which contains those layers of ghost points.
I know that MatGetSubMatrices can return a submatrix when determining the index set like PCASM, but how can I get the index set including those layers of ghost points? When a DA is setup, such IS for creating ltog mapping was already destroyed.
Or you may have some simpler way to get this?
You can use https://petsc.org/main/docs/manualpages/IS/ISLocalToGlobalMappingGetIndices.html<https://urldefense.proofpoint.com/v2/url?u=https-3A__petsc.org_main_docs_manualpages_IS_ISLocalToGlobalMappingGetIndices.html&d=DwMFaQ&c=KXXihdR8fRNGFkKiMQzstu-8MbOxd1NuZkcSBymGmgo&r=6GO4L2UoBZHW81bz8HZAjg&m=tkDjlI2jtepJrixctzCXSLsviiUnPvCpULVGq54Nlnw&s=wCqh9AeSX2TJUI2hj2v77d8pl3SkiwG4dGK8nAjSMMI&e=> to get the indices out of the L2G map, and then call MatGetSubmatrix().
Thanks,
Matt
Bests,
Li Luo
________________________________
From: Mark Adams <mfadams at lbl.gov<mailto:mfadams at lbl.gov>>
Sent: Monday, 14 March, 2022 22:49:47
To: liluo
Cc: petsc-users at mcs.anl.gov<mailto:petsc-users at mcs.anl.gov>
Subject: Re: [petsc-users] How to obtain the local matrix from a global matrix in DMDA?
You might want to explain what you want to do.
A local vector has ghost values that you can use to compute local residuals. You don't usually want a matrix that conforms with this local vector.
You could get the global equations of the local vector and use MatCreateSubMatrix, but I think there is a better way to do what you want.
OK, Matt and Jed beat me
On Mon, Mar 14, 2022 at 10:35 AM liluo <liluo at um.edu.mo<mailto:liluo at um.edu.mo>> wrote:
Dear developers,
I created a DMDA object and obtain the local vector from a global vector by using DMGlobalToLocalBegin/End.
How can I obtain the corresponding local matrix from the global matrix?
In my case, the global matrix is of MPIBAIJ type created by DMCreateMatrix(da,MATBAIJ,&A);
Bests,
LI
--
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/<https://urldefense.proofpoint.com/v2/url?u=http-3A__www.cse.buffalo.edu_-7Eknepley_&d=DwMFaQ&c=KXXihdR8fRNGFkKiMQzstu-8MbOxd1NuZkcSBymGmgo&r=6GO4L2UoBZHW81bz8HZAjg&m=tkDjlI2jtepJrixctzCXSLsviiUnPvCpULVGq54Nlnw&s=wBtYlAe1bEuUGs7BoKAXU_PVeO1nihvIr00NdejMVWY&e=>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20220314/0c95f5f4/attachment.html>
More information about the petsc-users
mailing list