diff --git a/framework/include/utils/MooseTypes.h b/framework/include/utils/MooseTypes.h index 35d0b6f4367c..da5708d60969 100644 --- a/framework/include/utils/MooseTypes.h +++ b/framework/include/utils/MooseTypes.h @@ -750,18 +750,12 @@ enum LineSearchType LS_DEFAULT, LS_NONE, LS_BASIC, -#if PETSC_VERSION_LESS_THAN(3, 3, 0) - LS_CUBIC, - LS_QUADRATIC, - LS_BASICNONORMS, -#else LS_SHELL, LS_CONTACT, LS_PROJECT, LS_L2, LS_BT, LS_CP -#endif }; /** diff --git a/framework/include/utils/PetscDMMoose.h b/framework/include/utils/PetscDMMoose.h index 6fc614b965bc..784fcb703956 100644 --- a/framework/include/utils/PetscDMMoose.h +++ b/framework/include/utils/PetscDMMoose.h @@ -9,11 +9,8 @@ #pragma once -// This only works with petsc-3.3 and above. #include "libmesh/petsc_macro.h" -#if !PETSC_VERSION_LESS_THAN(3, 3, 0) - // PETSc includes #include #define DMMOOSE "moose" @@ -58,5 +55,3 @@ extern PetscErrorCode DMMooseGetSplitBlocks(DM, const std::string &, std::set &); extern PetscErrorCode DMMooseGetSplitSides(DM, const std::string &, std::set &); extern PetscErrorCode SNESUpdateDMMoose(SNES snes, PetscInt iteration); - -#endif // #if !PETSC_VERSION_LESS_THAN(3,3,0) diff --git a/framework/include/utils/PetscSupport.h b/framework/include/utils/PetscSupport.h index c85a91f2389c..eeb54cbb0de0 100644 --- a/framework/include/utils/PetscSupport.h +++ b/framework/include/utils/PetscSupport.h @@ -160,10 +160,6 @@ void disableNonlinearConvergedReason(FEProblemBase & fe_problem); */ void disableLinearConvergedReason(FEProblemBase & fe_problem); -#if PETSC_VERSION_LESS_THAN(3, 4, 0) -#define SNESGETLINESEARCH SNESGetSNESLineSearch -#else #define SNESGETLINESEARCH SNESGetLineSearch -#endif } } diff --git a/framework/src/preconditioners/FieldSplitPreconditioner.C b/framework/src/preconditioners/FieldSplitPreconditioner.C index cb3c05c481fd..2c5863598497 100644 --- a/framework/src/preconditioners/FieldSplitPreconditioner.C +++ b/framework/src/preconditioners/FieldSplitPreconditioner.C @@ -8,7 +8,6 @@ //* https://www.gnu.org/licenses/lgpl-2.1.html #include "libmesh/petsc_macro.h" -#if !PETSC_VERSION_LESS_THAN(3, 3, 0) #include "FieldSplitPreconditioner.h" // MOOSE includes @@ -97,5 +96,3 @@ FieldSplitPreconditioner::FieldSplitPreconditioner(const InputParameters & param // apply prefix and store PETSc options _fe_problem.getNonlinearSystemBase().setupFieldDecomposition(); } - -#endif diff --git a/framework/src/splits/Split.C b/framework/src/splits/Split.C index fb93b2af09e6..1695b876d36e 100644 --- a/framework/src/splits/Split.C +++ b/framework/src/splits/Split.C @@ -91,11 +91,6 @@ Split::Split(const InputParameters & parameters) void Split::setup(const std::string & prefix) { -// petsc 3.3.0 or later needed -#if PETSC_VERSION_LESS_THAN(3, 3, 0) - mooseError("The Splits functionality requires PETSc 3.3.0 or later."); -#endif - // The Split::setup() implementation does not actually depend on any // specific version of PETSc, so there's no need to wrap the entire // function. @@ -147,15 +142,7 @@ Split::setup(const std::string & prefix) petsc_schur_type[_splitting_type]); // set Schur Preconditioner - const std::string petsc_schur_pre[] = { - "self", - "selfp", -#if PETSC_VERSION_LESS_THAN(3, 4, 0) - "diag" -#else - "a11" -#endif - }; + const std::string petsc_schur_pre[] = {"self", "selfp", "a11"}; po.pairs.emplace_back(prefix + "pc_fieldsplit_schur_precondition", petsc_schur_pre[_schur_pre]); diff --git a/framework/src/systems/NonlinearSystem.C b/framework/src/systems/NonlinearSystem.C index 41d3c61c0c4d..fc258b2df240 100644 --- a/framework/src/systems/NonlinearSystem.C +++ b/framework/src/systems/NonlinearSystem.C @@ -208,22 +208,15 @@ NonlinearSystem::solve() _final_residual = _nl_implicit_sys.final_nonlinear_residual(); if (_use_coloring_finite_difference) -#if PETSC_VERSION_LESS_THAN(3, 2, 0) - MatFDColoringDestroy(_fdcoloring); -#else MatFDColoringDestroy(&_fdcoloring); -#endif } void NonlinearSystem::stopSolve() { -#if PETSC_VERSION_LESS_THAN(3, 0, 0) -#else PetscNonlinearSolver & solver = static_cast &>(*sys().nonlinear_solver); SNESSetFunctionDomainError(solver.snes()); -#endif // Insert a NaN into the residual vector. As of PETSc-3.6, this // should make PETSc return DIVERGED_NANORINF the next time it does @@ -283,11 +276,7 @@ NonlinearSystem::setupStandardFiniteDifferencedPreconditioner() SNESSetJacobian(petsc_nonlinear_solver->snes(), petsc_mat->mat(), petsc_mat->mat(), -#if PETSC_VERSION_LESS_THAN(3, 4, 0) - SNESDefaultComputeJacobian, -#else SNESComputeJacobianDefault, -#endif nullptr); } @@ -304,12 +293,6 @@ NonlinearSystem::setupColoringFiniteDifferencedPreconditioner() PetscMatrix * petsc_mat = dynamic_cast *>(&_nl_implicit_sys.get_system_matrix()); -#if PETSC_VERSION_LESS_THAN(3, 2, 0) - // This variable is only needed for PETSC < 3.2.0 - PetscVector * petsc_vec = - dynamic_cast *>(_nl_implicit_sys.solution.get()); -#endif - Moose::compute_jacobian(*_nl_implicit_sys.current_local_solution, *petsc_mat, _nl_implicit_sys); if (!petsc_mat) @@ -320,15 +303,6 @@ NonlinearSystem::setupColoringFiniteDifferencedPreconditioner() PetscErrorCode ierr = 0; ISColoring iscoloring; -#if PETSC_VERSION_LESS_THAN(3, 2, 0) - // PETSc 3.2.x - ierr = MatGetColoring(petsc_mat->mat(), MATCOLORING_LF, &iscoloring); - CHKERRABORT(libMesh::COMM_WORLD, ierr); -#elif PETSC_VERSION_LESS_THAN(3, 5, 0) - // PETSc 3.3.x, 3.4.x - ierr = MatGetColoring(petsc_mat->mat(), MATCOLORINGLF, &iscoloring); - CHKERRABORT(_communicator.get(), ierr); -#else // PETSc 3.5.x MatColoring matcoloring; ierr = MatColoringCreate(petsc_mat->mat(), &matcoloring); @@ -341,7 +315,6 @@ NonlinearSystem::setupColoringFiniteDifferencedPreconditioner() CHKERRABORT(_communicator.get(), ierr); ierr = MatColoringDestroy(&matcoloring); CHKERRABORT(_communicator.get(), ierr); -#endif MatFDColoringCreate(petsc_mat->mat(), iscoloring, &_fdcoloring); MatFDColoringSetFromOptions(_fdcoloring); @@ -351,36 +324,14 @@ NonlinearSystem::setupColoringFiniteDifferencedPreconditioner() libMesh::libmesh_petsc_snes_fd_residual, &petsc_nonlinear_solver); // clang-format on -#if !PETSC_RELEASE_LESS_THAN(3, 5, 0) MatFDColoringSetUp(petsc_mat->mat(), iscoloring, _fdcoloring); -#endif -#if PETSC_VERSION_LESS_THAN(3, 4, 0) - SNESSetJacobian(petsc_nonlinear_solver.snes(), - petsc_mat->mat(), - petsc_mat->mat(), - SNESDefaultComputeJacobianColor, - _fdcoloring); -#else SNESSetJacobian(petsc_nonlinear_solver.snes(), petsc_mat->mat(), petsc_mat->mat(), SNESComputeJacobianDefaultColor, _fdcoloring); -#endif -#if PETSC_VERSION_LESS_THAN(3, 2, 0) - Mat my_mat = petsc_mat->mat(); - MatStructure my_struct; - - SNESComputeJacobian( - petsc_nonlinear_solver.snes(), petsc_vec->vec(), &my_mat, &my_mat, &my_struct); -#endif - -#if PETSC_VERSION_LESS_THAN(3, 2, 0) - ISColoringDestroy(iscoloring); -#else - // PETSc 3.3.0 + // PETSc >=3.3.0 ISColoringDestroy(&iscoloring); -#endif } bool diff --git a/framework/src/systems/NonlinearSystemBase.C b/framework/src/systems/NonlinearSystemBase.C index a5f328b3ce6d..15808e5b1522 100644 --- a/framework/src/systems/NonlinearSystemBase.C +++ b/framework/src/systems/NonlinearSystemBase.C @@ -97,12 +97,10 @@ #include #include "petscsnes.h" -#if !PETSC_VERSION_LESS_THAN(3, 3, 0) #include EXTERN_C_BEGIN extern PetscErrorCode DMCreate_Moose(DM); EXTERN_C_END -#endif NonlinearSystemBase::NonlinearSystemBase(FEProblemBase & fe_problem, System & sys, @@ -1870,8 +1868,6 @@ NonlinearSystemBase::constraintJacobians(bool displaced) auto & jacobian = getMatrix(systemMatrixTag()); -#if PETSC_VERSION_LESS_THAN(3, 3, 0) -#else if (!_fe_problem.errorOnJacobianNonzeroReallocation()) MatSetOption(static_cast &>(jacobian).mat(), MAT_NEW_NONZERO_ALLOCATION_ERR, @@ -1879,7 +1875,6 @@ NonlinearSystemBase::constraintJacobians(bool displaced) if (_fe_problem.ignoreZerosInJacobian()) MatSetOption( static_cast &>(jacobian).mat(), MAT_IGNORE_ZERO_ENTRIES, PETSC_TRUE); -#endif std::vector zero_rows; std::map, PenetrationLocator *> * penetration_locators = @@ -2063,18 +2058,9 @@ NonlinearSystemBase::constraintJacobians(bool displaced) if (constraints_applied) { -#if PETSC_VERSION_LESS_THAN(3, 0, 0) - MatSetOption(static_cast &>(jacobian).mat(), MAT_KEEP_ZEROED_ROWS); -#elif PETSC_VERSION_LESS_THAN(3, 1, 0) - // In Petsc 3.0.0, MatSetOption has three args...the third arg - // determines whether the option is set (true) or unset (false) - MatSetOption( - static_cast &>(jacobian).mat(), MAT_KEEP_ZEROED_ROWS, PETSC_TRUE); -#else MatSetOption(static_cast &>(jacobian).mat(), MAT_KEEP_NONZERO_PATTERN, // This is changed in 3.1 PETSC_TRUE); -#endif jacobian.close(); jacobian.zero_rows(zero_rows, 0.0); @@ -2091,19 +2077,9 @@ NonlinearSystemBase::constraintJacobians(bool displaced) if (constraints_applied) { -// Necessary for speed -#if PETSC_VERSION_LESS_THAN(3, 0, 0) - MatSetOption(static_cast &>(jacobian).mat(), MAT_KEEP_ZEROED_ROWS); -#elif PETSC_VERSION_LESS_THAN(3, 1, 0) - // In Petsc 3.0.0, MatSetOption has three args...the third arg - // determines whether the option is set (true) or unset (false) - MatSetOption( - static_cast &>(jacobian).mat(), MAT_KEEP_ZEROED_ROWS, PETSC_TRUE); -#else MatSetOption(static_cast &>(jacobian).mat(), MAT_KEEP_NONZERO_PATTERN, // This is changed in 3.1 PETSC_TRUE); -#endif jacobian.close(); jacobian.zero_rows(zero_rows, 0.0); @@ -2294,19 +2270,9 @@ NonlinearSystemBase::constraintJacobians(bool displaced) if (constraints_applied) { -// Necessary for speed -#if PETSC_VERSION_LESS_THAN(3, 0, 0) - MatSetOption(static_cast &>(jacobian).mat(), MAT_KEEP_ZEROED_ROWS); -#elif PETSC_VERSION_LESS_THAN(3, 1, 0) - // In Petsc 3.0.0, MatSetOption has three args...the third arg - // determines whether the option is set (true) or unset (false) - MatSetOption( - static_cast &>(jacobian).mat(), MAT_KEEP_ZEROED_ROWS, PETSC_TRUE); -#else MatSetOption(static_cast &>(jacobian).mat(), MAT_KEEP_NONZERO_PATTERN, // This is changed in 3.1 PETSC_TRUE); -#endif jacobian.close(); jacobian.zero_rows(zero_rows, 0.0); @@ -2402,22 +2368,12 @@ NonlinearSystemBase::computeJacobianInternal(const std::set & tags) // Necessary for speed if (auto petsc_matrix = dynamic_cast *>(&jacobian)) { -#if PETSC_VERSION_LESS_THAN(3, 0, 0) - MatSetOption(petsc_matrix->mat(), MAT_KEEP_ZEROED_ROWS); -#elif PETSC_VERSION_LESS_THAN(3, 1, 0) - // In Petsc 3.0.0, MatSetOption has three args...the third arg - // determines whether the option is set (true) or unset (false) - MatSetOption(petsc_matrix->mat(), MAT_KEEP_ZEROED_ROWS, PETSC_TRUE); -#else MatSetOption(petsc_matrix->mat(), MAT_KEEP_NONZERO_PATTERN, // This is changed in 3.1 PETSC_TRUE); -#endif // PETSC_VERSION -#if !PETSC_VERSION_LESS_THAN(3, 3, 0) if (!_fe_problem.errorOnJacobianNonzeroReallocation()) MatSetOption(petsc_matrix->mat(), MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE); } -#endif // PETSC_VERSION } jacobianSetup(); @@ -2782,26 +2738,13 @@ NonlinearSystemBase::computeJacobianBlocks(std::vector & blocks { SparseMatrix & jacobian = blocks[i]->_jacobian; -// Necessary for speed -#if PETSC_VERSION_LESS_THAN(3, 0, 0) - MatSetOption(static_cast &>(jacobian).mat(), MAT_KEEP_ZEROED_ROWS); -#elif PETSC_VERSION_LESS_THAN(3, 1, 0) - // In Petsc 3.0.0, MatSetOption has three args...the third arg - // determines whether the option is set (true) or unset (false) - MatSetOption( - static_cast &>(jacobian).mat(), MAT_KEEP_ZEROED_ROWS, PETSC_TRUE); -#else + MatSetOption(static_cast &>(jacobian).mat(), + MAT_KEEP_NONZERO_PATTERN, // This is changed in 3.1 + PETSC_TRUE); + if (!_fe_problem.errorOnJacobianNonzeroReallocation()) MatSetOption(static_cast &>(jacobian).mat(), - MAT_KEEP_NONZERO_PATTERN, // This is changed in 3.1 + MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_TRUE); -#endif -#if PETSC_VERSION_LESS_THAN(3, 3, 0) -#else - if (!_fe_problem.errorOnJacobianNonzeroReallocation()) - MatSetOption(static_cast &>(jacobian).mat(), - MAT_NEW_NONZERO_ALLOCATION_ERR, - PETSC_TRUE); -#endif jacobian.zero(); } diff --git a/framework/src/utils/ColumnMajorMatrix.C b/framework/src/utils/ColumnMajorMatrix.C index 1afd252c3180..7fa442bed414 100644 --- a/framework/src/utils/ColumnMajorMatrix.C +++ b/framework/src/utils/ColumnMajorMatrix.C @@ -18,10 +18,6 @@ #include #include -#if PETSC_VERSION_LESS_THAN(3, 5, 0) -extern "C" void FORTRAN_CALL(dgetri)(...); // matrix inversion routine from LAPACK -#endif - template ColumnMajorMatrixTempl::ColumnMajorMatrixTempl(unsigned int rows, unsigned int cols) : _n_rows(rows), _n_cols(cols), _n_entries(rows * cols), _values(rows * cols, 0.0) diff --git a/framework/src/utils/Conversion.C b/framework/src/utils/Conversion.C index ad68ce8593f2..1537e9f786db 100644 --- a/framework/src/utils/Conversion.C +++ b/framework/src/utils/Conversion.C @@ -131,18 +131,12 @@ initLineSearchType() line_search_type_to_enum["NONE"] = LS_NONE; line_search_type_to_enum["BASIC"] = LS_BASIC; -#if PETSC_VERSION_LESS_THAN(3, 3, 0) - line_search_type_to_enum["CUBIC"] = LS_CUBIC; - line_search_type_to_enum["QUADRATIC"] = LS_QUADRATIC; - line_search_type_to_enum["BASICNONORMS"] = LS_BASICNONORMS; -#else line_search_type_to_enum["SHELL"] = LS_SHELL; line_search_type_to_enum["L2"] = LS_L2; line_search_type_to_enum["BT"] = LS_BT; line_search_type_to_enum["CP"] = LS_CP; line_search_type_to_enum["CONTACT"] = LS_CONTACT; line_search_type_to_enum["PROJECT"] = LS_PROJECT; -#endif } } diff --git a/framework/src/utils/MatrixTools.C b/framework/src/utils/MatrixTools.C index 3645e420cf3f..b76757ac4e4a 100644 --- a/framework/src/utils/MatrixTools.C +++ b/framework/src/utils/MatrixTools.C @@ -17,10 +17,6 @@ // PETSc includes #include "petscblaslapack.h" -#if PETSC_VERSION_LESS_THAN(3, 5, 0) -extern "C" void FORTRAN_CALL(dgetri)(...); // matrix inversion routine from LAPACK -#endif - namespace MatrixTools { void @@ -80,16 +76,6 @@ inverse(std::vector & A, unsigned int n) // get the inverse of A PetscBLASInt buffer_size = buffer.size(); -#if PETSC_VERSION_LESS_THAN(3, 5, 0) - FORTRAN_CALL(dgetri) - (reinterpret_cast(&n), - &A[0], - reinterpret_cast(&n), - &ipiv[0], - &buffer[0], - &buffer_size, - &return_value); -#else LAPACKgetri_(reinterpret_cast(&n), &A[0], reinterpret_cast(&n), @@ -97,7 +83,6 @@ inverse(std::vector & A, unsigned int n) &buffer[0], &buffer_size, &return_value); -#endif if (return_value != 0) throw MooseException(return_value < 0 diff --git a/framework/src/utils/PetscDMMoose.C b/framework/src/utils/PetscDMMoose.C index d8031cc1f903..029fc8c71788 100644 --- a/framework/src/utils/PetscDMMoose.C +++ b/framework/src/utils/PetscDMMoose.C @@ -10,10 +10,6 @@ // This only works with petsc-3.3 and above. #include "libmesh/petsc_macro.h" -#if !PETSC_VERSION_LESS_THAN(3, 3, 0) -// Inside these guards we can use PETSC_VERSION_LT, which need not be -// modified upon transition from dev to a release. - #include "PetscDMMoose.h" // PETSc includes @@ -1042,14 +1038,9 @@ DMCreateFieldDecomposition_Moose( CHKERRQ(ierr); if (dmm->_embedding) { -/* Create a relative embedding into the parent's index space. */ -#if PETSC_VERSION_LT(3, 4, 0) - ierr = ISMapFactorRight(dembedding, dmm->_embedding, PETSC_TRUE, &lembedding); - CHKERRQ(ierr); -#else + // Create a relative embedding into the parent's index space. ierr = ISEmbed(dembedding, dmm->_embedding, PETSC_TRUE, &lembedding); CHKERRQ(ierr); -#endif const PetscInt * lindices; PetscInt len, dlen, llen, *rindices, off, i; ierr = ISGetLocalSize(dembedding, &dlen); @@ -1130,52 +1121,6 @@ DMCreateDomainDecomposition_Moose( PetscFunctionReturn(0); } -#if PETSC_VERSION_LT(3, 4, 0) -#undef __FUNCT__ -#define __FUNCT__ "DMCreateFieldDecompositionDM_Moose" -PetscErrorCode -DMCreateFieldDecompositionDM_Moose(DM dm, const char * /*name*/, DM * ddm) -{ - PetscErrorCode ierr; - PetscBool ismoose; - - PetscFunctionBegin; - PetscValidHeaderSpecific(dm, DM_CLASSID, 1); - ierr = PetscObjectTypeCompare((PetscObject)dm, DMMOOSE, &ismoose); - CHKERRQ(ierr); - /* Return self. */ - if (*ddm) - { - ierr = PetscObjectReference((PetscObject)dm); - CHKERRQ(ierr); - *ddm = dm; - } - PetscFunctionReturn(0); -} - -#undef __FUNCT__ -#define __FUNCT__ "DMCreateDomainDecompositionDM_Moose" -PetscErrorCode -DMCreateDomainDecompositionDM_Moose(DM dm, const char * /*name*/, DM * ddm) -{ - PetscErrorCode ierr; - PetscBool ismoose; - - PetscFunctionBegin; - PetscValidHeaderSpecific(dm, DM_CLASSID, 1); - ierr = PetscObjectTypeCompare((PetscObject)dm, DMMOOSE, &ismoose); - CHKERRQ(ierr); - /* Return self. */ - if (*ddm) - { - ierr = PetscObjectReference((PetscObject)dm); - CHKERRQ(ierr); - *ddm = dm; - } - PetscFunctionReturn(0); -} -#endif - #undef __FUNCT__ #define __FUNCT__ "DMMooseFunction" static PetscErrorCode @@ -1250,7 +1195,6 @@ DMMooseFunction(DM dm, Vec x, Vec r) PetscFunctionReturn(0); } -#if !PETSC_VERSION_LT(3, 4, 0) #undef __FUNCT__ #define __FUNCT__ "SNESFunction_DMMoose" static PetscErrorCode @@ -1264,17 +1208,11 @@ SNESFunction_DMMoose(SNES, Vec x, Vec r, void * ctx) CHKERRQ(ierr); PetscFunctionReturn(0); } -#endif #undef __FUNCT__ #define __FUNCT__ "DMMooseJacobian" -#if PETSC_VERSION_LT(3, 5, 0) -static PetscErrorCode -DMMooseJacobian(DM dm, Vec x, Mat jac, Mat pc, MatStructure * msflag) -#else static PetscErrorCode DMMooseJacobian(DM dm, Vec x, Mat jac, Mat pc) -#endif { PetscErrorCode ierr; NonlinearSystemBase * nl = NULL; @@ -1352,37 +1290,22 @@ DMMooseJacobian(DM dm, Vec x, Mat jac, Mat pc) } the_pc.close(); Jac.close(); -#if PETSC_VERSION_LT(3, 5, 0) - *msflag = SAME_NONZERO_PATTERN; -#endif PetscFunctionReturn(0); } -#if !PETSC_VERSION_LT(3, 4, 0) #undef __FUNCT__ #define __FUNCT__ "SNESJacobian_DMMoose" -#if PETSC_VERSION_LT(3, 5, 0) -static PetscErrorCode -SNESJacobian_DMMoose(SNES, Vec x, Mat * jac, Mat * pc, MatStructure * flag, void * ctx) -#else static PetscErrorCode SNESJacobian_DMMoose(SNES, Vec x, Mat jac, Mat pc, void * ctx) -#endif { DM dm = (DM)ctx; PetscErrorCode ierr; PetscFunctionBegin; -#if PETSC_VERSION_LT(3, 5, 0) - ierr = DMMooseJacobian(dm, x, *jac, *pc, flag); - CHKERRQ(ierr); -#else ierr = DMMooseJacobian(dm, x, jac, pc); CHKERRQ(ierr); -#endif PetscFunctionReturn(0); } -#endif #undef __FUNCT__ #define __FUNCT__ "DMVariableBounds_Moose" @@ -1399,17 +1322,10 @@ DMVariableBounds_Moose(DM dm, Vec xl, Vec xu) PetscVector XL(xl, nl->comm()); PetscVector XU(xu, nl->comm()); -#if PETSC_VERSION_LESS_THAN(3, 5, 0) && PETSC_VERSION_RELEASE - ierr = VecSet(xl, SNES_VI_NINF); - CHKERRQ(ierr); - ierr = VecSet(xu, SNES_VI_INF); - CHKERRQ(ierr); -#else ierr = VecSet(xl, PETSC_NINFINITY); CHKERRQ(ierr); ierr = VecSet(xu, PETSC_INFINITY); CHKERRQ(ierr); -#endif if (nl->nonlinearSolver()->bounds != NULL) nl->nonlinearSolver()->bounds(XL, XU, nl->nonlinearSolver()->system()); else if (nl->nonlinearSolver()->bounds_object != NULL) @@ -1481,20 +1397,13 @@ DMCreateGlobalVector_Moose(DM dm, Vec * x) #undef __FUNCT__ #define __FUNCT__ "DMCreateMatrix_Moose" -#if PETSC_VERSION_LT(3, 5, 0) -static PetscErrorCode -DMCreateMatrix_Moose(DM dm, const MatType type, Mat * A) -#else static PetscErrorCode DMCreateMatrix_Moose(DM dm, Mat * A) -#endif { PetscErrorCode ierr; DM_Moose * dmm = (DM_Moose *)(dm->data); PetscBool ismoose; -#if !PETSC_RELEASE_LESS_THAN(3, 5, 0) MatType type; -#endif PetscFunctionBegin; ierr = PetscObjectTypeCompare((PetscObject)dm, DMMOOSE, &ismoose); @@ -1507,11 +1416,9 @@ DMCreateMatrix_Moose(DM dm, Mat * A) DMMOOSE); if (!dmm->_nl) SETERRQ(PETSC_COMM_WORLD, PETSC_ERR_ARG_WRONGSTATE, "No Moose system set for DM_Moose"); -// No PETSC_VERSION_GE macro prior to petsc-3.4 -#if !PETSC_VERSION_LT(3, 5, 0) ierr = DMGetMatType(dm, &type); CHKERRQ(ierr); -#endif + /* The simplest thing for now: compute the sparsity_pattern using dof_map and init the matrix using that info. @@ -2056,17 +1963,10 @@ DMSetUp_Moose(DM dm) if (dmm->_all_vars && dmm->_all_blocks && dmm->_nosides && dmm->_nounsides && dmm->_nocontacts && dmm->_nouncontacts) { -#if PETSC_VERSION_LT(3, 4, 0) - ierr = DMSetFunction(dm, DMMooseFunction); - CHKERRQ(ierr); - ierr = DMSetJacobian(dm, DMMooseJacobian); - CHKERRQ(ierr); -#else ierr = DMSNESSetFunction(dm, SNESFunction_DMMoose, (void *)dm); CHKERRQ(ierr); ierr = DMSNESSetJacobian(dm, SNESJacobian_DMMoose, (void *)dm); CHKERRQ(ierr); -#endif if (dmm->_nl->nonlinearSolver()->bounds || dmm->_nl->nonlinearSolver()->bounds_object) ierr = DMSetVariableBounds(dm, DMVariableBounds_Moose); CHKERRQ(ierr); @@ -2088,11 +1988,14 @@ DMSetUp_Moose(DM dm) #undef __FUNCT__ #define __FUNCT__ "DMSetFromOptions_Moose" #if !PETSC_VERSION_LESS_THAN(3, 7, 0) -PetscErrorCode DMSetFromOptions_Moose(PetscOptionItems * /*options*/, DM dm) // >= 3.7.0 +PetscErrorCode +DMSetFromOptions_Moose(PetscOptionItems * /*options*/, DM dm) // >= 3.7.0 #elif !PETSC_RELEASE_LESS_THAN(3, 6, 0) -PetscErrorCode DMSetFromOptions_Moose(PetscOptions * /*options*/, DM dm) // >= 3.6.0 +PetscErrorCode +DMSetFromOptions_Moose(PetscOptions * /*options*/, DM dm) // >= 3.6.0 #else -PetscErrorCode DMSetFromOptions_Moose(DM dm) // < 3.6.0 +PetscErrorCode +DMSetFromOptions_Moose(DM dm) // < 3.6.0 #endif { PetscErrorCode ierr; @@ -2552,10 +2455,6 @@ DMCreate_Moose(DM dm) dm->ops->createinjection = 0; #endif -#if PETSC_VERSION_LT(3, 4, 0) - dm->ops->createfielddecompositiondm = DMCreateFieldDecompositionDM_Moose; - dm->ops->createdomaindecompositiondm = DMCreateDomainDecompositionDM_Moose; -#endif dm->ops->createfielddecomposition = DMCreateFieldDecomposition_Moose; dm->ops->createdomaindecomposition = DMCreateDomainDecomposition_Moose; @@ -2632,15 +2531,9 @@ DMMooseRegisterAll() PetscFunctionBegin; if (!DMMooseRegisterAllCalled) { -#if PETSC_VERSION_LESS_THAN(3, 4, 0) - ierr = DMRegister(DMMOOSE, PETSC_NULL, "DMCreate_Moose", DMCreate_Moose); - CHKERRQ(ierr); -#else ierr = DMRegister(DMMOOSE, DMCreate_Moose); CHKERRQ(ierr); -#endif DMMooseRegisterAllCalled = PETSC_TRUE; } PetscFunctionReturn(0); } -#endif // #if !PETSC_VERSION_LESS_THAN(3,3,0) diff --git a/framework/src/utils/PetscSupport.C b/framework/src/utils/PetscSupport.C index bde0ad160357..d7d364d6901f 100644 --- a/framework/src/utils/PetscSupport.C +++ b/framework/src/utils/PetscSupport.C @@ -45,15 +45,7 @@ // For graph coloring #include #include - -#if PETSC_VERSION_LESS_THAN(3, 3, 0) -// PETSc 3.2.x and lower -#include -#include -#else -// PETSc 3.3.0+ #include -#endif // PetscDMMoose include #include "PetscDMMoose.h" @@ -109,14 +101,6 @@ stringify(const LineSearchType & t) return "default"; case LS_NONE: return "none"; -#if PETSC_VERSION_LESS_THAN(3, 3, 0) - case LS_CUBIC: - return "cubic"; - case LS_QUADRATIC: - return "quadratic"; - case LS_BASICNONORMS: - return "basicnonorms"; -#else case LS_SHELL: return "shell"; case LS_L2: @@ -129,7 +113,6 @@ stringify(const LineSearchType & t) return "contact"; case LS_PROJECT: return "project"; -#endif case LS_INVALID: mooseError("Invalid LineSearchType"); } @@ -185,20 +168,12 @@ setSolverOptions(SolverParams & solver_params) ls_type = Moose::LS_BASIC; if (ls_type != Moose::LS_DEFAULT && ls_type != Moose::LS_CONTACT && ls_type != Moose::LS_PROJECT) - { -#if PETSC_VERSION_LESS_THAN(3, 3, 0) - setSinglePetscOption("-snes_type", "ls"); - setSinglePetscOption("-snes_ls", stringify(ls_type)); -#else setSinglePetscOption("-snes_linesearch_type", stringify(ls_type)); -#endif - } } void petscSetupDM(NonlinearSystemBase & nl) { -#if !PETSC_VERSION_LESS_THAN(3, 3, 0) PetscErrorCode ierr; PetscBool ismoose; DM dm = PETSC_NULL; @@ -231,15 +206,14 @@ petscSetupDM(NonlinearSystemBase & nl) CHKERRABORT(nl.comm().get(), ierr); ierr = DMDestroy(&dm); CHKERRABORT(nl.comm().get(), ierr); -// We temporarily comment out this updating function because -// we lack an approach to check if the problem -// structure has been changed from the last iteration. -// The indices will be rebuilt for every timestep. -// TODO: figure out a way to check the structure changes of the -// matrix -// ierr = SNESSetUpdate(snes,SNESUpdateDMMoose); -// CHKERRABORT(nl.comm().get(),ierr); -#endif + // We temporarily comment out this updating function because + // we lack an approach to check if the problem + // structure has been changed from the last iteration. + // The indices will be rebuilt for every timestep. + // TODO: figure out a way to check the structure changes of the + // matrix + // ierr = SNESSetUpdate(snes,SNESUpdateDMMoose); + // CHKERRABORT(nl.comm().get(),ierr); } void @@ -358,10 +332,9 @@ petscNonlinearConverged(SNES snes, } #endif -// See if SNESSetFunctionDomainError() has been called. Note: -// SNESSetFunctionDomainError() and SNESGetFunctionDomainError() -// were added in different releases of PETSc. -#if !PETSC_VERSION_LESS_THAN(3, 3, 0) + // See if SNESSetFunctionDomainError() has been called. Note: + // SNESSetFunctionDomainError() and SNESGetFunctionDomainError() + // were added in different releases of PETSc. PetscBool domainerror; ierr = SNESGetFunctionDomainError(snes, &domainerror); CHKERRABORT(problem.comm().get(), ierr); @@ -370,7 +343,6 @@ petscNonlinearConverged(SNES snes, *reason = SNES_DIVERGED_FUNCTION_DOMAIN; return 0; } -#endif // Error message that will be set by the FEProblemBase. std::string msg; @@ -417,11 +389,7 @@ petscNonlinearConverged(SNES snes, break; case MooseNonlinearConvergenceReason::CONVERGED_SNORM_RELATIVE: -#if PETSC_VERSION_LESS_THAN(3, 3, 0) - *reason = SNES_CONVERGED_PNORM_RELATIVE; -#else *reason = SNES_CONVERGED_SNORM_RELATIVE; -#endif break; case MooseNonlinearConvergenceReason::DIVERGED_FUNCTION_COUNT: @@ -433,11 +401,7 @@ petscNonlinearConverged(SNES snes, break; case MooseNonlinearConvergenceReason::DIVERGED_LINE_SEARCH: -#if PETSC_VERSION_LESS_THAN(3, 2, 0) - *reason = SNES_DIVERGED_LS_FAILURE; -#else *reason = SNES_DIVERGED_LINE_SEARCH; -#endif break; case MooseNonlinearConvergenceReason::DIVERGED_NL_RESIDUAL_PINGPONG: @@ -499,16 +463,9 @@ petscSetDefaultPCSide(FEProblemBase & problem, KSP ksp) { NonlinearSystemBase & nl = problem.getNonlinearSystemBase(); -#if PETSC_VERSION_LESS_THAN(3, 2, 0) - // pc_side is NOT set, PETSc will make the decision - // PETSc 3.1.x- - if (nl.getPCSide() != Moose::PCS_DEFAULT) - KSPSetPreconditionerSide(ksp, getPetscPCSide(nl.getPCSide())); -#else // PETSc 3.2.x+ if (nl.getPCSide() != Moose::PCS_DEFAULT) KSPSetPCSide(ksp, getPetscPCSide(nl.getPCSide())); -#endif } void @@ -546,12 +503,6 @@ petscSetDefaults(FEProblemBase & problem) SNESSetMaxLinearSolveFailures(snes, 1000000); -#if PETSC_VERSION_LESS_THAN(3, 0, 0) - // PETSc 2.3.3- - SNESSetConvergenceTest(snes, petscNonlinearConverged, &problem); -#else - // PETSc 3.0.0+ - // In 3.0.0, the context pointer must actually be used, and the // final argument to KSPSetConvergenceTest() is a pointer to a // routine for destroying said private data context. In this case, @@ -561,7 +512,6 @@ petscSetDefaults(FEProblemBase & problem) auto ierr = SNESSetConvergenceTest(snes, petscNonlinearConverged, &problem, PETSC_NULL); CHKERRABORT(nl.comm().get(), ierr); } -#endif petscSetKSPDefaults(problem, ksp); } @@ -826,11 +776,7 @@ storePetscOptions(FEProblemBase & fe_problem, const InputParameters & params) std::set getPetscValidLineSearches() { -#if PETSC_VERSION_LESS_THAN(3, 3, 0) - return {"default", "cubic", "quadratic", "none", "basic", "basicnonorms"}; -#else return {"default", "shell", "none", "basic", "l2", "bt", "cp"}; -#endif } InputParameters @@ -961,9 +907,6 @@ colorAdjacencyMatrix(PetscScalar * adjacency_matrix, &A); ISColoring iscoloring; -#if PETSC_VERSION_LESS_THAN(3, 5, 0) - MatGetColoring(A, coloring_algorithm, &iscoloring); -#else MatColoring mc; MatColoringCreate(A, &mc); MatColoringSetType(mc, coloring_algorithm); @@ -973,7 +916,6 @@ colorAdjacencyMatrix(PetscScalar * adjacency_matrix, MatColoringSetDistance(mc, 1); MatColoringSetFromOptions(mc); MatColoringApply(mc, &iscoloring); -#endif PetscInt nn; IS * is; @@ -1001,10 +943,7 @@ colorAdjacencyMatrix(PetscScalar * adjacency_matrix, } MatDestroy(&A); -#if !PETSC_VERSION_LESS_THAN(3, 5, 0) MatColoringDestroy(&mc); -#endif - ISColoringDestroy(&iscoloring); } void diff --git a/modules/contact/include/linesearches/PetscContactLineSearch.h b/modules/contact/include/linesearches/PetscContactLineSearch.h index 00a7ccad00b7..f30e1c0218ec 100644 --- a/modules/contact/include/linesearches/PetscContactLineSearch.h +++ b/modules/contact/include/linesearches/PetscContactLineSearch.h @@ -12,9 +12,6 @@ #include "libmesh/libmesh_common.h" #include "libmesh/petsc_macro.h" -#if PETSC_VERSION_LESS_THAN(3, 3, 0) -#else - #include "ContactLineSearchBase.h" using namespace libMesh; @@ -40,5 +37,3 @@ class PetscContactLineSearch : public ContactLineSearchBase protected: PetscNonlinearSolver * _solver; }; - -#endif // PETSC_VERSION_LESS_THAN(3, 3, 0) diff --git a/modules/contact/include/linesearches/PetscProjectSolutionOntoBounds.h b/modules/contact/include/linesearches/PetscProjectSolutionOntoBounds.h index b3ea813b0e61..67767559babb 100644 --- a/modules/contact/include/linesearches/PetscProjectSolutionOntoBounds.h +++ b/modules/contact/include/linesearches/PetscProjectSolutionOntoBounds.h @@ -12,9 +12,6 @@ #include "libmesh/libmesh_common.h" #include "libmesh/petsc_macro.h" -#if PETSC_VERSION_LESS_THAN(3, 3, 0) -#else - #include "LineSearch.h" #include @@ -53,5 +50,3 @@ class PetscProjectSolutionOntoBounds : public LineSearch const std::map, PenetrationLocator *> * _pentration_locators; }; - -#endif // PETSC_VERSION_LESS_THAN(3, 3, 0) diff --git a/modules/contact/include/splits/ContactSplit.h b/modules/contact/include/splits/ContactSplit.h index c6c8e72f5506..0489193a06c3 100644 --- a/modules/contact/include/splits/ContactSplit.h +++ b/modules/contact/include/splits/ContactSplit.h @@ -23,12 +23,10 @@ class ContactSplit : public Split ContactSplit(const InputParameters & params); virtual void setup(const std::string & prefix = "-") override; -#if !PETSC_VERSION_LESS_THAN(3, 3, 0) protected: const std::vector> _contact_pairs; std::vector _contact_displaced; const std::vector> _uncontact_pairs; std::vector _uncontact_displaced; bool _include_all_contact_nodes; -#endif // !PETSC_VERSION_LESS_THAN(3,3,0) }; diff --git a/modules/contact/src/linesearches/PetscContactLineSearch.C b/modules/contact/src/linesearches/PetscContactLineSearch.C index 80bd7a224996..c62fb913562a 100644 --- a/modules/contact/src/linesearches/PetscContactLineSearch.C +++ b/modules/contact/src/linesearches/PetscContactLineSearch.C @@ -187,4 +187,4 @@ PetscContactLineSearch::lineSearch() _old_contact_state = std::move(contact_state_stored); } -#endif // !PETSC_VERSION_LESS_THAN(3, 3, 0) +#endif // !PETSC_VERSION_LESS_THAN(3, 6, 0) diff --git a/modules/contact/src/linesearches/PetscProjectSolutionOntoBounds.C b/modules/contact/src/linesearches/PetscProjectSolutionOntoBounds.C index 478f27e6d358..c46fdf4dbb1b 100644 --- a/modules/contact/src/linesearches/PetscProjectSolutionOntoBounds.C +++ b/modules/contact/src/linesearches/PetscProjectSolutionOntoBounds.C @@ -164,4 +164,4 @@ PetscProjectSolutionOntoBounds::lineSearch() LIBMESH_CHKERR(ierr); } -#endif // !PETSC_VERSION_LESS_THAN(3, 3, 0) +#endif // !PETSC_VERSION_LESS_THAN(3, 6, 0) diff --git a/modules/contact/src/splits/ContactSplit.C b/modules/contact/src/splits/ContactSplit.C index ff799a831ef4..999e732de934 100644 --- a/modules/contact/src/splits/ContactSplit.C +++ b/modules/contact/src/splits/ContactSplit.C @@ -12,7 +12,6 @@ #include "FEProblem.h" #include "Conversion.h" -#if !PETSC_VERSION_LESS_THAN(3, 3, 0) registerMooseObject("ContactApp", ContactSplit); InputParameters @@ -114,4 +113,3 @@ ContactSplit::setup(const std::string & prefix) _include_all_contact_nodes ? "yes" : "no"); Split::setup(prefix); } -#endif // #if !PETSC_VERSION_LESS_THAN(3, 3, 0) diff --git a/modules/contact/test/tests/pressure/tests b/modules/contact/test/tests/pressure/tests index 9953b360b3ac..67d323bbccb6 100644 --- a/modules/contact/test/tests/pressure/tests +++ b/modules/contact/test/tests/pressure/tests @@ -6,7 +6,6 @@ input = 'pressureAugLag.i' exodiff = 'pressureAugLag_out.e' custom_cmp = 'pressure.exodiff' - petsc_version = '>=3.1' max_parallel = 1 requirement = 'The contact system shall reproduce contact pressure results among various formulation types. Augmented Lagrangian formulation.' [../] diff --git a/test/tests/materials/material_dependency/tests b/test/tests/materials/material_dependency/tests index 68c8d4b543c1..fad0454dd8c8 100644 --- a/test/tests/materials/material_dependency/tests +++ b/test/tests/materials/material_dependency/tests @@ -4,11 +4,6 @@ input = 'diff_kernel_aux_mat_dep.i' exodiff = 'diff_kernel_aux_mat_dep_out.e' max_threads = 1 - # The Material in this test effectively counts the number of residual - # evaluations performed by the code, and that varies between older and - # newer versions of PETSc due to the changes in 3061bbd5d. This test is - # therefore only valid with newer versions of PETSc. - petsc_version = '>=3.5.0' petsc_version_release = true compiler = '!INTEL' diff --git a/test/tests/outputs/iterative/tests b/test/tests/outputs/iterative/tests index aab626ba369f..b25cd2a457f8 100644 --- a/test/tests/outputs/iterative/tests +++ b/test/tests/outputs/iterative/tests @@ -76,9 +76,6 @@ max_threads = 1 # no. of iterations is not recoverable recover = false - # This test requires a different number of residual evaluations in older PETScs - # due to the changes in 3061bbd5d. - petsc_version = '>=3.5.0' petsc_version_release = true compiler = '!INTEL' diff --git a/test/tests/preconditioners/fsp/tests b/test/tests/preconditioners/fsp/tests index 0acba056d26f..0f7285075a0e 100644 --- a/test/tests/preconditioners/fsp/tests +++ b/test/tests/preconditioners/fsp/tests @@ -9,8 +9,6 @@ input = 'fsp_test.i' exodiff = 'out.e' max_parallel = 1 - # Splits require PETSc >= 3.3.0 - petsc_version = '>=3.3.0' detail = "a single subdomain and" [] @@ -20,8 +18,6 @@ exodiff = 'kitten_out.e' max_parallel = 4 min_parallel = 4 - # Splits require PETSc >= 3.3.0 - petsc_version = '>=3.3.0' vtk = true detail = "multiple subdomains." diff --git a/test/tests/userobjects/shape_element_user_object/tests b/test/tests/userobjects/shape_element_user_object/tests index ea1e6e4e10c3..df8b7cf2e562 100644 --- a/test/tests/userobjects/shape_element_user_object/tests +++ b/test/tests/userobjects/shape_element_user_object/tests @@ -65,7 +65,6 @@ # This tests sometimes reports an incorrect jacobian when run # with multiple threads. max_threads = 1 - petsc_version = '>=3.5.0' detail = 'on the side of elements, and' []