> On May 16, 2019, at 8:04 PM, Sajid Ali <sajidsyed2...@u.northwestern.edu> 
> wrote:
> 
> While there is a ~3.5X speedup, deleting the aforementioned 20 lines also 
> leads the new version of petsc to give the wrong solution (off by orders of 
> magnitude for the same program). 

   Ok, sorry about this. Unfortunately this stuff has been giving us headaches 
for years and we are struggling to get it right.

> 
> I tried switching over the the IFunction/IJacobian interface as per the 
> manual (page 146) which the following lines :

  It is probably better to not switch to the IFunction/IJacobian, we are more 
likely to get the TS version working properly.
> ```
> TSSetProblemType(ts,TSLINEAR);
> TSSetRHSFunction(ts,NULL,TSComputeRHSFunctionLinear,NULL);
> TSSetRHSJacobian(ts,A,A,TSComputeRHSJacobianConstant,NULL);
> ```
> are equivalent to :
> ```
> TSSetProblemType(ts,TSLINEAR);
> TSSetIFunction(ts,NULL,TSComputeIFunctionLinear,NULL);
> TSSetIJacobian(ts,A,A,TSComputeIJacobianConstant,NULL);
> ```
> But the example at src/ts/examples/tutorials/ex3.c employs a strategy of 
> setting a shift flag to prevent re-computation for time-independent problems. 
> Moreover, the docs say "using this function (TSComputeIFunctionLinear) is NOT 
> equivalent to using TSComputeRHSFunctionLinear()" and now I'm even more 
> confused.
> 
> PS : Doing the simple switch is as slow as the original code and the answer 
> is wrong as well. 
> 
> Thank You,
> Sajid Ali
> Applied Physics
> Northwestern University

Reply via email to