[petsc-users] Uninterpolating DMLabels?
Matthew Knepley
knepley at gmail.com
Tue Apr 7 20:37:25 CDT 2015
On Tue, Apr 7, 2015 at 7:18 PM, Justin Chang <jchang27 at uh.edu> wrote:
> Hi all,
>
> So I am interpolating/uninterpolating my DMPlex mesh. This is the mesh
> information for a cell-vertex mesh only:
>
> DM Object: 1 MPI processes
> type: plex
> DM_0x84000000_0 in 3 dimensions:
> 0-cells: 159
> 3-cells: 592
> Labels:
> marker: 1 strata of sizes (100)
> depth: 2 strata of sizes (159, 592)
>
> I am interpolating the mesh with the following lines:
>
> ierr = DMPlexInterpolate(*dm, &idm);CHKERRQ(ierr);
> ierr = DMPlexCopyCoordinates(*dm, idm);CHKERRQ(ierr);
> ierr = DMPlexCopyLabels(*dm, idm);CHKERRQ(ierr);
> ierr = DMPlexGetLabel(idm, "marker", &label);CHKERRQ(ierr);
> ierr = DMPlexMarkBoundaryFaces(idm,label);CHKERRQ(ierr);
> ierr = DMDestroy(dm);CHKERRQ(ierr);
> *dm = idm;
>
> And the resulting mesh:
>
> DM Object: 1 MPI processes
> type: plex
> DM_0x84000000_1 in 3 dimensions:
> 0-cells: 159
> 1-cells: 845
> 2-cells: 1280
> 3-cells: 592
> Labels:
> marker: 1 strata of sizes (292)
> depth: 4 strata of sizes (159, 845, 1280, 592)
>
> The reason I did this is so that incase I decide to refine the mesh with
> "-dm_refine <number>" the DM will be sure to include the "marker" points in
> the refinement process. Now, if I decide to uninterpolate the mesh with the
> following lines:
>
> ierr = DMPlexUninterpolate(*dm, &idm);CHKERRQ(ierr);
> ierr = DMPlexCopyCoordinates(*dm, idm);CHKERRQ(ierr);
> ierr = DMPlexCopyLabels(*dm, idm);CHKERRQ(ierr);
> ierr = DMDestroy(dm);CHKERRQ(ierr);
> *dm = idm;
>
> I end up with this mesh:
>
> DM Object: 1 MPI processes
> type: plex
> DM_0x84000000_2 in 3 dimensions:
> 0-cells: 159
> 3-cells: 592
> Labels:
> marker: 1 strata of sizes (292)
> depth: 2 strata of sizes (159, 592)
>
> The problem is that although the cells and vertices have gone back to the
> original number, the "marker" label still includes face/edge points. This
> gives me an error once I invoke DMCreateGobalVector(...).
>
> [0]PETSC ERROR: --------------------- Error Message
> --------------------------------------------------------------
> [0]PETSC ERROR: Argument out of range
> [0]PETSC ERROR: Section point 755 should be in [0, 751)
> [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html
> for trouble shooting.
> [0]PETSC ERROR: Petsc Development GIT revision: v3.5.3-2528-gbee642f GIT
> Date: 2015-03-29 20:36:38 -0500
> [0]PETSC ERROR: ./cube_with_hole on a arch-linux2-c-debug named pacotaco
> by justin Tue Apr 7 19:09:12 2015
> [0]PETSC ERROR: Configure options --download-chaco --download-exodusii
> --download-fblaslapack --download-hdf5 --download-metis --download-mpich
> --download-mumps --download-netcdf --download-parmetis --download-scalapack
> --download-triangle --with-cc=gcc --with-cmake=cmake --with-cxx=g++
> --with-debugging=1 --with-fc=gfortran --with-valgrind=1
> PETSC_ARCH=arch-linux2-c-debug
> [0]PETSC ERROR: #1 PetscSectionGetDof() line 499 in
> /home/justin/petsc-dev/src/vec/is/utils/vsectionis.c
> [0]PETSC ERROR: #2 DMPlexGetConeSize() line 841 in
> /home/justin/petsc-dev/src/dm/impls/plex/plex.c
> [0]PETSC ERROR: #3 DMPlexGetTransitiveClosure() line 1342 in
> /home/justin/petsc-dev/src/dm/impls/plex/plex.c
> [0]PETSC ERROR: #4 DMPlexLabelComplete() line 88 in
> /home/justin/petsc-dev/src/dm/impls/plex/plexsubmesh.c
> [0]PETSC ERROR: #5 DMCreateDefaultSection_Plex() line 5605 in
> /home/justin/petsc-dev/src/dm/impls/plex/plex.c
> [0]PETSC ERROR: #6 DMGetDefaultSection() line 3035 in
> /home/justin/petsc-dev/src/dm/interface/dm.c
> [0]PETSC ERROR: #7 DMGetDefaultGlobalSection() line 3266 in
> /home/justin/petsc-dev/src/dm/interface/dm.c
> [0]PETSC ERROR: #8 DMCreateGlobalVector_Section_Private() line 13 in
> /home/justin/petsc-dev/src/dm/interface/dmi.c
> [0]PETSC ERROR: #9 DMCreateGlobalVector_Plex() line 1170 in
> /home/justin/petsc-dev/src/dm/impls/plex/plexcreate.c
> [0]PETSC ERROR: #10 DMCreateGlobalVector() line 698 in
> /home/justin/petsc-dev/src/dm/interface/dm.c
> [0]PETSC ERROR: #11 main() line 363 in
> /home/justin/Dropbox/Research_Topics/Code_PETSc/Nonneg/cube_with_hole.c
>
>
> From this error, it seems it's trying to access sieve points that non
> longer exist. And I think it has to do with the label "marker" still
> contains data from the interpolated mesh. Is there a way to "uninterpolate"
> or remove such points? Or is there a better way of approaching this whole
> thing?
>
1) It would be easy to write a small function to throw out the points in
the label that do not exist in the DM. You
would just extract each stratumIS and then Clear each invalid point.
2) However, I do not understand the rationale for this above. You could
just call MarkBoundaryFaces on the final mesh.
If you are really trying to preserve a label across regular refinement
AND you really do not want an interpolated mesh,
then code up 1). I have yet to see a case where the extra memory for
edges and faces makes a difference, but it may exist.
Thanks,
Matt
> Thanks,
>
>
>
> --
> Justin Chang
> PhD Candidate, Civil Engineering - Computational Sciences
> University of Houston, Department of Civil and Environmental Engineering
> Houston, TX 77004
> (512) 963-3262
>
--
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20150407/8242e3cf/attachment-0001.html>
More information about the petsc-users
mailing list