[petsc-users] Some clarifications about TS ex3.c

Sajid Ali sajidsyed2021 at u.northwestern.edu
Tue Nov 27 15:25:32 CST 2018


Hi,

I wanted to ask a few questions about the TS example ex3.c when using the
ifunc option

190:     Mat <https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/Mat.html#Mat>
J;
192:     RHSMatrixHeat(ts,0.0,u,A,A,&appctx);193:     MatDuplicate
<https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatDuplicate.html#MatDuplicate>(A,MAT_DO_NOT_COPY_VALUES
<https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatDuplicateOption.html#MatDuplicateOption>,&J);194:
    TSSetIFunction
<https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/TS/TSSetIFunction.html#TSSetIFunction>(ts,NULL,IFunctionHeat,&appctx);195:
    TSSetIJacobian
<https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/TS/TSSetIJacobian.html#TSSetIJacobian>(ts,J,J,IJacobianHeat,&appctx);196:
    MatDestroy <https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatDestroy.html#MatDestroy>(&J);
198:     PetscObjectReference
<https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Sys/PetscObjectReference.html#PetscObjectReference>((PetscObject
<https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Sys/PetscObject.html#PetscObject>)A);199:
    appctx.A = A;200:     appctx.oshift = PETSC_MIN_REAL;201:   }


1) When TSSetIJacobian is called on line 195, J is empty. Why is J deleted
after calling the routing but before TSSolve is called ? (Isn't J supposed
to hold the jacobian ? )

2) The shift is not calculated before calling TSSetIJacobian. Does this
mean that the TSSetIJacobian takes care of the shift ?

3) What is happening on line 198 ?


Thank You,
Sajid Ali
Applied Physics
Northwestern University
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20181127/0a5a92fe/attachment.html>


More information about the petsc-users mailing list