Hi Matteo, Take a look at these posts from a few years ago and see if they will help you:
https://lists.mcs.anl.gov/pipermail/petsc-users/2021-January/043037.html https://lists.mcs.anl.gov/pipermail/petsc-users/2021-January/043043.html We were able to use this approach to extract a sub-region of a DMDA, and it should be possible for you to do so as well. Good luck, Randy M. > On Oct 10, 2025, at 6:48 AM, Matteo Semplice via petsc-users > <[email protected]> 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? > > 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 >
