mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
adding isProducer() and isProjector() to wellNode class.
Did not see type() function there, while it should still be a okay idea.
This commit is contained in:
parent
7926a58fae
commit
86e41a8937
@ -701,7 +701,7 @@ namespace Opm
|
|||||||
// Report on our rates.
|
// Report on our rates.
|
||||||
const int np = phaseUsage().num_phases;
|
const int np = phaseUsage().num_phases;
|
||||||
for (int phase = 0; phase < np; ++phase) {
|
for (int phase = 0; phase < np; ++phase) {
|
||||||
if (wells_->type[self_index_] == INJECTOR) {
|
if (isInjector()) {
|
||||||
summed_phases.res_inj_rates[phase] = well_reservoirrates_phase[np*self_index_ + phase];
|
summed_phases.res_inj_rates[phase] = well_reservoirrates_phase[np*self_index_ + phase];
|
||||||
summed_phases.surf_inj_rates[phase] = well_surfacerates_phase[np*self_index_ + phase];
|
summed_phases.surf_inj_rates[phase] = well_surfacerates_phase[np*self_index_ + phase];
|
||||||
} else {
|
} else {
|
||||||
@ -711,7 +711,6 @@ namespace Opm
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check constraints.
|
// Check constraints.
|
||||||
bool is_producer = (wells_->type[self_index_] == PRODUCER);
|
|
||||||
const WellControls * ctrls = wells_->ctrls[self_index_];
|
const WellControls * ctrls = wells_->ctrls[self_index_];
|
||||||
for (int ctrl_index = 0; ctrl_index < well_controls_get_num(ctrls); ++ctrl_index) {
|
for (int ctrl_index = 0; ctrl_index < well_controls_get_num(ctrls); ++ctrl_index) {
|
||||||
if (ctrl_index == well_controls_get_current(ctrls) || ctrl_index == group_control_index_) {
|
if (ctrl_index == well_controls_get_current(ctrls) || ctrl_index == group_control_index_) {
|
||||||
@ -725,7 +724,7 @@ namespace Opm
|
|||||||
case BHP: {
|
case BHP: {
|
||||||
const double my_well_bhp = well_bhp[self_index_];
|
const double my_well_bhp = well_bhp[self_index_];
|
||||||
const double my_target_bhp = well_controls_iget_target( ctrls , ctrl_index);
|
const double my_target_bhp = well_controls_iget_target( ctrls , ctrl_index);
|
||||||
ctrl_violated = is_producer ? (my_target_bhp > my_well_bhp)
|
ctrl_violated = isProducer() ? (my_target_bhp > my_well_bhp)
|
||||||
: (my_target_bhp < my_well_bhp);
|
: (my_target_bhp < my_well_bhp);
|
||||||
if (ctrl_violated) {
|
if (ctrl_violated) {
|
||||||
OpmLog::info("BHP limit violated for well " + name() + ":\n"
|
OpmLog::info("BHP limit violated for well " + name() + ":\n"
|
||||||
@ -859,7 +858,7 @@ namespace Opm
|
|||||||
// && (injSpec().control_mode_ != InjectionSpecification::GRUP && injSpec().control_mode_ != InjectionSpecification::NONE)) {
|
// && (injSpec().control_mode_ != InjectionSpecification::GRUP && injSpec().control_mode_ != InjectionSpecification::NONE)) {
|
||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
if (wells_->type[self_index_] != INJECTOR) {
|
if ( !isInjector() ) {
|
||||||
assert(target == 0.0);
|
assert(target == 0.0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -904,7 +903,7 @@ namespace Opm
|
|||||||
double WellNode::getTotalProductionFlow(const std::vector<double>& phase_flows,
|
double WellNode::getTotalProductionFlow(const std::vector<double>& phase_flows,
|
||||||
const BlackoilPhases::PhaseIndex phase)
|
const BlackoilPhases::PhaseIndex phase)
|
||||||
{
|
{
|
||||||
if (type() == INJECTOR) {
|
if (isInjector()) {
|
||||||
return 0.0;
|
return 0.0;
|
||||||
}
|
}
|
||||||
return phase_flows[self_index_*phaseUsage().num_phases + phaseUsage().phase_pos[phase]];
|
return phase_flows[self_index_*phaseUsage().num_phases + phaseUsage().phase_pos[phase]];
|
||||||
@ -938,7 +937,7 @@ namespace Opm
|
|||||||
std::cout << "Returning" << std::endl;
|
std::cout << "Returning" << std::endl;
|
||||||
return;
|
return;
|
||||||
} */
|
} */
|
||||||
if (wells_->type[self_index_] != PRODUCER) {
|
if ( !isProducer() ) {
|
||||||
// assert(target == 0.0);
|
// assert(target == 0.0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1056,6 +1055,19 @@ namespace Opm
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// Returing whether the well is a producer
|
||||||
|
bool WellNode::isProducer() const
|
||||||
|
{
|
||||||
|
return (type() == PRODUCER);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Returing whether the well is a injector
|
||||||
|
bool WellNode::isInjector() const
|
||||||
|
{
|
||||||
|
return (type() == INJECTOR);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -420,6 +420,10 @@ namespace Opm
|
|||||||
const std::vector<double>& well_surfacerates_phase);
|
const std::vector<double>& well_surfacerates_phase);
|
||||||
int groupControlIndex() const;
|
int groupControlIndex() const;
|
||||||
|
|
||||||
|
bool isProducer() const;
|
||||||
|
|
||||||
|
bool isInjector() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Wells* wells_;
|
Wells* wells_;
|
||||||
int self_index_;
|
int self_index_;
|
||||||
|
Loading…
Reference in New Issue
Block a user