mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-12-26 01:01:00 -06:00
Merge pull request #3845 from bska/detect-invalid-cpdata
Don't Process Corner-Point Data If No Valid Cell Geometry
This commit is contained in:
commit
6b74ba512a
@ -472,6 +472,8 @@ private:
|
||||
summaryConfig_, nullptr, python, std::move(parseContext),
|
||||
init_from_restart_file, outputCout_, outputInterval);
|
||||
|
||||
verifyValidCellGeometry(EclGenericVanguard::comm(), *this->eclipseState_);
|
||||
|
||||
setupTime_ = externalSetupTimer.elapsed();
|
||||
outputFiles_ = (outputMode != FileOutputMode::OUTPUT_NONE);
|
||||
}
|
||||
|
@ -54,6 +54,8 @@
|
||||
#include <opm/input/eclipse/Parser/ErrorGuard.hpp>
|
||||
#include <opm/input/eclipse/Parser/Parser.hpp>
|
||||
|
||||
#include <opm/input/eclipse/Units/UnitSystem.hpp>
|
||||
|
||||
#include <opm/simulators/flow/KeywordValidation.hpp>
|
||||
#include <opm/simulators/flow/ValidationFunctions.hpp>
|
||||
#include <opm/simulators/utils/ParallelEclipseState.hpp>
|
||||
@ -332,6 +334,44 @@ namespace {
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
bool gridHasValidCellGeometry(const Opm::EclipseGrid& inputGrid,
|
||||
const Opm::UnitSystem& usys)
|
||||
{
|
||||
const auto numActive = inputGrid.getNumActive();
|
||||
|
||||
for (auto activeCell = 0*numActive; activeCell < numActive; ++activeCell) {
|
||||
if (inputGrid.isValidCellGeomtry(inputGrid.getGlobalIndex(activeCell), usys)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool gridHasValidCellGeometry(Opm::Parallel::Communication comm,
|
||||
const Opm::EclipseState& eclipseState)
|
||||
{
|
||||
bool hasValidCells = false;
|
||||
|
||||
if (comm.rank() == 0) {
|
||||
hasValidCells =
|
||||
gridHasValidCellGeometry(eclipseState.getInputGrid(),
|
||||
eclipseState.getDeckUnitSystem());
|
||||
}
|
||||
|
||||
#if HAVE_MPI
|
||||
const auto status = comm.broadcast(&hasValidCells, 1, 0);
|
||||
|
||||
if (status != MPI_SUCCESS) {
|
||||
throw std::invalid_argument {
|
||||
"Unable to establish cell geomtry validity across MPI ranks"
|
||||
};
|
||||
}
|
||||
#endif // HAVE_MPI
|
||||
|
||||
return hasValidCells;
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@ -518,3 +558,16 @@ void Opm::readDeck(Opm::Parallel::Communication comm,
|
||||
std::exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
void Opm::verifyValidCellGeometry(Parallel::Communication comm,
|
||||
const EclipseState& eclipseState)
|
||||
{
|
||||
if (gridHasValidCellGeometry(comm, eclipseState)) {
|
||||
return;
|
||||
}
|
||||
|
||||
throw std::invalid_argument {
|
||||
R"(No active cell in input grid has valid/finite cell geometry
|
||||
Please check geometry keywords, especially if grid is imported through GDFILE)"
|
||||
};
|
||||
}
|
||||
|
@ -86,6 +86,9 @@ void readDeck(Parallel::Communication comm,
|
||||
bool initFromRestart,
|
||||
bool checkDeck,
|
||||
const std::optional<int>& outputInterval);
|
||||
|
||||
void verifyValidCellGeometry(Parallel::Communication comm,
|
||||
const EclipseState& eclipseState);
|
||||
} // end namespace Opm
|
||||
|
||||
#endif // OPM_READDECK_HEADER_INCLUDED
|
||||
|
Loading…
Reference in New Issue
Block a user