Added completionSet as DynamicState<> property to the Well Object
This commit is contained in:
@@ -24,11 +24,16 @@
|
||||
#include <opm/parser/eclipse/Deck/DeckRecord.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/DynamicState.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Well.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/CompletionSet.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Completion.hpp>
|
||||
|
||||
namespace Opm {
|
||||
|
||||
Well::Well(const std::string& name, TimeMapConstPtr timeMap)
|
||||
: m_oilRate(new DynamicState<double>(timeMap, 0.0)), m_inPredictionMode(new DynamicState<bool>(timeMap, true)) {
|
||||
Well::Well(const std::string& name , TimeMapConstPtr timeMap)
|
||||
: m_oilRate( new DynamicState<double>( timeMap , 0.0)) ,
|
||||
m_inPredictionMode(new DynamicState<bool>(timeMap, true)),
|
||||
m_completions( new DynamicState<CompletionSetConstPtr>( timeMap , CompletionSetConstPtr( new CompletionSet()) ))
|
||||
{
|
||||
m_name = name;
|
||||
}
|
||||
|
||||
@@ -62,6 +67,20 @@ namespace Opm {
|
||||
|
||||
}
|
||||
|
||||
CompletionSetConstPtr Well::getCompletions(size_t timeStep) {
|
||||
return m_completions->get( timeStep );
|
||||
}
|
||||
|
||||
void Well::addCompletions(size_t time_step , const std::vector<CompletionConstPtr>& newCompletions) {
|
||||
CompletionSetConstPtr currentCompletionSet = m_completions->get(time_step);
|
||||
CompletionSetPtr newCompletionSet = CompletionSetPtr( currentCompletionSet->shallowCopy() );
|
||||
|
||||
for (size_t ic = 0; ic < newCompletions.size(); ic++)
|
||||
newCompletionSet->add( newCompletions[ic] );
|
||||
|
||||
m_completions->add( time_step , newCompletionSet);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/TimeMap.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/DynamicState.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/CompletionSet.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Completion.hpp>
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <string>
|
||||
@@ -39,12 +41,13 @@ namespace Opm {
|
||||
bool isInPredictionMode(size_t timeStep) const;
|
||||
void setInPredictionMode(size_t timeStep, bool isInPredictionMode);
|
||||
void addWELSPECS(DeckRecordConstPtr deckRecord);
|
||||
|
||||
void addCompletions(size_t time_step , const std::vector<CompletionConstPtr>& newCompletions);
|
||||
CompletionSetConstPtr getCompletions(size_t timeStep);
|
||||
private:
|
||||
std::string m_name;
|
||||
boost::shared_ptr<DynamicState<double> > m_oilRate;
|
||||
boost::shared_ptr<DynamicState<bool> > m_inPredictionMode;
|
||||
|
||||
boost::shared_ptr<DynamicState<CompletionSetConstPtr> > m_completions;
|
||||
};
|
||||
typedef boost::shared_ptr<Well> WellPtr;
|
||||
typedef boost::shared_ptr<const Well> WellConstPtr;
|
||||
|
||||
@@ -64,3 +64,51 @@ BOOST_AUTO_TEST_CASE(setPredictionMode_ModeSetCorrect) {
|
||||
BOOST_CHECK_EQUAL(false , well.isInPredictionMode( 5 ));
|
||||
BOOST_CHECK_EQUAL(false , well.isInPredictionMode( 8 ));
|
||||
}
|
||||
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(NewWellZeroCompletions) {
|
||||
Opm::TimeMapPtr timeMap = createXDaysTimeMap(10);
|
||||
Opm::Well well("WELL1" , timeMap);
|
||||
Opm::CompletionSetConstPtr completions = well.getCompletions( 0 );
|
||||
BOOST_CHECK_EQUAL( 0U , completions->size());
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(UpdateCompletions) {
|
||||
Opm::TimeMapPtr timeMap = createXDaysTimeMap(10);
|
||||
Opm::Well well("WELL1" , timeMap);
|
||||
Opm::CompletionSetConstPtr completions = well.getCompletions( 0 );
|
||||
BOOST_CHECK_EQUAL( 0U , completions->size());
|
||||
|
||||
std::vector<Opm::CompletionConstPtr> newCompletions;
|
||||
std::vector<Opm::CompletionConstPtr> newCompletions2;
|
||||
Opm::CompletionConstPtr comp1(new Opm::Completion( 10 , 10 , 10 , Opm::AUTO , 99.0));
|
||||
Opm::CompletionConstPtr comp2(new Opm::Completion( 10 , 11 , 10 , Opm::SHUT , 99.0));
|
||||
Opm::CompletionConstPtr comp3(new Opm::Completion( 10 , 10 , 12 , Opm::OPEN , 99.0));
|
||||
Opm::CompletionConstPtr comp4(new Opm::Completion( 10 , 10 , 12 , Opm::SHUT , 99.0));
|
||||
Opm::CompletionConstPtr comp5(new Opm::Completion( 10 , 10 , 13 , Opm::OPEN , 99.0));
|
||||
|
||||
//std::vector<Opm::CompletionConstPtr> newCompletions2{ comp4 , comp5}; Newer c++
|
||||
|
||||
newCompletions.push_back( comp1 );
|
||||
newCompletions.push_back( comp2 );
|
||||
newCompletions.push_back( comp3 );
|
||||
|
||||
newCompletions2.push_back( comp4 );
|
||||
newCompletions2.push_back( comp5 );
|
||||
|
||||
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));
|
||||
|
||||
well.addCompletions( 6 , newCompletions2 );
|
||||
|
||||
completions = well.getCompletions( 6 );
|
||||
BOOST_CHECK_EQUAL( 4U , completions->size());
|
||||
BOOST_CHECK_EQUAL( comp4 , completions->get(2));
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user