Commits

Shrirang Abhyankar committed 7e3ebea

IFunction is written in the form "f(x) - xdot". Hence the xdot passed to
IFunction should be xdot = (x(n+1)-x(n))/(theta*dt) - (1-theta)/theta*f(x(n))

  • Participants
  • Parent commits 2d38026
  • Branches shri/FTRTDS-project

Comments (0)

Files changed (1)

src/ts/impls/implicit/theta/theta.c

       ierr = VecZeroEntries(th->Xdot);CHKERRQ(ierr);
       if (!th->affine) {ierr = VecDuplicate(ts->vec_sol,&th->affine);CHKERRQ(ierr);}
       ierr = TSComputeIFunction(ts,ts->ptime,ts->vec_sol,th->Xdot,th->affine,PETSC_FALSE);CHKERRQ(ierr);
-      ierr = VecScale(th->affine,(th->Theta-1.)/th->Theta);CHKERRQ(ierr);
+      ierr = VecScale(th->affine,(1.0-th->Theta)/th->Theta);CHKERRQ(ierr);
     }
     if (th->extrapolate) {
       ierr = VecWAXPY(th->X,1./shift,th->Xdot,ts->vec_sol);CHKERRQ(ierr);