[petsc-users] SNESSetJacobian and TSSetRHSJacobian

Peter Brune prbrune at gmail.com
Wed May 22 16:45:18 CDT 2013


On Wed, May 22, 2013 at 4:30 PM, Zou (Non-US), Ling <ling.zou at inl.gov>wrote:

> Thank you Peter.
>
> Can I simply ignore this step:
>
> TSSetRHSJacobian(ts, J, J, SNESDefaultComputeJacobian, PETSC_NULL);
>
>
> And get the SNES context from TS, then set the Jacobian option this way:
>
> SNES snes;
>
> TSGetSNES(ts, &snes);
>
> SNESSetJacobian(snes, J, J, SNESDefaultComputeJacobian, PETSC_NULL);
>
>
>
This should work as well.  Note that SNESDefaultComputeJacobian is quite
expensive and should be used for testing only, which is why I would
hesitate to hard-code its use.

- Peter

(Guess my last email didn't work well)
>
>
>
Ling
>
>
>
> On Wed, May 22, 2013 at 3:17 PM, Peter Brune <prbrune at gmail.com> wrote:
>
>> This may be done with the command-line option:
>>
>> -snes_fd
>>
>> - Peter
>>
>>
>> On Wed, May 22, 2013 at 4:03 PM, Zou (Non-US), Ling <ling.zou at inl.gov>wrote:
>>
>>> Hi All,
>>>
>>> In 'SNESSetJacobian' I could pass 'SNESDefaultComputeJacobian' to let
>>> PETSc do the finite differencing for me to calculate Jacobian, i.e.,
>>>
>>> SNESSetJacobian(snes, J, J, SNESDefaultComputeJacobian, PETSC_NULL);
>>>
>>>
>>> In TSSetRHSJacobian, this options seems to be invalid, i.e., it requires
>>> a function to evaluate the Jacobian, i.e.,
>>>
>>>
>>> TSSetRHSJacobian(ts, J, J, FormRHSJacobian, PETSC_NULL);
>>>
>>>
>>> Is it possible that TS could also use PETSc finite differencing Jacobian
>>> as SNES does?
>>>
>>>
>>> Best,
>>>
>>>
>>> Ling
>>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20130522/1a83bcdb/attachment-0001.html>


More information about the petsc-users mailing list