[petsc-users] Matrix-free preconditioner using shell matrix
Smith, Barry F.
bsmith at mcs.anl.gov
Sat May 19 10:46:18 CDT 2018
> On May 18, 2018, at 11:23 PM, Praveen C <cpraveen at gmail.com> wrote:
>
> Thanks Barry and Jed.
>
>
>> On 18-May-2018, at 10:35 PM, Smith, Barry F. <bsmith at mcs.anl.gov> wrote:
>>
>> This is wrong. If you have a ApplyPC you need to attach it to the PC not the mat. So you would have
>>
>> SNESGetPC(snes,&pc);
>> PCSetType(pc,PCSHELL);
>> PCShellSetAppy(pc,ApplyPC)
>
> I am now setting up with PCSHELL, but face a doubt on Mat objects.
>
> So in my case (-snes_mf and PCSHELL), I dont have any jacobian and precond matrix. In fortran should I do something like this
>
> call TSSetRHSJacobian(ts, PETSC_NULL_MAT, PETSC_NULL_MAT, RHSJacobian, ctx, ierr)
>
> But this gives segmentation violation when TSSetRHSJacobian is called.
Praveen,
Ahh, we didn't have support for passing PETSC_NULL_MAT from Fortran for this routine. I have added it in the branch barry/fix-null-matrix-set-jacobian/maint which after testing will go into the maint branch.
Could you please try this branch and let us know if it resolves the problem (or a new problem pops up)?
Barry
Unfortunately handling null objects from Fortran requires us to manually tweak the Fortran interface functions and sometimes we forget or don't realize they need fixing until someone reports a problem.
>
> Thanks
> praveen
More information about the petsc-users
mailing list