[petsc-dev] TS Terminology

Zhang, Hong hongzhang at anl.gov
Fri Oct 20 15:03:29 CDT 2017


On Oct 20, 2017, at 11:34 AM, Jed Brown <jed at jedbrown.org<mailto:jed at jedbrown.org>> wrote:

Matthew Knepley <knepley at gmail.com<mailto:knepley at gmail.com>> writes:

On Fri, Oct 20, 2017 at 11:58 AM, Emil Constantinescu <emconsta at mcs.anl.gov<mailto:emconsta at mcs.anl.gov>>
wrote:

On 10/20/17 10:43 AM, Matthew Knepley wrote:

On Fri, Oct 20, 2017 at 11:22 AM, Emil Constantinescu <
emconsta at mcs.anl.gov<mailto:emconsta at mcs.anl.gov> <mailto:emconsta at mcs.anl.gov>> wrote:

   On 10/20/17 9:11 AM, Matthew Knepley wrote:

       On Fri, Oct 20, 2017 at 9:23 AM, Emil Constantinescu
       <emconsta at mcs.anl.gov<mailto:emconsta at mcs.anl.gov> <mailto:emconsta at mcs.anl.gov>
       <mailto:emconsta at mcs.anl.gov <mailto:emconsta at mcs.anl.gov>>>
wrote:

            On 10/20/17 7:57 AM, Matthew Knepley wrote:

                I am confused by some of the terminology in TS. At the
top
                level, IFunction appears to mean the entire equation

                    F(u, u_t, x) = 0


            Matt, page 141 of the manual: F(t, u, u_t) = G(t, u), and
       not zero
            on the RHS side. To make the interface general we allow
       internally
            for F:= F(t, u, u_t) - G(t, u) and then F=0.


       This is not "internal". Its the toplevel interface:

       https://bitbucket.org/petsc/petsc/src/63ae3ecac3af8ce782273a
76ad4152cddc2fd80a/src/ts/interface/ts.c?at=master&
fileviewer=file-view-default#ts.c-884
       <https://bitbucket.org/petsc/petsc/src/63ae3ecac3af8ce782273
a76ad4152cddc2fd80a/src/ts/interface/ts.c?at=master&
fileviewer=file-view-default#ts.c-884>

       It computes F - G.


   That's what it should do in some cases. The user provides either
   ifunction or rhs funtion or both. The api to the solvers can take
   care of this stuff automatically - that's what I meant by internal.
   Different TS solvers can take different definitions of the funtions;
   e.g., imex need both, beuler can take ifuntion and/or rhs function
   but instead of writing beuler for both we choose the most general
   case (ifunction) and compose the functions accordingly. The F - G is
   transparent to the user. But somewhere the sausage needs to be made
   and I think that is the right level because that is least likely to
   change and least maintenance.


I know what it does. I looked at the code. You are missing the point here.

We cannot use the same word, IFunction, for two different things, F and
F-G. The argument that is is not user facing is complete bullshit.
The user inputs the points for ifunction, and can also call the toplevel
interface.


Matt, we do not. IFunction is F(t,u_t,u), RHS function is G(t,u). What we
solve is F=G and not F=0. Do you doubt that?

When the user specifies IFunction it is that F; when the user specifies
RHS it is that G.


Nope. We use the word IFunction, specifically in the ifunction function
pointer to mean

 F

but we use the word IFunction, specifically in TSComputeIFunction, to mean

 F - G

And, no its visible to everyone, not just "TS developers".

The "imex" flag is part of the TSComputeIFunction interface.  If that
flag is TRUE, then IFunction is exactly what the user provides.  If
FALSE, then the RHSFunction is subtracted off.  Should that be better
documented?

I think the confusion really comes from the following description in the comments:

TSComputeIFunction<http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/TS/TSComputeIFunction.html#TSComputeIFunction> - Evaluates the DAE residual written in implicit form F(t,U,Udot)=0

It would be easier to understand if we say

TSComputeIFunction<http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/TS/TSComputeIFunction.html#TSComputeIFunction> - Evaluates F or F-G, depending on the "imex" flag

since it is stated in the manual that PETSc addresses the general form F(t,u,udot) = G(t,u).
And normally users do not need to be aware of anything about the fully implicit form that some internal TS solvers work with, but developers do.

Another confusion which is not related to this topic is the usage of the word "DAE".
I disagree with the statement "In general, this (the general form) is a differential algebraic equation (DAE)" on page 141 of the manual.
The word "DAE" has been abused in the comments of many TS functions (including TSComputeIFunction), where it actually should mean "DAE or ODE".
PETSc uses the same interfaces for both DAE and ODE, but it is wrong to consider ODE as a special case of DAE.
They are fundamentally different from each other and should be distinguished explicitly in the manual and the source code.

Hong (Mr.)


We could make a new interface TSComputeIFunctionMaybeMinusRHSFunction()
but I don't think it's necessary.  Without any such interface, the TS
implementations would each need to reproduce a bunch of vector and
matrix wrangling.

Note that TSComputeIFunction is very much like SNESComputeFunction,
which includes

 if (snes->vec_rhs) {
   ierr = VecAXPY(y,-1.0,snes->vec_rhs);CHKERRQ(ierr);
 }

Why haven't you complained about that?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20171020/b7a5958c/attachment-0001.html>


More information about the petsc-dev mailing list