[petsc-users] TSSetIJacobian is never called
Matthew Knepley
knepley at gmail.com
Mon Oct 27 13:13:59 CDT 2014
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20141027/db66c56c/attachment.html>
More information about the petsc-users
mailing list