<div dir="ltr"><div dir="ltr">On Wed, Apr 5, 2023 at 3:04 PM Mike Michell <<a href="mailto:mi.mike1021@gmail.com">mi.mike1021@gmail.com</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Dear PETSc developer team,<br><br>Hi, this is a follow-up question regarding generating sub-dm for surface from the original volumetric dm (<a href="https://lists.mcs.anl.gov/pipermail/petsc-users/2023-March/048263.html" target="_blank">https://lists.mcs.anl.gov/pipermail/petsc-users/2023-March/048263.html</a>).<br><br>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:<br><br>-------------------------------------<br>    call DMClone(dm_origin, dm_wall, ierr);CHKERRA(ierr)<br><br>    ! label for face sets<br>    call DMGetLabel(dm_wall, "Face Sets", label_facesets, ierr);CHKERRA(ierr)<br>    call DMPlexLabelComplete(dm_wall, label_facesets, ierr);CHKERRA(ierr)<br><br>    ! label for vertex on surface<br>    call DMCreateLabel(dm_wall, "Wall", ierr);CHKERRA(ierr)<br>    call DMGetLabel(dm_wall, "Wall", label_surf, ierr);CHKERRA(ierr)<br>    call DMPlexGetChart(dm_wall, ist, iend, ierr);CHKERRA(ierr)<br>    do i=ist,iend<br>      call DMLabelGetValue(label_facesets, i, val, ierr);CHKERRA(ierr)<br>      if(val .eq. ID_wall) then<br>        call DMLabelSetValue(label_surf, i, ID_wall, ierr);CHKERRA(ierr)<br>      endif<br>    enddo<br>    call DMPlexLabelComplete(dm_wall, label_surf, ierr);CHKERRA(ierr)<br><br>    ! create submesh<br>    call DMPlexCreateSubmesh(dm_wall, label_surf, ID_wall, PETSC_TRUE, dm_sub, ierr);CHKERRA(ierr)<br>    call DMPlexGetSubpointMap(dm_sub, label_sub, ierr);CHKERRA(ierr)<br>-------------------------------------<br><br>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?<br></div></blockquote><div><br></div><div>I would use DMProjectField(). This would project a vector field in some FEM space on the volumetric mesh (the input U), into a vector field defined in some FEM space on the surface (the input dm _and_ the output vector). This should work correctly. Let me know if this does not make sense to code.</div><div><br></div><div>  Thanks,</div><div><br></div><div>     Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Thanks,<br>Mike<br></div>
</blockquote></div><br clear="all"><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div><div><br></div><div><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>