Commit cfba5616 authored by Thomas Witkowski's avatar Thomas Witkowski

Changed handling of removing rhs null space in parallel computations for...

Changed handling of removing rhs null space in parallel computations for multiple stationary problems.
parent e77df268
...@@ -57,6 +57,11 @@ namespace AMDiS { ...@@ -57,6 +57,11 @@ namespace AMDiS {
bool createMatrixData = true, bool createMatrixData = true,
bool storeMatrixData = false); bool storeMatrixData = false);
PetscSolver* getPetscSolver()
{
return petscSolver;
}
protected: protected:
PetscSolver *petscSolver; PetscSolver *petscSolver;
......
...@@ -21,12 +21,15 @@ namespace AMDiS { ...@@ -21,12 +21,15 @@ namespace AMDiS {
PetscSolver::PetscSolver() PetscSolver::PetscSolver()
: meshDistributor(NULL), : meshDistributor(NULL),
mpiRank(-1), mpiRank(-1),
kspPrefix("") kspPrefix(""),
removeRhsNullSpace(false)
{ {
string kspStr = ""; string kspStr = "";
Parameters::get("parallel->solver->petsc->ksp", kspStr); Parameters::get("parallel->solver->petsc->ksp", kspStr);
if (kspStr != "") if (kspStr != "")
PetscOptionsInsertString(kspStr.c_str()); PetscOptionsInsertString(kspStr.c_str());
Parameters::get("parallel->remove rhs null space", removeRhsNullSpace);
} }
......
...@@ -98,6 +98,11 @@ namespace AMDiS { ...@@ -98,6 +98,11 @@ namespace AMDiS {
kspPrefix = s; kspPrefix = s;
} }
void setRemoveRhsNullSpace(bool b)
{
removeRhsNullSpace = b;
}
protected: protected:
void printSolutionInfo(AdaptInfo* adaptInfo, void printSolutionInfo(AdaptInfo* adaptInfo,
bool iterationCounter = true, bool iterationCounter = true,
...@@ -149,6 +154,10 @@ namespace AMDiS { ...@@ -149,6 +154,10 @@ namespace AMDiS {
/// KSP database prefix /// KSP database prefix
string kspPrefix; 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;
}; };
......
...@@ -153,6 +153,7 @@ namespace AMDiS { ...@@ -153,6 +153,7 @@ namespace AMDiS {
VecAssemblyEnd(petscRhsVec); VecAssemblyEnd(petscRhsVec);
if (removeRhsNullSpace) { if (removeRhsNullSpace) {
MSG("Remove constant null space from the RHS!\n");
MatNullSpace sp; MatNullSpace sp;
MatNullSpaceCreate(PETSC_COMM_WORLD, PETSC_TRUE, 0, PETSC_NULL, &sp); MatNullSpaceCreate(PETSC_COMM_WORLD, PETSC_TRUE, 0, PETSC_NULL, &sp);
MatNullSpaceRemove(sp, petscRhsVec, PETSC_NULL); MatNullSpaceRemove(sp, petscRhsVec, PETSC_NULL);
......
...@@ -41,14 +41,11 @@ namespace AMDiS { ...@@ -41,14 +41,11 @@ namespace AMDiS {
o_nnz(NULL), o_nnz(NULL),
lastMeshNnz(0), lastMeshNnz(0),
zeroStartVector(false), zeroStartVector(false),
alwaysCreateNnzStructure(false), alwaysCreateNnzStructure(false)
removeRhsNullSpace(false)
{ {
Parameters::get("parallel->use zero start vector", zeroStartVector); Parameters::get("parallel->use zero start vector", zeroStartVector);
Parameters::get("parallel->always create nnz structure", Parameters::get("parallel->always create nnz structure",
alwaysCreateNnzStructure); alwaysCreateNnzStructure);
Parameters::get("parallel->remove rhs null space",
removeRhsNullSpace);
} }
void fillPetscMatrix(Matrix<DOFMatrix*> *mat); void fillPetscMatrix(Matrix<DOFMatrix*> *mat);
...@@ -97,9 +94,6 @@ namespace AMDiS { ...@@ -97,9 +94,6 @@ namespace AMDiS {
/// Mapping from global DOF indices to global matrix indices under /// Mapping from global DOF indices to global matrix indices under
/// consideration of possibly multiple components. /// consideration of possibly multiple components.
DofToMatIndex dofToMatIndex; DofToMatIndex dofToMatIndex;
/// If true, the constant null space is projected out of the RHS vector.
bool removeRhsNullSpace;
}; };
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment