Remove name member from WellSegments class

This commit is contained in:
Joakim Hove 2020-02-11 17:41:18 +01:00
parent b5d3af49e9
commit 8657d59696
3 changed files with 16 additions and 30 deletions

View File

@ -63,14 +63,12 @@ namespace Opm {
WellSegments() = default;
WellSegments(const DeckKeyword& keyword);
WellSegments(const std::string& wname,
LengthDepth lenDepType,
WellSegments(LengthDepth lenDepType,
CompPressureDrop compDrop,
MultiPhaseModel multiPhase,
const std::vector<Segment>& segments,
const std::map<int,int>& segmentNumberIdx);
const std::string& wellName() const;
int size() const;
double depthTopSegment() const;
double lengthTopSegment() const;
@ -109,7 +107,6 @@ namespace Opm {
void addSegment(const Segment& new_segment);
void loadWELSEGS( const DeckKeyword& welsegsKeyword);
std::string m_well_name;
// depth of the nodal point of the top segment
// it is taken as the BHP reference depth of the well
// BHP reference depth data from elsewhere will be ignored for multi-segmented wells

View File

@ -178,7 +178,7 @@ namespace {
Opm::RestartIO::Helpers::SegmentSetSourceSinkTerms
getSegmentSetSSTerms(const Opm::WellSegments& segSet, const std::vector<Opm::data::Connection>& rateConns,
getSegmentSetSSTerms(const std::string& wname, const Opm::WellSegments& segSet, const std::vector<Opm::data::Connection>& rateConns,
const Opm::WellConnections& welConns, const Opm::UnitSystem& units)
{
std::vector<double> qosc (segSet.size(), 0.);
@ -194,7 +194,7 @@ namespace {
throw std::invalid_argument {
"Inconsistent number of open connections I in Opm::WellConnections (" +
std::to_string(welConns.size()) + ") and vector<Opm::data::Connection> (" +
std::to_string(rateConns.size()) + ") in Well " + segSet.wellName()
std::to_string(rateConns.size()) + ") in Well " + wname
};
}
for (auto nConn = openConnections.size(), connID = 0*nConn; connID < nConn; connID++) {
@ -222,7 +222,7 @@ namespace {
}
Opm::RestartIO::Helpers::SegmentSetFlowRates
getSegmentSetFlowRates(const Opm::WellSegments& segSet, const std::vector<Opm::data::Connection>& rateConns,
getSegmentSetFlowRates(const std::string& wname, const Opm::WellSegments& segSet, const std::vector<Opm::data::Connection>& rateConns,
const Opm::WellConnections& welConns, const Opm::UnitSystem& units)
{
std::vector<double> sofr (segSet.size(), 0.);
@ -230,7 +230,7 @@ namespace {
std::vector<double> sgfr (segSet.size(), 0.);
//
//call function to calculate the individual segment source/sink terms
auto sSSST = getSegmentSetSSTerms(segSet, rateConns, welConns, units);
auto sSSST = getSegmentSetSSTerms(wname, segSet, rateConns, welConns, units);
// find an ordered list of segments
std::size_t segmentInd = 0;
@ -355,7 +355,7 @@ namespace {
}
int inflowSegmentCurBranch(const Opm::WellSegments& segSet, std::size_t segIndex) {
int inflowSegmentCurBranch(const std::string& wname, const Opm::WellSegments& segSet, std::size_t segIndex) {
const auto& branch = segSet[segIndex].branchNumber();
const auto& segNumber = segSet[segIndex].segmentNumber();
int inFlowSegInd = -1;
@ -368,12 +368,12 @@ namespace {
inFlowSegInd = segSet.segmentNumberToIndex(i_segNum);
}
else {
std::cout << "Non-unique inflow segment in same branch, Well: " << segSet.wellName() << std::endl;
std::cout << "Non-unique inflow segment in same branch, Well: " << wname << std::endl;
std::cout << "Segment number: " << segNumber << std::endl;
std::cout << "Branch number: " << branch << std::endl;
std::cout << "Inflow segment number 1: " << segSet[inFlowSegInd].segmentNumber() << std::endl;
std::cout << "Inflow segment number 2: " << segSet[ind].segmentNumber() << std::endl;
throw std::invalid_argument("Non-unique inflow segment in same branch, Well " + segSet.wellName());
throw std::invalid_argument("Non-unique inflow segment in same branch, Well " + wname);
}
}
}
@ -464,7 +464,7 @@ namespace {
auto iS = (segNumber-1)*noElmSeg;
iSeg[iS + 0] = welSegSet[orderedSegmentNo[ind]].segmentNumber();
iSeg[iS + 1] = segment.outletSegment();
iSeg[iS + 2] = (inflowSegmentCurBranch(welSegSet, ind) == 0) ? 0 : welSegSet[inflowSegmentCurBranch(welSegSet, ind)].segmentNumber();
iSeg[iS + 2] = (inflowSegmentCurBranch(well.name(), welSegSet, ind) == 0) ? 0 : welSegSet[inflowSegmentCurBranch(well.name(), welSegSet, ind)].segmentNumber();
iSeg[iS + 3] = segment.branchNumber();
iSeg[iS + 4] = noInFlowBranches(welSegSet, ind);
iSeg[iS + 5] = sumNoInFlowBranches(welSegSet, ind);
@ -652,7 +652,7 @@ namespace {
// find well connections and calculate segment rates based on well connection production/injection terms
auto sSFR = Opm::RestartIO::Helpers::SegmentSetFlowRates{};
if (haveWellRes) {
sSFR = getSegmentSetFlowRates(welSegSet, wRatesIt->second.connections, welConns, units);
sSFR = getSegmentSetFlowRates(well.name(), welSegSet, wRatesIt->second.connections, welConns, units);
}
// 'stringSegNum' is one-based (1 .. #segments inclusive)
std::string stringSegNum = std::to_string(segNumber);

View File

@ -36,14 +36,12 @@
namespace Opm {
WellSegments::WellSegments(const std::string& wname,
LengthDepth lenDepType,
WellSegments::WellSegments(LengthDepth lenDepType,
CompPressureDrop compDrop,
MultiPhaseModel multiPhase,
const std::vector<Segment>& segments,
const std::map<int,int>& segmentNumberIdx)
: m_well_name(wname)
, m_length_depth_type(lenDepType)
: m_length_depth_type(lenDepType)
, m_comp_pressure_drop(compDrop)
, m_multiphase_model(multiPhase)
, m_segments(segments)
@ -56,12 +54,8 @@ namespace Opm {
this->loadWELSEGS(keyword);
}
const std::string& WellSegments::wellName() const {
return m_well_name;
}
int WellSegments::size() const {
int WellSegments::size() const {
return m_segments.size();
}
@ -118,8 +112,6 @@ namespace Opm {
// for the first record, which provides the information for the top segment
// and information for the whole segment set
const auto& record1 = welsegsKeyword.getRecord(0);
m_well_name = record1.getItem("WELL").getTrimmedString(0);
const double invalid_value = Segment::invalidValue(); // meaningless value to indicate unspecified values
const double depth_top = record1.getItem("DEPTH").getSIDouble(0);
@ -424,8 +416,7 @@ namespace Opm {
}
bool WellSegments::operator==( const WellSegments& rhs ) const {
return this->m_well_name == rhs.m_well_name
&& this->m_length_depth_type == rhs.m_length_depth_type
return this->m_length_depth_type == rhs.m_length_depth_type
&& this->m_comp_pressure_drop == rhs.m_comp_pressure_drop
&& this->m_multiphase_model == rhs.m_multiphase_model
&& this->m_segments.size() == rhs.m_segments.size()
@ -461,8 +452,7 @@ namespace Opm {
bool WellSegments::updateWSEGSICD(const std::vector<std::pair<int, SpiralICD> >& sicd_pairs) {
if (m_comp_pressure_drop == CompPressureDrop::H__) {
const std::string msg = "to use spiral ICD segment for well " + m_well_name
+ " , you have to activate the frictional pressure drop calculation";
const std::string msg = "to use spiral ICD segment you have to activate the frictional pressure drop calculation";
throw std::runtime_error(msg);
}
@ -480,8 +470,7 @@ namespace Opm {
bool WellSegments::updateWSEGVALV(const std::vector<std::pair<int, Valve> >& valve_pairs) {
if (m_comp_pressure_drop == CompPressureDrop::H__) {
const std::string msg = "to use WSEGVALV segment for well " + m_well_name
+ " , you have to activate the frictional pressure drop calculation";
const std::string msg = "to use WSEGVALV segment you have to activate the frictional pressure drop calculation";
throw std::runtime_error(msg);
}