diff --git a/AMDiS/src/parallel/PetscProblemStat.h b/AMDiS/src/parallel/PetscProblemStat.h index 491c4d0c6685ff2b0e45cd86693681e0183a6873..a844b5c9f68882eba82d4c3498013b65b62bd368 100644 --- a/AMDiS/src/parallel/PetscProblemStat.h +++ b/AMDiS/src/parallel/PetscProblemStat.h @@ -57,6 +57,11 @@ namespace AMDiS { bool createMatrixData = true, bool storeMatrixData = false); + PetscSolver* getPetscSolver() + { + return petscSolver; + } + protected: PetscSolver *petscSolver; diff --git a/AMDiS/src/parallel/PetscSolver.cc b/AMDiS/src/parallel/PetscSolver.cc index ad2d7cc9eeedd1002469cd99011c18364d807109..da03fe93fa366cfc367e7496879983b96aaee8df 100644 --- a/AMDiS/src/parallel/PetscSolver.cc +++ b/AMDiS/src/parallel/PetscSolver.cc @@ -21,12 +21,15 @@ namespace AMDiS { PetscSolver::PetscSolver() : meshDistributor(NULL), mpiRank(-1), - kspPrefix("") + kspPrefix(""), + removeRhsNullSpace(false) { string kspStr = ""; Parameters::get("parallel->solver->petsc->ksp", kspStr); if (kspStr != "") PetscOptionsInsertString(kspStr.c_str()); + + Parameters::get("parallel->remove rhs null space", removeRhsNullSpace); } diff --git a/AMDiS/src/parallel/PetscSolver.h b/AMDiS/src/parallel/PetscSolver.h index 3c2e3e1d13a882c6988131744f24ecb06c4c1bb3..b3331055a7f92f94e4c876f7f5aca776b3849eef 100644 --- a/AMDiS/src/parallel/PetscSolver.h +++ b/AMDiS/src/parallel/PetscSolver.h @@ -98,6 +98,11 @@ namespace AMDiS { kspPrefix = s; } + void setRemoveRhsNullSpace(bool b) + { + removeRhsNullSpace = b; + } + protected: void printSolutionInfo(AdaptInfo* adaptInfo, bool iterationCounter = true, @@ -149,6 +154,10 @@ namespace AMDiS { /// KSP database prefix string kspPrefix; + + /// If true, the constant null space is projected out of the RHS vector. It + /// depends on the specific PETSc solver if it considers this value. + bool removeRhsNullSpace; }; diff --git a/AMDiS/src/parallel/PetscSolverGlobalMatrix.cc b/AMDiS/src/parallel/PetscSolverGlobalMatrix.cc index b5300c8d232effa2be9e594eb5592c0397250d06..a621412e6a452635b1e86d9c0313ac510e546421 100644 --- a/AMDiS/src/parallel/PetscSolverGlobalMatrix.cc +++ b/AMDiS/src/parallel/PetscSolverGlobalMatrix.cc @@ -153,6 +153,7 @@ namespace AMDiS { VecAssemblyEnd(petscRhsVec); if (removeRhsNullSpace) { + MSG("Remove constant null space from the RHS!\n"); MatNullSpace sp; MatNullSpaceCreate(PETSC_COMM_WORLD, PETSC_TRUE, 0, PETSC_NULL, &sp); MatNullSpaceRemove(sp, petscRhsVec, PETSC_NULL); diff --git a/AMDiS/src/parallel/PetscSolverGlobalMatrix.h b/AMDiS/src/parallel/PetscSolverGlobalMatrix.h index 9bafdf5057915d649258ddbd81f9fef30cbba3de..ed2abcf95b3ca316ca9f866a2b555c09c3a5fef2 100644 --- a/AMDiS/src/parallel/PetscSolverGlobalMatrix.h +++ b/AMDiS/src/parallel/PetscSolverGlobalMatrix.h @@ -41,14 +41,11 @@ namespace AMDiS { o_nnz(NULL), lastMeshNnz(0), zeroStartVector(false), - alwaysCreateNnzStructure(false), - removeRhsNullSpace(false) + alwaysCreateNnzStructure(false) { Parameters::get("parallel->use zero start vector", zeroStartVector); Parameters::get("parallel->always create nnz structure", alwaysCreateNnzStructure); - Parameters::get("parallel->remove rhs null space", - removeRhsNullSpace); } void fillPetscMatrix(Matrix<DOFMatrix*> *mat); @@ -97,9 +94,6 @@ namespace AMDiS { /// Mapping from global DOF indices to global matrix indices under /// consideration of possibly multiple components. DofToMatIndex dofToMatIndex; - - /// If true, the constant null space is projected out of the RHS vector. - bool removeRhsNullSpace; };