Commit 1c145a63 authored by Thomas Witkowski's avatar Thomas Witkowski
Browse files

Fixed problem for nnz structure with PETSc global matrix solver.

parent 6c719d35
...@@ -421,7 +421,7 @@ namespace AMDiS { ...@@ -421,7 +421,7 @@ namespace AMDiS {
WorldVector<double> tmp = (it->second)[i]; WorldVector<double> tmp = (it->second)[i];
tmp -= recvCoords[it->first][i]; tmp -= recvCoords[it->first][i];
if (norm(tmp) > 1e-13) { if (norm(tmp) > 1e-8) {
// === Print error message if the coordinates are not the same. === // === Print error message if the coordinates are not the same. ===
if (printCoords) { if (printCoords) {
MSG("[DBG] i = %d\n", i); MSG("[DBG] i = %d\n", i);
......
...@@ -48,7 +48,9 @@ namespace AMDiS { ...@@ -48,7 +48,9 @@ namespace AMDiS {
meshDistributor->getMpiComm().Allreduce(&sendValue, &recvAllValues, meshDistributor->getMpiComm().Allreduce(&sendValue, &recvAllValues,
1, MPI_INT, MPI_SUM); 1, MPI_INT, MPI_SUM);
if (!d_nnz || recvAllValues != 0) { recvAllValues = 1;
if (!d_nnz || recvAllValues != 0 || alwaysCreateNnzStructure) {
if (d_nnz) { if (d_nnz) {
delete [] d_nnz; delete [] d_nnz;
d_nnz = NULL; d_nnz = NULL;
......
...@@ -39,9 +39,12 @@ namespace AMDiS { ...@@ -39,9 +39,12 @@ namespace AMDiS {
d_nnz(NULL), d_nnz(NULL),
o_nnz(NULL), o_nnz(NULL),
lastMeshNnz(0), lastMeshNnz(0),
zeroStartVector(false) zeroStartVector(false),
alwaysCreateNnzStructure(false)
{ {
Parameters::get("parallel->use zero start vector", zeroStartVector); Parameters::get("parallel->use zero start vector", zeroStartVector);
Parameters::get("parallel->always create nnz structure",
alwaysCreateNnzStructure);
} }
void fillPetscMatrix(Matrix<DOFMatrix*> *mat); void fillPetscMatrix(Matrix<DOFMatrix*> *mat);
...@@ -77,6 +80,14 @@ namespace AMDiS { ...@@ -77,6 +80,14 @@ namespace AMDiS {
int lastMeshNnz; int lastMeshNnz;
bool zeroStartVector; bool zeroStartVector;
/// If this variable is set to true, the non-zero matrix structure is
/// created each time from scratch by calling \ref createPetscNnzStrcuture.
/// This can be necessary if the number of non-zeros in the matrix varies
/// though the mesh does not change. This may happen if there are many
/// operators using DOFVectors from old timestep containing many zeros due to
/// some phase fields.
bool alwaysCreateNnzStructure;
}; };
......
Supports Markdown
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