[petsc-dev] TSComputeRHSJacobian
Stefano Zampini
stefano.zampini at gmail.com
Mon Aug 28 11:59:51 CDT 2017
I was wondering if the following code in TSComputeRHSJacobian is correct
when the user pass the reuse flag via TSRHSJacobianReuse
if (ts->rhsjacobian.time == t && (ts->problem_type == TS_LINEAR ||
(ts->rhsjacobian.Xid == Uid && ts->rhsjacobian.Xstate == Ustate)) &&
(rhsfunction != TSComputeRHSFunctionLinear)) {
PetscFunctionReturn(0);
}
Should the above code be replaced by the following?
if (ts->rhsjacobian.time == t && (ts->problem_type == TS_LINEAR ||
(ts->rhsjacobian.Xid == Uid && ts->rhsjacobian.Xstate == Ustate)) &&
(rhsfunction != TSComputeRHSFunctionLinear)) {
if (ts->rhsjacobian.reuse) {
ierr = MatShift(A,-ts->rhsjacobian.shift);CHKERRQ(ierr);
ierr = MatScale(A,1./ts->rhsjacobian.scale);CHKERRQ(ierr);
if (B && A != B) {
ierr = MatShift(B,-ts->rhsjacobian.shift);CHKERRQ(ierr);
ierr = MatScale(B,1./ts->rhsjacobian.scale);CHKERRQ(ierr);
}
ts->rhsjacobian.shift = 0;
ts->rhsjacobian.scale = 1.;
}
PetscFunctionReturn(0);
}
--
Stefano
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20170828/e6ef3447/attachment.html>
More information about the petsc-dev
mailing list