Commit 820d3462 authored by Alexander Kissinger's avatar Alexander Kissinger
Browse files

This commit is related to FS#221 concerning freezes during parallel computations.

The error occurs in the compositional multi-phase models 2p2c, 3p3c and co2 during the update of the static data
- The problem has been fixed for the three models
- Additionally another check in the implicitmodel.hh update() function was added to make sure that no process converges if all the other processes have not converged as well.
Reviewed by Bernd.

git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@14431 2fb0f335-1f38-0410-981e-8018bf24f1b0
parent c8b13c30
...@@ -507,7 +507,8 @@ public: ...@@ -507,7 +507,8 @@ public:
const SolutionVector &oldGlobalSol) const SolutionVector &oldGlobalSol)
{ {
bool wasSwitched = false; bool wasSwitched = false;
int succeeded;
try {
for (unsigned i = 0; i < staticDat_.size(); ++i) for (unsigned i = 0; i < staticDat_.size(); ++i)
staticDat_[i].visited = false; staticDat_[i].visited = false;
...@@ -547,6 +548,26 @@ public: ...@@ -547,6 +548,26 @@ public:
} }
} }
} }
succeeded = 1;
}
catch (Dumux::NumericalProblem &e)
{
std::cout << "\n"
<< "Rank " << this->problem_().gridView().comm().rank()
<< " caught an exception while updating the static data." << e.what()
<< "\n";
succeeded = 0;
}
//make sure that all processes succeeded. If not throw a NumericalProblem to decrease the time step size.
if (this->gridView_().comm().size() > 1)
succeeded = this->gridView_().comm().min(succeeded);
if (!succeeded) {
if(this->problem_().gridView().comm().rank() == 0)
DUNE_THROW(NumericalProblem,
"A process did not succeed in updating the static data.");
return;
}
// 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
......
...@@ -495,6 +495,8 @@ public: ...@@ -495,6 +495,8 @@ public:
const SolutionVector &oldGlobalSol) const SolutionVector &oldGlobalSol)
{ {
bool wasSwitched = false; bool wasSwitched = false;
int succeeded;
try {
for (unsigned i = 0; i < staticDat_.size(); ++i) for (unsigned i = 0; i < staticDat_.size(); ++i)
staticDat_[i].visited = false; staticDat_[i].visited = false;
...@@ -535,6 +537,26 @@ public: ...@@ -535,6 +537,26 @@ public:
} }
} }
} }
succeeded = 1;
}
catch (Dumux::NumericalProblem &e)
{
std::cout << "\n"
<< "Rank " << this->problem_().gridView().comm().rank()
<< " caught an exception while updating the static data." << e.what()
<< "\n";
succeeded = 0;
}
//make sure that all processes succeeded. If not throw a NumericalProblem to decrease the time step size.
if (this->gridView_().comm().size() > 1)
succeeded = this->gridView_().comm().min(succeeded);
if (!succeeded) {
if(this->problem_().gridView().comm().rank() == 0)
DUNE_THROW(NumericalProblem,
"A process did not succeed in updating the static data.");
return;
}
// 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
......
...@@ -100,6 +100,8 @@ public: ...@@ -100,6 +100,8 @@ public:
const SolutionVector &oldGlobalSol) const SolutionVector &oldGlobalSol)
{ {
bool wasSwitched = false; bool wasSwitched = false;
int succeeded;
try {
for (unsigned i = 0; i < ParentType::staticDat_.size(); ++i) for (unsigned i = 0; i < ParentType::staticDat_.size(); ++i)
ParentType::staticDat_[i].visited = false; ParentType::staticDat_[i].visited = false;
...@@ -110,6 +112,7 @@ public: ...@@ -110,6 +112,7 @@ public:
const ElementIterator &eEndIt = this->gridView_().template end<0> (); const ElementIterator &eEndIt = this->gridView_().template end<0> ();
for (; eIt != eEndIt; ++eIt) for (; eIt != eEndIt; ++eIt)
{ {
fvGeometry.update(this->gridView_(), *eIt); fvGeometry.update(this->gridView_(), *eIt);
for (int scvIdx = 0; scvIdx < fvGeometry.numScv; ++scvIdx) for (int scvIdx = 0; scvIdx < fvGeometry.numScv; ++scvIdx)
{ {
...@@ -136,6 +139,26 @@ public: ...@@ -136,6 +139,26 @@ public:
} }
} }
} }
succeeded = 1;
}
catch (Dumux::NumericalProblem &e)
{
std::cout << "\n"
<< "Rank " << this->problem_().gridView().comm().rank()
<< " caught an exception while updating the static data." << e.what()
<< "\n";
succeeded = 0;
}
//make sure that all processes succeeded. If not throw a NumericalProblem to decrease the time step size.
if (this->gridView_().comm().size() > 1)
succeeded = this->gridView_().comm().min(succeeded);
if (!succeeded) {
if(this->problem_().gridView().comm().rank() == 0)
DUNE_THROW(NumericalProblem,
"A process did not succeed in updating the static data.");
return;
}
// 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
......
...@@ -459,7 +459,12 @@ public: ...@@ -459,7 +459,12 @@ public:
asImp_().updateBegin(); asImp_().updateBegin();
bool converged = solver.execute(controller); int converged = solver.execute(controller);
if (this->gridView_().comm().size() > 1)
{
converged = this->gridView_().comm().min(converged);
}
if (converged) { if (converged) {
asImp_().updateSuccessful(); asImp_().updateSuccessful();
} }
......
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