[petsc-users] ARKIMEX produces incorrect values

Jed Brown jed at jedbrown.org
Mon Aug 31 10:23:30 CDT 2020

Ed Bueler <elbueler at alaska.edu> writes:

>>>> I realize the ARKIMEX page does say "Methods with an explicit stage can
>>>> only be used with ODE in which the stiff part G(t,X,Xdot) has the form
> Xdot
>>>> + Ghat(t,X)."  So my example does not do that.  Is there a way for
>>>> ARKIMEX to detect that dG/d(Xdot) = I?
>>> Other than sampling its action on vectors?  Not really; it's user code.
>  > Call TSComputeIFunction(TS ts,PetscReal t,Vec U,Vec Udot,Vec Y,PetscBool
>  > imex) with Udot all 1 and rhsfunction turned off. Call again with Udot is
>  > zero, take the difference. If it does not return all 1 then you know the
>  > user has provided an unacceptable function?

That's weaker than sampling with random vectors.  For example, it would
"accept" any case in which the matrix has row sum of 1, which is true
for permutation matrices, arbitrary mass matrices (with appropriate
scaling), etc.  It'd be more reliable to set Udot=random and check that
the difference matches that random vector.

>  > You could do this at the beginning of each TSSolve() for these picky
>  > methods in debug mode.
> How about calling the IJacobian first with a=0 and then with a=1 and
> subtracting matrices, to see if the result is the identity?

That's more precise (assuming the IJacobian does not depend on Udot),
but significantly more expensive in memory and time.

More information about the petsc-users mailing list