Use common ICDStatus class for both Valve and SpiralICD
This commit is contained in:
parent
e2b58cecda
commit
9bed25f035
@ -22,6 +22,9 @@
|
||||
#include <vector>
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/Segment.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/SpiralICD.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/icd.hpp>
|
||||
|
||||
namespace Opm {
|
||||
namespace RestartIO {
|
||||
|
||||
@ -33,7 +36,7 @@ struct RstSegment {
|
||||
int branch;
|
||||
Segment::SegmentType segment_type;
|
||||
int icd_scaling_mode;
|
||||
int icd_open_flag;
|
||||
ICDStatus icd_status;
|
||||
|
||||
double dist_outlet;
|
||||
double outlet_dz;
|
||||
|
@ -37,19 +37,6 @@ namespace Opm { namespace RestartIO { namespace Helpers { namespace VectorItems
|
||||
ICDOpenShutFlag = 19,
|
||||
};
|
||||
|
||||
namespace Value {
|
||||
enum SegmentType : int {
|
||||
REGULAR = -1,
|
||||
AICD = -8,
|
||||
SICD = -7,
|
||||
Valve = -5,
|
||||
};
|
||||
|
||||
enum SICDStatus : int {
|
||||
Open = 0, // Yes, Open = 0 is correct
|
||||
Shut = 1,
|
||||
};
|
||||
} // Value
|
||||
} // ISeg
|
||||
|
||||
namespace RSeg {
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/icd.hpp>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
@ -34,11 +35,6 @@ namespace Opm {
|
||||
class SpiralICD {
|
||||
public:
|
||||
|
||||
enum class Status {
|
||||
OPEN,
|
||||
SHUT
|
||||
};
|
||||
|
||||
SpiralICD();
|
||||
explicit SpiralICD(const DeckRecord& record);
|
||||
SpiralICD(double strength,
|
||||
@ -50,7 +46,7 @@ namespace Opm {
|
||||
double maxViscosityRatio,
|
||||
int methodFlowScaling,
|
||||
double maxAbsoluteRate,
|
||||
Status status,
|
||||
ICDStatus status,
|
||||
double scalingFactor);
|
||||
|
||||
// the function will return a map
|
||||
@ -61,7 +57,7 @@ namespace Opm {
|
||||
fromWSEGSICD(const DeckKeyword& wsegsicd);
|
||||
|
||||
double maxAbsoluteRate() const;
|
||||
Status status() const;
|
||||
ICDStatus status() const;
|
||||
double strength() const;
|
||||
double length() const;
|
||||
double densityCalibration() const;
|
||||
@ -73,7 +69,7 @@ namespace Opm {
|
||||
|
||||
void updateScalingFactor(const double segment_length, const double completion_length);
|
||||
double scalingFactor() const;
|
||||
|
||||
int ecl_status() const;
|
||||
bool operator==(const SpiralICD& data) const;
|
||||
|
||||
private:
|
||||
@ -86,7 +82,7 @@ namespace Opm {
|
||||
double m_max_viscosity_ratio;
|
||||
int m_method_flow_scaling;
|
||||
double m_max_absolute_rate;
|
||||
Status m_status;
|
||||
ICDStatus m_status;
|
||||
// scaling factor is the only one can not be gotten from deck directly, needs to be
|
||||
// updated afterwards
|
||||
double m_scaling_factor;
|
||||
|
@ -24,6 +24,8 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/icd.hpp>
|
||||
|
||||
|
||||
namespace Opm {
|
||||
|
||||
@ -33,10 +35,6 @@ namespace Opm {
|
||||
|
||||
class Valve {
|
||||
public:
|
||||
enum class Status {
|
||||
OPEN,
|
||||
SHUT
|
||||
};
|
||||
|
||||
Valve();
|
||||
explicit Valve(const DeckRecord& record);
|
||||
@ -47,7 +45,7 @@ namespace Opm {
|
||||
double pipeDiam,
|
||||
double pipeRough,
|
||||
double pipeCrossA,
|
||||
Status stat);
|
||||
ICDStatus stat);
|
||||
|
||||
// the function will return a map
|
||||
// [
|
||||
@ -67,7 +65,7 @@ namespace Opm {
|
||||
double pipeCrossArea() const;
|
||||
|
||||
// Status: OPEN or SHUT
|
||||
Status status() const;
|
||||
ICDStatus status() const;
|
||||
|
||||
void setConMaxCrossArea(const double area);
|
||||
|
||||
@ -87,7 +85,7 @@ namespace Opm {
|
||||
double m_pipe_diameter;
|
||||
double m_pipe_roughness;
|
||||
double m_pipe_cross_area;
|
||||
Status m_status;
|
||||
ICDStatus m_status;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
#include <opm/io/eclipse/rst/segment.hpp>
|
||||
#include <opm/output/eclipse/VectorItems/msw.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/icd.hpp>
|
||||
|
||||
namespace VI = ::Opm::RestartIO::Helpers::VectorItems;
|
||||
|
||||
@ -46,7 +47,7 @@ RstSegment::RstSegment(const int * iseg, const double * rseg) :
|
||||
branch(iseg[VI::ISeg::BranchNo]),
|
||||
segment_type(from_ecl<Segment::SegmentType>(iseg[VI::ISeg::SegmentType])),
|
||||
icd_scaling_mode(iseg[VI::ISeg::ICDScalingMode]),
|
||||
icd_open_flag(iseg[VI::ISeg::ICDOpenShutFlag]),
|
||||
icd_status(from_int<ICDStatus>(iseg[VI::ISeg::ICDOpenShutFlag])),
|
||||
dist_outlet(rseg[VI::RSeg::DistOutlet]),
|
||||
outlet_dz(rseg[VI::RSeg::OutletDepthDiff]),
|
||||
diameter(rseg[VI::RSeg::SegDiam]),
|
||||
|
@ -418,34 +418,12 @@ namespace {
|
||||
const std::size_t baseIndex,
|
||||
ISegArray& iSeg)
|
||||
{
|
||||
namespace ISegValue = ::Opm::RestartIO::Helpers::
|
||||
VectorItems::ISeg::Value;
|
||||
|
||||
using Ix = ::Opm::RestartIO::Helpers::
|
||||
VectorItems::ISeg::index;
|
||||
|
||||
const auto& sicd = segment.spiralICD();
|
||||
|
||||
iSeg[baseIndex + Ix::SegmentType] = ISegValue::SegmentType::SICD;
|
||||
iSeg[baseIndex + Ix::ICDScalingMode] = sicd->methodFlowScaling();
|
||||
|
||||
iSeg[baseIndex + Ix::ICDOpenShutFlag] =
|
||||
(sicd->status() == Opm::SpiralICD::Status::OPEN)
|
||||
? ISegValue::SICDStatus::Open
|
||||
: ISegValue::SICDStatus::Shut;
|
||||
}
|
||||
|
||||
template <class ISegArray>
|
||||
void assignValveCharacteristics(const std::size_t baseIndex,
|
||||
ISegArray& iSeg)
|
||||
{
|
||||
namespace ISegValue = ::Opm::RestartIO::Helpers::
|
||||
VectorItems::ISeg::Value;
|
||||
|
||||
using Ix = ::Opm::RestartIO::Helpers::
|
||||
VectorItems::ISeg::index;
|
||||
|
||||
iSeg[baseIndex + Ix::SegmentType] = ISegValue::SegmentType::Valve;
|
||||
iSeg[baseIndex + Ix::ICDOpenShutFlag] = sicd->ecl_status();
|
||||
}
|
||||
|
||||
template <class ISegArray>
|
||||
@ -456,10 +434,6 @@ namespace {
|
||||
if (isSpiralICD(segment)) {
|
||||
assignSpiralICDCharacteristics(segment, baseIndex, iSeg);
|
||||
}
|
||||
|
||||
if (isValve(segment)) {
|
||||
assignValveCharacteristics(baseIndex, iSeg);
|
||||
}
|
||||
}
|
||||
|
||||
template <class ISegArray>
|
||||
@ -467,12 +441,9 @@ namespace {
|
||||
const std::vector<int>& inteHead,
|
||||
ISegArray& iSeg)
|
||||
{
|
||||
using IsTyp = ::Opm::RestartIO::Helpers::
|
||||
VectorItems::ISeg::Value::SegmentType;
|
||||
|
||||
using Ix = ::Opm::RestartIO::Helpers::
|
||||
VectorItems::ISeg::index;
|
||||
|
||||
|
||||
if (well.isMultiSegment()) {
|
||||
//loop over segment set and print out information
|
||||
const auto& welSegSet = well.getSegments();
|
||||
@ -501,12 +472,10 @@ namespace {
|
||||
iSeg[iS + 7] = sumConnectionsSegment(completionSet, welSegSet, ind);
|
||||
iSeg[iS + 8] = seg_reorder[ind];
|
||||
|
||||
iSeg[iS + Ix::SegmentType] = segment.ecl_type_id();
|
||||
if (! isRegular(segment)) {
|
||||
assignSegmentTypeCharacteristics(segment, iS, iSeg);
|
||||
}
|
||||
if (segment.segmentType() == Opm::Segment::SegmentType::REGULAR) {
|
||||
iSeg[iS + Ix::SegmentType] = IsTyp::REGULAR;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -18,6 +18,7 @@
|
||||
along with OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/icd.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/SpiralICD.hpp>
|
||||
#include <opm/parser/eclipse/Deck/DeckRecord.hpp>
|
||||
#include <opm/parser/eclipse/Deck/DeckKeyword.hpp>
|
||||
@ -29,7 +30,7 @@
|
||||
namespace Opm {
|
||||
|
||||
SpiralICD::SpiralICD()
|
||||
: SpiralICD(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 0.0, Status::SHUT, 1.0)
|
||||
: SpiralICD(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 0.0, ICDStatus::SHUT, 1.0)
|
||||
{
|
||||
}
|
||||
|
||||
@ -42,7 +43,7 @@ namespace Opm {
|
||||
double maxViscosityRatio,
|
||||
int flowScaling,
|
||||
double maxAbsoluteRate,
|
||||
Status status,
|
||||
ICDStatus status,
|
||||
double scalingFactor)
|
||||
: m_strength(strength),
|
||||
m_length(length),
|
||||
@ -73,9 +74,9 @@ namespace Opm {
|
||||
: std::numeric_limits<double>::max()), m_scaling_factor(std::numeric_limits<double>::lowest())
|
||||
{
|
||||
if (record.getItem("STATUS").getTrimmedString(0) == "OPEN") {
|
||||
m_status = Status::OPEN;
|
||||
m_status = ICDStatus::OPEN;
|
||||
} else {
|
||||
m_status = Status::SHUT;
|
||||
m_status = ICDStatus::SHUT;
|
||||
}
|
||||
}
|
||||
|
||||
@ -111,7 +112,7 @@ namespace Opm {
|
||||
return m_max_absolute_rate;
|
||||
}
|
||||
|
||||
SpiralICD::Status SpiralICD::status() const {
|
||||
ICDStatus SpiralICD::status() const {
|
||||
return m_status;
|
||||
}
|
||||
|
||||
@ -200,4 +201,10 @@ namespace Opm {
|
||||
this->status() == data.status() &&
|
||||
this->scalingFactor() == data.scalingFactor();
|
||||
}
|
||||
|
||||
int SpiralICD::ecl_status() const {
|
||||
return to_int(this->m_status);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -27,7 +27,7 @@
|
||||
namespace Opm {
|
||||
|
||||
Valve::Valve()
|
||||
: Valve(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Status::SHUT)
|
||||
: Valve(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, ICDStatus::SHUT)
|
||||
{
|
||||
}
|
||||
|
||||
@ -38,7 +38,7 @@ namespace Opm {
|
||||
double pipeDiam,
|
||||
double pipeRough,
|
||||
double pipeCrossA,
|
||||
Status stat)
|
||||
ICDStatus stat)
|
||||
: m_con_flow_coeff(conFlowCoeff)
|
||||
, m_con_cross_area(conCrossA)
|
||||
, m_con_max_cross_area(conMaxCrossA)
|
||||
@ -83,9 +83,9 @@ namespace Opm {
|
||||
}
|
||||
|
||||
if (record.getItem("STATUS").getTrimmedString(0) == "OPEN") {
|
||||
m_status = Status::OPEN;
|
||||
m_status = ICDStatus::OPEN;
|
||||
} else {
|
||||
m_status = Status::SHUT;
|
||||
m_status = ICDStatus::SHUT;
|
||||
// TODO: should we check illegal input here
|
||||
}
|
||||
|
||||
@ -113,7 +113,7 @@ namespace Opm {
|
||||
return res;
|
||||
}
|
||||
|
||||
Valve::Status Valve::status() const {
|
||||
ICDStatus Valve::status() const {
|
||||
return m_status;
|
||||
}
|
||||
|
||||
|
@ -135,7 +135,7 @@ BOOST_AUTO_TEST_CASE(MultisegmentWellTest) {
|
||||
|
||||
const std::shared_ptr<Opm::SpiralICD> sicd_ptr = segment.spiralICD();
|
||||
BOOST_CHECK_GT(sicd_ptr->maxAbsoluteRate(), 1.e99);
|
||||
BOOST_CHECK(sicd_ptr->status()==Opm::SpiralICD::Status::SHUT);
|
||||
BOOST_CHECK(sicd_ptr->status()==Opm::ICDStatus::SHUT);
|
||||
// 0.002 bars*day*day/Volume^2
|
||||
BOOST_CHECK_EQUAL(sicd_ptr->strength(), 0.002*1.e5*86400.*86400.);
|
||||
BOOST_CHECK_EQUAL(sicd_ptr->length(), -0.7);
|
||||
@ -413,7 +413,7 @@ BOOST_AUTO_TEST_CASE(testwsegvalv) {
|
||||
BOOST_CHECK_EQUAL(valv1->pipeDiameter(), 0.2);
|
||||
BOOST_CHECK_EQUAL(valv1->pipeRoughness(), 0.00015);
|
||||
BOOST_CHECK_EQUAL(valv1->pipeCrossArea(), 0.031415926535897934);
|
||||
BOOST_CHECK(valv1->status()==Opm::Valve::Status::OPEN);
|
||||
BOOST_CHECK(valv1->status()==Opm::ICDStatus::OPEN);
|
||||
|
||||
const int segment_number2 = segvalv_vector[1].first;
|
||||
BOOST_CHECK_EQUAL(9, segment_number2);
|
||||
@ -436,7 +436,7 @@ BOOST_AUTO_TEST_CASE(testwsegvalv) {
|
||||
BOOST_CHECK_EQUAL(valv2->pipeDiameter(), 1.2);
|
||||
BOOST_CHECK_EQUAL(valv2->pipeRoughness(), 0.1);
|
||||
BOOST_CHECK_EQUAL(valv2->pipeCrossArea(), 8.);
|
||||
BOOST_CHECK(valv2->status()==Opm::Valve::Status::SHUT);
|
||||
BOOST_CHECK(valv2->status()==Opm::ICDStatus::SHUT);
|
||||
|
||||
// valve changes the segment data
|
||||
BOOST_CHECK_EQUAL(segment2.internalDiameter(), valv2->pipeDiameter());
|
||||
|
Loading…
Reference in New Issue
Block a user