@@ -126,7 +126,7 @@ extern "C"
126126 ierr = KSPGetIterationNumber (ksp , & niter );
127127 LIBMESH_CHKERR2 (solver -> comm (),ierr );
128128
129- if (niter > cast_int < PetscInt > (solver -> reuse_preconditioner_max_its ()))
129+ if (niter > cast_int < PetscInt > (solver -> reuse_preconditioner_max_linear_its ()))
130130 {
131131 // -2 is a magic number for "recalculate next time you need it
132132 // and then not again"
@@ -682,8 +682,6 @@ void PetscNonlinearSolver<T>::clear ()
682682 }
683683}
684684
685-
686-
687685template < typename T >
688686void PetscNonlinearSolver < T > ::init (const char * name )
689687{
@@ -855,7 +853,6 @@ PetscNonlinearSolver<T>::solve (SparseMatrix<T> & pre_in, // System Preconditi
855853 LOG_SCOPE ("solve()" , "PetscNonlinearSolver" );
856854 this -> init ();
857855
858-
859856 // Make sure the data passed in are really of Petsc types
860857 PetscMatrix < T > * pre = cast_ptr < PetscMatrix < T > * > (& pre_in );
861858 PetscVector < T > * x = cast_ptr < PetscVector < T > * > (& x_in );
@@ -878,7 +875,7 @@ PetscNonlinearSolver<T>::solve (SparseMatrix<T> & pre_in, // System Preconditi
878875 ierr = SNESSetLagPreconditioner (_snes , -2 );
879876 LIBMESH_CHKERR (ierr );
880877 // Add in our callback which will trigger recalculating
881- // the preconditioner when we hit reuse_preconditioner_max_its
878+ // the preconditioner when we hit reuse_preconditioner_max_linear_its
882879 ierr = SNESMonitorSet (_snes , & libmesh_petsc_recalculate_monitor ,
883880 this ,
884881 NULL );
@@ -1129,11 +1126,19 @@ bool PetscNonlinearSolver<T>::reuse_preconditioner() const
11291126}
11301127
11311128template < typename T >
1132- unsigned int PetscNonlinearSolver < T > ::reuse_preconditioner_max_its () const
1129+ unsigned int PetscNonlinearSolver < T > ::reuse_preconditioner_max_linear_its () const
11331130{
1134- return this -> _reuse_preconditioner_max_its ;
1131+ return this -> _reuse_preconditioner_max_linear_its ;
11351132}
11361133
1134+ template < typename T >
1135+ void PetscNonlinearSolver < T > ::force_new_preconditioner ()
1136+ {
1137+ // Easiest way is just to clear everything out
1138+ this -> _is_initialized = false;
1139+ _snes .destroy ();
1140+ _setup_reuse = false;
1141+ }
11371142
11381143//------------------------------------------------------------------
11391144// Explicit instantiations
0 commit comments