Skip to content

Commit 700db19

Browse files
Go back to the simpler fix for AMR
1 parent 79e9874 commit 700db19

File tree

2 files changed

+0
-50
lines changed

2 files changed

+0
-50
lines changed

include/solvers/petsc_nonlinear_solver.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -287,11 +287,6 @@ class PetscNonlinearSolver : public NonlinearSolver<T>
287287
*/
288288
bool _setup_reuse;
289289

290-
/**
291-
* Check on operator sizes to see if we need to get a new preconditioner
292-
*/
293-
void check_reuse_operator_sizes(numeric_index_type new_size);
294-
295290
private:
296291
friend ResidualContext libmesh_petsc_snes_residual_helper (SNES snes, Vec x, void * ctx);
297292
friend PetscErrorCode libmesh_petsc_snes_residual (SNES snes, Vec x, Vec r, void * ctx);

src/solvers/petsc_nonlinear_solver.C

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -853,10 +853,6 @@ PetscNonlinearSolver<T>::solve (SparseMatrix<T> & pre_in, // System Preconditi
853853
LOG_SCOPE("solve()", "PetscNonlinearSolver");
854854
this->init ();
855855

856-
// Backup check on the size of the stored preconditioner to see if the
857-
// problem size has changed. If so do not use the stored preconditioner.
858-
check_reuse_operator_sizes(x_in.size());
859-
860856
// Make sure the data passed in are really of Petsc types
861857
PetscMatrix<T> * pre = cast_ptr<PetscMatrix<T> *>(&pre_in);
862858
PetscVector<T> * x = cast_ptr<PetscVector<T> *>(&x_in);
@@ -1144,47 +1140,6 @@ void PetscNonlinearSolver<T>::force_new_preconditioner()
11441140
_setup_reuse = false;
11451141
}
11461142

1147-
template <typename T>
1148-
void PetscNonlinearSolver<T>::check_reuse_operator_sizes(numeric_index_type new_size)
1149-
{
1150-
// There are some special cases where libmesh won't know the
1151-
// operator size has changed (for example, problems involving
1152-
// variational inequalities). This check will force a new
1153-
// preconditioner if the operator sizes has changed, regardless
1154-
// of what libmesh itself knows about the problem
1155-
//
1156-
if (!(this->_reuse_preconditioner) ||
1157-
!(this->_is_initialized) ||
1158-
!(_setup_reuse))
1159-
return;
1160-
1161-
1162-
KSP ksp;
1163-
PetscErrorCode ierr = SNESGetKSP(_snes, &ksp);
1164-
LIBMESH_CHKERR(ierr);
1165-
1166-
PetscBool setup_A, setup_P;
1167-
ierr = KSPGetOperatorsSet(ksp, &setup_A, &setup_P);
1168-
LIBMESH_CHKERR(ierr);
1169-
if (!(setup_A && setup_P))
1170-
return;
1171-
1172-
Mat A;
1173-
Mat P;
1174-
ierr = KSPGetOperators(ksp, &A, &P);
1175-
LIBMESH_CHKERR(ierr);
1176-
1177-
PetscInt Pm, Pn;
1178-
ierr = MatGetSize(A, &Pm, &Pn);
1179-
LIBMESH_CHKERR(ierr);
1180-
1181-
if ((unsigned) Pn != new_size)
1182-
{
1183-
this->force_new_preconditioner();
1184-
this->init();
1185-
}
1186-
}
1187-
11881143
//------------------------------------------------------------------
11891144
// Explicit instantiations
11901145
template class LIBMESH_EXPORT PetscNonlinearSolver<Number>;

0 commit comments

Comments
 (0)