mirror of
https://github.com/OPM/ResInsight.git
synced 2024-12-29 10:21:54 -06:00
HDF Summary : Add support for LGR summary vectors
This commit is contained in:
parent
4b0f3486ad
commit
6b4d80d116
@ -273,6 +273,29 @@ RifEclipseSummaryAddress RifOpmCommonSummaryTools::createAddressFromSummaryNode(
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case Opm::EclIO::SummaryNode::Category::Node:
|
||||
break;
|
||||
case Opm::EclIO::SummaryNode::Category::Network:
|
||||
return RifEclipseSummaryAddress::networkAddress( summaryNode.keyword );
|
||||
break;
|
||||
case Opm::EclIO::SummaryNode::Category::Well_Lgr:
|
||||
return RifEclipseSummaryAddress::wellLgrAddress( summaryNode.keyword, summaryNode.lgrname, summaryNode.wgname );
|
||||
break;
|
||||
case Opm::EclIO::SummaryNode::Category::Block_Lgr:
|
||||
return RifEclipseSummaryAddress::blockLgrAddress( summaryNode.keyword,
|
||||
summaryNode.lgrname,
|
||||
summaryNode.lgri,
|
||||
summaryNode.lgrj,
|
||||
summaryNode.lgrk );
|
||||
break;
|
||||
case Opm::EclIO::SummaryNode::Category::Connection_Lgr:
|
||||
return RifEclipseSummaryAddress::wellCompletionLgrAddress( summaryNode.keyword,
|
||||
summaryNode.lgrname,
|
||||
summaryNode.wgname,
|
||||
summaryNode.lgri,
|
||||
summaryNode.lgrj,
|
||||
summaryNode.lgrk );
|
||||
break;
|
||||
}
|
||||
|
||||
return RifEclipseSummaryAddress();
|
||||
|
@ -117,7 +117,7 @@ private:
|
||||
|
||||
void updatePathAndRootName(Opm::filesystem::path& dir, Opm::filesystem::path& rootN) const;
|
||||
|
||||
std::string makeKeyString(const std::string& keyword, const std::string& wgname, int num) const;
|
||||
std::string makeKeyString(const std::string& keyword, const std::string& wgname, int num, const std::string& lgr, int lgri, int lgrj, int lgrk) const;
|
||||
|
||||
std::string unpackNumber(const SummaryNode&) const;
|
||||
std::string lookupKey(const SummaryNode&) const;
|
||||
|
@ -39,6 +39,10 @@ struct SummaryNode {
|
||||
Aquifer,
|
||||
Node,
|
||||
Miscellaneous,
|
||||
Network,
|
||||
Well_Lgr,
|
||||
Block_Lgr,
|
||||
Connection_Lgr
|
||||
};
|
||||
|
||||
enum class Type {
|
||||
@ -57,6 +61,11 @@ struct SummaryNode {
|
||||
Type type;
|
||||
std::string wgname;
|
||||
int number;
|
||||
std::string lgrname;
|
||||
int lgri;
|
||||
int lgrj;
|
||||
int lgrk;
|
||||
|
||||
size_t smspecKeywordIndex;
|
||||
|
||||
std::optional<std::string> fip_region;
|
||||
@ -79,6 +88,10 @@ struct SummaryNode {
|
||||
bool isRegionToRegion() const;
|
||||
std::pair<int, int> regionToRegionNumbers() const;
|
||||
|
||||
static std::string create_key_lgr_well(const std::string& keyword, const std::string& wgname, const std::string& lgrname);
|
||||
static std::string create_key_lgr_completion(const std::string& keyword, const std::string& wgname, const std::string& lgrname, int i, int j, int k);
|
||||
static std::string create_key_lgr_block(const std::string& keyword, const std::string& lgrname, int i, int j, int k);
|
||||
|
||||
};
|
||||
|
||||
}} // namespace Opm::EclIO
|
||||
|
@ -63,7 +63,7 @@ namespace Opm {
|
||||
const Location& location( ) const { return this->loc; }
|
||||
|
||||
operator Opm::EclIO::SummaryNode() const {
|
||||
return { keyword_, category_, type_, name_, number_, std::numeric_limits<size_t>::max() };
|
||||
return { keyword_, category_, type_, name_, number_, "", -1, -1, -1, std::numeric_limits<size_t>::max() };
|
||||
}
|
||||
|
||||
template<class Serializer>
|
||||
|
@ -201,13 +201,34 @@ ESmry::ESmry(const std::string &filename, bool loadBaseRunData , bool uselodsmry
|
||||
const std::vector<int> nums = smspecList.back().get<int>("NUMS");
|
||||
const std::vector<std::string> units = smspecList.back().get<std::string>("UNITS");
|
||||
|
||||
std::vector<std::string> lgrs;
|
||||
std::vector<int> numlx;
|
||||
std::vector<int> numly;
|
||||
std::vector<int> numlz;
|
||||
|
||||
if (smspecList.back().hasKey("LGRS")) lgrs = smspecList.back().get<std::string>("LGRS");
|
||||
if (smspecList.back().hasKey("NUMLX")) numlx = smspecList.back().get<int>("NUMLX");
|
||||
if (smspecList.back().hasKey("NUMLY")) numly = smspecList.back().get<int>("NUMLY");
|
||||
if (smspecList.back().hasKey("NUMLZ")) numlz = smspecList.back().get<int>("NUMLZ");
|
||||
|
||||
std::vector<std::string> combindKeyList;
|
||||
combindKeyList.reserve(dimens[0]);
|
||||
|
||||
this->startdat = make_date(smspecList.back().get<int>("STARTDAT"));
|
||||
|
||||
for (unsigned int i=0; i<keywords.size(); i++) {
|
||||
const std::string keyString = makeKeyString(keywords[i], wgnames[i], nums[i]);
|
||||
|
||||
std::string lgrName;
|
||||
int lgri = -1;
|
||||
int lgrj = -1;
|
||||
int lgrk = -1;
|
||||
|
||||
if (i < lgrs.size()) lgrName = lgrs[i];
|
||||
if (i < numlx.size()) lgri = numlx[i];
|
||||
if (i < numly.size()) lgrj = numly[i];
|
||||
if (i < numlz.size()) lgrk = numlz[i];
|
||||
|
||||
const std::string keyString = makeKeyString(keywords[i], wgnames[i], nums[i], lgrName, lgri, lgrj, lgrk);
|
||||
combindKeyList.push_back(keyString);
|
||||
|
||||
if (keyString.length() > 0) {
|
||||
@ -217,6 +238,10 @@ ESmry::ESmry(const std::string &filename, bool loadBaseRunData , bool uselodsmry
|
||||
SummaryNode::Type::Undefined,
|
||||
wgnames[i],
|
||||
nums[i],
|
||||
lgrName,
|
||||
lgri,
|
||||
lgrj,
|
||||
lgrk,
|
||||
i,
|
||||
""
|
||||
});
|
||||
@ -290,14 +315,36 @@ ESmry::ESmry(const std::string &filename, bool loadBaseRunData , bool uselodsmry
|
||||
const std::vector<int> nums = smspecList.back().get<int>("NUMS");
|
||||
const std::vector<std::string> units = smspecList.back().get<std::string>("UNITS");
|
||||
|
||||
std::vector<std::string> lgrs;
|
||||
std::vector<int> numlx;
|
||||
std::vector<int> numly;
|
||||
std::vector<int> numlz;
|
||||
|
||||
if (smspecList.back().hasKey("LGRS")) lgrs = smspecList.back().get<std::string>("LGRS");
|
||||
if (smspecList.back().hasKey("NUMLX")) numlx = smspecList.back().get<int>("NUMLX");
|
||||
if (smspecList.back().hasKey("NUMLY")) numly = smspecList.back().get<int>("NUMLY");
|
||||
if (smspecList.back().hasKey("NUMLZ")) numlz = smspecList.back().get<int>("NUMLZ");
|
||||
|
||||
std::vector<std::string> combindKeyList;
|
||||
combindKeyList.reserve(dimens[0]);
|
||||
|
||||
this->startdat = make_date(smspecList.back().get<int>("STARTDAT"));
|
||||
|
||||
for (size_t i = 0; i < keywords.size(); i++) {
|
||||
const std::string keyString = makeKeyString(keywords[i], wgnames[i], nums[i]);
|
||||
|
||||
std::string lgrName;
|
||||
int lgri = -1;
|
||||
int lgrj = -1;
|
||||
int lgrk = -1;
|
||||
|
||||
if (i < lgrs.size()) lgrName = lgrs[i];
|
||||
if (i < numlx.size()) lgri = numlx[i];
|
||||
if (i < numly.size()) lgrj = numly[i];
|
||||
if (i < numlz.size()) lgrk = numlz[i];
|
||||
|
||||
const std::string keyString = makeKeyString(keywords[i], wgnames[i], nums[i], lgrName, lgri, lgrj, lgrk);
|
||||
combindKeyList.push_back(keyString);
|
||||
|
||||
if (keyString.length() > 0) {
|
||||
summaryNodes.push_back({
|
||||
keywords[i],
|
||||
@ -305,6 +352,10 @@ ESmry::ESmry(const std::string &filename, bool loadBaseRunData , bool uselodsmry
|
||||
SummaryNode::Type::Undefined,
|
||||
wgnames[i],
|
||||
nums[i],
|
||||
lgrName,
|
||||
lgri,
|
||||
lgrj,
|
||||
lgrk,
|
||||
i,
|
||||
""
|
||||
});
|
||||
@ -358,8 +409,29 @@ ESmry::ESmry(const std::string &filename, bool loadBaseRunData , bool uselodsmry
|
||||
|
||||
const std::vector<int> nums = smspecList[specInd].get<int>("NUMS");
|
||||
|
||||
std::vector<std::string> lgrs;
|
||||
std::vector<int> numlx;
|
||||
std::vector<int> numly;
|
||||
std::vector<int> numlz;
|
||||
|
||||
if (smspecList[specInd].hasKey("LGRS")) lgrs = smspecList[specInd].get<std::string>("LGRS");
|
||||
if (smspecList[specInd].hasKey("NUMLX")) numlx = smspecList[specInd].get<int>("NUMLX");
|
||||
if (smspecList[specInd].hasKey("NUMLY")) numly = smspecList[specInd].get<int>("NUMLY");
|
||||
if (smspecList[specInd].hasKey("NUMLZ")) numlz = smspecList[specInd].get<int>("NUMLZ");
|
||||
|
||||
|
||||
for (size_t i=0; i < keywords.size(); i++) {
|
||||
const std::string keyw = makeKeyString(keywords[i], wgnames[i], nums[i]);
|
||||
std::string lgrName;
|
||||
int lgri = -1;
|
||||
int lgrj = -1;
|
||||
int lgrk = -1;
|
||||
|
||||
if (i < lgrs.size()) lgrName = lgrs[i];
|
||||
if (i < numlx.size()) lgri = numlx[i];
|
||||
if (i < numly.size()) lgrj = numly[i];
|
||||
if (i < numlz.size()) lgrk = numlz[i];
|
||||
|
||||
const std::string keyw = makeKeyString(keywords[i], wgnames[i], nums[i], lgrName, lgri, lgrj, lgrk);
|
||||
|
||||
if (keywList.find(keyw) != keywList.end())
|
||||
arrayPos[specInd][keyIndex[keyw]]=i;
|
||||
@ -1188,7 +1260,7 @@ void ESmry::ijk_from_global_index(int glob,int &i,int &j,int &k) const
|
||||
}
|
||||
|
||||
|
||||
std::string ESmry::makeKeyString(const std::string& keywordArg, const std::string& wgname, int num) const
|
||||
std::string ESmry::makeKeyString(const std::string& keywordArg, const std::string& wgname, int num, const std::string& lgr, int lgri, int lgrj, int lgrk) const
|
||||
{
|
||||
std::string keyStr;
|
||||
const std::vector<std::string> segmExcep= {"STEPTYPE", "SEPARATE", "SUMTHIN"};
|
||||
@ -1242,6 +1314,27 @@ std::string ESmry::makeKeyString(const std::string& keywordArg, const std::strin
|
||||
keyStr = keywordArg;
|
||||
}
|
||||
|
||||
if (keywordArg.size() > 1) {
|
||||
std::string firstTwoLetters = keywordArg.substr(0, 2);
|
||||
|
||||
if (firstTwoLetters == "LW")
|
||||
{
|
||||
if (wgname != ":+:+:+:+") {
|
||||
keyStr = SummaryNode::create_key_lgr_well(keywordArg, wgname, lgr);
|
||||
}
|
||||
}
|
||||
if (firstTwoLetters == "LC")
|
||||
{
|
||||
if (wgname != ":+:+:+:+") {
|
||||
keyStr = SummaryNode::create_key_lgr_completion(keywordArg, wgname, lgr, lgri, lgrj, lgrk);
|
||||
}
|
||||
}
|
||||
if (firstTwoLetters == "LB")
|
||||
{
|
||||
keyStr = SummaryNode::create_key_lgr_block(keywordArg, lgr, lgri, lgrj, lgrk);
|
||||
}
|
||||
}
|
||||
|
||||
return keyStr;
|
||||
}
|
||||
|
||||
|
@ -90,8 +90,18 @@ distinguish_group_from_node(const std::string& keyword)
|
||||
}
|
||||
|
||||
std::string Opm::EclIO::SummaryNode::unique_key(number_renderer render_number) const {
|
||||
std::vector<std::string> key_parts { keyword } ;
|
||||
|
||||
if (category == Category::Well_Lgr) {
|
||||
return create_key_lgr_well(keyword, wgname, lgrname);
|
||||
}
|
||||
else if (category == Category::Connection_Lgr) {
|
||||
return create_key_lgr_completion(keyword, wgname, lgrname, lgri, lgrj, lgrk);
|
||||
}
|
||||
else if (category == Category::Block_Lgr) {
|
||||
return create_key_lgr_block(keyword, lgrname, lgri, lgrj, lgrk);
|
||||
}
|
||||
|
||||
std::vector<std::string> key_parts { keyword } ;
|
||||
if (auto opt = display_name())
|
||||
key_parts.emplace_back(opt.value());
|
||||
|
||||
@ -164,11 +174,24 @@ Opm::EclIO::SummaryNode::Category Opm::EclIO::SummaryNode::category_from_keyword
|
||||
case 'C': return Category::Connection;
|
||||
case 'F': return Category::Field;
|
||||
case 'G': return distinguish_group_from_node(keyword);
|
||||
case 'N': return Category::Network;
|
||||
case 'R': return Category::Region;
|
||||
case 'S': return Category::Segment;
|
||||
case 'W': return Category::Well;
|
||||
default: return Category::Miscellaneous;
|
||||
default: break;
|
||||
}
|
||||
|
||||
if (keyword.length() > 1)
|
||||
{
|
||||
// Then check LGR categories
|
||||
std::string firstTwoLetters = keyword.substr(0, 2);
|
||||
|
||||
if (firstTwoLetters == "LB") return Category::Block_Lgr;
|
||||
if (firstTwoLetters == "LC") return Category::Connection_Lgr;
|
||||
if (firstTwoLetters == "LW") return Category::Well_Lgr;
|
||||
}
|
||||
|
||||
return Category::Miscellaneous;
|
||||
}
|
||||
|
||||
std::optional<std::string> Opm::EclIO::SummaryNode::display_name() const {
|
||||
@ -183,16 +206,14 @@ std::optional<std::string> Opm::EclIO::SummaryNode::display_number() const {
|
||||
return display_number(default_number_renderer);
|
||||
}
|
||||
|
||||
bool Opm::EclIO::SummaryNode::isRegionToRegion() const
|
||||
{
|
||||
bool Opm::EclIO::SummaryNode::isRegionToRegion() const {
|
||||
if ((category == SummaryNode::Category::Region) &&
|
||||
(keyword.size() > 2 && keyword[2] == 'F')) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
std::pair<int, int> Opm::EclIO::SummaryNode::regionToRegionNumbers() const
|
||||
{
|
||||
std::pair<int, int> Opm::EclIO::SummaryNode::regionToRegionNumbers() const {
|
||||
if (category != SummaryNode::Category::Region) return { -1, -1 };
|
||||
|
||||
if (keyword.size() > 2 && keyword[2] == 'F') {
|
||||
@ -204,6 +225,21 @@ std::pair<int, int> Opm::EclIO::SummaryNode::regionToRegionNumbers() const
|
||||
return { -1, -1 };
|
||||
}
|
||||
|
||||
std::string Opm::EclIO::SummaryNode::create_key_lgr_well(const std::string& keyword,
|
||||
const std::string& wgname, const std::string& lgrname) {
|
||||
return keyword + ":" + wgname + ":" + lgrname;
|
||||
}
|
||||
|
||||
std::string Opm::EclIO::SummaryNode::create_key_lgr_completion(const std::string& keyword, const std::string& wgname,
|
||||
const std::string& lgrname, int i, int j, int k) {
|
||||
return keyword + ":" + wgname + ":" + lgrname + ":" + std::to_string(i) + "," + std::to_string(j) + "," + std::to_string(k);
|
||||
}
|
||||
|
||||
std::string Opm::EclIO::SummaryNode::create_key_lgr_block(const std::string& keyword, const std::string& lgrname,
|
||||
int i, int j, int k) {
|
||||
return keyword + ":" + lgrname + ":" + std::to_string(i) + "," + std::to_string(j) + "," + std::to_string(k);
|
||||
}
|
||||
|
||||
std::optional<std::string> Opm::EclIO::SummaryNode::display_number(number_renderer render_number) const {
|
||||
if (use_number(category)) {
|
||||
return render_number(*this);
|
||||
|
Loading…
Reference in New Issue
Block a user