[petsc-users] TSSetIJacobian is never called

Sharp Stone thronesf at gmail.com
Mon Oct 27 13:40:59 CDT 2014


Hi Matt,

Thank you very much for your reply.

The ts_view output is attached below. I found my code results say "SNES has
not been set up", and PC "has not been set up". Does this cause the
problem? If so I do not see example ex17 explicitly set up the snes object?

PS: I don't know why the -ts_view option does not work in my command line,
so I use TSView() routine just before the TSSolve() routine.




TS output:

TS Object: 1 MPI processes
  type: theta
  maximum steps=100000000
  maximum time=5e-06
  total number of nonlinear solver iterations=0
  total number of nonlinear solve failures=0
  total number of linear solver iterations=0
  total number of rejected steps=0
    Theta=1
    Extrapolation=no
  SNES Object:   1 MPI processes
    type: newtonls
    SNES has not been set up so information may be incomplete
    maximum iterations=50, maximum function evaluations=10000
    tolerances: relative=1e-08, absolute=1e-50, solution=1e-08
    total number of linear solver iterations=0
    total number of function evaluations=0
    SNESLineSearch Object:     1 MPI processes
      type: bt
        interpolation: cubic
        alpha=1.000000e-04
      maxstep=1.000000e+08, minlambda=1.000000e-12
      tolerances: relative=1.000000e-08, absolute=1.000000e-15,
lambda=1.000000e-08
      maximum iterations=40
    KSP Object:     1 MPI processes
      type: gmres
        GMRES: restart=30, using Classical (unmodified) Gram-Schmidt
Orthogonalization with no iterative refinement
        GMRES: happy breakdown tolerance 1e-30
      maximum iterations=10000, initial guess is zero
      tolerances:  relative=1e-05, absolute=1e-50, divergence=10000
      left preconditioning
      using DEFAULT norm type for convergence test
    PC Object:     1 MPI processes
      type: ilu
      PC has not been set up so information may be incomplete
        ILU: out-of-place factorization
        0 levels of fill
        tolerance for zero pivot 2.22045e-14
        using diagonal shift on blocks to prevent zero pivot [INBLOCKS]
        matrix ordering: natural
      linear system matrix = precond matrix:
      Mat Object:       1 MPI processes
        type: seqaij
        rows=20904, cols=20904, bs=4
        total: nonzeros=410816, allocated nonzeros=410816
        total number of mallocs used during MatSetValues calls =0
          using I-node routines: found 5226 nodes, limit used is 5



On Mon, Oct 27, 2014 at 2:13 PM, Matthew Knepley <knepley at gmail.com> wrote:

> On Mon, Oct 27, 2014 at 1:11 PM, Sharp Stone <thronesf at gmail.com> wrote:
>
>> Hi Matt,
>>
>> Thank you for your reply.
>>
>> That's why I am confused and need help. I set printf routines as I run my
>> code, but it never output it on the screen.
>>
>
> Here is one point of confusion:
>
>   1) TSSetIJacobian() sets a callback routine for creating the Jacobian.
> This was definitely called
>
>   2) FormIJacobian() is your function which I assume creates the Jacobian.
> This is what I think you are saying is not called.
>
> Not all TS solvers use a linear solve. Your first step is to run with
> -ts_view so that we can see what solver is actually being used.
>
>    Matt
>
>
>> Thanks!
>>
>> On Mon, Oct 27, 2014 at 2:05 PM, Matthew Knepley <knepley at gmail.com>
>> wrote:
>>
>>> On Mon, Oct 27, 2014 at 1:02 PM, Sharp Stone <thronesf at gmail.com> wrote:
>>>
>>>> Hi Matt,
>>>>
>>>> Thank you for your reply and sorry for the confusion.
>>>>
>>>> No. What I was trying to say is my code has never called the
>>>> TSSetIJacobian() routine. I don't know why this happens, and how to resolve
>>>> this either.
>>>>
>>>
>>> If your code has not called TSSetIJacobian(), I can only assume it is
>>> because you did not put it in. However, in
>>> the code fragment you sent, it was definitely there.
>>>
>>>   Thanks,
>>>
>>>     Matt
>>>
>>>
>>>> Thank you in advance!
>>>>
>>>> On Mon, Oct 27, 2014 at 1:57 PM, Matthew Knepley <knepley at gmail.com>
>>>> wrote:
>>>>
>>>>> On Mon, Oct 27, 2014 at 12:52 PM, Sharp Stone <thronesf at gmail.com>
>>>>> wrote:
>>>>>
>>>>>> Dear All,
>>>>>>
>>>>>> I'm using the TS theta solver for backward Euler method. But I found
>>>>>> that the TSSetIJacobian() routine has never been called. I did the code
>>>>>> just following what the example does: src/ts/examples/tutorials/ex17. I can
>>>>>> run the example without errors. But when I run my code, it won't be as good
>>>>>> as the example as stated above. I also attached the piece of my setups to
>>>>>> this email.
>>>>>>
>>>>>> How could I fix this problem? Thank you in advance!
>>>>>>
>>>>>
>>>>> I cannot understand the paragraph above.
>>>>>
>>>>>   1) TS ex17 does call TSSetIJacobian(), unless you choose a
>>>>> matrix-free version. You seem to imply above that it does not.
>>>>>
>>>>>   2) Do you mean that you do not call it? You do not have too, since
>>>>> you can use the finite difference approximations offered by SNES
>>>>>
>>>>>   Thanks,
>>>>>
>>>>>     Matt
>>>>>
>>>>>
>>>>>>
>>>>>>     TSCreate(PETSC_COMM_WORLD, &ts);
>>>>>>     TSSetProblemType(ts, TS_NONLINEAR);
>>>>>>     TSSetType(ts, TSTHETA);
>>>>>>     TSThetaSetTheta(ts, 1.0);
>>>>>>     TSSetIFunction(ts, NULL, FormIFunction, &appctx);
>>>>>>     DMSetMatType(da, MATAIJ);
>>>>>>     DMCreateMatrix(da, &J);
>>>>>>     TSSetDM(ts, da);
>>>>>>     TSSetIJacobian(ts, J, J, FormIJacobian, &appctx);
>>>>>>     TSSetDuration(ts, timeStepsMax, Tend);
>>>>>>     // Evaluate initial conditions
>>>>>>     FormInitialSolution(&appctx);
>>>>>>     TSSetSolution(ts, solution);
>>>>>>     dt = 1.0;
>>>>>>     TSSetInitialTimeStep(ts, 0.0, dt);
>>>>>>     TSSolve(ts, solution);
>>>>>>
>>>>>> --
>>>>>> Best regards,
>>>>>>
>>>>>> Feng
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> What most experimenters take for granted before they begin their
>>>>> experiments is infinitely more interesting than any results to which their
>>>>> experiments lead.
>>>>> -- Norbert Wiener
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Best regards,
>>>>
>>>> Feng
>>>>
>>>
>>>
>>>
>>> --
>>> What most experimenters take for granted before they begin their
>>> experiments is infinitely more interesting than any results to which their
>>> experiments lead.
>>> -- Norbert Wiener
>>>
>>
>>
>>
>> --
>> Best regards,
>>
>> Feng
>>
>
>
>
> --
> What most experimenters take for granted before they begin their
> experiments is infinitely more interesting than any results to which their
> experiments lead.
> -- Norbert Wiener
>



-- 
Best regards,

Feng
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20141027/3a30d9da/attachment-0001.html>


More information about the petsc-users mailing list