[petsc-users] TSTHETA not working without explicit declaration with TSSetRHSJacobian

Barry Smith barryfsmith at me.com
Wed Oct 25 10:29:58 CDT 2017


  Sorry for the delay in answering this if you have not gotten and answer.

   If there is no DM and you want to use SNESComputeJacobianColor then you need to provide a Jacobian with the correct nonzero pattern (all the "nonzero" entries can just be set to zero when you pass in the matrix) this is because the coloring code uses the nonzero structure to color the matrix and then compute the Jacobians. It cannot work without the nonzero structure. I checked this and the manual page does explicitly state this.

 Barry



> On Oct 12, 2017, at 12:08 PM, Ali Berk Kahraman <aliberkkahraman at yahoo.com> wrote:
> 
> My apologies for missing this earlier, but I have found these lines in the documentation that provides the solution for my problem.
> 
> "To use a fully implicit method like TSTHETA or TSGL, either provide the Jacobian of F () (and G()
> if G() is provided) or use a DM that provides a coloring so the Jacobian can be computed efficiently
> via finite differences."
> 
> However, I'm still confused with this, since the computation process of the Jacobian happens anyway, instead of giving an error such as "no jacobian is entered, aborting".
> 
> 
> On 12-10-2017 19:45, Ali Berk Kahraman wrote:
>> Hello All,
>> 
>> 
>> I am trying to use TS solver without declaring RHS Jacobian, because I do not have it analytically. I'm getting the error posted at the end of the e-mail. As I understand, the SNES solver within the TS solver sees that I have not declared a Jacobian, so it calls the function SNESComputeJacobianColor to get a finite difference aproximation of the Jacobian, as I am too lazy to make this approximation myself, and SNESComputeJacobianColor calls MatFDColoringCreate() and this function finally gives the error "Matrix is in wrong state, Matrix must be assembled by calls to MatAssemblyBegin/End(); ".
>> 
>> I am not sure if this is a bug, or it is something I'm doing wrong. It looks like a bug to me since the error is generated when the code understands that I haven't provided a Jacobian and consequently trying to compute it for me. However, I cannot be sure because I'm still pretty inexperienced using PETSc, so I'm writing this here and not to petsc-maint. Any ideas?
>> 
>> 
>> Best Regards ,
>> 
>> Ali
>> 
>> 
>> [0]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------
>> [0]PETSC ERROR: Object is in wrong state
>> [0]PETSC ERROR: Matrix must be assembled by calls to MatAssemblyBegin/End();
>> [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html for trouble shooting.
>> [0]PETSC ERROR: Petsc Release Version 3.8.0, unknown
>> [0]PETSC ERROR: ./FastWavelet1DTransientHeat on a arch-linux2-c-debug named abk-CFDLab by abk Thu Oct 12 19:39:21 2017
>> [0]PETSC ERROR: Configure options --with-cc=gcc --with-cxx=g++ --with-fc=gfortran --download-mpich --download-fblaslapack
>> [0]PETSC ERROR: #1 MatFDColoringCreate() line 464 in /home/abk/petsc/src/mat/matfd/fdmatrix.c
>> [0]PETSC ERROR: #2 SNESComputeJacobianDefaultColor() line 83 in /home/abk/petsc/src/snes/interface/snesj2.c
>> [0]PETSC ERROR: #3 SNESComputeJacobian() line 2358 in /home/abk/petsc/src/snes/interface/snes.c
>> [0]PETSC ERROR: #4 SNESSolve_KSPONLY() line 36 in /home/abk/petsc/src/snes/impls/ksponly/ksponly.c
>> [0]PETSC ERROR: #5 SNESSolve() line 4106 in /home/abk/petsc/src/snes/interface/snes.c
>> [0]PETSC ERROR: #6 TS_SNESSolve() line 176 in /home/abk/petsc/src/ts/impls/implicit/theta/theta.c
>> [0]PETSC ERROR: #7 TSStep_Theta() line 216 in /home/abk/petsc/src/ts/impls/implicit/theta/theta.c
>> [0]PETSC ERROR: #8 TSStep() line 4120 in /home/abk/petsc/src/ts/interface/ts.c
>> [0]PETSC ERROR: #9 TSSolve() line 4374 in /home/abk/petsc/src/ts/interface/ts.c
>> [0]PETSC ERROR: #10 main() line 886 in /home/abk/Dropbox/MyWorkspace/WaveletCollocation/FastWaveletCollocation1D/FastWavelet1DTransientHeat.c
>> [0]PETSC ERROR: No PETSc Option Table entries
>> [0]PETSC ERROR: ----------------End of Error Message -------send entire error message to petsc-maint at mcs.anl.gov----------
>> application called MPI_Abort(MPI_COMM_WORLD, 73) - process 0
>> [unset]: aborting job:
>> application called MPI_Abort(MPI_COMM_WORLD, 73) - process 0
>> 
>> 
>> ------------------
>> (program exited with code: 73)
>> Press return to continue
>> 
>> 
> 



More information about the petsc-users mailing list