Hi Matthew and Stefano,

@Stefano, thank you for the explanation. DMPlexGetTransitiveClosure is exactly 
what I needed.

@Matthew, thank you for your advise on using DMPlexFilter, this is much better !

Regards,
Fabien

> Le 22 févr. 2021 à 14:36, Matthew Knepley <[email protected]> a écrit :
> 
> On Mon, Feb 22, 2021 at 6:28 AM Fabien Vergnet 
> <[email protected] 
> <mailto:[email protected]>> wrote:
> Dear PETSc community,
> 
> Thank you for your amazing work. I discovered PETSc recently and I need your 
> help for a project.
> 
> As a training, I would like to assemble the Finite Element Matrix for the 
> Poisson problem on a part of my mesh. So, I create a DMPlex from a .msh file 
> and I create a Submesh with
> 
> DMPlexCreateSubmesh(dm, label, 1, PETSC_TRUE, &subdm);
> 
> I don't think you want this call. It is designed to pick out hypersurfaces. 
> If you just want part of a mesh, DMPlexFilter is better.
>  
> In order to assemble my Finite Element Matrix, I need to iterate over the 
> cells of the mesh (which are triangles) and identify the vertices composing 
> each cell.
> 
> My question is the following : how can I get, for each cell, the vertices 
> composing the cell ?
> 
> I have tried to uninterpolate the subdm with DMPlexUninterpolate (with the 
> objective to get the vertices from DMPlexGetCone) but it does not seem to 
> work for a Submesh since I get the following error:
> 
> ----------
> 
> [0]PETSC ERROR: --------------------- Error Message 
> --------------------------------------------------------------
> [0]PETSC ERROR: Invalid argument
> [0]PETSC ERROR: Not for partially interpolated meshes
> [0]PETSC ERROR: See https://www.mcs.anl.gov/petsc/documentation/faq.html 
> <https://www.mcs.anl.gov/petsc/documentation/faq.html> for trouble shooting.
> [0]PETSC ERROR: Petsc Release Version 3.14.4, Feb 03, 2021 
> [0]PETSC ERROR: Configure options 
> --prefix=/users/home/vergnet/apps/spack/opt/spack/linux-ubuntu20.04-zen2/gcc-9.3.0/petsc-3.14.4-xtae5tcwlzkb4oiifbayj77bqlz5nngk
>  --with-ssl=0 --download-c2html=0 --download-sowing=0 --download-hwloc=0 
> CFLAGS= FFLAGS= CXXFLAGS= 
> --with-cc=/users/home/vergnet/apps/spack/opt/spack/linux-ubuntu20.04-zen2/gcc-9.3.0/openmpi-4.0.5-ygn7zymoy7crl7b4xsdkc4zmfojugmdy/bin/mpicc
>  
> --with-cxx=/users/home/vergnet/apps/spack/opt/spack/linux-ubuntu20.04-zen2/gcc-9.3.0/openmpi-4.0.5-ygn7zymoy7crl7b4xsdkc4zmfojugmdy/bin/mpic++
>  
> --with-fc=/users/home/vergnet/apps/spack/opt/spack/linux-ubuntu20.04-zen2/gcc-9.3.0/openmpi-4.0.5-ygn7zymoy7crl7b4xsdkc4zmfojugmdy/bin/mpif90
>  --with-precision=double --with-scalar-type=real --with-shared-libraries=1 
> --with-debugging=0 --with-64-bit-indices=0 COPTFLAGS= FOPTFLAGS= CXXOPTFLAGS= 
> --with-blaslapack-lib=/users/home/vergnet/apps/spack/opt/spack/linux-ubuntu20.04-zen2/gcc-9.3.0/openblas-0.3.13-6b3u6zc5j4hvauqh3ldcwnf7lm2o4vyl/lib/libopenblas.so
>  --with-x=0 --with-clanguage=C --with-scalapack=0 --with-cuda=0 
> --with-metis=1 
> --with-metis-dir=/users/home/vergnet/apps/spack/opt/spack/linux-ubuntu20.04-zen2/gcc-9.3.0/metis-5.1.0-lm3k7dh2vslghqtqc6dvcpnc54bfpqq2
>  --with-hypre=1 
> --with-hypre-dir=/users/home/vergnet/apps/spack/opt/spack/linux-ubuntu20.04-zen2/gcc-9.3.0/hypre-2.20.0-4pyxhku65wb5lmh2fpflhmjmow2pbjg7
>  --with-parmetis=1 
> --with-parmetis-dir=/users/home/vergnet/apps/spack/opt/spack/linux-ubuntu20.04-zen2/gcc-9.3.0/parmetis-4.0.3-pfiam4ccxkyqpapejcdjtlyr6cyz7irc
>  --with-mumps=0 --with-trilinos=0 --with-fftw=0 --with-valgrind=0 
> --with-gmp=0 --with-libpng=0 --with-giflib=0 --with-mpfr=0 --with-netcdf=0 
> --with-pnetcdf=0 --with-moab=0 --with-random123=0 --with-exodusii=0 
> --with-cgns=0 --with-memkind=0 --with-p4est=0 --with-saws=0 --with-yaml=0 
> --with-libjpeg=0 --with-cxx-dialect=C++11 
> --with-superlu_dist-include=/users/home/vergnet/apps/spack/opt/spack/linux-ubuntu20.04-zen2/gcc-9.3.0/superlu-dist-6.4.0-bagymefhq7s7gerf7jxwiv4fv7szoljh/include
>  
> --with-superlu_dist-lib=/users/home/vergnet/apps/spack/opt/spack/linux-ubuntu20.04-zen2/gcc-9.3.0/superlu-dist-6.4.0-bagymefhq7s7gerf7jxwiv4fv7szoljh/lib/libsuperlu_dist.a
>  --with-superlu_dist=1 --with-suitesparse=0 --with-ptscotch=0 
> --with-hdf5-include=/users/home/vergnet/apps/spack/opt/spack/linux-ubuntu20.04-zen2/gcc-9.3.0/hdf5-1.10.7-dkfs4ir3hlahyfs5z4xcmsf4ogklimji/include
>  
> --with-hdf5-lib=/users/home/vergnet/apps/spack/opt/spack/linux-ubuntu20.04-zen2/gcc-9.3.0/hdf5-1.10.7-dkfs4ir3hlahyfs5z4xcmsf4ogklimji/lib/libhdf5.so
>  --with-hdf5=1 
> --with-zlib-include=/users/home/vergnet/apps/spack/opt/spack/linux-ubuntu20.04-zen2/gcc-9.3.0/zlib-1.2.11-2pwsgfxppopolmjj6tf34k5jsaqzpodo/include
>  
> --with-zlib-lib=/users/home/vergnet/apps/spack/opt/spack/linux-ubuntu20.04-zen2/gcc-9.3.0/zlib-1.2.11-2pwsgfxppopolmjj6tf34k5jsaqzpodo/lib/libz.so
>  --with-zlib=1
> [0]PETSC ERROR: #1 DMPlexUninterpolate() line 1514 in 
> /tmp/vergnet/spack-stage/spack-stage-petsc-3.14.4-xtae5tcwlzkb4oiifbayj77bqlz5nngk/spack-src/src/dm/impls/plex/plexinterpolate.c
> [0]PETSC ERROR: #2 assemble_mass() line 59 in 
> /users/home/vergnet/codes/cilia/cilia/cpp/assembling.hpp
> 
> ----------
> 
> Attached are a minimal working example, a mesh file and a makefile.
> 
> The code does not seem to be attached.
> 
> As Stefano says, you can use DMPlexGetTransitiveClosure() to get vertices, 
> but if you actually want values attached to the
> vertices, it is easier to use DMPlexVecGetClosure().
> 
>   Thanks,
> 
>      Matt
>  
> Any ideas or suggestions are more than welcome !
> 
> Regards,
> Fabien
> 
> 
> 
> 
> 
> -- 
> 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://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/>

Reply via email to