On Mon, 13 Dec 2021 at 19:55, Tang, Qi <tan...@msu.edu> wrote: > Matt and Dave, > > Thanks, this is consistent with what we found. If Patrick or someone can > add some basic coloring option with DMStag, that would be very useful for > our project. > > Colouring only requires the non-zero structure of the matrix. So actually colouring is supported. The only thing missing for you is that the matrix returned from DMCreateMatrix for DMSTAG does not have a defined non-zero structure. Once that is set / defined, colouring will just work.
Qi > > > > On Dec 13, 2021, at 11:52 AM, Dave May <dave.mayhe...@gmail.com> wrote: > > > > On Mon, 13 Dec 2021 at 19:29, Matthew Knepley <knep...@gmail.com> wrote: > >> On Mon, Dec 13, 2021 at 1:16 PM Dave May <dave.mayhe...@gmail.com> wrote: >> >>> >>> >>> On Sat 11. Dec 2021 at 22:28, Matthew Knepley <knep...@gmail.com> wrote: >>> >>>> On Sat, Dec 11, 2021 at 1:58 PM Tang, Qi <tan...@msu.edu> wrote: >>>> >>>>> Hi, >>>>> Does anyone have comment on finite difference coloring with DMStag? We >>>>> are using DMStag and TS to evolve some nonlinear equations implicitly. It >>>>> would be helpful to have the coloring Jacobian option with that. >>>>> >>>> >>>> Since DMStag produces the Jacobian connectivity, >>>> >>> >>> This is incorrect. >>> The DMCreateMatrix implementation for DMSTAG only sets the number of >>> nonzeros (very inaccurately). It does not insert any zero values and thus >>> the nonzero structure is actually not defined. >>> That is why coloring doesn’t work. >>> >> >> Ah, thanks Dave. >> >> Okay, we should fix that.It is perfectly possible to compute the nonzero >> pattern from the DMStag information. >> > > Agreed. The API for DMSTAG is complete enough to enable one to > loop over the cells, and for all quantities defined on the cell (centre, > face, vertex), > insert values into the appropriate slot in the matrix. > Combined with MATPREALLOCATOR, I believe a compact and readable > code should be possible to write for the preallocation (cf DMDA). > > I think the only caveat with the approach of using all quantities defined > on the cell is > It may slightly over allocate depending on how the user wishes to impose > the boundary condition, > or slightly over allocate for says Stokes where there is no > pressure-pressure coupling term. > > Thanks, > Dave > > >> Paging Patrick :) >> >> Thanks, >> >> Matt >> >> >>> Thanks, >>> Dave >>> >>> >>> you can use -snes_fd_color_use_mat. It has many options. Here is an >>>> example of us using that: >>>> >>>> >>>> https://gitlab.com/petsc/petsc/-/blob/main/src/snes/tutorials/ex19.c#L898 >>>> <https://urldefense.com/v3/__https://gitlab.com/petsc/petsc/-/blob/main/src/snes/tutorials/ex19.c*L898__;Iw!!HXCxUKc!h_StfE5Flul2AzB6sJ3ooEa2GBhV-GZ4s8KWEB2soynkpcpilsVmmHUbsYezUA$> >>>> >>>> Thanks, >>>> >>>> Matt >>>> >>>> >>>>> Thanks, >>>>> Qi >>>>> >>>>> >>>>> On Oct 15, 2021, at 3:07 PM, Jorti, Zakariae via petsc-users < >>>>> petsc-users@mcs.anl.gov> wrote: >>>>> >>>>> Hello, >>>>> >>>>> Does the Jacobian approximation using coloring and finite >>>>> differencing of the function evaluation work in DMStag? >>>>> Thank you. >>>>> Best regards, >>>>> >>>>> Zakariae >>>>> >>>>> >>>>> >>>> >>>> -- >>>> 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/ >>>> <https://urldefense.com/v3/__http://www.cse.buffalo.edu/*knepley/__;fg!!HXCxUKc!h_StfE5Flul2AzB6sJ3ooEa2GBhV-GZ4s8KWEB2soynkpcpilsVmmHUXuu3a8g$> >>>> >>> >> >> -- >> 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/ >> <https://urldefense.com/v3/__http://www.cse.buffalo.edu/*knepley/__;fg!!HXCxUKc!h_StfE5Flul2AzB6sJ3ooEa2GBhV-GZ4s8KWEB2soynkpcpilsVmmHUXuu3a8g$> >> > >