mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Merge pull request #823 from atgeirr/parallel-nldd-fixes
Avoid collective operations in single-domain calls.
This commit is contained in:
commit
19bde5f5ec
@ -239,33 +239,17 @@ public:
|
|||||||
const GlobalEqVector& currentResidual,
|
const GlobalEqVector& currentResidual,
|
||||||
const DofIndices& dofIndices)
|
const DofIndices& dofIndices)
|
||||||
{
|
{
|
||||||
const auto& comm = this->simulator_.gridView().comm();
|
const auto zero = 0.0 * solutionUpdate[0];
|
||||||
|
for (auto dofIdx : dofIndices) {
|
||||||
int succeeded;
|
if (solutionUpdate[dofIdx] == zero) {
|
||||||
try {
|
continue;
|
||||||
auto zero = solutionUpdate[0];
|
|
||||||
zero = 0.0;
|
|
||||||
for (auto dofIdx : dofIndices) {
|
|
||||||
if (solutionUpdate[dofIdx] == zero) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
updatePrimaryVariables_(dofIdx,
|
|
||||||
nextSolution[dofIdx],
|
|
||||||
currentSolution[dofIdx],
|
|
||||||
solutionUpdate[dofIdx],
|
|
||||||
currentResidual[dofIdx]);
|
|
||||||
}
|
}
|
||||||
succeeded = 1;
|
updatePrimaryVariables_(dofIdx,
|
||||||
|
nextSolution[dofIdx],
|
||||||
|
currentSolution[dofIdx],
|
||||||
|
solutionUpdate[dofIdx],
|
||||||
|
currentResidual[dofIdx]);
|
||||||
}
|
}
|
||||||
catch (...) {
|
|
||||||
succeeded = 0;
|
|
||||||
}
|
|
||||||
succeeded = comm.min(succeeded);
|
|
||||||
|
|
||||||
if (!succeeded)
|
|
||||||
throw NumericalProblem("A process did not succeed in adapting the primary variables");
|
|
||||||
|
|
||||||
numPriVarsSwitched_ = comm.sum(numPriVarsSwitched_);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -191,7 +191,29 @@ public:
|
|||||||
*/
|
*/
|
||||||
void linearizeDomain()
|
void linearizeDomain()
|
||||||
{
|
{
|
||||||
linearizeDomain(fullDomain_);
|
int succeeded;
|
||||||
|
try {
|
||||||
|
linearizeDomain(fullDomain_);
|
||||||
|
succeeded = 1;
|
||||||
|
}
|
||||||
|
catch (const std::exception& e)
|
||||||
|
{
|
||||||
|
std::cout << "rank " << simulator_().gridView().comm().rank()
|
||||||
|
<< " caught an exception while linearizing:" << e.what()
|
||||||
|
<< "\n" << std::flush;
|
||||||
|
succeeded = 0;
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
std::cout << "rank " << simulator_().gridView().comm().rank()
|
||||||
|
<< " caught an exception while linearizing"
|
||||||
|
<< "\n" << std::flush;
|
||||||
|
succeeded = 0;
|
||||||
|
}
|
||||||
|
succeeded = simulator_().gridView().comm().min(succeeded);
|
||||||
|
|
||||||
|
if (!succeeded)
|
||||||
|
throw NumericalProblem("A process did not succeed in linearizing the system");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -222,29 +244,7 @@ public:
|
|||||||
resetSystem_(domain);
|
resetSystem_(domain);
|
||||||
}
|
}
|
||||||
|
|
||||||
int succeeded;
|
linearize_(domain);
|
||||||
try {
|
|
||||||
linearize_(domain);
|
|
||||||
succeeded = 1;
|
|
||||||
}
|
|
||||||
catch (const std::exception& e)
|
|
||||||
{
|
|
||||||
std::cout << "rank " << simulator_().gridView().comm().rank()
|
|
||||||
<< " caught an exception while linearizing:" << e.what()
|
|
||||||
<< "\n" << std::flush;
|
|
||||||
succeeded = 0;
|
|
||||||
}
|
|
||||||
catch (...)
|
|
||||||
{
|
|
||||||
std::cout << "rank " << simulator_().gridView().comm().rank()
|
|
||||||
<< " caught an exception while linearizing"
|
|
||||||
<< "\n" << std::flush;
|
|
||||||
succeeded = 0;
|
|
||||||
}
|
|
||||||
succeeded = simulator_().gridView().comm().min(succeeded);
|
|
||||||
|
|
||||||
if (!succeeded)
|
|
||||||
throw NumericalProblem("A process did not succeed in linearizing the system");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void finalize()
|
void finalize()
|
||||||
|
Loading…
Reference in New Issue
Block a user