[petsc-users] extract arbitrary subset of a DMDA

Matthew Knepley knepley at gmail.com
Fri Oct 10 09:39:23 CDT 2025


On Fri, Oct 10, 2025 at 9:48 AM Matteo Semplice via petsc-users <
petsc-users at mcs.anl.gov> wrote:

> Dear all,
>
>      I am wondering if there is a way to extract a subset of a DMDA and
> use it as a mesh. The use case is to program a finite-difference method
> in which the domain is defined by a levelset function: if I could
> completely ignore the parts of the background DMDA that are "far away"
> from the object, I guess I would avoid some cores having almost no
> workload. I figure that I could setup a DMDA, load/compute the levelset
> on the entire box, then mark the nodes to be retained, extract the
> submesh and repartition it. I would also need a mean to transfer some
> Vec data from the DMDA to the new mesh.
>
> I guess that the extracted mesh would then become a DMPlex and it would
> not retain any DMDA flavour (like notions of which are the grid nodes
> sitting on top/bottom, left/right of a given node), right?
>

If you are planning on extracting a Plex anyway, I think it would be easier
to just
start with a Cartesian Plex, instead of a DA, and use DMPlexCreateSubmesh().

  Thanks,

     Matt


> Thanks
>
>      Matteo
>
> --
> Prof. Matteo Semplice
> Università degli Studi dell’Insubria
> Dipartimento di Scienza e Alta Tecnologia – DiSAT
> Professore Associato
> Via Valleggio, 11 – 22100 Como (CO) – Italia
> tel.: +39 031 2386316
>
>

-- 
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://urldefense.us/v3/__https://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!aTBS1B2YLKRIG_VAvtEwS0a40kgk7MzMmM_K5S1XBiDFyLWFu4yXTeH6Rhx4N3TyI18v_Z0k4cSxEq72EWVS$  <https://urldefense.us/v3/__http://www.cse.buffalo.edu/*knepley/__;fg!!G_uCfscf7eWS!aTBS1B2YLKRIG_VAvtEwS0a40kgk7MzMmM_K5S1XBiDFyLWFu4yXTeH6Rhx4N3TyI18v_Z0k4cSxEnXFXELM$ >
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20251010/03d641ee/attachment-0001.html>


More information about the petsc-users mailing list