mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Use ScheduleState to handle VFP propertes + simplifications
This commit is contained in:
@@ -333,7 +333,7 @@ namespace Opm {
|
||||
std::optional<int> last_run_wellpi_{};
|
||||
|
||||
std::unique_ptr<RateConverterType> rateConverter_;
|
||||
std::unique_ptr<VFPProperties<VFPInjProperties,VFPProdProperties>> vfp_properties_;
|
||||
std::unique_ptr<VFPProperties> vfp_properties_;
|
||||
|
||||
SimulatorReportSingle last_report_;
|
||||
|
||||
|
||||
@@ -302,14 +302,14 @@ namespace Opm {
|
||||
std::vector<int>(local_num_cells_, 0)));
|
||||
rateConverter_->template defineState<ElementContext>(ebosSimulator_);
|
||||
|
||||
// update VFP properties
|
||||
vfp_properties_.reset (new VFPProperties<VFPInjProperties,VFPProdProperties> (
|
||||
schedule().getVFPInjTables(timeStepIdx),
|
||||
schedule().getVFPProdTables(timeStepIdx)) );
|
||||
|
||||
this->initializeWellProdIndCalculators();
|
||||
if (this->schedule()[timeStepIdx].events().hasEvent(ScheduleEvents::Events::WELL_PRODUCTIVITY_INDEX)) {
|
||||
this->runWellPIScaling(timeStepIdx, local_deferredLogger);
|
||||
{
|
||||
const auto& sched_state = this->schedule()[timeStepIdx];
|
||||
// update VFP properties
|
||||
vfp_properties_.reset(new VFPProperties( sched_state.vfpinj(), sched_state.vfpprod()) );
|
||||
this->initializeWellProdIndCalculators();
|
||||
if (sched_state.events().hasEvent(ScheduleEvents::Events::WELL_PRODUCTIVITY_INDEX)) {
|
||||
this->runWellPIScaling(timeStepIdx, local_deferredLogger);
|
||||
}
|
||||
}
|
||||
|
||||
// update the previous well state. This is used to restart failed steps.
|
||||
|
||||
@@ -32,21 +32,6 @@
|
||||
namespace Opm {
|
||||
|
||||
|
||||
VFPInjProperties::VFPInjProperties() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
VFPInjProperties::VFPInjProperties(const VFPInjTable* table){
|
||||
m_tables[table->getTableNum()] = table;
|
||||
}
|
||||
|
||||
|
||||
VFPInjProperties::VFPInjProperties(const VFPInjProperties::InjTable& tables) {
|
||||
for (const auto& table : tables) {
|
||||
m_tables[table.first] = table.second.get();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
double VFPInjProperties::bhp(int table_id,
|
||||
@@ -98,4 +83,9 @@ bool VFPInjProperties::hasTable(const int table_id) const {
|
||||
return detail::hasTable(m_tables, table_id);
|
||||
}
|
||||
|
||||
void VFPInjProperties::addTable(const VFPInjTable * new_table) {
|
||||
this->m_tables.emplace( new_table->getTableNum(), new_table );
|
||||
}
|
||||
|
||||
|
||||
} //Namespace Opm
|
||||
|
||||
@@ -34,25 +34,11 @@ namespace Opm {
|
||||
|
||||
class VFPInjProperties {
|
||||
public:
|
||||
VFPInjProperties() = default;
|
||||
/**
|
||||
* Empty constructor
|
||||
*/
|
||||
VFPInjProperties();
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* Takes *no* ownership of data.
|
||||
* @param inj_table A *single* VFPINJ table
|
||||
*/
|
||||
explicit VFPInjProperties(const VFPInjTable* inj_table);
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* Takes *no* ownership of data.
|
||||
* @param inj_tables A map of different VFPINJ tables.
|
||||
*/
|
||||
using InjTable = std::map<int, std::shared_ptr<const VFPInjTable> >;
|
||||
explicit VFPInjProperties(const InjTable& inj_tables);
|
||||
void addTable(const VFPInjTable * new_table);
|
||||
|
||||
/**
|
||||
* Linear interpolation of bhp as a function of the input parameters given as
|
||||
|
||||
@@ -33,23 +33,6 @@ namespace Opm {
|
||||
|
||||
|
||||
|
||||
VFPProdProperties::VFPProdProperties() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
VFPProdProperties::VFPProdProperties(const VFPProdTable* table){
|
||||
m_tables[table->getTableNum()] = table;
|
||||
}
|
||||
|
||||
|
||||
VFPProdProperties::VFPProdProperties(const VFPProdProperties::ProdTable& tables) {
|
||||
for (const auto& table : tables) {
|
||||
m_tables[table.first] = table.second.get();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
double VFPProdProperties::thp(int table_id,
|
||||
const double& aqua,
|
||||
const double& liquid,
|
||||
@@ -261,5 +244,8 @@ calculateBhpWithTHPTarget(const std::vector<double>& ipr_a,
|
||||
}
|
||||
}
|
||||
|
||||
void VFPProdProperties::addTable(const VFPProdTable * new_table) {
|
||||
this->m_tables.emplace( new_table->getTableNum(), new_table );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -38,25 +38,11 @@ namespace Opm {
|
||||
*/
|
||||
class VFPProdProperties {
|
||||
public:
|
||||
VFPProdProperties() = default;
|
||||
/**
|
||||
* Empty constructor
|
||||
*/
|
||||
VFPProdProperties();
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* Takes *no* ownership of data.
|
||||
* @param prod_table A *single* VFPPROD table
|
||||
*/
|
||||
explicit VFPProdProperties(const VFPProdTable* prod_table);
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* Takes *no* ownership of data.
|
||||
* @param prod_tables A map of different VFPPROD tables.
|
||||
*/
|
||||
using ProdTable = std::map<int, std::shared_ptr<const VFPProdTable> >;
|
||||
explicit VFPProdProperties(const ProdTable& prod_tables);
|
||||
void addTable(const VFPProdTable * new_table);
|
||||
|
||||
/**
|
||||
* Linear interpolation of bhp as a function of the input parameters given as
|
||||
|
||||
@@ -23,6 +23,9 @@
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/VFPInjTable.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/VFPProdTable.hpp>
|
||||
|
||||
#include <opm/simulators/wells/VFPInjProperties.hpp>
|
||||
#include <opm/simulators/wells/VFPProdProperties.hpp>
|
||||
|
||||
#include <map>
|
||||
|
||||
namespace Opm {
|
||||
@@ -31,26 +34,10 @@ namespace Opm {
|
||||
* A thin wrapper class that holds one VFPProdProperties and one
|
||||
* VFPInjProperties object.
|
||||
*/
|
||||
template<typename VFPInjProp, typename VFPProdProp>
|
||||
class VFPProperties {
|
||||
public:
|
||||
VFPProperties() {}
|
||||
VFPProperties() = default;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* Takes *no* ownership of data.
|
||||
* @param inj_table A *single* VFPINJ table or NULL (no table)
|
||||
* @param prod_table A *single* VFPPROD table or NULL (no table)
|
||||
*/
|
||||
explicit VFPProperties(const VFPInjTable* inj_table, const VFPProdTable* prod_table)
|
||||
{
|
||||
if (inj_table != nullptr) {
|
||||
m_inj.reset(new VFPInjProp(inj_table));
|
||||
}
|
||||
if (prod_table != nullptr) {
|
||||
m_prod.reset(new VFPProdProp(prod_table));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@@ -58,27 +45,34 @@ public:
|
||||
* @param inj_tables A map of different VFPINJ tables.
|
||||
* @param prod_tables A map of different VFPPROD tables.
|
||||
*/
|
||||
VFPProperties(const std::map<int, std::shared_ptr<const VFPInjTable> >& inj_tables,
|
||||
const std::map<int, std::shared_ptr<const VFPProdTable> >& prod_tables)
|
||||
: m_inj(new VFPInjProp(inj_tables)), m_prod(new VFPProdProp(prod_tables)) {}
|
||||
|
||||
VFPProperties(const std::vector<const VFPInjTable *>& inj_tables,
|
||||
const std::vector<const VFPProdTable *>& prod_tables)
|
||||
{
|
||||
for (const auto& vfpinj_ptr : inj_tables)
|
||||
this->m_inj.addTable( vfpinj_ptr );
|
||||
|
||||
for (const auto& vfpprod_ptr : prod_tables)
|
||||
this->m_prod.addTable( vfpprod_ptr );
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the VFP properties for injection wells
|
||||
*/
|
||||
const VFPInjProp* getInj() const {
|
||||
return m_inj.get();
|
||||
const VFPInjProperties* getInj() const {
|
||||
return &m_inj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the VFP properties for production wells
|
||||
*/
|
||||
const VFPProdProp* getProd() const {
|
||||
return m_prod.get();
|
||||
const VFPProdProperties* getProd() const {
|
||||
return &m_prod;
|
||||
}
|
||||
|
||||
private:
|
||||
std::shared_ptr<VFPInjProp> m_inj;
|
||||
std::shared_ptr<VFPProdProp> m_prod;
|
||||
VFPInjProperties m_inj;
|
||||
VFPProdProperties m_prod;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -151,7 +151,7 @@ namespace Opm
|
||||
/// Well cells.
|
||||
const std::vector<int>& cells() const {return well_cells_; }
|
||||
|
||||
void setVFPProperties(const VFPProperties<VFPInjProperties,VFPProdProperties>* vfp_properties_arg);
|
||||
void setVFPProperties(const VFPProperties* vfp_properties_arg);
|
||||
|
||||
void setGuideRate(const GuideRate* guide_rate_arg);
|
||||
|
||||
@@ -384,7 +384,7 @@ namespace Opm
|
||||
|
||||
bool getAllowCrossFlow() const;
|
||||
|
||||
const VFPProperties<VFPInjProperties,VFPProdProperties>* vfp_properties_;
|
||||
const VFPProperties* vfp_properties_;
|
||||
|
||||
const GuideRate* guide_rate_;
|
||||
|
||||
|
||||
@@ -174,7 +174,7 @@ namespace Opm
|
||||
template<typename TypeTag>
|
||||
void
|
||||
WellInterface<TypeTag>::
|
||||
setVFPProperties(const VFPProperties<VFPInjProperties,VFPProdProperties>* vfp_properties_arg)
|
||||
setVFPProperties(const VFPProperties* vfp_properties_arg)
|
||||
{
|
||||
vfp_properties_ = vfp_properties_arg;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user