Merge pull request #2974 from bska/disallow-wells-parented-to-field
Disallow Wells Parented Directly to FIELD
This commit is contained in:
commit
99f2c4d6ab
@ -1404,23 +1404,36 @@ File {} line {}.)", wname, location.keyword, location.filename, location.lineno)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Schedule::handleWELSPECS(HandlerContext& handlerContext) {
|
void Schedule::handleWELSPECS(HandlerContext& handlerContext)
|
||||||
const auto& keyword = handlerContext.keyword;
|
{
|
||||||
for (std::size_t recordNr = 0; recordNr < keyword.size(); recordNr++) {
|
auto getTrimmedName = [&handlerContext](const auto& item)
|
||||||
const auto& record = keyword.getRecord(recordNr);
|
{
|
||||||
const std::string& wellName = trim_wgname(keyword, record.getItem<ParserKeywords::WELSPECS::WELL>().get<std::string>(0), handlerContext.parseContext, handlerContext.errors);
|
return trim_wgname(handlerContext.keyword,
|
||||||
const std::string& groupName = trim_wgname(keyword, record.getItem<ParserKeywords::WELSPECS::GROUP>().get<std::string>(0), handlerContext.parseContext, handlerContext.errors);
|
item.template get<std::string>(0),
|
||||||
auto density_calc_type = record.getItem<ParserKeywords::WELSPECS::DENSITY_CALC>().get<std::string>(0);
|
handlerContext.parseContext,
|
||||||
auto fip_region_number = record.getItem<ParserKeywords::WELSPECS::FIP_REGION>().get<int>(0);
|
handlerContext.errors);
|
||||||
|
};
|
||||||
|
|
||||||
|
auto fieldWells = std::vector<std::string>{};
|
||||||
|
for (const auto& record : handlerContext.keyword) {
|
||||||
|
const auto wellName = getTrimmedName(record.getItem<ParserKeywords::WELSPECS::WELL>());
|
||||||
|
const auto groupName = getTrimmedName(record.getItem<ParserKeywords::WELSPECS::GROUP>());
|
||||||
|
|
||||||
|
if (groupName == "FIELD") {
|
||||||
|
fieldWells.push_back(wellName);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto fip_region_number = record.getItem<ParserKeywords::WELSPECS::FIP_REGION>().get<int>(0);
|
||||||
if (fip_region_number != 0) {
|
if (fip_region_number != 0) {
|
||||||
const auto& location = keyword.location();
|
const auto& location = handlerContext.keyword.location();
|
||||||
std::string msg = "The FIP_REGION item in the WELSPECS keyword in file: " + location.filename + " line: " + std::to_string(location.lineno) + " using default value: " + std::to_string(ParserKeywords::WELSPECS::FIP_REGION::defaultValue);
|
std::string msg = "The FIP_REGION item in the WELSPECS keyword in file: " + location.filename + " line: " + std::to_string(location.lineno) + " using default value: " + std::to_string(ParserKeywords::WELSPECS::FIP_REGION::defaultValue);
|
||||||
OpmLog::warning(msg);
|
OpmLog::warning(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const auto& density_calc_type = record.getItem<ParserKeywords::WELSPECS::DENSITY_CALC>().get<std::string>(0);
|
||||||
if (density_calc_type != "SEG") {
|
if (density_calc_type != "SEG") {
|
||||||
const auto& location = keyword.location();
|
const auto& location = handlerContext.keyword.location();
|
||||||
std::string msg = "The DENSITY_CALC item in the WELSPECS keyword in file: " + location.filename + " line: " + std::to_string(location.lineno) + " using default value: " + ParserKeywords::WELSPECS::DENSITY_CALC::defaultValue;
|
std::string msg = "The DENSITY_CALC item in the WELSPECS keyword in file: " + location.filename + " line: " + std::to_string(location.lineno) + " using default value: " + ParserKeywords::WELSPECS::DENSITY_CALC::defaultValue;
|
||||||
OpmLog::warning(msg);
|
OpmLog::warning(msg);
|
||||||
}
|
}
|
||||||
@ -1474,6 +1487,16 @@ File {} line {}.)", wname, location.keyword, location.filename, location.lineno)
|
|||||||
|
|
||||||
this->addWellToGroup(groupName, wellName, handlerContext.currentStep);
|
this->addWellToGroup(groupName, wellName, handlerContext.currentStep);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (! fieldWells.empty()) {
|
||||||
|
const auto* plural = (fieldWells.size() == 1) ? "" : "s";
|
||||||
|
|
||||||
|
throw OpmInputError {
|
||||||
|
fmt::format(R"(Well{0} cannot be parented directly to 'FIELD'.
|
||||||
|
Well{0} entered with disallowed 'FIELD' parent group:
|
||||||
|
* {1})", plural, fmt::join(fieldWells, "\n * ")), handlerContext.keyword.location()
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -43,7 +43,7 @@ RPTRST
|
|||||||
--NORST=1 --> output for visualization only
|
--NORST=1 --> output for visualization only
|
||||||
|
|
||||||
WELSPECS
|
WELSPECS
|
||||||
'F-14A' 'FIELD' 12 85 99.00 'OIL' 7* /
|
'F-14A' 'G' 12 85 99.00 'OIL' 7* /
|
||||||
/
|
/
|
||||||
|
|
||||||
DATES
|
DATES
|
||||||
|
Loading…
Reference in New Issue
Block a user