[petsc-dev] FD matrices

Barry Smith bsmith at mcs.anl.gov
Thu Aug 4 19:19:53 CDT 2016


> On Aug 4, 2016, at 10:15 AM, Mark Adams <mfadams at lbl.gov> wrote:
> 
>> 
>> Okay, there is
>> 
>>  -snes_fd_color -snes_fd_color_use_mat -mat_coloring_type greedy
>> 
>> which takes a properly preallocated matrix.
>> 
> 
> Which Mat will it use?  Our operators matrix is a shell so it must be the PC ...

   If you are actually going to form the Jacobian and compute it via coloring then there is no particular reason to use a shell matrix as the operator. You might as well just use the Jacobian via coloring that you are computing anyways.
> 
> If it uses the PC Mat we could take the transpose of the PC Mat, scale
> it by like 1.e-30, add it back into the PC Mat to get a symmetric
> structure, if that matters, and get a safe graph for coloring.

   No need to mess with transposes, scales or anything. Just create the matrix (the second one passed to SNESSetJacobian()), do a proper preallocation, put zeros in nonzero locations with MatSetValues, do MatAssembly  and pass it in to SNESSetJacobian()
> 
> Dan: this is easy, I will send you code today to modify "A", just use
> Matt's parameters above.




More information about the petsc-dev mailing list