diff --git a/opm/parser/eclipse/EclipseState/Schedule/Group/Group.hpp b/opm/parser/eclipse/EclipseState/Schedule/Group/Group.hpp index 02e2ea2c7..c005cb98e 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/Group/Group.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/Group/Group.hpp @@ -162,12 +162,35 @@ struct ProductionControls { }; + Group(); Group(const std::string& group_name, std::size_t insert_index_arg, std::size_t init_step_arg, double udq_undefined_arg, const UnitSystem& unit_system); + Group(const std::string& gname, + std::size_t insert_idx, + std::size_t initstep, + double udqUndef, + const UnitSystem& units, + GroupType gtype, + double groupEF, + bool transferGroupEF, + int vfp, + const std::string& parent, + const IOrderSet& well, + const IOrderSet& group, + const GroupInjectionProperties& injProps, + const GroupProductionProperties& prodProps); + bool defined(std::size_t timeStep) const; std::size_t insert_index() const; + std::size_t initStep() const; + double udqUndefined() const; + const UnitSystem& units() const; const std::string& name() const; + GroupType type() const; int getGroupNetVFPTable() const; + const IOrderSet& iwells() const; + const IOrderSet& igroups() const; + bool updateNetVFPTable(int vfp_arg); bool update_gefac(double gefac, bool transfer_gefac); @@ -203,6 +226,9 @@ struct ProductionControls { Phase injection_phase() const; bool has_control(ProductionCMode control) const; bool has_control(InjectionCMode control) const; + + bool operator==(const Group& data) const; + private: bool hasType(GroupType gtype) const; void addType(GroupType new_gtype); diff --git a/opm/parser/eclipse/EclipseState/Schedule/MSW/Segment.hpp b/opm/parser/eclipse/EclipseState/Schedule/MSW/Segment.hpp index e408a53b1..48ea4d8e3 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/MSW/Segment.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/MSW/Segment.hpp @@ -44,6 +44,14 @@ namespace Opm { Segment(int segment_number_in, int branch_in, int outlet_segment_in, double length_in, double depth_in, double internal_diameter_in, double roughness_in, double cross_area_in, double volume_in, bool data_ready_in); + Segment(int segmentNumber, int branchNumber, int outlegSegment, + const std::vector& inletSegments, + double totalLength, double depth, double internalDiameter, + double roughness, double crossArea, double volume, + bool dataReady, SegmentType segmentType, + std::shared_ptr spiralICD, + std::shared_ptr valv); + int segmentNumber() const; int branchNumber() const; int outletSegment() const; @@ -71,6 +79,7 @@ namespace Opm { void updateSpiralICD(const SpiralICD& spiral_icd); const std::shared_ptr& spiralICD() const; + const std::shared_ptr& getValve() const; void updateValve(const Valve& valve, const double segment_length); diff --git a/opm/parser/eclipse/EclipseState/Schedule/MSW/SpiralICD.hpp b/opm/parser/eclipse/EclipseState/Schedule/MSW/SpiralICD.hpp index 8ae4e4ba6..53a9e6088 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/MSW/SpiralICD.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/MSW/SpiralICD.hpp @@ -39,7 +39,19 @@ namespace Opm { SHUT }; + SpiralICD(); explicit SpiralICD(const DeckRecord& record); + SpiralICD(double strength, + double length, + double densityCalibration, + double viscosityCalibration, + double criticalValue, + double widthTransitionRegion, + double maxViscosityRatio, + int methodFlowScaling, + double maxAbsoluteRate, + Status status, + double scalingFactor); // the function will return a map // [ @@ -62,6 +74,8 @@ namespace Opm { void updateScalingFactor(const double segment_length, const double completion_length); double scalingFactor() const; + bool operator==(const SpiralICD& data) const; + private: double m_strength; double m_length; diff --git a/opm/parser/eclipse/EclipseState/Schedule/MSW/Valve.hpp b/opm/parser/eclipse/EclipseState/Schedule/MSW/Valve.hpp index ecca41b3e..9d590943e 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/MSW/Valve.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/MSW/Valve.hpp @@ -38,7 +38,16 @@ namespace Opm { SHUT }; + Valve(); explicit Valve(const DeckRecord& record); + Valve(double conFlowCoeff, + double conCrossA, + double conMaxCrossA, + double pipeAddLength, + double pipeDiam, + double pipeRough, + double pipeCrossA, + Status stat); // the function will return a map // [ @@ -67,9 +76,11 @@ namespace Opm { void setPipeRoughness(const double rou); void setPipeCrossArea(const double area); + bool operator==(const Valve& data) const; + private: - const double m_con_flow_coeff; - const double m_con_cross_area; + double m_con_flow_coeff; + double m_con_cross_area; double m_con_max_cross_area; double m_pipe_additional_length; diff --git a/opm/parser/eclipse/EclipseState/Schedule/MSW/WellSegments.hpp b/opm/parser/eclipse/EclipseState/Schedule/MSW/WellSegments.hpp index 5452155d2..aee4e352f 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/MSW/WellSegments.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/MSW/WellSegments.hpp @@ -62,6 +62,15 @@ namespace Opm { WellSegments() = default; + WellSegments(const std::string& wname, + double depthTopSeg, + double lengthTopSeg, + double volumeTopSeg, + LengthDepth lenDepType, + CompPressureDrop compDrop, + MultiPhaseModel multiPhase, + const std::vector& segments, + const std::map& segmentNumberIdx); const std::string& wellName() const; int size() const; @@ -70,6 +79,7 @@ namespace Opm { double volumeTopSegment() const; CompPressureDrop compPressureDrop() const; + LengthDepth lengthDepthType() const; MultiPhaseModel multiPhaseModel() const; // mapping the segment number to the index in the vector of segments @@ -92,6 +102,8 @@ namespace Opm { // it returns true if there is no error encountered during the update bool updateWSEGSICD(const std::vector >& sicd_pairs); + const std::vector& segments() const; + const std::map& segmentNumberIndex() const; bool updateWSEGVALV(const std::vector >& valve_pairs); diff --git a/opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp b/opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp index 4a23c8668..3e2cd93f3 100644 --- a/opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp +++ b/opm/parser/eclipse/EclipseState/Schedule/Well/Well.hpp @@ -370,6 +370,7 @@ public: }; + Well(); Well(const std::string& wname, const std::string& gname, std::size_t init_step, @@ -383,6 +384,35 @@ public: const UnitSystem& unit_system, double udq_undefined); + Well(const std::string& wname, + const std::string& gname, + std::size_t init_step, + std::size_t insert_index, + int headI, + int headJ, + double ref_depth, + const Phase& phase_arg, + Connection::Order ordering, + const UnitSystem& unit_system, + double udq_undefined, + Status status, + double drainageRadius, + bool allowCrossFlow, + bool automaticShutIn, + bool isProducer, + const WellGuideRate& guideRate, + double efficiencyFactor, + double solventFraction, + bool prediction_mode, + std::shared_ptr econLimits, + std::shared_ptr foamProperties, + std::shared_ptr polymerProperties, + std::shared_ptr tracerProperties, + std::shared_ptr connections, + std::shared_ptr production, + std::shared_ptr injection, + std::shared_ptr segments); + bool isMultiSegment() const; bool isAvailableForGroupControl() const; double getGuideRate() const; @@ -482,6 +512,13 @@ public: int vfp_table_number() const; double alq_value() const; double temperature() const; + const UnitSystem& units() const; + double udqUndefined() const; + bool hasSegments() const; + const WellGuideRate& wellGuideRate() const; + + bool operator==(const Well& data) const; + private: std::string wname; std::string group_name; diff --git a/opm/parser/eclipse/EclipseState/Util/IOrderSet.hpp b/opm/parser/eclipse/EclipseState/Util/IOrderSet.hpp index b67bfaac5..8f94d1d14 100644 --- a/opm/parser/eclipse/EclipseState/Util/IOrderSet.hpp +++ b/opm/parser/eclipse/EclipseState/Util/IOrderSet.hpp @@ -46,19 +46,24 @@ namespace Opm { template class IOrderSet { - +public: using storage_type = typename std::vector; using index_type = typename std::unordered_set; using const_iter_type = typename storage_type::const_iterator; private: - index_type index; + index_type m_index; storage_type m_data; public: + IOrderSet() = default; + IOrderSet(const index_type& index, const storage_type& data) + : m_index(index) + , m_data(data) + {} std::size_t size() const { - return this->index.size(); + return this->m_index.size(); } bool empty() const { @@ -66,7 +71,7 @@ public: } std::size_t count(const T& value) const { - return this->index.count(value); + return this->m_index.count(value); } bool contains(const T& value) const { @@ -77,7 +82,7 @@ public: if (this->contains(value)) return false; - this->index.insert(value); + this->m_index.insert(value); this->m_data.push_back(value); return true; } @@ -86,7 +91,7 @@ public: if (!this->contains(value)) return 0; - this->index.erase(value); + this->m_index.erase(value); auto data_iter = std::find(this->m_data.begin(), this->m_data.end(), value); this->m_data.erase(data_iter); return 1; @@ -108,6 +113,15 @@ public: return this->m_data; }; + const index_type& index() const { + return this->m_index; + }; + + bool operator==(const IOrderSet& data) const { + return this->index() == data.index() && + this->data() == data.data(); + } + }; } diff --git a/opm/parser/eclipse/Units/Dimension.hpp b/opm/parser/eclipse/Units/Dimension.hpp index d91b3cf54..2e8f9fe24 100644 --- a/opm/parser/eclipse/Units/Dimension.hpp +++ b/opm/parser/eclipse/Units/Dimension.hpp @@ -30,6 +30,7 @@ namespace Opm { Dimension(const std::string& name, double SIfactor, double SIoffset = 0.0); double getSIScaling() const; + double getSIScalingRaw() const; double getSIOffset() const; double convertRawToSi(double rawValue) const; diff --git a/opm/parser/eclipse/Units/UnitSystem.hpp b/opm/parser/eclipse/Units/UnitSystem.hpp index c1cd26d26..c35ef2ba9 100644 --- a/opm/parser/eclipse/Units/UnitSystem.hpp +++ b/opm/parser/eclipse/Units/UnitSystem.hpp @@ -78,6 +78,9 @@ namespace Opm { explicit UnitSystem(UnitType unit = UnitType::UNIT_TYPE_METRIC); explicit UnitSystem(const std::string& deck_name); + UnitSystem(const std::string& name, UnitType unit, + const std::map& dimensions, + size_t use_count); const std::string& getName() const; UnitType getType() const; @@ -88,6 +91,7 @@ namespace Opm { const Dimension& getDimension(const std::string& dimension) const; bool hasDimension(const std::string& dimension) const; bool equal(const UnitSystem& other) const; + const std::map& getDimensions() const; bool operator==( const UnitSystem& ) const; bool operator!=( const UnitSystem& ) const; diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/Group/Group.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/Group/Group.cpp index faf4484e0..e5a4c6ee8 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/Group/Group.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/Group/Group.cpp @@ -25,6 +25,11 @@ namespace Opm { +Group::Group() + : Group("", 0, 0, 0.0, UnitSystem()) +{ +} + Group::Group(const std::string& name, std::size_t insert_index_arg, std::size_t init_step_arg, double udq_undefined_arg, const UnitSystem& unit_system_arg) : m_name(name), m_insert_index(insert_index_arg), @@ -41,10 +46,57 @@ Group::Group(const std::string& name, std::size_t insert_index_arg, std::size_t this->parent_group = "FIELD"; } +Group::Group(const std::string& gname, + std::size_t insert_idx, + std::size_t initstep, + double udqUndef, + const UnitSystem& units, + GroupType gtype, + double groupEF, + bool transferGroupEF, + int vfp, + const std::string& parentName, + const IOrderSet& well, + const IOrderSet& group, + const GroupInjectionProperties& injProps, + const GroupProductionProperties& prodProps) : + m_name(gname), + m_insert_index(insert_idx), + init_step(initstep), + udq_undefined(udqUndef), + unit_system(units), + group_type(gtype), + gefac(groupEF), + transfer_gefac(transferGroupEF), + vfp_table(vfp), + parent_group(parentName), + m_wells(well), + m_groups(group), + injection_properties(injProps), + production_properties(prodProps) +{ +} + std::size_t Group::insert_index() const { return this->m_insert_index; } +std::size_t Group::initStep() const { + return this->init_step; +} + +double Group::udqUndefined() const { + return this->udq_undefined; +} + +const UnitSystem& Group::units() const { + return this->unit_system; +} + +Group::GroupType Group::type() const { + return this->group_type; +} + bool Group::defined(size_t timeStep) const { return (timeStep >= this->init_step); } @@ -65,6 +117,14 @@ int Group::getGroupNetVFPTable() const { return this->vfp_table; } +const IOrderSet& Group::iwells() const { + return m_wells; +} + +const IOrderSet& Group::igroups() const { + return m_groups; +} + bool Group::updateNetVFPTable(int vfp_arg) { if (this->vfp_table != vfp_arg) { this->vfp_table = vfp_arg; @@ -493,4 +553,22 @@ Group::GuideRateTarget Group::GuideRateTargetFromString( const std::string& stri return GuideRateTarget::NO_GUIDE_RATE; } +bool Group::operator==(const Group& data) const +{ + return this->name() == data.name() && + this->insert_index() == data.insert_index() && + this->initStep() == data.initStep() && + this->udqUndefined() == data.udqUndefined() && + this->units() == data.units() && + this->type() == data.type() && + this->getGroupEfficiencyFactor() == data.getGroupEfficiencyFactor() && + this->getTransferGroupEfficiencyFactor() == data.getTransferGroupEfficiencyFactor() && + this->getGroupNetVFPTable() == data.getGroupNetVFPTable() && + this->parent() == data.parent() && + this->iwells() == data.iwells() && + this->igroups() == data.igroups() && + this->injectionProperties() == data.injectionProperties() && + this->productionProperties() == data.productionProperties(); +} + } diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/MSW/Segment.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/MSW/Segment.cpp index 8bebd9f45..7d5fa7c14 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/MSW/Segment.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/MSW/Segment.cpp @@ -56,6 +56,31 @@ namespace Opm { { } + Segment::Segment(int segmentNum, int branchNum, int outletSeg, + const std::vector& inletSegs, + double totalLen, double dept, double internalDiam, + double rough, double crossA, double vol, + bool dr, SegmentType segment, + std::shared_ptr spiralIcd, + std::shared_ptr valv) + : m_segment_number(segmentNum), + m_branch(branchNum), + m_outlet_segment(outletSeg), + m_inlet_segments(inletSegs), + m_total_length(totalLen), + m_depth(dept), + m_internal_diameter(internalDiam), + m_roughness(rough), + m_cross_area(crossA), + m_volume(vol), + m_data_ready(dr), + m_segment_type(segment), + m_spiral_icd(spiralIcd), + m_valve(valv) + { + } + + int Segment::segmentNumber() const { return m_segment_number; } @@ -196,4 +221,8 @@ namespace Opm { return m_valve.get(); } + const std::shared_ptr& Segment::getValve() const { + return m_valve; + } + } diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/MSW/SpiralICD.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/MSW/SpiralICD.cpp index a12e62fd3..477131bb9 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/MSW/SpiralICD.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/MSW/SpiralICD.cpp @@ -28,6 +28,37 @@ 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::SpiralICD(double strength, + double length, + double densityCalibration, + double viscosityCalibration, + double criticalValue, + double widthTransitionRegion, + double maxViscosityRatio, + int flowScaling, + double maxAbsoluteRate, + Status status, + double scalingFactor) + : m_strength(strength), + m_length(length), + m_density_calibration(densityCalibration), + m_viscosity_calibration(viscosityCalibration), + m_critical_value(criticalValue), + m_width_transition_region(widthTransitionRegion), + m_max_viscosity_ratio(maxViscosityRatio), + m_method_flow_scaling(flowScaling), + m_max_absolute_rate(maxAbsoluteRate), + m_status(status), + m_scaling_factor(scalingFactor) + { + } + + SpiralICD::SpiralICD(const DeckRecord& record) : m_strength(record.getItem("STRENGTH").getSIDouble(0)), m_length(record.getItem("LENGTH").getSIDouble(0)), @@ -154,4 +185,19 @@ namespace Opm { throw std::logic_error(" invalid method specified to calculate flow scaling factor for SICD"); } } + + + bool SpiralICD::operator==(const SpiralICD& data) const { + return this->strength() == data.strength() && + this->length() == data.length() && + this->densityCalibration() == data.densityCalibration() && + this->viscosityCalibration() == data.viscosityCalibration() && + this->criticalValue() == data.criticalValue() && + this->widthTransitionRegion() == data.widthTransitionRegion() && + this->maxViscosityRatio() == data.maxViscosityRatio() && + this->methodFlowScaling() == data.methodFlowScaling() && + this->maxAbsoluteRate() == data.maxAbsoluteRate() && + this->status() == data.status() && + this->scalingFactor() == data.scalingFactor(); + } } diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/MSW/Valve.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/MSW/Valve.cpp index 12b0bf434..91716c7a7 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/MSW/Valve.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/MSW/Valve.cpp @@ -26,6 +26,30 @@ namespace Opm { + Valve::Valve() + : Valve(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Status::SHUT) + { + } + + Valve::Valve(double conFlowCoeff, + double conCrossA, + double conMaxCrossA, + double pipeAddLength, + double pipeDiam, + double pipeRough, + double pipeCrossA, + Status stat) + : m_con_flow_coeff(conFlowCoeff) + , m_con_cross_area(conCrossA) + , m_con_max_cross_area(conMaxCrossA) + , m_pipe_additional_length(pipeAddLength) + , m_pipe_diameter(pipeDiam) + , m_pipe_roughness(pipeRough) + , m_pipe_cross_area(pipeCrossA) + , m_status(stat) + { + } + Valve::Valve(const DeckRecord& record) : m_con_flow_coeff(record.getItem("CV").get(0)) , m_con_cross_area(record.getItem("AREA").get(0)) @@ -140,4 +164,15 @@ namespace Opm { void Valve::setPipeAdditionalLength(const double length) { m_pipe_additional_length = length; } + + bool Valve::operator==(const Valve& data) const { + return this->conFlowCoefficient() == data.conFlowCoefficient() && + this->conCrossArea() == data.conCrossArea() && + this->conMaxCrossArea() == data.conMaxCrossArea() && + this->pipeAdditionalLength() == data.pipeAdditionalLength() && + this->pipeDiameter() == data.pipeDiameter() && + this->pipeRoughness() == data.pipeRoughness() && + this->pipeCrossArea() == data.pipeCrossArea() && + this->status() == data.status(); + } } diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/MSW/WellSegments.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/MSW/WellSegments.cpp index 2e6ecd66d..e1f697ce5 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/MSW/WellSegments.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/MSW/WellSegments.cpp @@ -36,6 +36,27 @@ namespace Opm { + WellSegments::WellSegments(const std::string& wname, + double depthTopSeg, + double lengthTopSeg, + double volumeTopSeg, + LengthDepth lenDepType, + CompPressureDrop compDrop, + MultiPhaseModel multiPhase, + const std::vector& segments, + const std::map& segmentNumberIdx) + : m_well_name(wname) + , m_depth_top(depthTopSeg) + , m_length_top(lengthTopSeg) + , m_volume_top(volumeTopSeg) + , m_length_depth_type(lenDepType) + , m_comp_pressure_drop(compDrop) + , m_multiphase_model(multiPhase) + , m_segments(segments) + , segment_number_to_index(segmentNumberIdx) + { + } + const std::string& WellSegments::wellName() const { return m_well_name; } @@ -560,6 +581,18 @@ WellSegments::MultiPhaseModel WellSegments::MultiPhaseModelFromString(const std: } else { throw std::invalid_argument("Unknown enum string_value: " + string_value + " for MultiPhaseModel"); } +} + +WellSegments::LengthDepth WellSegments::lengthDepthType() const { + return m_length_depth_type; +} + +const std::vector& WellSegments::segments() const { + return m_segments; +} + +const std::map& WellSegments::segmentNumberIndex() const { + return segment_number_to_index; +} } -} diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/Well/Well.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/Well/Well.cpp index 02e1c2707..3f61b4472 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/Well/Well.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/Well/Well.cpp @@ -72,6 +72,25 @@ namespace { } +Well::Well() : + init_step(0), + insert_index(0), + headI(0), + headJ(0), + ref_depth(0.0), + phase(Phase::OIL), + ordering(Connection::Order::DEPTH), + udq_undefined(0.0), + status(Status::STOP), + drainage_radius(0.0), + allow_cross_flow(false), + automatic_shutin(false), + producer(false), + efficiency_factor(0.0), + solvent_fraction(0.0) +{ +} + Well::Well(const std::string& wname_arg, const std::string& gname, @@ -117,6 +136,65 @@ Well::Well(const std::string& wname_arg, this->updateProduction(p); } +Well::Well(const std::string& wname_arg, + const std::string& gname, + std::size_t init_step_arg, + std::size_t insert_index_arg, + int headI_arg, + int headJ_arg, + double ref_depth_arg, + const Phase& phase_arg, + Connection::Order ordering_arg, + const UnitSystem& units, + double udq_undefined_arg, + Status status_arg, + double drainageRadius, + bool allowCrossFlow, + bool automaticShutIn, + bool isProducer, + const WellGuideRate& guideRate, + double efficiencyFactor, + double solventFraction, + bool predictionMode, + std::shared_ptr econLimits, + std::shared_ptr foamProperties, + std::shared_ptr polymerProperties, + std::shared_ptr tracerProperties, + std::shared_ptr connections_arg, + std::shared_ptr production_arg, + std::shared_ptr injection_arg, + std::shared_ptr segments_arg) : + wname(wname_arg), + group_name(gname), + init_step(init_step_arg), + insert_index(insert_index_arg), + headI(headI_arg), + headJ(headJ_arg), + ref_depth(ref_depth_arg), + phase(phase_arg), + ordering(ordering_arg), + unit_system(units), + udq_undefined(udq_undefined_arg), + status(status_arg), + drainage_radius(drainageRadius), + allow_cross_flow(allowCrossFlow), + automatic_shutin(automaticShutIn), + producer(isProducer), + guide_rate(guideRate), + efficiency_factor(efficiencyFactor), + solvent_fraction(solventFraction), + prediction_mode(predictionMode), + econ_limits(econLimits), + foam_properties(foamProperties), + polymer_properties(polymerProperties), + tracer_properties(tracerProperties), + connections(connections_arg), + production(production_arg), + injection(injection_arg), + segments(segments_arg) +{ +} + bool Well::updateEfficiencyFactor(double efficiency_factor_arg) { if (this->efficiency_factor != efficiency_factor_arg) { this->efficiency_factor = efficiency_factor_arg; @@ -1057,4 +1135,57 @@ Well::GuideRateTarget Well::GuideRateTargetFromString( const std::string& string else throw std::invalid_argument("Unknown enum state string: " + stringValue ); } + +const Well::WellGuideRate& Well::wellGuideRate() const { + return guide_rate; +} + +const UnitSystem& Well::units() const { + return unit_system; +} + +double Well::udqUndefined() const { + return udq_undefined; +} + +bool Well::hasSegments() const { + return segments != nullptr; +} + + +bool Well::operator==(const Well& data) const { + if (this->hasSegments() != data.hasSegments()) { + return false; + } + + if (this->hasSegments() && (this->getSegments() != data.getSegments())) { + return false; + } + + return this->name() == data.name() && + this->groupName() == data.groupName() && + this->firstTimeStep() == data.firstTimeStep() && + this->seqIndex() == data.seqIndex() && + this->getHeadI() == data.getHeadI() && + this->getHeadJ() == data.getHeadJ() && + this->getRefDepth() == data.getRefDepth() && + this->getPreferredPhase() == data.getPreferredPhase() && + this->getWellConnectionOrdering() == data.getWellConnectionOrdering() && + this->units() == data.units() && + this->udqUndefined() == data.udqUndefined() && + this->getStatus() == data.getStatus() && + this->getDrainageRadius() == data.getDrainageRadius() && + this->getAllowCrossFlow() == data.getAllowCrossFlow() && + this->getAutomaticShutIn() == data.getAutomaticShutIn() && + this->isProducer() == data.isProducer() && + this->wellGuideRate() == data.wellGuideRate() && + this->getEfficiencyFactor() == data.getEfficiencyFactor() && + this->getSolventFraction() == data.getSolventFraction() && + this->getEconLimits() == data.getEconLimits() && + this->getFoamProperties() == data.getFoamProperties() && + this->getTracerProperties() == data.getTracerProperties() && + this->getProductionProperties() == data.getProductionProperties() && + this->getInjectionProperties() == data.getInjectionProperties(); +} + } diff --git a/src/opm/parser/eclipse/Units/Dimension.cpp b/src/opm/parser/eclipse/Units/Dimension.cpp index 6542d5f68..1a4b928bf 100644 --- a/src/opm/parser/eclipse/Units/Dimension.cpp +++ b/src/opm/parser/eclipse/Units/Dimension.cpp @@ -51,6 +51,10 @@ namespace Opm { return m_SIfactor; } + double Dimension::getSIScalingRaw() const { + return m_SIfactor; + } + double Dimension::getSIOffset() const { return m_SIoffset; } diff --git a/src/opm/parser/eclipse/Units/UnitSystem.cpp b/src/opm/parser/eclipse/Units/UnitSystem.cpp index c99b45239..1e5055d28 100644 --- a/src/opm/parser/eclipse/Units/UnitSystem.cpp +++ b/src/opm/parser/eclipse/Units/UnitSystem.cpp @@ -826,6 +826,41 @@ namespace { }; } + UnitSystem::UnitSystem(const std::string& name, UnitType unit, + const std::map& dimensions, + size_t use_count) + : m_name(name) + , m_unittype(unit) + , m_dimensions(dimensions) + , m_use_count(use_count) + { + switch(unit) { + case(UnitType::UNIT_TYPE_METRIC): + this->initMETRIC(); + break; + + case(UnitType::UNIT_TYPE_FIELD): + this->initFIELD(); + break; + + case(UnitType::UNIT_TYPE_LAB): + this->initLAB(); + break; + + case(UnitType::UNIT_TYPE_PVT_M): + this->initPVT_M(); + break; + + case(UnitType::UNIT_TYPE_INPUT): + this->initINPUT(); + break; + + default: + throw std::runtime_error("Tried to construct UnitSystem with unknown unit family."); + break; + }; + } + void UnitSystem::initINPUT() { this->m_name = "Input"; this->measure_table_from_si = to_input; @@ -1048,7 +1083,7 @@ namespace { case(UnitType::UNIT_TYPE_LAB): return "LAB"; case(UnitType::UNIT_TYPE_PVT_M): return "PVT-M"; default: - throw std::invalid_argument("No valuid deckname could be inferred"); + throw std::invalid_argument("No valid deckname could be inferred"); } } @@ -1222,5 +1257,9 @@ namespace { return system; } + const std::map& UnitSystem::getDimensions() const { + return m_dimensions; + } + }