WIP in adding class DynamicListEconLimited

to handle the closed wells and connection dynamically based on the
economic limits provied by keyword WECON
This commit is contained in:
Kai Bao 2016-06-24 16:01:12 +02:00
parent b5f6513520
commit 7dac2201bb
4 changed files with 77 additions and 6 deletions

View File

@ -0,0 +1,57 @@
/*
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 <cassert>
namespace Opm
{
/// to handle the wells and connections voilating economic limits.
class DynamicListEconLimited
{
public:
bool anyWellEconLimited() const {
return !(m_shut_wells.empty());
};
bool wellEconLimited(const std::string& well_name) const {
return std::find(m_shut_wells.begin(), m_shut_wells.end(), well_name) != m_shut_wells.end();
};
void addShuttedWell(const std::string& well_name) {
// the well should not be in the list
// TODO: not sure wheter a shutted well can
// still be running through some other mechanism.
assert( !wellEconLimited(well_name) );
m_shut_wells.push_back(well_name);
};
private:
std::vector <std::string> m_shut_wells;
};
} // namespace Opm
#endif /* OPM_DYNAMICLISTECONLIMITED_HPP */

View File

@ -332,12 +332,15 @@ namespace Opm
const double* permeability) const double* permeability)
: w_(0), is_parallel_run_(false) : w_(0), is_parallel_run_(false)
{ {
std::vector<double> dummy_well_potentials; std::vector<double> dummy_well_potentials;;
// 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, timeStep, UgGridHelpers::numCells(grid), init(eclipseState, timeStep, UgGridHelpers::numCells(grid),
UgGridHelpers::globalCell(grid), UgGridHelpers::cartDims(grid), UgGridHelpers::globalCell(grid), UgGridHelpers::cartDims(grid),
UgGridHelpers::dimensions(grid), UgGridHelpers::dimensions(grid),
UgGridHelpers::cell2Faces(grid), UgGridHelpers::beginFaceCentroids(grid), UgGridHelpers::cell2Faces(grid), UgGridHelpers::beginFaceCentroids(grid),
permeability, dummy_well_potentials); permeability, dummy_list_econ_limited, dummy_well_potentials);
} }

View File

@ -25,6 +25,7 @@
#include <opm/core/wells/WellCollection.hpp> #include <opm/core/wells/WellCollection.hpp>
#include <opm/core/wells/WellsGroup.hpp> #include <opm/core/wells/WellsGroup.hpp>
#include <opm/core/wells/DynamicListEconLimited.hpp>
#include <opm/parser/eclipse/EclipseState/Schedule/GroupTree.hpp> #include <opm/parser/eclipse/EclipseState/Schedule/GroupTree.hpp>
#include <opm/core/utility/CompressedPropertyAccess.hpp> #include <opm/core/utility/CompressedPropertyAccess.hpp>
@ -86,6 +87,7 @@ namespace Opm
const F2C& f2c, const F2C& f2c,
FC begin_face_centroids, FC begin_face_centroids,
const double* permeability, const double* permeability,
const DynamicListEconLimited& list_econ_limited,
bool is_parallel_run=false, bool is_parallel_run=false,
const std::vector<double>& well_potentials={}); const std::vector<double>& well_potentials={});
@ -155,6 +157,7 @@ namespace Opm
const C2F& cell_to_faces, const C2F& cell_to_faces,
FC begin_face_centroids, FC begin_face_centroids,
const double* permeability, const double* permeability,
const DynamicListEconLimited& list_econ_limited,
const std::vector<double>& well_potentials); const std::vector<double>& well_potentials);
// Disable copying and assignment. // Disable copying and assignment.
WellsManager(const WellsManager& other); WellsManager(const WellsManager& other);
@ -178,7 +181,8 @@ namespace Opm
const std::map<int,int>& cartesian_to_compressed, const std::map<int,int>& cartesian_to_compressed,
const double* permeability, const double* permeability,
const NTG& ntg, const NTG& ntg,
std::vector<int>& wells_on_proc); std::vector<int>& wells_on_proc,
const DynamicListEconLimited& list_econ_limited);
void addChildGroups(GroupTreeNodeConstPtr parentNode, std::shared_ptr< const Schedule > schedule, size_t timeStep, const PhaseUsage& phaseUsage); void addChildGroups(GroupTreeNodeConstPtr parentNode, std::shared_ptr< const Schedule > schedule, size_t timeStep, const PhaseUsage& phaseUsage);
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, 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,

View File

@ -120,7 +120,8 @@ void WellsManager::createWellsFromSpecs(std::vector<const Well*>& wells, size_t
const std::map<int,int>& cartesian_to_compressed, const std::map<int,int>& cartesian_to_compressed,
const double* permeability, const double* permeability,
const NTG& ntg, const NTG& ntg,
std::vector<int>& wells_on_proc) std::vector<int>& wells_on_proc,
const DynamicListEconLimited& list_econ_limited)
{ {
if (dimensions != 3) { if (dimensions != 3) {
OPM_THROW(std::domain_error, OPM_THROW(std::domain_error,
@ -144,6 +145,10 @@ void WellsManager::createWellsFromSpecs(std::vector<const Well*>& wells, size_t
continue; continue;
} }
if (list_econ_limited.wellEconLimited(well->name())) {
continue;
}
{ // COMPDAT handling { // COMPDAT handling
auto completionSet = well->getCompletions(timeStep); auto completionSet = well->getCompletions(timeStep);
// shut completions and open ones stored in this process will have 1 others 0. // shut completions and open ones stored in this process will have 1 others 0.
@ -327,13 +332,14 @@ WellsManager(const Opm::EclipseStateConstPtr eclipseState,
const C2F& cell_to_faces, const C2F& cell_to_faces,
FC begin_face_centroids, FC begin_face_centroids,
const double* permeability, const double* permeability,
const DynamicListEconLimited& list_econ_limited,
bool is_parallel_run, bool is_parallel_run,
const std::vector<double>& well_potentials) const std::vector<double>& well_potentials)
: w_(0), is_parallel_run_(is_parallel_run) : w_(0), is_parallel_run_(is_parallel_run)
{ {
init(eclipseState, timeStep, number_of_cells, global_cell, init(eclipseState, timeStep, number_of_cells, global_cell,
cart_dims, dimensions, cart_dims, dimensions,
cell_to_faces, begin_face_centroids, permeability, well_potentials); cell_to_faces, begin_face_centroids, permeability, list_econ_limited, well_potentials);
} }
/// Construct wells from deck. /// Construct wells from deck.
@ -348,6 +354,7 @@ WellsManager::init(const Opm::EclipseStateConstPtr eclipseState,
const C2F& cell_to_faces, const C2F& cell_to_faces,
FC begin_face_centroids, FC begin_face_centroids,
const double* permeability, const double* permeability,
const DynamicListEconLimited& list_econ_limited,
const std::vector<double>& well_potentials) const std::vector<double>& well_potentials)
{ {
if (dimensions != 3) { if (dimensions != 3) {
@ -410,7 +417,7 @@ WellsManager::init(const Opm::EclipseStateConstPtr eclipseState,
dz, dz,
well_names, well_data, well_names_to_index, well_names, well_data, well_names_to_index,
pu, cartesian_to_compressed, permeability, ntg, pu, cartesian_to_compressed, permeability, ntg,
wells_on_proc); wells_on_proc, list_econ_limited);
setupWellControls(wells, timeStep, well_names, pu, wells_on_proc); setupWellControls(wells, timeStep, well_names, pu, wells_on_proc);