[petsc-users] MatFDColoringSetUp with Periodic BC

Pierre Bernigaud pierre.bernigaud at onera.fr
Tue Feb 14 03:33:54 CST 2023


Dear all,

I hope this email finds you well.
We are currently working on a solver which is employing DMDA with SNES. 
The jacobian is computed via FDColoring, ie:

call DMDACreate1D(PETSC_COMM_WORLD, DM_BOUNDARY_GHOSTED, NY, NC, NGc, 
PETSC_NULL_INTEGER, dmF, ierr)

! ----- Some steps ...

call DMCreateColoring(dmF, IS_COLORING_GLOBAL, iscoloring, ierr)
call MatFDColoringCreate(Jac,iscoloring, matfdcoloring, ierr)
call MatFDColoringSetFunction(matfdcoloring, FormFunction, CTX, ierr)
call MatFDColoringSetUp(Jac ,iscoloring,matfdcoloring, ierr)
call SNESSetJacobian(snes, Jac, Jac, SNESComputeJacobianDefaultColor, 
matfdcoloring, ierr)

Everything is running smoothly.
Recently, we modified the boundary conditions such as to use periodic 
BC:

call DMDACreate1D(PETSC_COMM_WORLD, DM_BOUNDARY_PERIODIC, NY, NC, NGc, 
PETSC_NULL_INTEGER, dmF, ierr)

We then encountered frequent crashes when calling MatFDColoringSetUp, 
depending on the number of cells NY. After looking for an solution, I 
found this old thread: 
https://lists.mcs.anl.gov/pipermail/petsc-users/2013-May/017449.html
It appears that when using periodic BC, FDColoring can only be used if 
the number of cells is divisible by 2*NGc+1. Even though this is only a 
slight annoyance, I was wondering if you were working on this matter / 
if you had a quick fix at hand? At any rate, I think it would be nice if 
a warning was displayed in the FDColoring documentation?

Respectfully,
Pierre Bernigaud
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20230214/fe5dbf6f/attachment.html>


More information about the petsc-users mailing list