Make Completion+CompletionSet no longer use shared_ptr
This commit is contained in:
@@ -46,73 +46,22 @@ namespace Opm {
|
||||
m_skinFactor(skinFactor),
|
||||
m_state(state),
|
||||
m_direction(direction),
|
||||
m_segment_number(-1),
|
||||
m_center_depth( depth )
|
||||
{}
|
||||
|
||||
Completion::Completion(std::shared_ptr<const Completion> oldCompletion, WellCompletion::StateEnum newStatus)
|
||||
:
|
||||
m_i(oldCompletion->getI()),
|
||||
m_j(oldCompletion->getJ()),
|
||||
m_k(oldCompletion->getK()),
|
||||
m_diameter(oldCompletion->getDiameterAsValueObject()),
|
||||
m_connectionTransmissibilityFactor(oldCompletion->getConnectionTransmissibilityFactorAsValueObject()),
|
||||
m_wellPi(oldCompletion->getWellPi()),
|
||||
m_skinFactor(oldCompletion->getSkinFactorAsValueObject()),
|
||||
m_state(newStatus),
|
||||
m_direction(oldCompletion->getDirection()),
|
||||
m_center_depth(oldCompletion->getCenterDepth())
|
||||
Completion::Completion(const Completion& oldCompletion, WellCompletion::StateEnum newStatus ) :
|
||||
Completion( oldCompletion )
|
||||
{
|
||||
if (oldCompletion->attachedToSegment()) {
|
||||
m_segment_number = oldCompletion->getSegmentNumber();
|
||||
} else {
|
||||
m_segment_number = -1;
|
||||
}
|
||||
this->m_state = newStatus;
|
||||
}
|
||||
|
||||
Completion::Completion(std::shared_ptr<const Completion> oldCompletion, double wellPi)
|
||||
:
|
||||
m_i(oldCompletion->getI()),
|
||||
m_j(oldCompletion->getJ()),
|
||||
m_k(oldCompletion->getK()),
|
||||
m_diameter(oldCompletion->getDiameterAsValueObject()),
|
||||
m_connectionTransmissibilityFactor(oldCompletion->getConnectionTransmissibilityFactorAsValueObject()),
|
||||
m_wellPi(oldCompletion->getWellPi()),
|
||||
m_skinFactor(oldCompletion->getSkinFactorAsValueObject()),
|
||||
m_state(oldCompletion->getState()),
|
||||
m_direction(oldCompletion->getDirection()),
|
||||
m_center_depth(oldCompletion->getCenterDepth())
|
||||
Completion::Completion(const Completion& oldCompletion, double wellPi) :
|
||||
Completion( oldCompletion )
|
||||
{
|
||||
if (oldCompletion->attachedToSegment()) {
|
||||
m_segment_number = oldCompletion->getSegmentNumber();
|
||||
if( this->m_wellPi != 0 ) {
|
||||
this->m_wellPi *= wellPi;
|
||||
} else {
|
||||
m_segment_number = -1;
|
||||
}
|
||||
|
||||
if(m_wellPi!=0){
|
||||
m_wellPi*=wellPi;
|
||||
}else{
|
||||
m_wellPi=wellPi;
|
||||
}
|
||||
}
|
||||
|
||||
Completion::Completion(std::shared_ptr<const Completion> oldCompletion)
|
||||
:
|
||||
m_i(oldCompletion->getI()),
|
||||
m_j(oldCompletion->getJ()),
|
||||
m_k(oldCompletion->getK()),
|
||||
m_diameter(oldCompletion->getDiameterAsValueObject()),
|
||||
m_connectionTransmissibilityFactor(oldCompletion->getConnectionTransmissibilityFactorAsValueObject()),
|
||||
m_wellPi(oldCompletion->getWellPi()),
|
||||
m_skinFactor(oldCompletion->getSkinFactorAsValueObject()),
|
||||
m_state(oldCompletion->getState()),
|
||||
m_direction(oldCompletion->getDirection()),
|
||||
m_center_depth(oldCompletion->getCenterDepth())
|
||||
{
|
||||
if (oldCompletion->attachedToSegment()) {
|
||||
m_segment_number = oldCompletion->getSegmentNumber();
|
||||
} else {
|
||||
m_segment_number = -1;
|
||||
this->m_wellPi = wellPi;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -141,10 +90,10 @@ namespace Opm {
|
||||
disentangled, and each completion is returned separately.
|
||||
*/
|
||||
|
||||
inline std::vector< CompletionPtr >
|
||||
inline std::vector< Completion >
|
||||
fromCOMPDAT( const EclipseGrid& grid, const DeckRecord& compdatRecord, const Well& well ) {
|
||||
|
||||
std::vector<CompletionPtr> completions;
|
||||
std::vector< Completion > completions;
|
||||
|
||||
// We change from eclipse's 1 - n, to a 0 - n-1 solution
|
||||
// I and J can be defaulted with 0 or *, in which case they are fetched
|
||||
@@ -182,9 +131,13 @@ namespace Opm {
|
||||
const WellCompletion::DirectionEnum direction = WellCompletion::DirectionEnumFromString(compdatRecord.getItem("DIR").getTrimmedString(0));
|
||||
|
||||
for (int k = K1; k <= K2; k++) {
|
||||
double depth = grid.getCellDepth( I,J,k );
|
||||
CompletionPtr completion(new Completion(I , J , k , depth , state , connectionTransmissibilityFactor, diameter, skinFactor, direction ));
|
||||
completions.push_back( completion );
|
||||
completions.emplace_back( I, J, k,
|
||||
grid.getCellDepth( I,J,k ),
|
||||
state,
|
||||
connectionTransmissibilityFactor,
|
||||
diameter,
|
||||
skinFactor,
|
||||
direction );
|
||||
}
|
||||
|
||||
return completions;
|
||||
@@ -200,12 +153,12 @@ namespace Opm {
|
||||
}
|
||||
*/
|
||||
|
||||
std::map< std::string, std::vector< CompletionPtr > >
|
||||
std::map< std::string, std::vector< Completion > >
|
||||
Completion::fromCOMPDAT( const EclipseGrid& grid ,
|
||||
const DeckKeyword& compdatKeyword,
|
||||
const std::vector< const Well* >& wells ) {
|
||||
|
||||
std::map< std::string, std::vector< CompletionPtr > > res;
|
||||
std::map< std::string, std::vector< Completion > > res;
|
||||
|
||||
for( const auto& record : compdatKeyword ) {
|
||||
|
||||
@@ -221,8 +174,8 @@ namespace Opm {
|
||||
auto completions = Opm::fromCOMPDAT( grid, record, **well );
|
||||
|
||||
res[ wellname ].insert( res[ wellname ].end(),
|
||||
completions.begin(),
|
||||
completions.end() );
|
||||
std::make_move_iterator( completions.begin() ),
|
||||
std::make_move_iterator( completions.end() ) );
|
||||
}
|
||||
|
||||
return res;
|
||||
@@ -307,7 +260,24 @@ namespace Opm {
|
||||
return (m_segment_number > 0);
|
||||
}
|
||||
|
||||
bool Completion::operator==( const Completion& rhs ) const {
|
||||
return this->m_i == rhs.m_i
|
||||
&& this->m_j == rhs.m_j
|
||||
&& this->m_k == rhs.m_k
|
||||
&& this->m_diameter == rhs.m_diameter
|
||||
&& this->m_connectionTransmissibilityFactor
|
||||
== rhs.m_connectionTransmissibilityFactor
|
||||
&& this->m_wellPi == rhs.m_wellPi
|
||||
&& this->m_skinFactor == rhs.m_skinFactor
|
||||
&& this->m_state == rhs.m_state
|
||||
&& this->m_direction == rhs.m_direction
|
||||
&& this->m_segment_number == rhs.m_segment_number
|
||||
&& this->m_center_depth == rhs.m_center_depth;
|
||||
}
|
||||
|
||||
bool Completion::operator!=( const Completion& rhs ) const {
|
||||
return !( *this == rhs );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -47,9 +47,8 @@ namespace Opm {
|
||||
const Value<double>& skinFactor,
|
||||
const WellCompletion::DirectionEnum direction = WellCompletion::DirectionEnum::Z);
|
||||
|
||||
Completion(std::shared_ptr<const Completion> oldCompletion, WellCompletion::StateEnum newStatus);
|
||||
Completion(std::shared_ptr<const Completion> oldCompletion, double wellPi);
|
||||
Completion(std::shared_ptr<const Completion> oldCompletion);
|
||||
Completion(const Completion&, WellCompletion::StateEnum newStatus);
|
||||
Completion(const Completion&, double wellPi);
|
||||
|
||||
bool sameCoordinate(const Completion& other) const;
|
||||
bool sameCoordinate(const int i, const int j, const int k) const;
|
||||
@@ -71,11 +70,14 @@ namespace Opm {
|
||||
|
||||
WellCompletion::DirectionEnum getDirection() const;
|
||||
|
||||
static std::map< std::string, std::vector< std::shared_ptr< Completion > > >
|
||||
static std::map< std::string, std::vector< Completion > >
|
||||
fromCOMPDAT( const EclipseGrid& grid,
|
||||
const DeckKeyword& compdatKeyword,
|
||||
const std::vector< const Well* >& );
|
||||
|
||||
bool operator==( const Completion& ) const;
|
||||
bool operator!=( const Completion& ) const;
|
||||
|
||||
private:
|
||||
int m_i, m_j, m_k;
|
||||
Value<double> m_diameter;
|
||||
@@ -86,15 +88,11 @@ namespace Opm {
|
||||
WellCompletion::DirectionEnum m_direction;
|
||||
Value<double> getDiameterAsValueObject() const;
|
||||
Value<double> getSkinFactorAsValueObject() const;
|
||||
// related segment number
|
||||
// -1 means the completion is not related to segment
|
||||
int m_segment_number;
|
||||
// related segment number
|
||||
// -1 means the completion is not related to segment
|
||||
int m_segment_number = -1;
|
||||
double m_center_depth;
|
||||
|
||||
};
|
||||
|
||||
typedef std::shared_ptr<Completion> CompletionPtr;
|
||||
typedef std::shared_ptr<const Completion> CompletionConstPtr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -28,25 +28,17 @@
|
||||
|
||||
namespace Opm {
|
||||
|
||||
CompletionSet::CompletionSet() {}
|
||||
|
||||
|
||||
size_t CompletionSet::size() const {
|
||||
return m_completions.size();
|
||||
}
|
||||
|
||||
|
||||
CompletionConstPtr CompletionSet::get(size_t index) const {
|
||||
if (index >= m_completions.size())
|
||||
throw std::range_error("Out of bounds");
|
||||
|
||||
return m_completions[index];
|
||||
const Completion& CompletionSet::get(size_t index) const {
|
||||
return this->m_completions.at( index );
|
||||
}
|
||||
|
||||
|
||||
CompletionConstPtr CompletionSet::getFromIJK(const int i, const int j, const int k) const {
|
||||
const Completion& CompletionSet::getFromIJK(const int i, const int j, const int k) const {
|
||||
for (size_t ic = 0; ic < size(); ++ic) {
|
||||
if (get(ic)->sameCoordinate(i, j, k)) {
|
||||
if (get(ic).sameCoordinate(i, j, k)) {
|
||||
return get(ic);
|
||||
}
|
||||
}
|
||||
@@ -54,42 +46,25 @@ namespace Opm {
|
||||
}
|
||||
|
||||
|
||||
void CompletionSet::add(CompletionConstPtr completion) {
|
||||
bool inserted = false;
|
||||
|
||||
for (size_t ic = 0; ic < m_completions.size(); ic++) {
|
||||
CompletionConstPtr current = m_completions[ic];
|
||||
if (current->sameCoordinate( *completion )) {
|
||||
m_completions[ic] = completion;
|
||||
inserted = true;
|
||||
void CompletionSet::add( Completion completion ) {
|
||||
for( auto& c : this->m_completions ) {
|
||||
if( c.sameCoordinate( completion ) ) {
|
||||
c = std::move( completion );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!inserted)
|
||||
m_completions.push_back( completion );
|
||||
m_completions.push_back( std::move( completion ) );
|
||||
}
|
||||
|
||||
|
||||
CompletionSet * CompletionSet::shallowCopy() const {
|
||||
CompletionSet * copy = new CompletionSet();
|
||||
for (size_t ic = 0; ic < m_completions.size(); ic++) {
|
||||
CompletionConstPtr completion = m_completions[ic];
|
||||
copy->m_completions.push_back( completion );
|
||||
}
|
||||
return copy;
|
||||
}
|
||||
|
||||
|
||||
bool CompletionSet::allCompletionsShut( ) const {
|
||||
bool allShut = true;
|
||||
for (auto ci = m_completions.begin(); ci != m_completions.end(); ++ci) {
|
||||
CompletionConstPtr completion_ptr = *ci;
|
||||
if (completion_ptr->getState() != WellCompletion::StateEnum::SHUT) {
|
||||
allShut = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return allShut;
|
||||
auto shut = []( const Completion& c ) {
|
||||
return c.getState() == WellCompletion::StateEnum::SHUT;
|
||||
};
|
||||
|
||||
return std::all_of( this->m_completions.begin(),
|
||||
this->m_completions.end(),
|
||||
shut );
|
||||
}
|
||||
|
||||
|
||||
@@ -111,10 +86,12 @@ namespace Opm {
|
||||
// O(n^2) algorithm. However, it should be acceptable since
|
||||
// the expected number of completions is fairly low (< 100).
|
||||
|
||||
if( this->m_completions.empty() ) return;
|
||||
|
||||
for (size_t pos = 1; pos < m_completions.size() - 1; ++pos) {
|
||||
CompletionConstPtr prev = m_completions[pos - 1];
|
||||
const double prevz = prev->getCenterDepth();
|
||||
size_t next_index = findClosestCompletion(prev->getI(), prev->getJ(), prevz, pos);
|
||||
const auto& prev = m_completions[pos - 1];
|
||||
const double prevz = prev.getCenterDepth();
|
||||
size_t next_index = findClosestCompletion(prev.getI(), prev.getJ(), prevz, pos);
|
||||
std::swap(m_completions[next_index], m_completions[pos]);
|
||||
}
|
||||
}
|
||||
@@ -127,9 +104,11 @@ namespace Opm {
|
||||
int min_ijdist2 = std::numeric_limits<int>::max();
|
||||
double min_zdiff = std::numeric_limits<double>::max();
|
||||
for (size_t pos = start_pos; pos < m_completions.size(); ++pos) {
|
||||
const double depth = m_completions[pos]->getCenterDepth();
|
||||
const int ci = m_completions[pos]->getI();
|
||||
const int cj = m_completions[pos]->getJ();
|
||||
const auto& completion = m_completions[ pos ];
|
||||
|
||||
const double depth = completion.getCenterDepth();
|
||||
const int ci = completion.getI();
|
||||
const int cj = completion.getJ();
|
||||
// Using square of distance to avoid non-integer arithmetics.
|
||||
const int ijdist2 = (ci - oi) * (ci - oi) + (cj - oj) * (cj - oj);
|
||||
if (ijdist2 < min_ijdist2) {
|
||||
@@ -148,4 +127,13 @@ namespace Opm {
|
||||
return closest;
|
||||
}
|
||||
|
||||
bool CompletionSet::operator==( const CompletionSet& rhs ) const {
|
||||
return this->size() == rhs.size()
|
||||
&& std::equal( this->begin(), this->end(), rhs.begin() );
|
||||
}
|
||||
|
||||
bool CompletionSet::operator!=( const CompletionSet& rhs ) const {
|
||||
return !( *this == rhs );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -29,14 +29,12 @@ namespace Opm {
|
||||
|
||||
class CompletionSet {
|
||||
public:
|
||||
using const_iterator = std::vector< std::shared_ptr< const Completion > >::const_iterator;
|
||||
using const_iterator = std::vector< Completion >::const_iterator;
|
||||
|
||||
CompletionSet();
|
||||
void add(std::shared_ptr< const Completion > completion);
|
||||
void add( Completion );
|
||||
size_t size() const;
|
||||
CompletionSet * shallowCopy() const;
|
||||
std::shared_ptr< const Completion > get(size_t index) const;
|
||||
std::shared_ptr< const Completion > getFromIJK(const int i, const int j, const int k) const;
|
||||
const Completion& get(size_t index) const;
|
||||
const Completion& getFromIJK(const int i, const int j, const int k) const;
|
||||
|
||||
const_iterator begin() const { return this->m_completions.begin(); }
|
||||
const_iterator end() const { return this->m_completions.end(); }
|
||||
@@ -55,13 +53,14 @@ namespace Opm {
|
||||
/// \param[in] well_j logical cartesian j-coordinate of well head
|
||||
/// \param[in] grid EclipseGrid object, used for cell depths
|
||||
void orderCompletions(size_t well_i, size_t well_j);
|
||||
|
||||
bool operator==( const CompletionSet& ) const;
|
||||
bool operator!=( const CompletionSet& ) const;
|
||||
|
||||
private:
|
||||
std::vector<std::shared_ptr< const Completion >> m_completions;
|
||||
std::vector< Completion > m_completions;
|
||||
size_t findClosestCompletion(int oi, int oj, double oz, size_t start_pos);
|
||||
};
|
||||
|
||||
typedef std::shared_ptr<CompletionSet> CompletionSetPtr;
|
||||
typedef std::shared_ptr<const CompletionSet> CompletionSetConstPtr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -189,13 +189,13 @@ namespace Opm {
|
||||
const int j = compseg.m_j;
|
||||
const int k = compseg.m_k;
|
||||
|
||||
CompletionPtr new_completion = std::make_shared<Completion>(completion_set.getFromIJK(i, j, k));
|
||||
new_completion->attachSegment(compseg.m_segment_number, compseg.m_center_depth);
|
||||
auto new_completion = completion_set.getFromIJK( i, j, k );
|
||||
new_completion.attachSegment(compseg.m_segment_number, compseg.m_center_depth);
|
||||
completion_set.add(new_completion);
|
||||
}
|
||||
|
||||
for (size_t ic = 0; ic < completion_set.size(); ++ic) {
|
||||
if ( !(completion_set.get(ic)->attachedToSegment()) ) {
|
||||
if ( !(completion_set.get(ic).attachedToSegment()) ) {
|
||||
throw std::runtime_error("Not all the completions are attached with a segment. "
|
||||
"The information from COMPSEGS is not complete");
|
||||
}
|
||||
|
||||
@@ -511,9 +511,9 @@ namespace Opm {
|
||||
double wellPi = record.getItem("WELLPI").get< double >(0);
|
||||
|
||||
for( auto* well : getWells( wellNamePattern ) ) {
|
||||
CompletionSetConstPtr currentCompletionSet = well->getCompletions(currentStep);
|
||||
const auto& currentCompletionSet = well->getCompletions(currentStep);
|
||||
|
||||
CompletionSetPtr newCompletionSet(new CompletionSet( ));
|
||||
CompletionSet newCompletionSet;
|
||||
|
||||
Opm::Value<int> I = getValueItem(record.getItem("I"));
|
||||
Opm::Value<int> J = getValueItem(record.getItem("J"));
|
||||
@@ -521,51 +521,47 @@ namespace Opm {
|
||||
Opm::Value<int> FIRST = getValueItem(record.getItem("FIRST"));
|
||||
Opm::Value<int> LAST = getValueItem(record.getItem("LAST"));
|
||||
|
||||
size_t completionSize = currentCompletionSet->size();
|
||||
size_t completionSize = currentCompletionSet.size();
|
||||
|
||||
for(size_t i = 0; i < completionSize;i++) {
|
||||
|
||||
CompletionConstPtr currentCompletion = currentCompletionSet->get(i);
|
||||
const auto& currentCompletion = currentCompletionSet.get(i);
|
||||
|
||||
if (FIRST.hasValue()) {
|
||||
if (i < (size_t) FIRST.getValue()) {
|
||||
newCompletionSet->add(currentCompletion);
|
||||
newCompletionSet.add(currentCompletion);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (LAST.hasValue()) {
|
||||
if (i > (size_t) LAST.getValue()) {
|
||||
newCompletionSet->add(currentCompletion);
|
||||
newCompletionSet.add(currentCompletion);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
int ci = currentCompletion->getI();
|
||||
int cj = currentCompletion->getJ();
|
||||
int ck = currentCompletion->getK();
|
||||
int ci = currentCompletion.getI();
|
||||
int cj = currentCompletion.getJ();
|
||||
int ck = currentCompletion.getK();
|
||||
|
||||
if (I.hasValue() && (!(I.getValue() == ci) )) {
|
||||
newCompletionSet->add(currentCompletion);
|
||||
newCompletionSet.add(currentCompletion);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (J.hasValue() && (!(J.getValue() == cj) )) {
|
||||
newCompletionSet->add(currentCompletion);
|
||||
newCompletionSet.add(currentCompletion);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (K.hasValue() && (!(K.getValue() == ck) )) {
|
||||
newCompletionSet->add(currentCompletion);
|
||||
newCompletionSet.add(currentCompletion);
|
||||
continue;
|
||||
}
|
||||
|
||||
CompletionPtr newCompletion = std::make_shared<Completion>(currentCompletion, wellPi);
|
||||
newCompletionSet->add(newCompletion);
|
||||
newCompletionSet.add( Completion{ currentCompletion, wellPi } );
|
||||
}
|
||||
|
||||
well->addCompletionSet(currentStep, newCompletionSet);
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -762,9 +758,8 @@ namespace Opm {
|
||||
for( auto* well : getWells( wellNamePattern ) ) {
|
||||
|
||||
if(haveCompletionData){
|
||||
CompletionSetConstPtr currentCompletionSet = well->getCompletions(currentStep);
|
||||
|
||||
CompletionSetPtr newCompletionSet(new CompletionSet( ));
|
||||
const auto& currentCompletionSet = well->getCompletions(currentStep);
|
||||
CompletionSet newCompletionSet;
|
||||
|
||||
Opm::Value<int> I = getValueItem(record.getItem("I"));
|
||||
Opm::Value<int> J = getValueItem(record.getItem("J"));
|
||||
@@ -777,51 +772,51 @@ namespace Opm {
|
||||
throw std::exception();
|
||||
}
|
||||
|
||||
size_t completionSize = currentCompletionSet->size();
|
||||
size_t completionSize = currentCompletionSet.size();
|
||||
|
||||
for(size_t i = 0; i < completionSize;i++) {
|
||||
|
||||
CompletionConstPtr currentCompletion = currentCompletionSet->get(i);
|
||||
const auto& currentCompletion = currentCompletionSet.get(i);
|
||||
|
||||
if (C1.hasValue()) {
|
||||
if (i < (size_t) C1.getValue()) {
|
||||
newCompletionSet->add(currentCompletion);
|
||||
newCompletionSet.add(currentCompletion);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (C2.hasValue()) {
|
||||
if (i > (size_t) C2.getValue()) {
|
||||
newCompletionSet->add(currentCompletion);
|
||||
newCompletionSet.add(currentCompletion);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
int ci = currentCompletion->getI();
|
||||
int cj = currentCompletion->getJ();
|
||||
int ck = currentCompletion->getK();
|
||||
int ci = currentCompletion.getI();
|
||||
int cj = currentCompletion.getJ();
|
||||
int ck = currentCompletion.getK();
|
||||
|
||||
if (I.hasValue() && (!(I.getValue() == ci) )) {
|
||||
newCompletionSet->add(currentCompletion);
|
||||
newCompletionSet.add(currentCompletion);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (J.hasValue() && (!(J.getValue() == cj) )) {
|
||||
newCompletionSet->add(currentCompletion);
|
||||
newCompletionSet.add(currentCompletion);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (K.hasValue() && (!(K.getValue() == ck) )) {
|
||||
newCompletionSet->add(currentCompletion);
|
||||
newCompletionSet.add(currentCompletion);
|
||||
continue;
|
||||
}
|
||||
|
||||
WellCompletion::StateEnum completionStatus = WellCompletion::StateEnumFromString(record.getItem("STATUS").getTrimmedString(0));
|
||||
CompletionPtr newCompletion = std::make_shared<Completion>(currentCompletion, completionStatus);
|
||||
newCompletionSet->add(newCompletion);
|
||||
newCompletionSet.add( { currentCompletion, completionStatus } );
|
||||
}
|
||||
|
||||
well->addCompletionSet(currentStep, newCompletionSet);
|
||||
m_events.addEvent(ScheduleEvents::COMPLETION_CHANGE, currentStep);
|
||||
if (newCompletionSet->allCompletionsShut())
|
||||
if (newCompletionSet.allCompletionsShut())
|
||||
updateWellStatus( *well, currentStep, WellCommon::StatusEnum::SHUT);
|
||||
|
||||
}
|
||||
@@ -1206,7 +1201,7 @@ namespace Opm {
|
||||
for( const auto pair : completions ) {
|
||||
auto& well = *this->m_wells.get( pair.first );
|
||||
well.addCompletions( currentStep, pair.second );
|
||||
if (well.getCompletions( currentStep )->allCompletionsShut()) {
|
||||
if (well.getCompletions( currentStep ).allCompletionsShut()) {
|
||||
std::string msg =
|
||||
"All completions in well " + well.name() + " is shut at " + std::to_string ( m_timeMap->getTimePassedUntil(currentStep) / (60*60*24) ) + " days. \n" +
|
||||
"The well is therefore also shut.";
|
||||
@@ -1238,11 +1233,9 @@ namespace Opm {
|
||||
const auto& current_segmentSet = well.getSegmentSet(currentStep);
|
||||
Compsegs::processCOMPSEGS(compsegs_vector, current_segmentSet);
|
||||
|
||||
CompletionSetConstPtr current_completionSet = well.getCompletions(currentStep);
|
||||
// it is necessary to update the segment related information for some completions.
|
||||
CompletionSetPtr new_completionSet = CompletionSetPtr(current_completionSet->shallowCopy());
|
||||
Compsegs::updateCompletionsWithSegment(compsegs_vector, *new_completionSet);
|
||||
|
||||
auto new_completionSet = well.getCompletions( currentStep );
|
||||
Compsegs::updateCompletionsWithSegment(compsegs_vector, new_completionSet);
|
||||
well.addCompletionSet(currentStep, new_completionSet);
|
||||
}
|
||||
|
||||
@@ -1569,10 +1562,10 @@ namespace Opm {
|
||||
size_t Schedule::getMaxNumCompletionsForWells(size_t timestep) const {
|
||||
size_t ncwmax = 0;
|
||||
for( const auto* wellPtr : getWells() ) {
|
||||
CompletionSetConstPtr completionsSetPtr = wellPtr->getCompletions(timestep);
|
||||
const auto& completions = wellPtr->getCompletions(timestep);
|
||||
|
||||
if (completionsSetPtr->size() > ncwmax )
|
||||
ncwmax = completionsSetPtr->size();
|
||||
if( completions.size() > ncwmax )
|
||||
ncwmax = completions.size();
|
||||
|
||||
}
|
||||
return ncwmax;
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace Opm {
|
||||
m_guideRatePhase(new DynamicState<GuideRate::GuideRatePhaseEnum>(*timeMap, GuideRate::UNDEFINED)),
|
||||
m_guideRateScalingFactor(new DynamicState<double>(*timeMap, 1.0)),
|
||||
m_isProducer(new DynamicState<int>(*timeMap, true)) ,
|
||||
m_completions( new DynamicState<CompletionSetConstPtr>( *timeMap , CompletionSetConstPtr( new CompletionSet()) )),
|
||||
m_completions( new DynamicState< std::shared_ptr< const CompletionSet > >( *timeMap, std::make_shared< const CompletionSet >() ) ),
|
||||
m_productionProperties( new DynamicState<WellProductionProperties>(*timeMap, WellProductionProperties() )),
|
||||
m_injectionProperties( new DynamicState<WellInjectionProperties>(*timeMap, WellInjectionProperties() )),
|
||||
m_polymerProperties( new DynamicState<WellPolymerProperties>(*timeMap, WellPolymerProperties() )),
|
||||
@@ -195,7 +195,7 @@ namespace Opm {
|
||||
}
|
||||
|
||||
bool Well::setStatus(size_t timeStep, WellCommon::StatusEnum status) {
|
||||
if ((WellCommon::StatusEnum::OPEN == status) && getCompletions(timeStep)->allCompletionsShut()) {
|
||||
if ((WellCommon::StatusEnum::OPEN == status) && getCompletions(timeStep).allCompletionsShut()) {
|
||||
m_messages.note("When handling keyword for well " + name() + ": Cannot open a well where all completions are shut");
|
||||
return false;
|
||||
} else
|
||||
@@ -269,10 +269,10 @@ namespace Opm {
|
||||
void Well::setRefDepthFromCompletions() const {
|
||||
size_t timeStep = m_creationTimeStep;
|
||||
while (true) {
|
||||
auto completions = getCompletions( timeStep );
|
||||
if (completions->size() > 0) {
|
||||
auto firstCompletion = completions->get(0);
|
||||
m_refDepth.setValue( firstCompletion->getCenterDepth() );
|
||||
const auto& completions = getCompletions( timeStep );
|
||||
if (completions.size() > 0) {
|
||||
auto firstCompletion = completions.get(0);
|
||||
m_refDepth.setValue( firstCompletion.getCenterDepth() );
|
||||
break;
|
||||
} else {
|
||||
timeStep++;
|
||||
@@ -287,32 +287,31 @@ namespace Opm {
|
||||
return m_preferredPhase;
|
||||
}
|
||||
|
||||
CompletionSetConstPtr Well::getCompletions(size_t timeStep) const {
|
||||
return m_completions->get( timeStep );
|
||||
const CompletionSet& Well::getCompletions(size_t timeStep) const {
|
||||
return *m_completions->get( timeStep );
|
||||
}
|
||||
|
||||
CompletionSetConstPtr Well::getCompletions() const {
|
||||
return m_completions->back();
|
||||
const CompletionSet& Well::getCompletions() const {
|
||||
return *m_completions->back();
|
||||
}
|
||||
|
||||
void Well::addCompletions(size_t time_step , const std::vector<CompletionPtr>& newCompletions) {
|
||||
CompletionSetConstPtr currentCompletionSet = m_completions->get(time_step);
|
||||
CompletionSetPtr newCompletionSet = CompletionSetPtr( currentCompletionSet->shallowCopy() );
|
||||
void Well::addCompletions(size_t time_step, std::vector< Completion > newCompletions ) {
|
||||
auto new_set = this->getCompletions( time_step );
|
||||
|
||||
for (size_t ic = 0; ic < newCompletions.size(); ic++) {
|
||||
newCompletions[ic]->fixDefaultIJ( m_headI , m_headJ );
|
||||
newCompletionSet->add( newCompletions[ic] );
|
||||
for( auto& completion : newCompletions ) {
|
||||
completion.fixDefaultIJ( m_headI , m_headJ );
|
||||
new_set.add( std::move( completion ) );
|
||||
}
|
||||
|
||||
addCompletionSet( time_step , newCompletionSet);
|
||||
this->addCompletionSet( time_step, new_set );
|
||||
}
|
||||
|
||||
void Well::addCompletionSet(size_t time_step, const CompletionSetConstPtr newCompletionSet){
|
||||
CompletionSetPtr mutable_copy(newCompletionSet->shallowCopy());
|
||||
if (getWellCompletionOrdering() == WellCompletion::TRACK) {
|
||||
mutable_copy->orderCompletions(m_headI, m_headJ);
|
||||
void Well::addCompletionSet(size_t time_step, CompletionSet new_set ){
|
||||
if( getWellCompletionOrdering() == WellCompletion::TRACK) {
|
||||
new_set.orderCompletions(m_headI, m_headJ);
|
||||
}
|
||||
m_completions->update(time_step, mutable_copy);
|
||||
|
||||
m_completions->update( time_step, std::make_shared< CompletionSet >( std::move( new_set ) ) );
|
||||
}
|
||||
|
||||
const std::string Well::getGroupName(size_t time_step) const {
|
||||
|
||||
@@ -78,10 +78,11 @@ namespace Opm {
|
||||
bool isProducer(size_t timeStep) const;
|
||||
bool isInjector(size_t timeStep) const;
|
||||
void addWELSPECS(const DeckRecord& deckRecord);
|
||||
void addCompletions(size_t time_step , const std::vector<std::shared_ptr< Completion >>& newCompletions);
|
||||
void addCompletionSet(size_t time_step, const std::shared_ptr< const CompletionSet > newCompletionSet);
|
||||
std::shared_ptr< const CompletionSet > getCompletions(size_t timeStep) const;
|
||||
std::shared_ptr< const CompletionSet > getCompletions( ) const;
|
||||
|
||||
void addCompletions(size_t time_step, std::vector< Completion > );
|
||||
void addCompletionSet(size_t time_step, CompletionSet );
|
||||
const CompletionSet& getCompletions(size_t timeStep) const;
|
||||
const CompletionSet& getCompletions() const;
|
||||
|
||||
/* The rate of a given phase under the following assumptions:
|
||||
* * Returns zero if production is requested for an injector (and vice
|
||||
|
||||
@@ -37,6 +37,17 @@
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
|
||||
|
||||
|
||||
namespace Opm {
|
||||
inline std::ostream& operator<<( std::ostream& stream, const Completion& c ) {
|
||||
return stream << "(" << c.getI() << "," << c.getJ() << "," << c.getK() << ")";
|
||||
}
|
||||
|
||||
inline std::ostream& operator<<( std::ostream& stream, const CompletionSet& cs ) {
|
||||
stream << "{ ";
|
||||
for( const auto& c : cs ) stream << c << " ";
|
||||
return stream << "}";
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(CreateCompletionSetOK) {
|
||||
Opm::CompletionSet completionSet;
|
||||
@@ -47,29 +58,29 @@ BOOST_AUTO_TEST_CASE(CreateCompletionSetOK) {
|
||||
|
||||
BOOST_AUTO_TEST_CASE(AddCompletionSizeCorrect) {
|
||||
Opm::CompletionSet completionSet;
|
||||
Opm::CompletionConstPtr completion1(new Opm::Completion(10,10,10,0.0,Opm::WellCompletion::OPEN , Opm::Value<double>("ConnectionTransmissibilityFactor",99.88), Opm::Value<double>("D",22.33), Opm::Value<double>("SKIN",33.22)));
|
||||
Opm::CompletionConstPtr completion2(new Opm::Completion(11,10,10,0.0,Opm::WellCompletion::OPEN , Opm::Value<double>("ConnectionTransmissibilityFactor",99.88), Opm::Value<double>("D",22.33), Opm::Value<double>("SKIN",33.22)));
|
||||
Opm::Completion completion1( 10,10,10,0.0,Opm::WellCompletion::OPEN , Opm::Value<double>("ConnectionTransmissibilityFactor",99.88), Opm::Value<double>("D",22.33), Opm::Value<double>("SKIN",33.22));
|
||||
Opm::Completion completion2( 11,10,10,0.0,Opm::WellCompletion::OPEN , Opm::Value<double>("ConnectionTransmissibilityFactor",99.88), Opm::Value<double>("D",22.33), Opm::Value<double>("SKIN",33.22));
|
||||
completionSet.add( completion1 );
|
||||
BOOST_CHECK_EQUAL( 1U , completionSet.size() );
|
||||
|
||||
completionSet.add( completion2 );
|
||||
BOOST_CHECK_EQUAL( 2U , completionSet.size() );
|
||||
|
||||
BOOST_CHECK_EQUAL( completion1 , completionSet.get(0));
|
||||
BOOST_CHECK_EQUAL( completion1 , completionSet.get(0) );
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(CompletionSetGetOutOfRangeThrows) {
|
||||
Opm::CompletionSet completionSet;
|
||||
Opm::CompletionConstPtr completion1(new Opm::Completion(10,10,10,0.0,Opm::WellCompletion::OPEN , Opm::Value<double>("ConnectionTransmissibilityFactor",99.88), Opm::Value<double>("D",22.33), Opm::Value<double>("SKIN",33.22)));
|
||||
Opm::CompletionConstPtr completion2(new Opm::Completion(11,10,10,0.0,Opm::WellCompletion::OPEN , Opm::Value<double>("ConnectionTransmissibilityFactor",99.88), Opm::Value<double>("D",22.33), Opm::Value<double>("SKIN",33.22)));
|
||||
Opm::Completion completion1( 10,10,10,0.0,Opm::WellCompletion::OPEN , Opm::Value<double>("ConnectionTransmissibilityFactor",99.88), Opm::Value<double>("D",22.33), Opm::Value<double>("SKIN",33.22));
|
||||
Opm::Completion completion2( 11,10,10,0.0,Opm::WellCompletion::OPEN , Opm::Value<double>("ConnectionTransmissibilityFactor",99.88), Opm::Value<double>("D",22.33), Opm::Value<double>("SKIN",33.22));
|
||||
completionSet.add( completion1 );
|
||||
BOOST_CHECK_EQUAL( 1U , completionSet.size() );
|
||||
|
||||
completionSet.add( completion2 );
|
||||
BOOST_CHECK_EQUAL( 2U , completionSet.size() );
|
||||
|
||||
BOOST_CHECK_THROW( completionSet.get(10) , std::range_error );
|
||||
BOOST_CHECK_THROW( completionSet.get(10) , std::out_of_range );
|
||||
}
|
||||
|
||||
|
||||
@@ -77,8 +88,8 @@ BOOST_AUTO_TEST_CASE(CompletionSetGetOutOfRangeThrows) {
|
||||
|
||||
BOOST_AUTO_TEST_CASE(AddCompletionSameCellUpdates) {
|
||||
Opm::CompletionSet completionSet;
|
||||
Opm::CompletionConstPtr completion1(new Opm::Completion(10,10,10,0.0, Opm::WellCompletion::OPEN , Opm::Value<double>("ConnectionTransmissibilityFactor",99.88), Opm::Value<double>("D",22.33), Opm::Value<double>("SKIN",33.22)));
|
||||
Opm::CompletionConstPtr completion2(new Opm::Completion(10,10,10,0.0,Opm::WellCompletion::SHUT , Opm::Value<double>("ConnectionTransmissibilityFactor",99.88), Opm::Value<double>("D",22.33), Opm::Value<double>("SKIN",33.22)));
|
||||
Opm::Completion completion1( 10,10,10,0.0, Opm::WellCompletion::OPEN , Opm::Value<double>("ConnectionTransmissibilityFactor",99.88), Opm::Value<double>("D",22.33), Opm::Value<double>("SKIN",33.22));
|
||||
Opm::Completion completion2( 10,10,10,0.0,Opm::WellCompletion::SHUT , Opm::Value<double>("ConnectionTransmissibilityFactor",99.88), Opm::Value<double>("D",22.33), Opm::Value<double>("SKIN",33.22));
|
||||
|
||||
|
||||
completionSet.add( completion1 );
|
||||
@@ -93,19 +104,19 @@ BOOST_AUTO_TEST_CASE(AddCompletionSameCellUpdates) {
|
||||
BOOST_AUTO_TEST_CASE(AddCompletionShallowCopy) {
|
||||
Opm::CompletionSet completionSet;
|
||||
|
||||
Opm::CompletionConstPtr completion1(new Opm::Completion(10,10,10,0.0, Opm::WellCompletion::OPEN , Opm::Value<double>("ConnectionTransmissibilityFactor",99.88), Opm::Value<double>("D",22.33), Opm::Value<double>("SKIN",33.22)));
|
||||
Opm::CompletionConstPtr completion2(new Opm::Completion(10,10,11,0.0, Opm::WellCompletion::SHUT , Opm::Value<double>("ConnectionTransmissibilityFactor",99.88), Opm::Value<double>("D",22.33), Opm::Value<double>("SKIN",33.22)));
|
||||
Opm::CompletionConstPtr completion3(new Opm::Completion(10,10,12,0.0, Opm::WellCompletion::SHUT , Opm::Value<double>("ConnectionTransmissibilityFactor",99.88), Opm::Value<double>("D",22.33), Opm::Value<double>("SKIN",33.22)));
|
||||
Opm::Completion completion1( 10,10,10,0.0, Opm::WellCompletion::OPEN , Opm::Value<double>("ConnectionTransmissibilityFactor",99.88), Opm::Value<double>("D",22.33), Opm::Value<double>("SKIN",33.22));
|
||||
Opm::Completion completion2( 10,10,11,0.0, Opm::WellCompletion::SHUT , Opm::Value<double>("ConnectionTransmissibilityFactor",99.88), Opm::Value<double>("D",22.33), Opm::Value<double>("SKIN",33.22));
|
||||
Opm::Completion completion3( 10,10,12,0.0, Opm::WellCompletion::SHUT , Opm::Value<double>("ConnectionTransmissibilityFactor",99.88), Opm::Value<double>("D",22.33), Opm::Value<double>("SKIN",33.22));
|
||||
|
||||
completionSet.add( completion1 );
|
||||
completionSet.add( completion2 );
|
||||
completionSet.add( completion3 );
|
||||
BOOST_CHECK_EQUAL( 3U , completionSet.size() );
|
||||
|
||||
Opm::CompletionSetConstPtr copy = Opm::CompletionSetConstPtr( completionSet.shallowCopy() );
|
||||
BOOST_CHECK_EQUAL( 3U , copy->size() );
|
||||
auto copy = completionSet;
|
||||
BOOST_CHECK_EQUAL( 3U , copy.size() );
|
||||
|
||||
BOOST_CHECK_EQUAL( completion1 , copy->get(0));
|
||||
BOOST_CHECK_EQUAL( completion2 , copy->get(1));
|
||||
BOOST_CHECK_EQUAL( completion3 , copy->get(2));
|
||||
BOOST_CHECK_EQUAL( completion1 , copy.get(0));
|
||||
BOOST_CHECK_EQUAL( completion2 , copy.get(1));
|
||||
BOOST_CHECK_EQUAL( completion3 , copy.get(2));
|
||||
}
|
||||
|
||||
@@ -451,67 +451,36 @@ BOOST_AUTO_TEST_CASE(CreateScheduleDeckWellsAndCompletionDataWithWELOPEN) {
|
||||
DeckPtr deck = createDeckWithWellsAndCompletionDataWithWELOPEN();
|
||||
Schedule schedule(ParseContext() , grid , deck );
|
||||
auto* well = schedule.getWell("OP_1");
|
||||
size_t currentStep = 0;
|
||||
BOOST_CHECK_EQUAL(WellCommon::StatusEnum::SHUT, well->getStatus(currentStep));
|
||||
currentStep = 3;
|
||||
BOOST_CHECK_EQUAL(WellCommon::StatusEnum::SHUT, well->getStatus(currentStep));
|
||||
BOOST_CHECK_EQUAL(WellCommon::StatusEnum::SHUT, well->getStatus( 0 ));
|
||||
BOOST_CHECK_EQUAL(WellCommon::StatusEnum::SHUT, well->getStatus( 3 ));
|
||||
|
||||
well = schedule.getWell("OP_2");
|
||||
CompletionSetConstPtr completionSet = well->getCompletions(currentStep);
|
||||
const auto& cs = well->getCompletions( 3 );
|
||||
|
||||
size_t index = 3;
|
||||
CompletionConstPtr completion = completionSet->get(index);
|
||||
BOOST_CHECK_EQUAL(WellCompletion::StateEnum::SHUT, completion->getState());
|
||||
index = 4;
|
||||
completion = completionSet->get(index);
|
||||
BOOST_CHECK_EQUAL(WellCompletion::StateEnum::SHUT, completion->getState());
|
||||
index = 5;
|
||||
completion = completionSet->get(index);
|
||||
BOOST_CHECK_EQUAL(WellCompletion::StateEnum::SHUT, completion->getState());
|
||||
index = 6;
|
||||
completion = completionSet->get(index);
|
||||
BOOST_CHECK_EQUAL(WellCompletion::StateEnum::OPEN, completion->getState());
|
||||
BOOST_CHECK_EQUAL(WellCompletion::StateEnum::SHUT, cs.get( 3 ).getState());
|
||||
BOOST_CHECK_EQUAL(WellCompletion::StateEnum::SHUT, cs.get( 4 ).getState());
|
||||
BOOST_CHECK_EQUAL(WellCompletion::StateEnum::SHUT, cs.get( 5 ).getState());
|
||||
BOOST_CHECK_EQUAL(WellCompletion::StateEnum::OPEN, cs.get( 6 ).getState());
|
||||
|
||||
currentStep = 4;
|
||||
completionSet = well->getCompletions(currentStep);
|
||||
index = 3;
|
||||
completion = completionSet->get(index);
|
||||
BOOST_CHECK_EQUAL(WellCompletion::StateEnum::OPEN, completion->getState());
|
||||
index = 4;
|
||||
completion = completionSet->get(index);
|
||||
BOOST_CHECK_EQUAL(WellCompletion::StateEnum::OPEN, completion->getState());
|
||||
index = 5;
|
||||
completion = completionSet->get(index);
|
||||
BOOST_CHECK_EQUAL(WellCompletion::StateEnum::OPEN, completion->getState());
|
||||
index = 6;
|
||||
completion = completionSet->get(index);
|
||||
BOOST_CHECK_EQUAL(WellCompletion::StateEnum::OPEN, completion->getState());
|
||||
const auto& cs2 = well->getCompletions( 4 );
|
||||
BOOST_CHECK_EQUAL(WellCompletion::StateEnum::OPEN, cs2.get( 3 ).getState());
|
||||
BOOST_CHECK_EQUAL(WellCompletion::StateEnum::OPEN, cs2.get( 4 ).getState());
|
||||
BOOST_CHECK_EQUAL(WellCompletion::StateEnum::OPEN, cs2.get( 5 ).getState());
|
||||
BOOST_CHECK_EQUAL(WellCompletion::StateEnum::OPEN, cs2.get( 6 ).getState());
|
||||
|
||||
well = schedule.getWell("OP_3");
|
||||
currentStep = 3;
|
||||
completionSet = well->getCompletions(currentStep);
|
||||
const auto& cs3 = well->getCompletions( 3 );
|
||||
|
||||
index = 0;
|
||||
completion = completionSet->get(index);
|
||||
BOOST_CHECK_EQUAL(WellCompletion::StateEnum::SHUT, completion->getState());
|
||||
BOOST_CHECK_EQUAL(WellCompletion::StateEnum::SHUT, cs3.get( 0 ).getState());
|
||||
|
||||
currentStep = 4;
|
||||
completionSet = well->getCompletions(currentStep);
|
||||
const auto& cs4 = well->getCompletions( 4 );
|
||||
|
||||
index = 0;
|
||||
completion = completionSet->get(index);
|
||||
BOOST_CHECK_EQUAL(WellCompletion::StateEnum::OPEN, completion->getState());
|
||||
BOOST_CHECK_EQUAL(WellCompletion::StateEnum::OPEN, cs4.get( 0 ).getState());
|
||||
|
||||
well = schedule.getWell("OP_1");
|
||||
|
||||
currentStep = 3;
|
||||
BOOST_CHECK_EQUAL(WellCommon::StatusEnum::SHUT, well->getStatus(currentStep));
|
||||
|
||||
currentStep = 4;
|
||||
BOOST_CHECK_EQUAL(WellCommon::StatusEnum::OPEN, well->getStatus(currentStep));
|
||||
|
||||
currentStep = 5;
|
||||
BOOST_CHECK_EQUAL(WellCommon::StatusEnum::SHUT, well->getStatus(currentStep));
|
||||
BOOST_CHECK_EQUAL(WellCommon::StatusEnum::SHUT, well->getStatus( 3 ));
|
||||
BOOST_CHECK_EQUAL(WellCommon::StatusEnum::OPEN, well->getStatus( 4 ));
|
||||
BOOST_CHECK_EQUAL(WellCommon::StatusEnum::SHUT, well->getStatus( 5 ));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(CreateScheduleDeckWithWELOPEN_TryToOpenWellWithShutCompletionsDoNotOpenWell) {
|
||||
@@ -973,33 +942,20 @@ BOOST_AUTO_TEST_CASE(createDeckWithWPIMULT) {
|
||||
Schedule schedule(parseContext , grid, deck );
|
||||
auto* well = schedule.getWell("OP_1");
|
||||
|
||||
size_t currentStep = 2;
|
||||
CompletionSetConstPtr currentCompletionSet = well->getCompletions(currentStep);
|
||||
size_t completionSize = currentCompletionSet->size();
|
||||
|
||||
for(size_t i = 0; i < completionSize;i++) {
|
||||
CompletionConstPtr currentCompletion = currentCompletionSet->get(i);
|
||||
BOOST_CHECK_EQUAL(currentCompletion->getWellPi(), 1.3);
|
||||
const auto& cs2 = well->getCompletions( 2 );
|
||||
for(size_t i = 0; i < cs2.size(); i++) {
|
||||
BOOST_CHECK_EQUAL(cs2.get( i ).getWellPi(), 1.3);
|
||||
}
|
||||
|
||||
currentStep = 3;
|
||||
currentCompletionSet = well->getCompletions(currentStep);
|
||||
completionSize = currentCompletionSet->size();
|
||||
|
||||
for(size_t i = 0; i < completionSize;i++) {
|
||||
CompletionConstPtr currentCompletion = currentCompletionSet->get(i);
|
||||
BOOST_CHECK_EQUAL(currentCompletion->getWellPi(), (1.3*1.3));
|
||||
const auto& cs3 = well->getCompletions( 3 );
|
||||
for(size_t i = 0; i < cs3.size(); i++ ) {
|
||||
BOOST_CHECK_EQUAL(cs3.get( i ).getWellPi(), (1.3*1.3));
|
||||
}
|
||||
|
||||
currentStep = 4;
|
||||
currentCompletionSet = well->getCompletions(currentStep);
|
||||
completionSize = currentCompletionSet->size();
|
||||
|
||||
for(size_t i = 0; i < completionSize;i++) {
|
||||
CompletionConstPtr currentCompletion = currentCompletionSet->get(i);
|
||||
BOOST_CHECK_EQUAL(currentCompletion->getWellPi(), 1.0);
|
||||
const auto& cs4 = well->getCompletions( 4 );
|
||||
for(size_t i = 0; i < cs4.size(); i++ ) {
|
||||
BOOST_CHECK_EQUAL(cs4.get( i ).getWellPi(), 1.0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(createDeckWithDRSDT) {
|
||||
|
||||
@@ -49,6 +49,12 @@ static std::shared_ptr< Opm::TimeMap > createXDaysTimeMap(size_t numDays) {
|
||||
return timeMap;
|
||||
}
|
||||
|
||||
namespace Opm {
|
||||
inline std::ostream& operator<<( std::ostream& stream, const Completion& c ) {
|
||||
return stream << "(" << c.getI() << "," << c.getJ() << "," << c.getK() << ")";
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(CreateWell_CorrectNameAndDefaultValues) {
|
||||
auto timeMap = createXDaysTimeMap(10);
|
||||
Opm::Well well("WELL1" , 0, 0, Opm::Value<double>("REF_DEPTH"), Opm::Phase::OIL, timeMap , 0);
|
||||
@@ -193,14 +199,12 @@ BOOST_AUTO_TEST_CASE(WellCOMPDATtestTRACK) {
|
||||
auto* op_1 = schedule.getWell("OP_1");
|
||||
|
||||
size_t timestep = 2;
|
||||
Opm::CompletionSetConstPtr completions = op_1->getCompletions( timestep );
|
||||
BOOST_CHECK_EQUAL((size_t)9 , completions->size());
|
||||
const auto& completions = op_1->getCompletions( timestep );
|
||||
BOOST_CHECK_EQUAL(9U, completions.size());
|
||||
|
||||
//Verify TRACK completion ordering
|
||||
Opm::CompletionConstPtr completion;
|
||||
for (size_t k = 0; k<completions->size(); ++k) {
|
||||
completion = completions->get(k);
|
||||
BOOST_CHECK_EQUAL((size_t)completion->getK(), k);
|
||||
for (size_t k = 0; k < completions.size(); ++k) {
|
||||
BOOST_CHECK_EQUAL(completions.get( k ).getK(), k);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -234,14 +238,12 @@ BOOST_AUTO_TEST_CASE(WellCOMPDATtestDefaultTRACK) {
|
||||
auto* op_1 = schedule.getWell("OP_1");
|
||||
|
||||
size_t timestep = 2;
|
||||
Opm::CompletionSetConstPtr completions = op_1->getCompletions( timestep );
|
||||
BOOST_CHECK_EQUAL((size_t)9 , completions->size());
|
||||
const auto& completions = op_1->getCompletions( timestep );
|
||||
BOOST_CHECK_EQUAL(9U, completions.size());
|
||||
|
||||
//Verify TRACK completion ordering
|
||||
Opm::CompletionConstPtr completion;
|
||||
for (size_t k = 0; k<completions->size(); ++k) {
|
||||
completion = completions->get(k);
|
||||
BOOST_CHECK_EQUAL((size_t)completion->getK(), k);
|
||||
for (size_t k = 0; k < completions.size(); ++k) {
|
||||
BOOST_CHECK_EQUAL(completions.get( k ).getK(), k);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -277,46 +279,25 @@ BOOST_AUTO_TEST_CASE(WellCOMPDATtestINPUT) {
|
||||
auto* op_1 = schedule.getWell("OP_1");
|
||||
|
||||
size_t timestep = 2;
|
||||
Opm::CompletionSetConstPtr completions = op_1->getCompletions( timestep );
|
||||
BOOST_CHECK_EQUAL((size_t)9 , completions->size());
|
||||
const auto& completions = op_1->getCompletions( timestep );
|
||||
BOOST_CHECK_EQUAL(9U, completions.size());
|
||||
|
||||
//Verify INPUT completion ordering
|
||||
Opm::CompletionConstPtr completion;
|
||||
{
|
||||
completion = completions->get(0);
|
||||
BOOST_CHECK_EQUAL(completion->getK(), 0);
|
||||
|
||||
completion = completions->get(1);
|
||||
BOOST_CHECK_EQUAL(completion->getK(), 2);
|
||||
|
||||
completion = completions->get(2);
|
||||
BOOST_CHECK_EQUAL(completion->getK(), 3);
|
||||
|
||||
completion = completions->get(3);
|
||||
BOOST_CHECK_EQUAL(completion->getK(), 4);
|
||||
|
||||
completion = completions->get(4);
|
||||
BOOST_CHECK_EQUAL(completion->getK(), 5);
|
||||
|
||||
completion = completions->get(5);
|
||||
BOOST_CHECK_EQUAL(completion->getK(), 6);
|
||||
|
||||
completion = completions->get(6);
|
||||
BOOST_CHECK_EQUAL(completion->getK(), 7);
|
||||
|
||||
completion = completions->get(7);
|
||||
BOOST_CHECK_EQUAL(completion->getK(), 8);
|
||||
|
||||
completion = completions->get(8);
|
||||
BOOST_CHECK_EQUAL(completion->getK(), 1);
|
||||
}
|
||||
BOOST_CHECK_EQUAL(completions.get( 0 ).getK(), 0);
|
||||
BOOST_CHECK_EQUAL(completions.get( 1 ).getK(), 2);
|
||||
BOOST_CHECK_EQUAL(completions.get( 2 ).getK(), 3);
|
||||
BOOST_CHECK_EQUAL(completions.get( 3 ).getK(), 4);
|
||||
BOOST_CHECK_EQUAL(completions.get( 4 ).getK(), 5);
|
||||
BOOST_CHECK_EQUAL(completions.get( 5 ).getK(), 6);
|
||||
BOOST_CHECK_EQUAL(completions.get( 6 ).getK(), 7);
|
||||
BOOST_CHECK_EQUAL(completions.get( 7 ).getK(), 8);
|
||||
BOOST_CHECK_EQUAL(completions.get( 8 ).getK(), 1);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(NewWellZeroCompletions) {
|
||||
auto timeMap = createXDaysTimeMap(10);
|
||||
Opm::Well well("WELL1" , 0, 0, Opm::Value<double>("REF_DEPTH"), Opm::Phase::OIL, timeMap , 0);
|
||||
Opm::CompletionSetConstPtr completions = well.getCompletions( 0 );
|
||||
BOOST_CHECK_EQUAL( 0U , completions->size());
|
||||
BOOST_CHECK_EQUAL( 0U , well.getCompletions( 0 ).size() );
|
||||
}
|
||||
|
||||
|
||||
@@ -324,19 +305,18 @@ BOOST_AUTO_TEST_CASE(UpdateCompletions) {
|
||||
auto timeMap = createXDaysTimeMap(10);
|
||||
|
||||
Opm::Well well("WELL1" , 0, 0, Opm::Value<double>("REF_DEPTH"), Opm::Phase::OIL, timeMap , 0);
|
||||
Opm::CompletionSetConstPtr completions = well.getCompletions( 0 );
|
||||
BOOST_CHECK_EQUAL( 0U , completions->size());
|
||||
const auto& completions = well.getCompletions( 0 );
|
||||
BOOST_CHECK_EQUAL( 0U , completions.size());
|
||||
|
||||
std::vector<Opm::CompletionPtr> newCompletions;
|
||||
std::vector<Opm::CompletionPtr> newCompletions2;
|
||||
Opm::CompletionPtr comp1(new Opm::Completion( 10 , 10 , 10 , 10,Opm::WellCompletion::AUTO , Opm::Value<double>("ConnectionTransmissibilityFactor",99.88), Opm::Value<double>("D",22.33), Opm::Value<double>("SKIN",33.22)));
|
||||
Opm::CompletionPtr comp2(new Opm::Completion( 10 , 10 , 11 , 11,Opm::WellCompletion::SHUT , Opm::Value<double>("ConnectionTransmissibilityFactor",99.88), Opm::Value<double>("D",22.33), Opm::Value<double>("SKIN",33.22)));
|
||||
Opm::CompletionPtr comp3(new Opm::Completion( 10 , 10 , 12 , 12,Opm::WellCompletion::OPEN , Opm::Value<double>("ConnectionTransmissibilityFactor",99.88), Opm::Value<double>("D",22.33), Opm::Value<double>("SKIN",33.22)));
|
||||
Opm::CompletionPtr comp4(new Opm::Completion( 10 , 10 , 12 , 12,Opm::WellCompletion::SHUT , Opm::Value<double>("ConnectionTransmissibilityFactor",99.88), Opm::Value<double>("D",22.33), Opm::Value<double>("SKIN",33.22)));
|
||||
Opm::CompletionPtr comp5(new Opm::Completion( 10 , 10 , 13 , 13,Opm::WellCompletion::OPEN , Opm::Value<double>("ConnectionTransmissibilityFactor",99.88), Opm::Value<double>("D",22.33), Opm::Value<double>("SKIN",33.22)));
|
||||
Opm::Completion comp1( 10 , 10 , 10 , 10,Opm::WellCompletion::AUTO , Opm::Value<double>("ConnectionTransmissibilityFactor",99.88), Opm::Value<double>("D",22.33), Opm::Value<double>("SKIN",33.22));
|
||||
Opm::Completion comp2( 10 , 10 , 11 , 11,Opm::WellCompletion::SHUT , Opm::Value<double>("ConnectionTransmissibilityFactor",99.88), Opm::Value<double>("D",22.33), Opm::Value<double>("SKIN",33.22));
|
||||
Opm::Completion comp3( 10 , 10 , 12 , 12,Opm::WellCompletion::OPEN , Opm::Value<double>("ConnectionTransmissibilityFactor",99.88), Opm::Value<double>("D",22.33), Opm::Value<double>("SKIN",33.22));
|
||||
Opm::Completion comp4( 10 , 10 , 12 , 12,Opm::WellCompletion::SHUT , Opm::Value<double>("ConnectionTransmissibilityFactor",99.88), Opm::Value<double>("D",22.33), Opm::Value<double>("SKIN",33.22));
|
||||
Opm::Completion comp5( 10 , 10 , 13 , 13,Opm::WellCompletion::OPEN , Opm::Value<double>("ConnectionTransmissibilityFactor",99.88), Opm::Value<double>("D",22.33), Opm::Value<double>("SKIN",33.22));
|
||||
|
||||
//std::vector<Opm::CompletionConstPtr> newCompletions2{ comp4 , comp5}; Newer c++
|
||||
|
||||
std::vector< Opm::Completion > newCompletions, newCompletions2;
|
||||
newCompletions.push_back( comp1 );
|
||||
newCompletions.push_back( comp2 );
|
||||
newCompletions.push_back( comp3 );
|
||||
@@ -346,34 +326,27 @@ BOOST_AUTO_TEST_CASE(UpdateCompletions) {
|
||||
|
||||
BOOST_CHECK_EQUAL( 3U , newCompletions.size());
|
||||
well.addCompletions( 5 , newCompletions );
|
||||
completions = well.getCompletions( 5 );
|
||||
BOOST_CHECK_EQUAL( 3U , completions->size());
|
||||
BOOST_CHECK_EQUAL( comp3 , completions->get(2));
|
||||
BOOST_CHECK_EQUAL( 3U , well.getCompletions( 5 ).size());
|
||||
BOOST_CHECK_EQUAL( comp3 , well.getCompletions( 5 ).get(2));
|
||||
|
||||
well.addCompletions( 6 , newCompletions2 );
|
||||
|
||||
completions = well.getCompletions( 6 );
|
||||
BOOST_CHECK_EQUAL( 4U , completions->size());
|
||||
BOOST_CHECK_EQUAL( comp4 , completions->get(2));
|
||||
|
||||
BOOST_CHECK_EQUAL( 4U , well.getCompletions( 6 ).size());
|
||||
BOOST_CHECK_EQUAL( comp4 , well.getCompletions( 6 ).get(2));
|
||||
}
|
||||
|
||||
Opm::CompletionPtr completion(const size_t i, const size_t j, const size_t k);
|
||||
|
||||
// Helper function for CompletionOrder test.
|
||||
Opm::CompletionPtr completion(const size_t i, const size_t j, const size_t k)
|
||||
{
|
||||
return std::make_shared<Opm::Completion>(i, j, k,
|
||||
k*1.0,
|
||||
Opm::WellCompletion::AUTO,
|
||||
Opm::Value<double>("ConnectionTransmissibilityFactor",99.88),
|
||||
Opm::Value<double>("D",22.33),
|
||||
Opm::Value<double>("SKIN",33.22),
|
||||
Opm::WellCompletion::DirectionEnum::Z);
|
||||
inline Opm::Completion completion( int i, int j, int k ) {
|
||||
return Opm::Completion{ i, j, k,
|
||||
k*1.0,
|
||||
Opm::WellCompletion::AUTO,
|
||||
Opm::Value<double>("ConnectionTransmissibilityFactor",99.88),
|
||||
Opm::Value<double>("D",22.33),
|
||||
Opm::Value<double>("SKIN",33.22),
|
||||
Opm::WellCompletion::DirectionEnum::Z };
|
||||
}
|
||||
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(CompletionOrder) {
|
||||
auto timeMap = createXDaysTimeMap(10);
|
||||
{
|
||||
@@ -383,13 +356,13 @@ BOOST_AUTO_TEST_CASE(CompletionOrder) {
|
||||
auto c2 = completion(5, 5, 9);
|
||||
auto c3 = completion(5, 5, 1);
|
||||
auto c4 = completion(5, 5, 0);
|
||||
std::vector<Opm::CompletionPtr> cv1 = { c1, c2 };
|
||||
std::vector< Opm::Completion > cv1 = { c1, c2 };
|
||||
well.addCompletions(1, cv1);
|
||||
BOOST_CHECK_EQUAL(well.getCompletions(1)->get(0), c1);
|
||||
std::vector<Opm::CompletionPtr> cv2 = { c3, c4 };
|
||||
BOOST_CHECK_EQUAL(well.getCompletions(1).get(0), c1);
|
||||
std::vector< Opm::Completion > cv2 = { c3, c4 };
|
||||
well.addCompletions(2, cv2);
|
||||
BOOST_CHECK_EQUAL(well.getCompletions(1)->get(0), c1);
|
||||
BOOST_CHECK_EQUAL(well.getCompletions(2)->get(0), c4);
|
||||
BOOST_CHECK_EQUAL(well.getCompletions(1).get(0), c1);
|
||||
BOOST_CHECK_EQUAL(well.getCompletions(2).get(0), c4);
|
||||
}
|
||||
|
||||
{
|
||||
@@ -401,31 +374,31 @@ BOOST_AUTO_TEST_CASE(CompletionOrder) {
|
||||
auto c4 = completion(9, 5, 8);
|
||||
auto c5 = completion(8, 5, 9);
|
||||
auto c6 = completion(5, 5, 4);
|
||||
std::vector<Opm::CompletionPtr> cv1 = { c1, c2 };
|
||||
std::vector<Opm::Completion> cv1 = { c1, c2 };
|
||||
well.addCompletions(1, cv1);
|
||||
BOOST_CHECK_EQUAL(well.getCompletions(1)->get(0), c2);
|
||||
std::vector<Opm::CompletionPtr> cv2 = { c3, c4, c5 };
|
||||
BOOST_CHECK_EQUAL(well.getCompletions(1).get(0), c2);
|
||||
std::vector<Opm::Completion> cv2 = { c3, c4, c5 };
|
||||
well.addCompletions(2, cv2);
|
||||
BOOST_CHECK_EQUAL(well.getCompletions(1)->get(0), c2);
|
||||
BOOST_CHECK_EQUAL(well.getCompletions(2)->get(0), c2);
|
||||
BOOST_CHECK_EQUAL(well.getCompletions(2)->get(1), c1);
|
||||
BOOST_CHECK_EQUAL(well.getCompletions(2)->get(2), c3);
|
||||
BOOST_CHECK_EQUAL(well.getCompletions(2)->get(3), c5);
|
||||
BOOST_CHECK_EQUAL(well.getCompletions(2)->get(4), c4);
|
||||
std::vector<Opm::CompletionPtr> cv3 = { c6 };
|
||||
BOOST_CHECK_EQUAL(well.getCompletions(1).get(0), c2);
|
||||
BOOST_CHECK_EQUAL(well.getCompletions(2).get(0), c2);
|
||||
BOOST_CHECK_EQUAL(well.getCompletions(2).get(1), c1);
|
||||
BOOST_CHECK_EQUAL(well.getCompletions(2).get(2), c3);
|
||||
BOOST_CHECK_EQUAL(well.getCompletions(2).get(3), c5);
|
||||
BOOST_CHECK_EQUAL(well.getCompletions(2).get(4), c4);
|
||||
std::vector<Opm::Completion> cv3 = { c6 };
|
||||
well.addCompletions(3, cv3);
|
||||
BOOST_CHECK_EQUAL(well.getCompletions(1)->get(0), c2);
|
||||
BOOST_CHECK_EQUAL(well.getCompletions(2)->get(0), c2);
|
||||
BOOST_CHECK_EQUAL(well.getCompletions(2)->get(1), c1);
|
||||
BOOST_CHECK_EQUAL(well.getCompletions(2)->get(2), c3);
|
||||
BOOST_CHECK_EQUAL(well.getCompletions(2)->get(3), c5);
|
||||
BOOST_CHECK_EQUAL(well.getCompletions(2)->get(4), c4);
|
||||
BOOST_CHECK_EQUAL(well.getCompletions(3)->get(0), c6);
|
||||
BOOST_CHECK_EQUAL(well.getCompletions(3)->get(1), c2);
|
||||
BOOST_CHECK_EQUAL(well.getCompletions(3)->get(2), c1);
|
||||
BOOST_CHECK_EQUAL(well.getCompletions(3)->get(3), c3);
|
||||
BOOST_CHECK_EQUAL(well.getCompletions(3)->get(4), c5);
|
||||
BOOST_CHECK_EQUAL(well.getCompletions(3)->get(5), c4);
|
||||
BOOST_CHECK_EQUAL(well.getCompletions(1).get(0), c2);
|
||||
BOOST_CHECK_EQUAL(well.getCompletions(2).get(0), c2);
|
||||
BOOST_CHECK_EQUAL(well.getCompletions(2).get(1), c1);
|
||||
BOOST_CHECK_EQUAL(well.getCompletions(2).get(2), c3);
|
||||
BOOST_CHECK_EQUAL(well.getCompletions(2).get(3), c5);
|
||||
BOOST_CHECK_EQUAL(well.getCompletions(2).get(4), c4);
|
||||
BOOST_CHECK_EQUAL(well.getCompletions(3).get(0), c6);
|
||||
BOOST_CHECK_EQUAL(well.getCompletions(3).get(1), c2);
|
||||
BOOST_CHECK_EQUAL(well.getCompletions(3).get(2), c1);
|
||||
BOOST_CHECK_EQUAL(well.getCompletions(3).get(3), c3);
|
||||
BOOST_CHECK_EQUAL(well.getCompletions(3).get(4), c5);
|
||||
BOOST_CHECK_EQUAL(well.getCompletions(3).get(5), c4);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -610,8 +583,8 @@ BOOST_AUTO_TEST_CASE(WellStatus) {
|
||||
|
||||
Opm::Well well("WELL1" , 0, 0, Opm::Value<double>("REF_DEPTH"), Opm::Phase::OIL, timeMap , 0);
|
||||
|
||||
std::vector<Opm::CompletionPtr> newCompletions;
|
||||
Opm::CompletionPtr comp1(new Opm::Completion( 10 , 10 , 10 , 0.25 , Opm::WellCompletion::OPEN , Opm::Value<double>("ConnectionTransmissibilityFactor",99.88), Opm::Value<double>("D",22.33), Opm::Value<double>("SKIN",33.22)));
|
||||
std::vector<Opm::Completion> newCompletions;
|
||||
Opm::Completion comp1(10 , 10 , 10 , 0.25 , Opm::WellCompletion::OPEN , Opm::Value<double>("ConnectionTransmissibilityFactor",99.88), Opm::Value<double>("D",22.33), Opm::Value<double>("SKIN",33.22));
|
||||
|
||||
newCompletions.push_back( comp1 );
|
||||
|
||||
|
||||
@@ -236,9 +236,9 @@ inline void keywordC( std::vector< ERT::smspec_node >& list,
|
||||
* over a well's completions regardless of the desired block is
|
||||
* defaulted or not
|
||||
*/
|
||||
for( const auto& completion : *well->getCompletions( last_timestep ) ) {
|
||||
for( const auto& completion : well->getCompletions( last_timestep ) ) {
|
||||
/* block coordinates defaulted */
|
||||
auto cijk = getijk( *completion );
|
||||
auto cijk = getijk( completion );
|
||||
|
||||
if( record.getItem( 1 ).defaultApplied( 0 ) ) {
|
||||
list.emplace_back( keywordstring, name, dims.data(), cijk.data() );
|
||||
|
||||
@@ -95,6 +95,14 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
bool operator==( const Value& rhs ) const {
|
||||
return this->equal( rhs );
|
||||
}
|
||||
|
||||
bool operator!=( const Value& rhs ) const {
|
||||
return !(*this == rhs );
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
@@ -53,33 +53,33 @@ BOOST_AUTO_TEST_CASE( CreateCompletionsFromKeyword ) {
|
||||
BOOST_CHECK_EQUAL( 5U , completions.find("W_2")->second.size() );
|
||||
BOOST_CHECK_EQUAL( 5U , completions.find("W_3")->second.size() );
|
||||
|
||||
std::vector<CompletionPtr> W_3Completions = completions.find("W_3")->second;
|
||||
std::vector<Completion> W_3Completions = completions.find("W_3")->second;
|
||||
|
||||
CompletionConstPtr completion0 = W_3Completions[0];
|
||||
CompletionConstPtr completion4 = W_3Completions[4];
|
||||
const auto& completion0 = W_3Completions[0];
|
||||
const auto& completion4 = W_3Completions[4];
|
||||
|
||||
BOOST_CHECK_EQUAL( 2 , completion0->getI() );
|
||||
BOOST_CHECK_EQUAL( 7 , completion0->getJ() );
|
||||
BOOST_CHECK_EQUAL( 0 , completion0->getK() );
|
||||
BOOST_CHECK_EQUAL( WellCompletion::OPEN , completion0->getState() );
|
||||
BOOST_CHECK_EQUAL( 3.1726851851851847e-12 , completion0->getConnectionTransmissibilityFactor() );
|
||||
BOOST_CHECK_EQUAL( WellCompletion::DirectionEnum::Y, completion0->getDirection() );
|
||||
BOOST_CHECK_EQUAL( 2 , completion0.getI() );
|
||||
BOOST_CHECK_EQUAL( 7 , completion0.getJ() );
|
||||
BOOST_CHECK_EQUAL( 0 , completion0.getK() );
|
||||
BOOST_CHECK_EQUAL( WellCompletion::OPEN , completion0.getState() );
|
||||
BOOST_CHECK_EQUAL( 3.1726851851851847e-12 , completion0.getConnectionTransmissibilityFactor() );
|
||||
BOOST_CHECK_EQUAL( WellCompletion::DirectionEnum::Y, completion0.getDirection() );
|
||||
|
||||
BOOST_CHECK_EQUAL( 2 , completion4->getI() );
|
||||
BOOST_CHECK_EQUAL( 6 , completion4->getJ() );
|
||||
BOOST_CHECK_EQUAL( 3 , completion4->getK() );
|
||||
BOOST_CHECK_EQUAL( WellCompletion::OPEN , completion4->getState() );
|
||||
BOOST_CHECK_EQUAL( 5.4722222222222212e-13 , completion4->getConnectionTransmissibilityFactor() );
|
||||
BOOST_CHECK_EQUAL( WellCompletion::DirectionEnum::Y, completion4->getDirection() );
|
||||
BOOST_CHECK_EQUAL( 2 , completion4.getI() );
|
||||
BOOST_CHECK_EQUAL( 6 , completion4.getJ() );
|
||||
BOOST_CHECK_EQUAL( 3 , completion4.getK() );
|
||||
BOOST_CHECK_EQUAL( WellCompletion::OPEN , completion4.getState() );
|
||||
BOOST_CHECK_EQUAL( 5.4722222222222212e-13 , completion4.getConnectionTransmissibilityFactor() );
|
||||
BOOST_CHECK_EQUAL( WellCompletion::DirectionEnum::Y, completion4.getDirection() );
|
||||
|
||||
|
||||
// Check that wells with all completions shut is also itself shut
|
||||
const Well* well1 = schedule.getWell("W_1");
|
||||
BOOST_CHECK (!well1->getCompletions(0)->allCompletionsShut());
|
||||
BOOST_CHECK (!well1->getCompletions(0).allCompletionsShut());
|
||||
BOOST_CHECK_EQUAL (well1->getStatus(0) , WellCommon::StatusEnum::OPEN);
|
||||
|
||||
const Well* well2 = schedule.getWell("W_2");
|
||||
BOOST_CHECK (well2->getCompletions(0)->allCompletionsShut());
|
||||
BOOST_CHECK (well2->getCompletions(0).allCompletionsShut());
|
||||
BOOST_CHECK_EQUAL (well2->getStatus(0) , WellCommon::StatusEnum::SHUT);
|
||||
|
||||
|
||||
|
||||
@@ -289,20 +289,18 @@ BOOST_AUTO_TEST_CASE(WellTestCOMPDAT) {
|
||||
{
|
||||
auto* well1 = sched->getWell("W_1");
|
||||
BOOST_CHECK_CLOSE(13000/Metric::Time , well1->getProductionPropertiesCopy(8).OilRate , 0.0001);
|
||||
CompletionSetConstPtr completions = well1->getCompletions(0);
|
||||
BOOST_CHECK_EQUAL(0U, completions->size());
|
||||
BOOST_CHECK_EQUAL(0U, well1->getCompletions( 0 ).size() );
|
||||
|
||||
completions = well1->getCompletions(3);
|
||||
BOOST_CHECK_EQUAL(4U, completions->size());
|
||||
const auto& completions = well1->getCompletions(3);
|
||||
BOOST_CHECK_EQUAL(4U, completions.size());
|
||||
|
||||
BOOST_CHECK_EQUAL(WellCompletion::OPEN, completions->get(3)->getState());
|
||||
BOOST_CHECK_EQUAL(2.2836805555555556e-12 , completions->get(3)->getConnectionTransmissibilityFactor());
|
||||
BOOST_CHECK_EQUAL(0.311/Metric::Length, completions->get(3)->getDiameter());
|
||||
BOOST_CHECK_EQUAL(3.3, completions->get(3)->getSkinFactor());
|
||||
BOOST_CHECK_EQUAL(WellCompletion::OPEN, completions.get(3).getState());
|
||||
BOOST_CHECK_EQUAL(2.2836805555555556e-12 , completions.get(3).getConnectionTransmissibilityFactor());
|
||||
BOOST_CHECK_EQUAL(0.311/Metric::Length, completions.get(3).getDiameter());
|
||||
BOOST_CHECK_EQUAL(3.3, completions.get(3).getSkinFactor());
|
||||
|
||||
completions = well1->getCompletions(7);
|
||||
BOOST_CHECK_EQUAL(4U, completions->size());
|
||||
BOOST_CHECK_EQUAL(WellCompletion::SHUT, completions->get(3)->getState());
|
||||
BOOST_CHECK_EQUAL(4U, well1->getCompletions( 7 ).size() );
|
||||
BOOST_CHECK_EQUAL(WellCompletion::SHUT, well1->getCompletions( 7 ).get( 3 ).getState() );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -663,9 +661,9 @@ COMPDAT \n\
|
||||
EclipseGrid grid(30,30,10);
|
||||
SchedulePtr sched(new Schedule(parseContext , grid , deck));
|
||||
const auto* well = sched->getWell("W1");
|
||||
CompletionSetConstPtr completions = well->getCompletions(0);
|
||||
BOOST_CHECK_EQUAL( 10 , completions->get(0)->getI() );
|
||||
BOOST_CHECK_EQUAL( 20 , completions->get(0)->getJ() );
|
||||
const auto& completions = well->getCompletions(0);
|
||||
BOOST_CHECK_EQUAL( 10 , completions.get(0).getI() );
|
||||
BOOST_CHECK_EQUAL( 20 , completions.get(0).getJ() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user