[petsc-users] MatFDColoringSetUp with Periodic BC

Barry Smith bsmith at petsc.dev
Tue Feb 14 14:35:08 CST 2023


  I have created an MR that documents this and moved the error checking to a more appropriate location https://gitlab.com/petsc/petsc/-/merge_requests/6070


> On Feb 14, 2023, at 4:33 AM, Pierre Bernigaud <pierre.bernigaud at onera.fr> wrote:
> 
> 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/f8de4716/attachment.html>


More information about the petsc-users mailing list