From: Stefano Zampini Date: Mon, 24 Jul 2023 20:38:29 +0000 (+0300) Subject: PETScWrappers::TimeStepper: Fix for older versions of PETSc X-Git-Tag: relicensing~621^2~5 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=65021919ecd0ba37c2beb9557f14abd67e277f8e;p=dealii.git PETScWrappers::TimeStepper: Fix for older versions of PETSc --- diff --git a/include/deal.II/lac/petsc_ts.templates.h b/include/deal.II/lac/petsc_ts.templates.h index a403edb405..ad2d87ded1 100644 --- a/include/deal.II/lac/petsc_ts.templates.h +++ b/include/deal.II/lac/petsc_ts.templates.h @@ -562,6 +562,17 @@ namespace PETScWrappers PetscCall(TSSetSolution(ts, new_x)); PetscCall(VecDestroy(&new_x)); } +# if DEAL_II_PETSC_VERSION_LT(3, 17, 0) + // Older versions of PETSc assume that the user does not + // change the solution vector during TSPostStep + // We "fix" it by taking a reference to the object and + // increment its state so that the time stepper is restarted + // properly. + AssertPETSc(PetscObjectCompose((PetscObject)ts, + "__dealii_ts_resize_bug__", + (PetscObject)x)); + petsc_increment_state_counter(x); +# endif PetscCall(VecDestroy(&x)); PetscFunctionReturn(PETSC_SUCCESS); };