Commit 9932726c authored by Bernd Flemisch's avatar Bernd Flemisch
Browse files

merged bugfixes

git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/releases/2.0.1@5326 2fb0f335-1f38-0410-981e-8018bf24f1b0
parent 11aecb1b
...@@ -208,7 +208,8 @@ public: ...@@ -208,7 +208,8 @@ public:
dest += this->localResidual().residual(i); dest += this->localResidual().residual(i);
}; };
this->gridView_().comm().sum(dest); if (this->gridView_().comm().size() > 1)
dest = this->gridView_().comm().sum(dest);
} }
/*! /*!
...@@ -580,7 +581,8 @@ public: ...@@ -580,7 +581,8 @@ public:
// make sure that if there was a variable switch in an // make sure that if there was a variable switch in an
// other partition we will also set the switch flag // other partition we will also set the switch flag
// for our partition. // for our partition.
wasSwitched = this->gridView_().comm().max(wasSwitched); if (this->gridView_().comm().size() > 1)
wasSwitched = this->gridView_().comm().max(wasSwitched);
setSwitched_(wasSwitched); setSwitched_(wasSwitched);
} }
......
...@@ -203,7 +203,10 @@ public: ...@@ -203,7 +203,10 @@ public:
int numElems = gridView_().size(0); int numElems = gridView_().size(0);
residual_.resize(numVerts); residual_.resize(numVerts);
totalElems_ = gridView_().comm().sum(numElems); if (gridView_().comm().size() > 1)
totalElems_ = gridView_().comm().sum(numElems);
else
totalElems_ = numElems;
// initialize data needed for partial reassembly // initialize data needed for partial reassembly
if (enablePartialReassemble) { if (enablePartialReassemble) {
...@@ -237,7 +240,8 @@ public: ...@@ -237,7 +240,8 @@ public:
}; };
if (enablePartialReassemble) { if (enablePartialReassemble) {
greenElems_ = gridView_().comm().sum(greenElems_); if (gridView_().comm().size() > 1)
greenElems_ = gridView_().comm().sum(greenElems_);
reassembleTolerance_ = nextReassembleTolerance_; reassembleTolerance_ = nextReassembleTolerance_;
// print some information at the end of the iteration // print some information at the end of the iteration
......
...@@ -204,7 +204,8 @@ public: ...@@ -204,7 +204,8 @@ public:
dest += localResidual().residual(i); dest += localResidual().residual(i);
}; };
gridView_().comm().sum(dest); if (gridView_().comm().size() > 1)
dest = gridView_().comm().sum(dest);
} }
/*! /*!
......
...@@ -101,8 +101,11 @@ public: ...@@ -101,8 +101,11 @@ public:
} }
} }
for (int i=0; i<dim; i++) { for (int i=0; i<dim; i++) {
bboxMin_[i] = gridView.comm().min(bboxMin_[i]); if (gridView.comm().size() > 1)
bboxMax_[i] = gridView.comm().max(bboxMax_[i]); {
bboxMin_[i] = gridView.comm().min(bboxMin_[i]);
bboxMax_[i] = gridView.comm().max(bboxMax_[i]);
}
} }
} }
......
...@@ -433,7 +433,8 @@ public: ...@@ -433,7 +433,8 @@ public:
} }
} }
error_ = gridView_().comm().max(error_); if (gridView_().comm().size() > 1)
error_ = gridView_().comm().max(error_);
} }
/*! /*!
...@@ -463,7 +464,8 @@ public: ...@@ -463,7 +464,8 @@ public:
// make sure all processes converged // make sure all processes converged
int converged = 1; int converged = 1;
gridView_().comm().min(converged); if (gridView_().comm().size() > 1)
gridView_().comm().min(converged);
if (!converged) { if (!converged) {
DUNE_THROW(NumericalProblem, DUNE_THROW(NumericalProblem,
...@@ -473,7 +475,8 @@ public: ...@@ -473,7 +475,8 @@ public:
catch (Dune::MatrixBlockError e) { catch (Dune::MatrixBlockError e) {
// make sure all processes converged // make sure all processes converged
int converged = 0; int converged = 0;
gridView_().comm().min(converged); if (gridView_().comm().size() > 1)
gridView_().comm().min(converged);
Dumux::NumericalProblem p; Dumux::NumericalProblem p;
std::string msg; std::string msg;
...@@ -485,7 +488,8 @@ public: ...@@ -485,7 +488,8 @@ public:
catch (const Dune::ISTLError &e) { catch (const Dune::ISTLError &e) {
// make sure all processes converged // make sure all processes converged
int converged = 0; int converged = 0;
gridView_().comm().min(converged); if (gridView_().comm().size() > 1)
gridView_().comm().min(converged);
Dumux::NumericalProblem p; Dumux::NumericalProblem p;
p.message(e.what()); p.message(e.what());
...@@ -774,7 +778,8 @@ protected: ...@@ -774,7 +778,8 @@ protected:
// somewhere. this should never happen but for some strange // somewhere. this should never happen but for some strange
// reason it happens anyway. // reason it happens anyway.
Scalar xNorm2 = x.two_norm2(); Scalar xNorm2 = x.two_norm2();
gridView_().comm().sum(xNorm2); if (gridView_().comm().size() > 1)
gridView_().comm().sum(xNorm2);
if (std::isnan(xNorm2) || !std::isfinite(xNorm2)) if (std::isnan(xNorm2) || !std::isfinite(xNorm2))
DUNE_THROW(Dumux::NumericalProblem, DUNE_THROW(Dumux::NumericalProblem,
"The linear solver produced a NaN or inf somewhere."); "The linear solver produced a NaN or inf somewhere.");
......
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