PVT Interpolants: Give More Meaningful Diagnostic if Missing

This commit refines the error message emitted if a particular
phase does not have a PVT interpolant--e.g., if the INIT file
does not provide PVT data.  Previously we would generate a
message akin to

    Region Index 0 Outside Valid Range (0 .. (size_t)-1)

which is not very helpful to users in diagnosing the issue.  The
new message does at least indicate that there is no interpolant
for the accompanying phase and also emits the (1-based) region
index for context.
This commit is contained in:
Bård Skaflestad
2019-04-16 13:09:04 +02:00
parent 4439f7609b
commit 4ad130ae47
3 changed files with 21 additions and 0 deletions

View File

@@ -496,6 +496,13 @@ void
Opm::ECLPVT::Gas::Impl::validateRegIdx(const RegIdx region) const
{
if (region >= this->eval_.size()) {
if (this->eval_.empty()) {
throw std::invalid_argument{
"No Gas PVT Interpolant Available in Region "
+ std::to_string(region + 1)
};
}
throw std::invalid_argument {
"Region Index " +
std::to_string(region) +

View File

@@ -691,6 +691,13 @@ void
Opm::ECLPVT::Oil::Impl::validateRegIdx(const RegIdx region) const
{
if (region >= this->eval_.size()) {
if (this->eval_.empty()) {
throw std::invalid_argument {
"No Oil PVT Interpolant Available in Region "
+ std::to_string(region + 1)
};
}
throw std::invalid_argument {
"Region Index " +
std::to_string(region) +

View File

@@ -252,6 +252,13 @@ void
Opm::ECLPVT::Water::Impl::validateRegIdx(const RegIdx region) const
{
if (region >= this->eval_.size()) {
if (this->eval_.empty()) {
throw std::invalid_argument {
"No Water PVT Interpolant Available in Region "
+ std::to_string(region + 1)
};
}
throw std::invalid_argument {
"Region Index " +
std::to_string(region) +