[petsc-dev] changes to the TS structure

Lisandro Dalcin dalcinl at gmail.com
Wed May 19 08:33:32 CDT 2010


On 19 May 2010 05:14, Jed Brown <jed at 59a2.org> wrote:
> On Tue, 18 May 2010 20:41:55 -0300, Lisandro Dalcin <dalcinl at gmail.com> wrote:
>> On 18 May 2010 17:08, Jed Brown <jed at 59a2.org> wrote:
>> > On Tue, 18 May 2010 14:51:57 -0300, Lisandro Dalcin <dalcinl at gmail.com> wrote:
>> >> 1) Could we remove "vec_sol_always" from the TS structure?
>> >
>> > Maybe, but are we really getting rid of vec_sol_always or just renaming
>> > it to vec_sol and being careful not to update vec_sol until after the
>> > step has been accepted?  The first doesn't work because you lose the
>> > ability to reject a step, the latter is fine, but it means that the
>> > method always needs to make private vectors to hold the solution while
>> > solving the stages.
>> >
>>
>> You have a point, but anyway, the reference counting rules in TS is is
>> general a mess. I wanted to get rid of vec_sol_always, and make TS
>> incref vec_sol. Subtypes should know if the can handle accept/reject
>> of steps, and allocate an additional vector for this.
>>
>> >> 2) For the case of nonlinear problems, could we have a new "vec_res",
>> >> then update Theta and GL to use it?
>> >
>> > Is there a reason that SNES can't own the residual?  Is it indeed the
>> > case that it will only be updated by SNESTSFormFunction?
>> >
>>
>> SNES will also own the residual. This change is a prelude for other
>> one I want to propose: make TSSetIFunction to also require a vector
>> for the residual, this will go to ts->vec_res, and in turn will also
>> be set in SNES. This would make it possible to have a vec available
>> early on in TS/SNES, and with proper reference counting.
>
> Do we really need such aliasing?  I think it would be good for
> TSSetIFunction to accept a vector, but I don't think the TS should keep
> a direct reference for the same reason that KSP does not keep a direct
> reference to the matrices provided in KSPSetOperators.
>

Making TS keep a reference will not harm. If TS keeps a ref, it will
have a properly dimensioned vector early on, no need to require a
SetSolution() or wait until TSSolve() in order to have a vec.
Yesterday, I had a really hard time to make SNES matrix-free (inside
TS Theta) working from Python.

Jed, you TS overhaul was great, but still there is a lot of work to do
to fix that mess. I'm working on a private clone, making a changes and
fixing things. Once I have something to show, I'll be back.

-- 
Lisandro Dalcin
---------------
CIMEC (INTEC/CONICET-UNL)
Predio CONICET-Santa Fe
Colectora RN 168 Km 472, Paraje El Pozo
Tel: +54-342-4511594 (ext 1011)
Tel/Fax: +54-342-4511169



More information about the petsc-dev mailing list