Removed unused saturation argument from conditionsMet() methods.

This commit is contained in:
Atgeirr Flø Rasmussen 2012-04-25 14:03:57 +02:00
parent eb35f02d85
commit 27af4b339d
6 changed files with 68 additions and 62 deletions

View File

@ -77,7 +77,7 @@ int main(int argc, char** argv) {
computeFlowRatePerWell(*wells.c_wells(), well_rate_per_cell, well_rate);
WellControlResult well_control_results;
wells.wellCollection().conditionsMet(well_bhp, well_rate, *grid.c_grid(), state.saturation(), well_control_results );
wells.wellCollection().conditionsMet(well_bhp, well_rate, *grid.c_grid(), well_control_results );
wells.applyControl(well_control_results);
#if 0

View File

@ -23,16 +23,9 @@ along with OpenRS. If not, see <http://www.gnu.org/licenses/>.
namespace Opm
{
WellCollection::WellCollection()
{
}
WellCollection::~WellCollection()
{
}
void WellCollection::addChild(std::string child_name, std::string parent_name,
const EclipseGridParser& deck)
void WellCollection::addChild(const std::string& child_name,
const std::string& parent_name,
const EclipseGridParser& deck)
{
WellsGroupInterface* parent = findNode(parent_name);
if (!parent) {
@ -100,11 +93,14 @@ namespace Opm
return NULL;
}
void WellCollection::conditionsMet(const std::vector<double>& well_bhp, const std::vector<double>& well_rate,
const UnstructuredGrid& grid, const std::vector<double>& saturations,
WellControlResult& result, double epsilon) const {
for(size_t i = 0; i < leaf_nodes_.size(); i++) {
static_cast<WellNode*>(leaf_nodes_[i].get())->conditionsMet(well_bhp, well_rate, grid, saturations, result, epsilon);
void WellCollection::conditionsMet(const std::vector<double>& well_bhp,
const std::vector<double>& well_rate,
const UnstructuredGrid& grid,
WellControlResult& result,
double epsilon) const
{
for (size_t i = 0; i < leaf_nodes_.size(); i++) {
static_cast<WellNode*>(leaf_nodes_[i].get())->conditionsMet(well_bhp, well_rate, grid, result, epsilon);
}
}
@ -114,4 +110,4 @@ namespace Opm
roots_[i]->calculateGuideRates();
}
}
}
}

View File

@ -33,17 +33,22 @@ namespace Opm
class WellCollection
{
public:
WellCollection();
virtual ~WellCollection();
/// Adds and creates if necessary the child to the collection
/// and appends it to parent's children. Also adds and creates the parent
/// if necessary.
/// \param[in] child name of child node
/// \param[in] parent name of parent node
/// \param[in] deck deck from which we will extract group control data
void addChild(const std::string& child,
const std::string& parent,
const EclipseGridParser& deck);
void addChild(std::string child, std::string parent,
const EclipseGridParser& deck);
void conditionsMet(const std::vector<double>& well_bhp, const std::vector<double>& well_rate,
const UnstructuredGrid& grid, const std::vector<double>& saturations,
/// Builds the WellControlResult object for the current well group hierachy.
void conditionsMet(const std::vector<double>& well_bhp,
const std::vector<double>& well_rate,
const UnstructuredGrid& grid,
WellControlResult& result,
double epsilon=1e-8) const;
const double epsilon=1e-8) const;
const std::vector<std::tr1::shared_ptr<WellsGroupInterface> >& getLeafNodes() const;

View File

@ -116,14 +116,17 @@ namespace Opm
}
void WellsGroup::conditionsMet(const std::vector<double>& well_bhp, const std::vector<double>& well_rate,
const UnstructuredGrid& grid, const std::vector<double>& saturations,
const struct Wells* wells, int index_of_well, WellControlResult& result,
double epsilon)
void WellsGroup::conditionsMet(const std::vector<double>& well_bhp,
const std::vector<double>& well_rate,
const UnstructuredGrid& grid,
const struct Wells* wells,
int index_of_well,
WellControlResult& result,
const double epsilon)
{
if (parent_ != NULL) {
(static_cast<WellsGroup*> (parent_))->conditionsMet(well_bhp,
well_rate,grid, saturations, wells, index_of_well, result, epsilon);
well_rate,grid, wells, index_of_well, result, epsilon);
}
int number_of_leaf_nodes = numberOfLeafNodes();
@ -197,20 +200,17 @@ namespace Opm
{
}
void WellNode::conditionsMet(const std::vector<double>& well_bhp, const std::vector<double>& well_rate,
const UnstructuredGrid& grid, const std::vector<double>& saturations,
WellControlResult& result, double epsilon)
void WellNode::conditionsMet(const std::vector<double>& well_bhp,
const std::vector<double>& well_rate,
const UnstructuredGrid& grid,
WellControlResult& result,
const double epsilon)
{
if (parent_ != NULL) {
(static_cast<WellsGroup*> (parent_))->conditionsMet(well_bhp,
well_rate,
grid,
saturations,
wells_,
self_index_,
result,
epsilon);
(static_cast<WellsGroup*> (parent_))
->conditionsMet(well_bhp, well_rate, grid, wells_,
self_index_, result, epsilon);
}
// Check for self:
@ -218,7 +218,7 @@ namespace Opm
double bhp_diff = well_bhp[self_index_] - prodSpec().BHP_limit_;
double rate_diff = well_rate[self_index_] - prodSpec().fluid_volume_max_rate_;
if(bhp_diff > epsilon) {
if (bhp_diff > epsilon) {
std::cout << "BHP exceeded, bhp_diff = " << bhp_diff << std::endl;
std::cout << "BHP_limit = " << prodSpec().BHP_limit_ << std::endl;
@ -231,7 +231,7 @@ namespace Opm
result.bhp_.push_back(info);
}
if(rate_diff > epsilon) {
if (rate_diff > epsilon) {
ExceedInformation info;
info.group_name_ = name();
info.surplus_ = rate_diff;
@ -244,7 +244,7 @@ namespace Opm
double rate_diff = well_rate[self_index_] - injSpec().fluid_volume_max_rate_;
if(bhp_diff > epsilon) {
if (bhp_diff > epsilon) {
std::cout << "BHP exceeded, bhp_diff = " << bhp_diff<<std::endl;
ExceedInformation info;
info.group_name_ = name();
@ -252,14 +252,14 @@ namespace Opm
info.well_index_ = self_index_;
result.bhp_.push_back(info);
}
if(rate_diff > epsilon) {
std::cout << "Flow diff exceeded, flow_diff = " << rate_diff << std::endl;
ExceedInformation info;
info.group_name_ = name();
info.surplus_ = rate_diff;
info.well_index_ = self_index_;
result.fluid_rate_.push_back(info);
}
if (rate_diff > epsilon) {
std::cout << "Flow diff exceeded, flow_diff = " << rate_diff << std::endl;
ExceedInformation info;
info.group_name_ = name();
info.surplus_ = rate_diff;
info.well_index_ = self_index_;
result.fluid_rate_.push_back(info);
}
}
}

View File

@ -21,8 +21,8 @@ namespace Opm
std::vector<ExceedInformation> oil_rate_;
std::vector<ExceedInformation> fluid_rate_;
std::vector<ExceedInformation> bhp_;
};
class WellsGroupInterface
{
public:
@ -86,12 +86,15 @@ namespace Opm
void addChild(std::tr1::shared_ptr<WellsGroupInterface> child);
void conditionsMet(const std::vector<double>& well_bhp, const std::vector<double>& well_rate,
const UnstructuredGrid& grid, const std::vector<double>& saturations, const struct Wells* wells,
int index_of_well, WellControlResult& result, double epsilon = 1e-8);
void conditionsMet(const std::vector<double>& well_bhp,
const std::vector<double>& well_rate,
const UnstructuredGrid& grid,
const struct Wells* wells,
int index_of_well,
WellControlResult& result,
double epsilon = 1e-8);
virtual void calculateGuideRates();
virtual int numberOfLeafNodes();
private:
@ -108,9 +111,11 @@ namespace Opm
InjectionSpecification inj_spec);
virtual WellsGroupInterface* findGroup(std::string name_of_node);
virtual void conditionsMet(const std::vector<double>& well_bhp, const std::vector<double>& well_rate,
const UnstructuredGrid& grid, const std::vector<double>& saturations,
WellControlResult& result, double epsilon=1e-8);
virtual void conditionsMet(const std::vector<double>& well_bhp,
const std::vector<double>& well_rate,
const UnstructuredGrid& grid,
WellControlResult& result,
double epsilon=1e-8);
virtual bool isLeafNode() const;
void setWellsPointer(const struct Wells* wells, int self_index);

View File

@ -586,7 +586,7 @@ namespace Opm
}
const double* zfrac = (well_data[w].type == INJECTOR) ? fracs[well_data[w].injected_phase] : 0;
// DIRTY DIRTY HACK
// DIRTY DIRTY HACK to temporarily make things work in spite of bugs in the deck reader.
if(well_data[w].type == INJECTOR && (well_data[w].injected_phase < 0 || well_data[w].injected_phase > 2)){
zfrac = fracs[WATER];
}