[petsc-users] Periodic boundary conditions in DMPlex

Pierre Seize pierre.seize at onera.fr
Fri Oct 15 06:08:00 CDT 2021


Hi,

I'm writing a code using PETSc to solve NS equations with FV on an 
unstructured mesh. Therefore I use DMPlex.

Regarding periodicity, I manage to implement it this way:

   - for each couple of boundaries that is linked with periodicity, I 
create a buffer vector with an ISLocalToGlobalMapping

   - then, when I need to fill the ghost cells corresponding to the 
periodicity, the i "true" cell of the local vector fills the buffer 
vector on location i with VecSetValuesBlockedLocal, then 
VecAssemblyBegin/VecAssemblyEnd ensure each value is send to the correct 
location thanks to the mapping, then the i "ghost" cell of the local 
vector reads the vector on location i to get it's value.


It works, but it seems to me there is a better way, with maybe PetscSF, 
VecScatter, or something I don't know yet. Does anyone have any advice ?


Pierre Seize



More information about the petsc-users mailing list