Added changes to handle repeated read of COMPDAT for same grid cells
This commit is contained in:
parent
34b9cbcaa4
commit
21eddfbdf2
@ -71,6 +71,8 @@ namespace {
|
||||
for (const auto & conn : conns) {
|
||||
std::size_t sI = conn.getCompSegSeqIndex();
|
||||
cs_seqIndConnMap.insert(std::make_pair(sI, &conn));
|
||||
std::cout << "mapCSSITC: connSI sI: " << sI << " I: " << conn.getI() << " J: " << conn.getJ()
|
||||
<< " K: " << conn.getK() << std::endl;
|
||||
}
|
||||
return cs_seqIndConnMap;
|
||||
}
|
||||
@ -88,7 +90,7 @@ namespace {
|
||||
const auto* well = wells[wellID];
|
||||
|
||||
if (well == nullptr) { continue; }
|
||||
|
||||
std::cout << "Connloop: well: " << well->name() << std::endl;
|
||||
const auto& conns = well->getActiveConnections(sim_step, grid);
|
||||
const int niSI = static_cast<int>(well->getTotNoConn());
|
||||
std::map <std::size_t, const Opm::Connection*> sIToConn;
|
||||
@ -108,6 +110,8 @@ namespace {
|
||||
const auto searchSI = sIToConn.find(static_cast<std::size_t>(iSI));
|
||||
if (searchSI != sIToConn.end()) {
|
||||
connSI.push_back(searchSI->second);
|
||||
std::cout << "Connloop: connSI I: " << searchSI->second->getI() << " J: " << searchSI->second->getJ()
|
||||
<< " K: " << searchSI->second->getK() << std::endl;
|
||||
}
|
||||
}
|
||||
for (auto nConn = connSI.size(), connID = 0*nConn;
|
||||
|
@ -216,18 +216,18 @@ namespace {
|
||||
int newSInd = segIndex;
|
||||
auto origBranchNo = segSet[segIndex].branchNumber();
|
||||
bool endOrigBranch = true;
|
||||
//std::cout << "SegmentOrder-segIndex:" << segIndex << " origBranchno: " << origBranchNo << std::endl;
|
||||
std::cout << "SegmentOrder-segIndex:" << segIndex << " origBranchno: " << origBranchNo << std::endl;
|
||||
// loop down branch to find all segments in branch and number from "toe" to "heel"
|
||||
while (newSInd < segSet.size()) {
|
||||
endOrigBranch = true;
|
||||
const auto iSInd = inflowSegmentsIndex(segSet, newSInd);
|
||||
//std::cout << " SO- inflowSegmentsIndex:" << std::endl;
|
||||
std::cout << " SO- inflowSegmentsIndex:" << std::endl;
|
||||
for (auto isi : iSInd ) {
|
||||
auto inflowBranch = segSet[isi].branchNumber();
|
||||
if (origBranchNo == inflowBranch) {
|
||||
endOrigBranch = false;
|
||||
}
|
||||
//std::cout << " SO- isi:" << isi << std::endl;
|
||||
std::cout << " SO- isi:" << isi << std::endl;
|
||||
}
|
||||
if (iSInd.size() > 0) {
|
||||
for (auto ind : iSInd) {
|
||||
@ -237,16 +237,16 @@ namespace {
|
||||
segIndCB.insert(segIndCB.begin(), ind);
|
||||
// search recursively down this branch to find more inflow branches
|
||||
newSInd = ind;
|
||||
//std::cout << "SO-ind-loop: origB=iflowB - ind:" << ind << std::endl;
|
||||
std::cout << "SO-ind-loop: origB=iflowB - ind:" << ind << std::endl;
|
||||
}
|
||||
else {
|
||||
// if inflow segment belongs to different branch, start new search
|
||||
//std::cout << "SO-ind-loop: origB!=iflowB - ind:" << ind << std::endl;
|
||||
std::cout << "SO-ind-loop: origB!=iflowB - ind:" << ind << std::endl;
|
||||
auto nSOrd = segmentOrder(segSet, ind);
|
||||
// copy the segments already found and indexed into the total ordered segment vector
|
||||
for (std::size_t indOS = 0; indOS < nSOrd.size(); indOS++) {
|
||||
ordSegNumber.push_back(nSOrd[indOS]);
|
||||
//std::cout << "SO-ind-loop: origB!=iflowB - indOS:" << indOS << " nSOrd[indOS] " << nSOrd[indOS] << std::endl;
|
||||
std::cout << "SO-ind-loop: origB!=iflowB - indOS:" << indOS << " nSOrd[indOS] " << nSOrd[indOS] << std::endl;
|
||||
}
|
||||
if (endOrigBranch) {
|
||||
newSInd = segSet.size();
|
||||
@ -257,10 +257,10 @@ namespace {
|
||||
}
|
||||
if (endOrigBranch || (iSInd.size()==0)) {
|
||||
// have come to toe of current branch - store segment indicies of current branch
|
||||
//std::cout << "SO-Toe of current branch - newSInd :" << newSInd << std::endl;
|
||||
std::cout << "SO-Toe of current branch - newSInd :" << newSInd << std::endl;
|
||||
for (std::size_t indOS = 0; indOS < segIndCB.size(); indOS++) {
|
||||
ordSegNumber.push_back(segIndCB[indOS]);
|
||||
//std::cout << "SO end CB - indOS:" << indOS << " segIndCB[indOS] " << segIndCB[indOS] << std::endl;
|
||||
std::cout << "SO end CB - indOS:" << indOS << " segIndCB[indOS] " << segIndCB[indOS] << std::endl;
|
||||
}
|
||||
// set new index to exit while loop
|
||||
newSInd = segSet.size();
|
||||
@ -270,11 +270,11 @@ namespace {
|
||||
|
||||
if (origBranchNo == 1) {
|
||||
// make the vector of ordered segments
|
||||
//std::cout << "SO-OrBr=1 -ordSegNumber.size():" << ordSegNumber.size() << std::endl;
|
||||
std::cout << "SO-OrBr=1 -ordSegNumber.size():" << ordSegNumber.size() << std::endl;
|
||||
tempOrdVect.resize(ordSegNumber.size());
|
||||
for (std::size_t ov_ind = 0; ov_ind < ordSegNumber.size(); ov_ind++) {
|
||||
tempOrdVect[ordSegNumber[ov_ind]] = ov_ind+1;
|
||||
//std::cout << "SO_OrBr=1- ov_ind:" << ov_ind << " ordSegNumber[ov_ind] " << ordSegNumber[ov_ind] << std::endl;
|
||||
std::cout << "SO_OrBr=1- ov_ind:" << ov_ind << " ordSegNumber[ov_ind] " << ordSegNumber[ov_ind] << std::endl;
|
||||
}
|
||||
return tempOrdVect;
|
||||
} else {
|
||||
|
@ -18,6 +18,7 @@
|
||||
*/
|
||||
|
||||
#include <cmath>
|
||||
#include <iostream>
|
||||
|
||||
#include <opm/parser/eclipse/Deck/DeckItem.hpp>
|
||||
#include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
|
||||
@ -120,12 +121,13 @@ namespace Opm {
|
||||
segment_number = 0;
|
||||
// will decide the segment number based on the distance in a process later.
|
||||
}
|
||||
|
||||
std::cout << "COMPSEGS - Read I: " << I << " J: " << J << " K: " << K << std::endl;
|
||||
if (!record.getItem<ParserKeywords::COMPSEGS::END_IJK>().hasValue(0)) { // only one compsegs
|
||||
|
||||
if (grid.cellActive(I, J, K)) {
|
||||
std::size_t seqIndex = compsegs.size();
|
||||
totNC = seqIndex;
|
||||
std::cout << "COMPSEGS - before-emplace_back- seqIndex: " << seqIndex << " totNC " << totNC << std::endl;
|
||||
compsegs.emplace_back( I, J, K,
|
||||
branch,
|
||||
distance_start, distance_end,
|
||||
@ -134,6 +136,8 @@ namespace Opm {
|
||||
segment_number,
|
||||
seqIndex
|
||||
);
|
||||
std::cout << "COMPSEGS - after-emplace_back- compsegs.size(): " << compsegs.size()
|
||||
<< " compsegs[compsegs.size()-1].m_seqIndex: " << compsegs[compsegs.size()-1].m_seqIndex << std::endl;
|
||||
}
|
||||
} else { // a range is defined. genrate a range of Compsegs
|
||||
throw std::runtime_error("entering COMPSEGS entries with a range is not supported yet!");
|
||||
@ -246,7 +250,9 @@ namespace Opm {
|
||||
const int i = compseg.m_i;
|
||||
const int j = compseg.m_j;
|
||||
const int k = compseg.m_k;
|
||||
std::cout << "COMPSEGS - updCWS i: " << i << " j: " << j << " k: " << k << std::endl;
|
||||
if (grid.cellActive(i, j, k)) {
|
||||
std::cout << "COMPSEGS - updCWS-ActiveCell i: " << i << " j: " << j << " k: " << k << std::endl;
|
||||
Connection& connection = connection_set.getFromIJK( i, j, k );
|
||||
connection.updateSegment(compseg.segment_number, compseg.center_depth,compseg.m_seqIndex);
|
||||
|
||||
@ -254,6 +260,8 @@ namespace Opm {
|
||||
connection.setCompSegSeqIndex(compseg.m_seqIndex);
|
||||
connection.setSegDistStart(compseg.m_distance_start);
|
||||
connection.setSegDistEnd(compseg.m_distance_end);
|
||||
std::cout << "COMPSEGS - updCWS- compseg.m_seqIndex: " << compseg.m_seqIndex <<
|
||||
" connection.getSegSeqIndex() " << connection.getCompSegSeqIndex() << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -285,9 +285,11 @@ namespace {
|
||||
auto prev = std::find_if( this->m_connections.begin(),
|
||||
this->m_connections.end(),
|
||||
same_ijk );
|
||||
std::cout << "WellConn - loadCOMPDAT I: " << I << " J: " << J << " k: " << k << std::endl;
|
||||
// Only add connection for active grid cells
|
||||
if (grid.cellActive(I, J, k)) {
|
||||
if (prev == this->m_connections.end()) {
|
||||
std::cout << "WellConn -cellAct-new I: " << I << " J: " << J << " k: " << k << std::endl;
|
||||
std::size_t noConn = this->m_connections.size();
|
||||
totNC = noConn;
|
||||
this->addConnection(I,J,k,
|
||||
@ -301,10 +303,17 @@ namespace {
|
||||
noConn, 0., 0., defaultSatTable);
|
||||
}
|
||||
else {
|
||||
std::cout << "WellConn -cellAct-prev I: " << I << " J: " << J << " k: " << k << std::endl;
|
||||
std::size_t noConn = prev->getSeqIndex();
|
||||
// The complnum value carries over; the rest of the state is fully specified by
|
||||
// the current COMPDAT keyword.
|
||||
int complnum = prev->complnum();
|
||||
std::size_t css_ind = prev->getCompSegSeqIndex();
|
||||
int conSegNo = prev->segment();
|
||||
std::size_t con_SIndex = prev->getSeqIndex();
|
||||
double conCDepth = prev->depth();
|
||||
double conSDStart = prev->getSegDistStart();
|
||||
double conSDEnd = prev->getSegDistEnd();
|
||||
*prev = Connection(I,J,k,
|
||||
complnum,
|
||||
grid.getCellDepth(I,J,k),
|
||||
@ -315,6 +324,14 @@ namespace {
|
||||
satTableId,
|
||||
direction,
|
||||
noConn, 0., 0., defaultSatTable);
|
||||
prev->setCompSegSeqIndex(css_ind);
|
||||
prev->updateSegment(conSegNo, conCDepth, con_SIndex);
|
||||
prev->setSegDistStart(conSDStart);
|
||||
prev->setSegDistEnd(conSDEnd);
|
||||
std::cout << "CSeqIndex: " << prev->getSeqIndex() << "CSSIndex: " << prev->getCompSegSeqIndex() <<
|
||||
"CSegNo: " << prev->segment() << std::endl;
|
||||
std::cout << "CSDepth: " << prev->depth() << "conSDStart: " << prev->getSegDistStart() <<
|
||||
"conSDEnd: " << prev->getSegDistEnd() << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user