[petsc-dev] TSSolve web page JED and EMIL READ THIS!

Jed Brown jed at jedbrown.org
Fri Feb 6 19:58:25 CST 2015


Barry Smith <bsmith at mcs.anl.gov> writes:

>> On Feb 6, 2015, at 12:28 PM, Mark Adams <mfadams at lbl.gov> wrote:
>> 
>> http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/TS/TSSolve.html#TSSolve
>> 
>> The TSSolve web page does not have an output parameter.  It is not clear to my why you would use TSSetSolution.  Is there any difference between using and not using TSSetSolution other than you do not need to give TSSolve u?  
>
>
>    This is fuzzy (even fuzzier than the fact that KSP has
>    KSPSetSolution() or one can pass it into KSPSolve() while
>    SNESSolve() does NOT take a solution.

What do you mean "SNESSolve does not take a solution"?

  PetscErrorCode SNESSolve(SNES snes,Vec b,Vec x)

>    Our API here is not great:
>
>    Normally it doesn't matter, one can pass it in either place or both places. BUT if TS_EXACTFINALTIME_INTERPOLATE is used then the u is required (this is not documented and the error checking does not give useful feedback to the user) but the user could either or not call TSSetSolution() also. The reason for this case is that TS internally wants to keep the actual final step step inside the TS object and interpolate the solution into the u provided to the user.  Note also that TSGetSolution() after solve returns the solution at the final time computed by the TSSolve() NOT the interpolated solution at the time requested by the user. This could also be confusing.
>
>    I can document this crappy API but my instinct is too actually
>    remove TSSetSolution() to get rid of the oddball special case and
>    unneeded and hence confusing two ways of passing the "solution". 

I never liked the pattern of calling XXSolve() with u=NULL.  I think you
liked the idea that the user could configure a solver and say solve
without having to create a vector.  I can see how this would be
attractive for adaptive methods, but I'd rather solvers behave closer to
stateless.

>   Another alternative is to remove the u argument to TSSolve()
>   completely and have the user always call TSSetSolution(). Again when
>   TS_EXACTFINALTIME_INTERPOLATE we'd duplicate that thing internally

I don't like this.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20150206/af10a4f9/attachment.sig>


More information about the petsc-dev mailing list