Add structs InjectionControls and ProductionControls

This commit is contained in:
Joakim Hove
2019-05-09 17:03:29 +02:00
parent 73667596fc
commit 51aee6e8cb
10 changed files with 177 additions and 0 deletions

View File

@@ -511,6 +511,8 @@ if(ENABLE_ECL_INPUT)
opm/parser/eclipse/EclipseState/Schedule/VFPInjTable.hpp
opm/parser/eclipse/EclipseState/Schedule/VFPProdTable.hpp
opm/parser/eclipse/EclipseState/Schedule/Well/Connection.hpp
opm/parser/eclipse/EclipseState/Schedule/Well/ProductionControls.hpp
opm/parser/eclipse/EclipseState/Schedule/Well/InjectionControls.hpp
opm/parser/eclipse/EclipseState/Schedule/Well/WellInjectionProperties.hpp
opm/parser/eclipse/EclipseState/Schedule/Well/Well2.hpp
opm/parser/eclipse/EclipseState/Schedule/Well/WList.hpp

View File

@@ -0,0 +1,49 @@
/*
Copyright 2019 Equinor ASA.
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef INJECTION_CONTROLS_HPP
#define INJECTION_CONTROLS_HPP
namespace Opm {
struct InjectionControls {
public:
InjectionControls(int controls) :
controls(controls)
{}
double bhp_limit;
double thp_limit;
WellInjector::TypeEnum injector_type;
WellInjector::ControlModeEnum cmode;
double surface_rate;
double reservoir_rate;
double temperature;
int vfp_table_number;
bool hasControl(WellInjector::ControlModeEnum cmode) const {
return (this->controls & cmode) != 0;
}
private:
int controls;
};
}
#endif

View File

@@ -0,0 +1,53 @@
/*
Copyright 2019 Equinor ASA.
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PRODUCTION_CONTROLS_HPP
#define PRODUCTION_CONTROLS_HPP
namespace Opm {
struct ProductionControls {
public:
ProductionControls(int controls) :
controls(controls)
{
}
WellProducer::ControlModeEnum cmode;
double oil_rate;
double water_rate;
double gas_rate;
double liquid_rate;
double resv_rate;
double bhp_history;
double thp_history;
double bhp_limit;
double thp_limit;
double alq_value;
int vfp_table_number;
bool hasControl(WellProducer::ControlModeEnum cmode) const {
return (this->controls & cmode) != 0;
}
private:
int controls;
};
}
#endif

View File

@@ -25,8 +25,11 @@
#include <opm/parser/eclipse/EclipseState/Runspec.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/SummaryState.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellConnections.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/MSW/WellSegments.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/ProductionControls.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/InjectionControls.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellTracerProperties.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellInjectionProperties.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellProductionProperties.hpp>
@@ -150,6 +153,8 @@ public:
void filterConnections(const EclipseGrid& grid);
void switchToInjector();
void switchToProducer();
ProductionControls productionControls(const SummaryState& st) const;
InjectionControls injectionControls(const SummaryState& st) const;
private:
std::string wname;
std::string group_name;

View File

@@ -23,11 +23,13 @@
#include <iosfwd>
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/InjectionControls.hpp>
namespace Opm {
class DeckRecord;
class UnitSystem;
class SummaryState;
struct WellInjectionProperties {
double surfaceInjectionRate;
@@ -70,6 +72,7 @@ namespace Opm {
void resetDefaultHistoricalBHPLimit();
void setBHPLimit(const double limit);
InjectionControls controls(const SummaryState& st) const;
};
std::ostream& operator<<( std::ostream&, const WellInjectionProperties& );

View File

@@ -25,10 +25,12 @@
#include <opm/parser/eclipse/EclipseState/Runspec.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/ProductionControls.hpp>
namespace Opm {
class DeckRecord;
class SummaryState;
class WellProductionProperties {
public:
@@ -77,6 +79,7 @@ namespace Opm {
void resetDefaultBHPLimit();
void clearControls();
ProductionControls controls(const SummaryState& st) const;
private:
int m_productionControls = 0;
void init_rates( const DeckRecord& record );

View File

@@ -677,5 +677,20 @@ bool Well2::wellNameInWellNamePattern(const std::string& wellName, const std::st
return wellNameInPattern;
}
ProductionControls Well2::productionControls(const SummaryState& st) const {
if (this->isProducer())
return this->production->controls(st);
else
throw std::logic_error("Trying to get production data from an injector");
}
InjectionControls Well2::injectionControls(const SummaryState& st) const {
if (!this->isProducer())
return this->injection->controls(st);
else
throw std::logic_error("Trying to get injection data from a producer");
}
}

View File

@@ -248,4 +248,20 @@ namespace Opm {
<< "control mode: " << wp.controlMode << " }";
}
InjectionControls WellInjectionProperties::controls(const SummaryState& st) const {
InjectionControls controls(this->injectionControls);
controls.surface_rate = this->surfaceInjectionRate;
controls.reservoir_rate = this->reservoirInjectionRate;
controls.bhp_limit = this->BHPLimit;
controls.thp_limit = this->THPLimit;
controls.temperature = this->temperature;
controls.injector_type = this->injectorType;
controls.cmode = this->controlMode;
controls.vfp_table_number = this->VFPTableNumber;
controls.injector_type = this->injectorType;
return controls;
}
}

View File

@@ -267,4 +267,25 @@ namespace Opm {
return BHPLimit;
}
ProductionControls WellProductionProperties::controls(const SummaryState& st) const {
ProductionControls controls(this->m_productionControls);
controls.oil_rate = this->OilRate;
controls.water_rate = this->WaterRate;
controls.gas_rate = this->GasRate;
controls.liquid_rate = this->LiquidRate;
controls.resv_rate = this->ResVRate;
controls.bhp_limit = this->BHPLimit;
controls.thp_limit= this->THPLimit;
controls.bhp_history = this->BHPH;
controls.thp_history = this->THPH;
controls.vfp_table_number = this->VFPTableNumber;
controls.alq_value = this->ALQValue;
controls.cmode = this->controlMode;
return controls;
}
} // namespace Opm

View File

@@ -33,6 +33,7 @@
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
#include <opm/parser/eclipse/EclipseState/Grid/EclipseGrid.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Schedule.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/SummaryState.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/ScheduleEnums.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/Connection.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/Well/WellConnections.hpp>
@@ -746,3 +747,12 @@ BOOST_AUTO_TEST_CASE(CMODE_DEFAULT) {
BOOST_CHECK_EQUAL( Pproperties.controlMode , Opm::WellProducer::CMODE_UNDEFINED );
BOOST_CHECK_EQUAL( Iproperties.controlMode , Opm::WellInjector::CMODE_UNDEFINED );
}
BOOST_AUTO_TEST_CASE(WELL_CONTROLS) {
Opm::Well2 well("WELL", "GROUP", 0, 0, 0, 0, 1000, Opm::Phase::OIL, Opm::WellProducer::CMODE_UNDEFINED, Opm::WellCompletion::DEPTH);
Opm::SummaryState st;
const auto prod_controls = well.productionControls(st);
}