modified the group control interface slightly

This commit is contained in:
Kjetil Olsen Lye 2012-04-13 20:41:09 +02:00
parent c9a866fce0
commit b1c5fa5aca
4 changed files with 32 additions and 10 deletions

View File

@ -77,7 +77,11 @@ int main(int argc, char** argv) {
pressure_solver.solve(totmob, omega, src, wdp, bcs.c_bcs(), pressure, face_flux, well_bhp, well_rate_per_cell); pressure_solver.solve(totmob, omega, src, wdp, bcs.c_bcs(), pressure, face_flux, well_bhp, well_rate_per_cell);
std::cout << "Solved" << std::endl; std::cout << "Solved" << std::endl;
for(size_t i = 0; i < well_rate_per_cell.size(); i++) {
std::cout << well_rate_per_cell[i] << std::endl;
}
std::vector<double> well_rate; std::vector<double> well_rate;
computeFlowRatePerWell(*wells.c_wells(), well_rate_per_cell, well_rate); computeFlowRatePerWell(*wells.c_wells(), well_rate_per_cell, well_rate);
if(wells.wellCollection().conditionsMet(well_bhp, well_rate, *grid.c_grid(), state.saturation() )) { if(wells.wellCollection().conditionsMet(well_bhp, well_rate, *grid.c_grid(), state.saturation() )) {
std::cout << "Conditions met for wells!" << std::endl; std::cout << "Conditions met for wells!" << std::endl;

View File

@ -19,6 +19,7 @@ namespace Opm
ControlMode control_mode_; ControlMode control_mode_;
double surface_flow_max_rate_; double surface_flow_max_rate_;
double reinjection_fraction_target_; double reinjection_fraction_target_;
double fluid_volume_max_rate_;
double BHP_limit_; double BHP_limit_;
}; };
} }

View File

@ -6,6 +6,7 @@
*/ */
#include <opm/core/WellsGroup.hpp> #include <opm/core/WellsGroup.hpp>
#include <cmath>
namespace Opm namespace Opm
{ {
@ -152,24 +153,38 @@ namespace Opm
} }
} }
std::cout << "checking here" << std::endl;
// Check for self: // Check for self:
if (wells_->type[self_index_] == PRODUCER) { if (wells_->type[self_index_] == PRODUCER) {
if (well_rate[self_index_] - prodSpec().BHP_limit_ > epsilon) { double bhp_diff = well_bhp[self_index_] - prodSpec().BHP_limit_;
return false; double rate_diff = well_rate[self_index_] - prodSpec().fluid_volume_max_rate_;
switch(*wells_->ctrls[self_index_]->type) {
case BHP:
bhp_diff = std::abs(bhp_diff);
break;
case RATE:
rate_diff = std::abs(rate_diff);
break;
} }
if(bhp_diff > epsilon || rate_diff > epsilon) {
if (well_rate[self_index_] - prodSpec().fluid_volume_max_rate_ > epsilon) {
return false; return false;
} }
} else { } else {
if (well_rate[self_index_] - injSpec().BHP_limit_ > epsilon) { double bhp_diff = well_bhp[self_index_] - injSpec().BHP_limit_;
return false; double flow_diff = well_rate[self_index_] - injSpec().fluid_volume_max_rate_;
} switch(*wells_->ctrls[self_index_]->type) {
case BHP:
if (well_rate[self_index_] - injSpec().surface_flow_max_rate_ > epsilon) { bhp_diff = std::abs(bhp_diff);
break;
case RATE:
flow_diff = std::abs(flow_diff);
break;
}
if(bhp_diff > epsilon || flow_diff > epsilon) {
return false; return false;
} }
} }
return true; return true;
} }
@ -326,6 +341,7 @@ namespace Opm
injection_specification.injector_type_ = toSurfaceComponent(line.injector_type_); injection_specification.injector_type_ = toSurfaceComponent(line.injector_type_);
injection_specification.control_mode_ = toInjectionControlMode(line.control_mode_); injection_specification.control_mode_ = toInjectionControlMode(line.control_mode_);
injection_specification.surface_flow_max_rate_ = line.surface_flow_max_rate_; injection_specification.surface_flow_max_rate_ = line.surface_flow_max_rate_;
injection_specification.fluid_volume_max_rate_ = line.fluid_volume_max_rate_;
} }
} }
} }

View File

@ -34,6 +34,7 @@ namespace Opm
/// Injection specifications for the well or well group. /// Injection specifications for the well or well group.
InjectionSpecification& injSpec(); InjectionSpecification& injSpec();
/// \returns true if the object is a leaf node (WellNode), false otherwise. /// \returns true if the object is a leaf node (WellNode), false otherwise.
virtual bool isLeafNode() const; virtual bool isLeafNode() const;