mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-11-25 02:30:18 -06:00
removing DynamicListEconLimited
it is not used anymore. A lot of related implementation has been moved to WellTestState. Its existence makes some logic rather confusing and some new development not easy.
This commit is contained in:
parent
5f8431703a
commit
47b933a58e
@ -159,7 +159,6 @@ list (APPEND PUBLIC_HEADER_FILES
|
||||
opm/core/wells/WellCollection.hpp
|
||||
opm/core/wells/WellsGroup.hpp
|
||||
opm/core/wells/WellsManager.hpp
|
||||
opm/core/wells/DynamicListEconLimited.hpp
|
||||
opm/core/wells/WellsManager_impl.hpp
|
||||
opm/simulators/ParallelFileMerger.hpp
|
||||
opm/simulators/WellSwitchingLogger.hpp
|
||||
|
@ -37,7 +37,6 @@
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/WellTestState.hpp>
|
||||
|
||||
#include <opm/core/wells.h>
|
||||
#include <opm/core/wells/DynamicListEconLimited.hpp>
|
||||
#include <opm/core/wells/WellCollection.hpp>
|
||||
#include <opm/core/simulator/SimulatorReport.hpp>
|
||||
#include <opm/autodiff/VFPInjProperties.hpp>
|
||||
|
@ -180,10 +180,6 @@ namespace Opm {
|
||||
wells_ecl_ = schedule().getWells(timeStepIdx);
|
||||
|
||||
// Create wells and well state.
|
||||
// Pass empty dynamicListEconLimited class
|
||||
// The closing of wells due to limites is
|
||||
// handled by the wellTestState class
|
||||
DynamicListEconLimited dynamic_list_econ_limited;
|
||||
wells_manager_.reset( new WellsManager (eclState,
|
||||
schedule(),
|
||||
timeStepIdx,
|
||||
@ -193,7 +189,6 @@ namespace Opm {
|
||||
Opm::UgGridHelpers::dimensions(grid),
|
||||
Opm::UgGridHelpers::cell2Faces(grid),
|
||||
Opm::UgGridHelpers::beginFaceCentroids(grid),
|
||||
dynamic_list_econ_limited,
|
||||
grid.comm().size() > 1,
|
||||
defunct_well_names) );
|
||||
|
||||
@ -432,8 +427,6 @@ namespace Opm {
|
||||
BlackoilWellModel<TypeTag>::
|
||||
initFromRestartFile(const RestartValue& restartValues)
|
||||
{
|
||||
// gives a dummy dynamic_list_econ_limited
|
||||
DynamicListEconLimited dummyListEconLimited;
|
||||
const auto& defunctWellNames = ebosSimulator_.vanguard().defunctWellNames();
|
||||
WellsManager wellsmanager(eclState(),
|
||||
schedule(),
|
||||
@ -448,7 +441,6 @@ namespace Opm {
|
||||
Opm::UgGridHelpers::dimensions(grid()),
|
||||
Opm::UgGridHelpers::cell2Faces(grid()),
|
||||
Opm::UgGridHelpers::beginFaceCentroids(grid()),
|
||||
dummyListEconLimited,
|
||||
grid().comm().size() > 1,
|
||||
defunctWellNames);
|
||||
|
||||
|
@ -26,7 +26,6 @@
|
||||
#include <locale>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/Events.hpp>
|
||||
#include <opm/core/well_controls.h>
|
||||
#include <opm/core/wells/DynamicListEconLimited.hpp>
|
||||
|
||||
namespace Opm
|
||||
{
|
||||
|
@ -1,92 +0,0 @@
|
||||
/*
|
||||
Copyright 2016 SINTEF ICT, Applied Mathematics.
|
||||
|
||||
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 OPM_DYNAMICLISTECONLIMITED_HPP
|
||||
#define OPM_DYNAMICLISTECONLIMITED_HPP
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
#include <cassert>
|
||||
|
||||
namespace Opm
|
||||
{
|
||||
|
||||
/// to handle the wells and connections violating economic limits.
|
||||
class DynamicListEconLimited
|
||||
{
|
||||
public:
|
||||
|
||||
DynamicListEconLimited() {
|
||||
}
|
||||
|
||||
bool wellShutEconLimited(const std::string& well_name) const {
|
||||
return std::find(m_shut_wells.begin(), m_shut_wells.end(), well_name) != m_shut_wells.end();
|
||||
}
|
||||
|
||||
void addShutWell(const std::string& well_name) {
|
||||
assert( !wellShutEconLimited(well_name) );
|
||||
assert( !wellStoppedEconLimited(well_name) );
|
||||
|
||||
m_shut_wells.push_back(well_name);
|
||||
}
|
||||
|
||||
bool wellStoppedEconLimited(const std::string& well_name) const {
|
||||
return std::find(m_stopped_wells.begin(), m_stopped_wells.end(), well_name) != m_stopped_wells.end();
|
||||
}
|
||||
|
||||
void addStoppedWell(const std::string& well_name) {
|
||||
assert( !wellShutEconLimited(well_name) );
|
||||
assert( !wellStoppedEconLimited(well_name) );
|
||||
|
||||
m_stopped_wells.push_back(well_name);
|
||||
}
|
||||
|
||||
|
||||
// TODO: maybe completion better here
|
||||
bool anyConnectionClosedForWell(const std::string& well_name) const {
|
||||
return (m_cells_closed_connections.find(well_name) != m_cells_closed_connections.end());
|
||||
}
|
||||
|
||||
const std::vector<int>& getClosedConnectionsForWell(const std::string& well_name) const {
|
||||
return (m_cells_closed_connections.find(well_name)->second);
|
||||
}
|
||||
|
||||
void addClosedConnectionsForWell(const std::string& well_name,
|
||||
const int cell_closed_connection) {
|
||||
if (!anyConnectionClosedForWell(well_name)) {
|
||||
// first time adding a connection for the well
|
||||
std::vector<int> vector_cells = {cell_closed_connection};
|
||||
m_cells_closed_connections[well_name] = vector_cells;
|
||||
} else {
|
||||
std::vector<int>& closed_connections = m_cells_closed_connections.find(well_name)->second;
|
||||
closed_connections.push_back(cell_closed_connection);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
std::vector <std::string> m_shut_wells;
|
||||
std::vector <std::string> m_stopped_wells;
|
||||
// using grid cell number to indicate the location of the connections
|
||||
std::map<std::string, std::vector<int>> m_cells_closed_connections;
|
||||
};
|
||||
|
||||
} // namespace Opm
|
||||
#endif /* OPM_DYNAMICLISTECONLIMITED_HPP */
|
||||
|
@ -204,14 +204,10 @@ namespace Opm
|
||||
const UnstructuredGrid& grid)
|
||||
: w_(create_wells(0,0,0)), is_parallel_run_(false)
|
||||
{
|
||||
// TODO: not sure about the usage of this WellsManager constructor
|
||||
// TODO: not sure whether this is the correct thing to do here.
|
||||
DynamicListEconLimited dummy_list_econ_limited;
|
||||
init(eclipseState, schedule, timeStep, UgGridHelpers::numCells(grid),
|
||||
UgGridHelpers::globalCell(grid), UgGridHelpers::cartDims(grid),
|
||||
UgGridHelpers::globalCell(grid), UgGridHelpers::cartDims(grid),
|
||||
UgGridHelpers::dimensions(grid),
|
||||
UgGridHelpers::cell2Faces(grid), UgGridHelpers::beginFaceCentroids(grid),
|
||||
dummy_list_econ_limited,
|
||||
std::unordered_set<std::string>());
|
||||
|
||||
}
|
||||
@ -297,8 +293,7 @@ namespace Opm
|
||||
|
||||
void WellsManager::setupWellControls(std::vector< const Well* >& wells, size_t timeStep,
|
||||
std::vector<std::string>& well_names, const PhaseUsage& phaseUsage,
|
||||
const std::vector<int>& wells_on_proc,
|
||||
const DynamicListEconLimited& list_econ_limited) {
|
||||
const std::vector<int>& wells_on_proc) {
|
||||
int well_index = 0;
|
||||
auto well_on_proc = wells_on_proc.begin();
|
||||
|
||||
@ -316,11 +311,7 @@ namespace Opm
|
||||
continue;
|
||||
}
|
||||
|
||||
if (list_econ_limited.wellShutEconLimited(well->name())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (well->getStatus(timeStep) == WellCommon::STOP || list_econ_limited.wellStoppedEconLimited(well->name())) {
|
||||
if (well->getStatus(timeStep) == WellCommon::STOP) {
|
||||
// Stopped wells are kept in the well list but marked as stopped.
|
||||
well_controls_stop_well(w_->ctrls[well_index]);
|
||||
}
|
||||
|
@ -26,7 +26,6 @@
|
||||
|
||||
#include <opm/core/wells/WellCollection.hpp>
|
||||
#include <opm/core/wells/WellsGroup.hpp>
|
||||
#include <opm/core/wells/DynamicListEconLimited.hpp>
|
||||
#include <opm/parser/eclipse/EclipseState/Schedule/GroupTree.hpp>
|
||||
|
||||
#include <opm/grid/utility/CompressedPropertyAccess.hpp>
|
||||
@ -93,7 +92,6 @@ namespace Opm
|
||||
int dimensions,
|
||||
const F2C& f2c,
|
||||
FC begin_face_centroids,
|
||||
const DynamicListEconLimited& list_econ_limited,
|
||||
bool is_parallel_run=false,
|
||||
const std::unordered_set<std::string>& deactivated_wells = std::unordered_set<std::string> ());
|
||||
|
||||
@ -164,7 +162,6 @@ namespace Opm
|
||||
int dimensions,
|
||||
const C2F& cell_to_faces,
|
||||
FC begin_face_centroids,
|
||||
const DynamicListEconLimited& list_econ_limited,
|
||||
const std::unordered_set<std::string>& deactivated_wells);
|
||||
// Disable copying and assignment.
|
||||
WellsManager(const WellsManager& other);
|
||||
@ -172,8 +169,7 @@ namespace Opm
|
||||
static void setupCompressedToCartesian(const int* global_cell, int number_of_cells, std::map<int,int>& cartesian_to_compressed );
|
||||
void setupWellControls(std::vector<const Well*>& wells, size_t timeStep,
|
||||
std::vector<std::string>& well_names, const PhaseUsage& phaseUsage,
|
||||
const std::vector<int>& wells_on_proc,
|
||||
const DynamicListEconLimited& list_econ_limited);
|
||||
const std::vector<int>& wells_on_proc);
|
||||
|
||||
template<class C2F, class FC, class NTG>
|
||||
void createWellsFromSpecs( std::vector<const Well*>& wells, size_t timeStep,
|
||||
@ -190,8 +186,7 @@ namespace Opm
|
||||
const double* permeability,
|
||||
const NTG& ntg,
|
||||
std::vector<int>& wells_on_proc,
|
||||
const std::unordered_set<std::string>& deactivated_wells,
|
||||
const DynamicListEconLimited& list_econ_limited);
|
||||
const std::unordered_set<std::string>& deactivated_wells);
|
||||
|
||||
void setupGuideRates(std::vector<const Well*>& wells, const size_t timeStep, std::vector<WellData>& well_data, std::map<std::string, int>& well_names_to_index);
|
||||
|
||||
|
@ -116,8 +116,7 @@ void WellsManager::createWellsFromSpecs(std::vector<const Well*>& wells, size_t
|
||||
const double* permeability,
|
||||
const NTG& ntg,
|
||||
std::vector<int>& wells_on_proc,
|
||||
const std::unordered_set<std::string>& ignored_wells,
|
||||
const DynamicListEconLimited& list_econ_limited)
|
||||
const std::unordered_set<std::string>& ignored_wells)
|
||||
{
|
||||
if (dimensions != 3) {
|
||||
OPM_THROW(std::domain_error,
|
||||
@ -146,15 +145,6 @@ void WellsManager::createWellsFromSpecs(std::vector<const Well*>& wells, size_t
|
||||
continue;
|
||||
}
|
||||
|
||||
if (list_econ_limited.wellShutEconLimited(well->name())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
std::vector<int> cells_connection_closed;
|
||||
if (list_econ_limited.anyConnectionClosedForWell(well->name())) {
|
||||
cells_connection_closed = list_econ_limited.getClosedConnectionsForWell(well->name());
|
||||
}
|
||||
|
||||
{ // COMPDAT handling
|
||||
// shut completions and open ones stored in this process will have 1 others 0.
|
||||
|
||||
@ -175,15 +165,6 @@ void WellsManager::createWellsFromSpecs(std::vector<const Well*>& wells, size_t
|
||||
else
|
||||
{
|
||||
int cell = cgit->second;
|
||||
// check if the connection is closed due to economic limits
|
||||
if (!cells_connection_closed.empty()) {
|
||||
const bool connection_found = std::find(cells_connection_closed.begin(),
|
||||
cells_connection_closed.end(), cell)
|
||||
!= cells_connection_closed.end();
|
||||
if (connection_found) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
PerfData pd;
|
||||
pd.cell = cell;
|
||||
@ -286,14 +267,13 @@ WellsManager(const Opm::EclipseState& eclipseState,
|
||||
int dimensions,
|
||||
const C2F& cell_to_faces,
|
||||
FC begin_face_centroids,
|
||||
const DynamicListEconLimited& list_econ_limited,
|
||||
bool is_parallel_run,
|
||||
const std::unordered_set<std::string>& deactivated_wells)
|
||||
: w_(create_wells(0,0,0)), is_parallel_run_(is_parallel_run)
|
||||
{
|
||||
init(eclipseState, schedule, timeStep, number_of_cells, global_cell,
|
||||
cart_dims, dimensions,
|
||||
cell_to_faces, begin_face_centroids, list_econ_limited, deactivated_wells);
|
||||
cell_to_faces, begin_face_centroids, deactivated_wells);
|
||||
}
|
||||
|
||||
/// Construct wells from deck.
|
||||
@ -308,7 +288,6 @@ WellsManager::init(const Opm::EclipseState& eclipseState,
|
||||
int dimensions,
|
||||
const C2F& cell_to_faces,
|
||||
FC begin_face_centroids,
|
||||
const DynamicListEconLimited& list_econ_limited,
|
||||
const std::unordered_set<std::string>& deactivated_wells)
|
||||
{
|
||||
if (dimensions != 3) {
|
||||
@ -379,9 +358,9 @@ WellsManager::init(const Opm::EclipseState& eclipseState,
|
||||
dz,
|
||||
well_names, well_data, well_names_to_index,
|
||||
pu, cartesian_to_compressed, interleavedPerm.data(), ntg,
|
||||
wells_on_proc, deactivated_wells, list_econ_limited);
|
||||
wells_on_proc, deactivated_wells);
|
||||
|
||||
setupWellControls(wells, timeStep, well_names, pu, wells_on_proc, list_econ_limited);
|
||||
setupWellControls(wells, timeStep, well_names, pu, wells_on_proc);
|
||||
|
||||
{
|
||||
const auto& fieldGroup = schedule.getGroup( "FIELD" );
|
||||
|
@ -38,7 +38,6 @@
|
||||
#include <opm/parser/eclipse/Units/Units.hpp>
|
||||
#include <opm/core/wells/WellsManager.hpp>
|
||||
#include <opm/core/wells.h>
|
||||
#include <opm/core/wells/DynamicListEconLimited.hpp>
|
||||
|
||||
#include <opm/material/fluidmatrixinteractions/EclMaterialLawManager.hpp>
|
||||
#include <opm/grid/GridHelpers.hpp>
|
||||
@ -89,9 +88,6 @@ struct SetupTest {
|
||||
std::vector<int> compressed_to_cartesianIdx;
|
||||
Opm::createGlobalCellArray(grid, compressed_to_cartesianIdx);
|
||||
|
||||
// dummy_dynamic_list_econ_lmited
|
||||
const Opm::DynamicListEconLimited dummy_dynamic_list;
|
||||
|
||||
current_timestep = 0;
|
||||
|
||||
// Create wells.
|
||||
@ -104,7 +100,6 @@ struct SetupTest {
|
||||
Opm::UgGridHelpers::dimensions(grid),
|
||||
Opm::UgGridHelpers::cell2Faces(grid),
|
||||
Opm::UgGridHelpers::beginFaceCentroids(grid),
|
||||
dummy_dynamic_list,
|
||||
false,
|
||||
std::unordered_set<std::string>() ) );
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user