[petsc-users] Define sub-dm from original dm and vector mapping
Mike Michell
mi.mike1021 at gmail.com
Tue Apr 4 20:18:58 CDT 2023
Dear PETSc developer team,
Hi, this is a follow-up question regarding generating sub-dm for surface
from the original volumetric dm (
https://lists.mcs.anl.gov/pipermail/petsc-users/2023-March/048263.html).
I have created a short code as written below as a piece of it to create a
sub-dm on the surface, extracted from the original volume dmplex:
-------------------------------------
call DMClone(dm_origin, dm_wall, ierr);CHKERRA(ierr)
! label for face sets
call DMGetLabel(dm_wall, "Face Sets", label_facesets,
ierr);CHKERRA(ierr)
call DMPlexLabelComplete(dm_wall, label_facesets, ierr);CHKERRA(ierr)
! label for vertex on surface
call DMCreateLabel(dm_wall, "Wall", ierr);CHKERRA(ierr)
call DMGetLabel(dm_wall, "Wall", label_surf, ierr);CHKERRA(ierr)
call DMPlexGetChart(dm_wall, ist, iend, ierr);CHKERRA(ierr)
do i=ist,iend
call DMLabelGetValue(label_facesets, i, val, ierr);CHKERRA(ierr)
if(val .eq. ID_wall) then
call DMLabelSetValue(label_surf, i, ID_wall, ierr);CHKERRA(ierr)
endif
enddo
call DMPlexLabelComplete(dm_wall, label_surf, ierr);CHKERRA(ierr)
! create submesh
call DMPlexCreateSubmesh(dm_wall, label_surf, ID_wall, PETSC_TRUE,
dm_sub, ierr);CHKERRA(ierr)
call DMPlexGetSubpointMap(dm_sub, label_sub, ierr);CHKERRA(ierr)
-------------------------------------
Now I can define a vector on dm_sub and view it via PETSc_Viewer. However,
it is unclear how to map a vector defined on the volumetric dm (dm_wall)
into a vector defined on the surface dm (dm_sub). I guess label_sub created
via DMPlexGetSubpointMap() can help with it, but it is difficult to get a
solid picture without an example. Could I get a comment for it?
Thanks,
Mike
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20230404/5c5f2c48/attachment-0001.html>
More information about the petsc-users
mailing list