Remove trailing whitespaces

This commit is contained in:
Júlio Hoffimann
2013-07-28 08:34:13 -03:00
parent baa9bf12e0
commit c077912466
19 changed files with 199 additions and 199 deletions

View File

@@ -113,7 +113,7 @@ namespace Opm
return solver_->solve(size, nonzeros, ia, ja, sa, rhs, solution); return solver_->solve(size, nonzeros, ia, ja, sa, rhs, solution);
} }
void LinearSolverFactory::setTolerance(const double tol) void LinearSolverFactory::setTolerance(const double tol)
{ {
solver_->setTolerance(tol); solver_->setTolerance(tol);
} }

View File

@@ -78,7 +78,7 @@ namespace Opm
/// Get tolerance for the linear solver. /// Get tolerance for the linear solver.
/// \param[out] tolerance value /// \param[out] tolerance value
virtual double getTolerance() const = 0; virtual double getTolerance() const = 0;
}; };

View File

@@ -97,7 +97,7 @@ namespace Opm
int linsolver_smooth_steps_; int linsolver_smooth_steps_;
/** \brief The factor to scale the coarse grid correction with. */ /** \brief The factor to scale the coarse grid correction with. */
double linsolver_prolongate_factor_; double linsolver_prolongate_factor_;
}; };

View File

@@ -99,7 +99,7 @@ namespace Opm
int ok = flow_conditions_append_multi(BC_PRESSURE, faces.size(), &faces[0], pressure, bc_); int ok = flow_conditions_append_multi(BC_PRESSURE, faces.size(), &faces[0], pressure, bc_);
if (!ok) { if (!ok) {
THROW("Failed to append pressure boundary conditions for side " << sideString(side)); THROW("Failed to append pressure boundary conditions for side " << sideString(side));
} }
} }

View File

@@ -23,8 +23,8 @@
#include <opm/core/pressure/msmfem/dfs.h> #include <opm/core/pressure/msmfem/dfs.h>
/* /*
* Assign color (nonnegative number) to each connected component of graph * Assign color (nonnegative number) to each connected component of graph
*/ */
void dfs (int size, int *ia, int *ja, int *ncolors, int *color, int* work) void dfs (int size, int *ia, int *ja, int *ncolors, int *color, int* work)
{ {
@@ -35,7 +35,7 @@ void dfs (int size, int *ia, int *ja, int *ncolors, int *color, int* work)
int *bottom = stack; int *bottom = stack;
*ncolors = 0; /* colors are nonnegative */ *ncolors = 0; /* colors are nonnegative */
for (i=0; i<size; ++i) { for (i=0; i<size; ++i) {
color [i] = UNVISITED; color [i] = UNVISITED;
count [i] = ia[i+1]-ia[i]; count [i] = ia[i+1]-ia[i];
@@ -52,16 +52,16 @@ void dfs (int size, int *ia, int *ja, int *ncolors, int *color, int* work)
while ( stack != bottom ) { while ( stack != bottom ) {
c = *(stack-1); /* peek */ c = *(stack-1); /* peek */
if (count[c] > 0){ if (count[c] > 0){
int child = ja[ia[c] + count[c]-1]; int child = ja[ia[c] + count[c]-1];
count[c]--; count[c]--;
if (color[child] == UNVISITED) { if (color[child] == UNVISITED) {
*stack++ = child; *stack++ = child;
color[c] = VISITED; color[c] = VISITED;
} }
} else { } else {
color[c] = *ncolors; color[c] = *ncolors;
--stack; /* pop c */ --stack; /* pop c */
@@ -104,9 +104,9 @@ int main (int argc, char *argv [])
fprintf(stderr, "ncolors = %d\n", ncolors); fprintf(stderr, "ncolors = %d\n", ncolors);
for (j=0; j<size; ++j) { for (j=0; j<size; ++j) {
fprintf(stderr, "%d\n", color[j]); fprintf(stderr, "%d\n", color[j]);
} }
free (color); free (color);
free (work); free (work);

View File

@@ -45,7 +45,7 @@ namespace Opm
/// mapping from cell indices (typically from a processed grid) /// mapping from cell indices (typically from a processed grid)
/// to logical cartesian indices consistent with the deck. /// to logical cartesian indices consistent with the deck.
BlackoilPropertiesFromDeck(const EclipseGridParser& deck, BlackoilPropertiesFromDeck(const EclipseGridParser& deck,
const UnstructuredGrid& grid, bool init_rock=true ); const UnstructuredGrid& grid, bool init_rock=true );
/// Initialize from deck, grid and parameters. /// Initialize from deck, grid and parameters.
/// \param[in] deck Deck input parser /// \param[in] deck Deck input parser

View File

@@ -124,7 +124,7 @@ namespace Opm
initEPS(deck, grid, std::string("KRWR"), eps_.krwr_); initEPS(deck, grid, std::string("KRWR"), eps_.krwr_);
initEPS(deck, grid, std::string("KRO"), eps_.kro_); initEPS(deck, grid, std::string("KRO"), eps_.kro_);
initEPS(deck, grid, std::string("KRORW"), eps_.krorw_); initEPS(deck, grid, std::string("KRORW"), eps_.krorw_);
} }
} }
@@ -258,7 +258,7 @@ namespace Opm
const std::string& keyword, const std::string& keyword,
std::vector<double>& scaleparam) std::vector<double>& scaleparam)
{ {
bool useKeyword = deck.hasField(keyword); bool useKeyword = deck.hasField(keyword);
bool hasENPTVD = deck.hasField("ENPTVD"); bool hasENPTVD = deck.hasField("ENPTVD");
bool hasENKRVD = deck.hasField("ENKRVD"); bool hasENKRVD = deck.hasField("ENKRVD");
int itab = 0; int itab = 0;
@@ -301,8 +301,8 @@ namespace Opm
} }
if (!useKeyword && itab > 0) { if (!useKeyword && itab > 0) {
table = deck.getENPTVD().table_; table = deck.getENPTVD().table_;
} }
} else if (keyword[0] == 'K' && (useKeyword || hasENKRVD)) { } else if (keyword[0] == 'K' && (useKeyword || hasENKRVD)) {
if (keyword == std::string("KRW")) { if (keyword == std::string("KRW")) {
if (useKeyword || deck.getENKRVD().mask_[0]) { if (useKeyword || deck.getENKRVD().mask_[0]) {
itab = 1; itab = 1;
@@ -336,7 +336,7 @@ namespace Opm
} }
if (!useKeyword && itab > 0) { if (!useKeyword && itab > 0) {
table = deck.getENKRVD().table_; table = deck.getENKRVD().table_;
} }
} }
if (scaleparam.empty()) { if (scaleparam.empty()) {
@@ -371,7 +371,7 @@ namespace Opm
} }
} }
} }
// Saturation scaling // Saturation scaling
template <class SatFuncSet> template <class SatFuncSet>
@@ -380,11 +380,11 @@ namespace Opm
const int wpos = phase_usage_.phase_pos[BlackoilPhases::Aqua]; const int wpos = phase_usage_.phase_pos[BlackoilPhases::Aqua];
const int opos = phase_usage_.phase_pos[BlackoilPhases::Liquid]; const int opos = phase_usage_.phase_pos[BlackoilPhases::Liquid];
double ss[PhaseUsage::MaxNumPhases]; double ss[PhaseUsage::MaxNumPhases];
if (do_3pt_) { // Three-point scaling if (do_3pt_) { // Three-point scaling
// Transforms for water saturation // Transforms for water saturation
if (eps_.swcr_.empty() && eps_.swu_.empty()) { if (eps_.swcr_.empty() && eps_.swu_.empty()) {
ss[wpos] = s[wpos]; ss[wpos] = s[wpos];
} else { } else {
double s_r = 1.0-funcForCell(cell).sowcr_; double s_r = 1.0-funcForCell(cell).sowcr_;
double sr = eps_.sowcr_.empty() ? s_r : 1.0-eps_.sowcr_[cell]; double sr = eps_.sowcr_.empty() ? s_r : 1.0-eps_.sowcr_[cell];
@@ -398,9 +398,9 @@ namespace Opm
ss[wpos] = (s[wpos] >= swmax) ? sw_max : s_r+(s[wpos]-sr)*(sw_max-s_r)/(swmax-sr); ss[wpos] = (s[wpos] >= swmax) ? sw_max : s_r+(s[wpos]-sr)*(sw_max-s_r)/(swmax-sr);
} }
} }
// Transforms for oil saturation // Transforms for oil saturation
if (eps_.sowcr_.empty() && eps_.swl_.empty()) { if (eps_.sowcr_.empty() && eps_.swl_.empty()) {
ss[opos] = s[opos]; ss[opos] = s[opos];
} else { } else {
double s_r = 1.0-funcForCell(cell).swcr_; double s_r = 1.0-funcForCell(cell).swcr_;
double sr = eps_.swcr_.empty() ? s_r : 1.0-eps_.swcr_[cell]; double sr = eps_.swcr_.empty() ? s_r : 1.0-eps_.swcr_[cell];
@@ -415,9 +415,9 @@ namespace Opm
} }
} }
} else { // Two-point scaling } else { // Two-point scaling
// Transforms for water saturation // Transforms for water saturation
if (eps_.swcr_.empty() && eps_.swu_.empty()) { if (eps_.swcr_.empty() && eps_.swu_.empty()) {
ss[wpos] = s[wpos]; ss[wpos] = s[wpos];
} else { } else {
double sw_cr = funcForCell(cell).swcr_; double sw_cr = funcForCell(cell).swcr_;
double swcr = eps_.swcr_.empty() ? sw_cr : eps_.swcr_[cell]; double swcr = eps_.swcr_.empty() ? sw_cr : eps_.swcr_[cell];
@@ -429,9 +429,9 @@ namespace Opm
ss[wpos] = (s[wpos] >= swmax) ? sw_max : sw_cr + (s[wpos]-swcr)*(sw_max-sw_cr)/(swmax-swcr); ss[wpos] = (s[wpos] >= swmax) ? sw_max : sw_cr + (s[wpos]-swcr)*(sw_max-sw_cr)/(swmax-swcr);
} }
} }
// Transforms for oil saturation // Transforms for oil saturation
if (eps_.sowcr_.empty() && eps_.swl_.empty()) { if (eps_.sowcr_.empty() && eps_.swl_.empty()) {
ss[opos] = s[opos]; ss[opos] = s[opos];
} else { } else {
double sow_cr = funcForCell(cell).sowcr_; double sow_cr = funcForCell(cell).sowcr_;
double socr = eps_.sowcr_.empty() ? sow_cr : eps_.sowcr_[cell]; double socr = eps_.sowcr_.empty() ? sow_cr : eps_.sowcr_[cell];
@@ -453,7 +453,7 @@ namespace Opm
// Assume: sw_cr -> krw=0 sw_max -> krw=<max water relperm> // Assume: sw_cr -> krw=0 sw_max -> krw=<max water relperm>
// sow_cr -> kro=0 sow_max -> kro=<max oil relperm> // sow_cr -> kro=0 sow_max -> kro=<max oil relperm>
funcForCell(cell).evalKr(ss, kr); funcForCell(cell).evalKr(ss, kr);
} }
// Scaling of relperms values // Scaling of relperms values
// - Water // - Water
@@ -471,7 +471,7 @@ namespace Opm
double sw_max = funcForCell(cell).smax_[wpos]; double sw_max = funcForCell(cell).smax_[wpos];
double s_r = 1.0-funcForCell(cell).sowcr_; double s_r = 1.0-funcForCell(cell).sowcr_;
sr = swcr + (s_r-sw_cr)*(swmax-swcr)/(sw_max-sw_cr); sr = swcr + (s_r-sw_cr)*(swmax-swcr)/(sw_max-sw_cr);
} }
if (s[wpos] <= swcr) { if (s[wpos] <= swcr) {
kr[wpos] = 0.0; kr[wpos] = 0.0;
} else if (sr > swmax-1.0e-6) { } else if (sr > swmax-1.0e-6) {
@@ -496,7 +496,7 @@ namespace Opm
kr[wpos] = eps_.krw_.empty() ? funcForCell(cell).krwmax_ : eps_.krw_[cell]; kr[wpos] = eps_.krw_.empty() ? funcForCell(cell).krwmax_ : eps_.krw_[cell];
} }
} }
// - Oil // - Oil
if (eps_.kro_.empty() && eps_.krorw_.empty()) { // No value scaling if (eps_.kro_.empty() && eps_.krorw_.empty()) { // No value scaling
} else if (eps_.krorw_.empty()) { // Two-point scaling } else if (eps_.krorw_.empty()) { // Two-point scaling

View File

@@ -31,7 +31,7 @@ namespace Opm
class BlackoilPropertiesInterface; class BlackoilPropertiesInterface;
/// \file /// \file
/// ///
/// Functions for initializing a reservoir state. /// Functions for initializing a reservoir state.
/// Initialize a two-phase state from parameters. /// Initialize a two-phase state from parameters.

View File

@@ -507,7 +507,7 @@ namespace Opm
if (!deck.hasField("SGAS")) { if (!deck.hasField("SGAS")) {
THROW("initStateFromDeck(): missing SGAS keyword in 2-phase init"); THROW("initStateFromDeck(): missing SGAS keyword in 2-phase init");
} }
const std::vector<double>& sg_deck = deck.getFloatingPointValue("SGAS"); const std::vector<double>& sg_deck = deck.getFloatingPointValue("SGAS");
const int gpos = pu.phase_pos[BlackoilPhases::Vapour]; const int gpos = pu.phase_pos[BlackoilPhases::Vapour];
const int opos = pu.phase_pos[BlackoilPhases::Liquid]; const int opos = pu.phase_pos[BlackoilPhases::Liquid];
for (int c = 0; c < num_cells; ++c) { for (int c = 0; c < num_cells; ++c) {

View File

@@ -9,19 +9,19 @@
/* /*
Copyright 2011 SINTEF ICT, Applied Mathematics. Copyright 2011 SINTEF ICT, Applied Mathematics.
Copyright 2011 Statoil ASA. Copyright 2011 Statoil ASA.
This file is part of the Open Porous Media Project (OPM). This file is part of the Open Porous Media Project (OPM).
OPM is free software: you can redistribute it and/or modify OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
OPM is distributed in the hope that it will be useful, OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>. along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/ */

View File

@@ -141,7 +141,7 @@ namespace Opm
const std::vector<int>& cells, const std::vector<int>& cells,
const std::vector<double>& s , const std::vector<double>& s ,
std::vector<double>& pmobc); std::vector<double>& pmobc);
/// Computes the fractional flow for each cell in the cells argument /// Computes the fractional flow for each cell in the cells argument
/// @param[in] props rock and fluid properties /// @param[in] props rock and fluid properties
@@ -202,42 +202,42 @@ namespace Opm
/// For this to be valid, the wells must be all rate-controlled and /// For this to be valid, the wells must be all rate-controlled and
/// single-perforation. /// single-perforation.
void wellsToSrc(const Wells& wells, const int num_cells, std::vector<double>& src); void wellsToSrc(const Wells& wells, const int num_cells, std::vector<double>& src);
/// Computes the WDP for each well. /// Computes the WDP for each well.
/// \param[in] wells Wells that need their wdp calculated. /// \param[in] wells Wells that need their wdp calculated.
/// \param[in] grid The associated grid to make cell lookups. /// \param[in] grid The associated grid to make cell lookups.
/// \param[in] saturations A vector of weights for each cell for each phase /// \param[in] saturations A vector of weights for each cell for each phase
/// in the grid (or well, see per_grid_cell parameter). So for cell i, /// in the grid (or well, see per_grid_cell parameter). So for cell i,
/// saturations[i*densities.size() + p] should give the weight /// saturations[i*densities.size() + p] should give the weight
/// of phase p in cell i. /// of phase p in cell i.
/// \param[in] densities Density for each phase. /// \param[in] densities Density for each phase.
/// \param[out] wdp Will contain, for each well, the wdp of the well. /// \param[out] wdp Will contain, for each well, the wdp of the well.
/// \param[in] per_grid_cell Whether or not the saturations are per grid cell or per /// \param[in] per_grid_cell Whether or not the saturations are per grid cell or per
/// well cell. /// well cell.
void computeWDP(const Wells& wells, const UnstructuredGrid& grid, const std::vector<double>& saturations, void computeWDP(const Wells& wells, const UnstructuredGrid& grid, const std::vector<double>& saturations,
const double* densities, const double gravity, const bool per_grid_cell, const double* densities, const double gravity, const bool per_grid_cell,
std::vector<double>& wdp); std::vector<double>& wdp);
/// Computes (sums) the flow rate for each well. /// Computes (sums) the flow rate for each well.
/// \param[in] wells The wells for which the flow rate should be computed. /// \param[in] wells The wells for which the flow rate should be computed.
/// \param[in] flow_rates_per_cell Flow rates per well cells. Should ordered the same way as /// \param[in] flow_rates_per_cell Flow rates per well cells. Should ordered the same way as
/// wells. /// wells.
/// \param[out] flow_rates_per_well Will contain the summed up flow_rates for each well. /// \param[out] flow_rates_per_well Will contain the summed up flow_rates for each well.
void computeFlowRatePerWell(const Wells& wells, const std::vector<double>& flow_rates_per_cell, void computeFlowRatePerWell(const Wells& wells, const std::vector<double>& flow_rates_per_cell,
std::vector<double>& flow_rates_per_well); std::vector<double>& flow_rates_per_well);
/// Computes the phase flow rate per well /// Computes the phase flow rate per well
/// \param[in] wells The wells for which the flow rate should be computed /// \param[in] wells The wells for which the flow rate should be computed
/// \param[in] flow_rates_per_well_cell The total flow rate for each cell (ordered the same /// \param[in] flow_rates_per_well_cell The total flow rate for each cell (ordered the same
/// way as the wells struct /// way as the wells struct
/// \param[in] fractional_flows the fractional flow for each cell in each well /// \param[in] fractional_flows the fractional flow for each cell in each well
/// \param[out] phase_flow_per_well Will contain the phase flow per well /// \param[out] phase_flow_per_well Will contain the phase flow per well
void computePhaseFlowRatesPerWell(const Wells& wells, void computePhaseFlowRatesPerWell(const Wells& wells,
const std::vector<double>& flow_rates_per_well_cell, const std::vector<double>& flow_rates_per_well_cell,
const std::vector<double>& fractional_flows, const std::vector<double>& fractional_flows,
std::vector<double>& phase_flow_per_well); std::vector<double>& phase_flow_per_well);
/// Encapsulates the watercut curves. /// Encapsulates the watercut curves.
class Watercut class Watercut
{ {

View File

@@ -5,7 +5,7 @@ namespace Opm
{ {
ProductionSpecification::ProductionSpecification() ProductionSpecification::ProductionSpecification()
: :
control_mode_(NONE), control_mode_(NONE),
procedure_(NONE_P), procedure_(NONE_P),
oil_max_rate_(-1e100), oil_max_rate_(-1e100),
@@ -15,7 +15,7 @@ namespace Opm
reservoir_flow_max_rate_(-1e100), reservoir_flow_max_rate_(-1e100),
BHP_limit_(-1e100), BHP_limit_(-1e100),
guide_rate_(1.0), guide_rate_(1.0),
guide_rate_type_(NONE_GRT) guide_rate_type_(NONE_GRT)
{ {
} }

View File

@@ -18,14 +18,14 @@ namespace Opm
{ {
NONE_P, RATE, WELL NONE_P, RATE, WELL
}; };
enum GuideRateType enum GuideRateType
{ {
OIL, NONE_GRT OIL, NONE_GRT
}; };
ProductionSpecification(); ProductionSpecification();
ControlMode control_mode_; ControlMode control_mode_;
Procedure procedure_; Procedure procedure_;

View File

@@ -27,7 +27,7 @@ namespace Opm
void WellCollection::addChild(const std::string& child_name, void WellCollection::addChild(const std::string& child_name,
const std::string& parent_name, const std::string& parent_name,
const EclipseGridParser& deck) const EclipseGridParser& deck)
{ {
WellsGroupInterface* parent = findNode(parent_name); WellsGroupInterface* parent = findNode(parent_name);
if (!parent) { if (!parent) {
roots_.push_back(createWellsGroup(parent_name, deck)); roots_.push_back(createWellsGroup(parent_name, deck));
@@ -42,7 +42,7 @@ namespace Opm
for(size_t j = i; j < roots_.size() - 1; ++j) { for(size_t j = i; j < roots_.size() - 1; ++j) {
roots_[j] = roots_[j+1]; roots_[j] = roots_[j+1];
} }
roots_.resize(roots_.size()-1); roots_.resize(roots_.size()-1);
break; break;
} }
@@ -50,7 +50,7 @@ namespace Opm
if (!child.get()) { if (!child.get()) {
child = createWellsGroup(child_name, deck); child = createWellsGroup(child_name, deck);
} }
WellsGroup* parent_as_group = static_cast<WellsGroup*> (parent); WellsGroup* parent_as_group = static_cast<WellsGroup*> (parent);
if (!parent_as_group) { if (!parent_as_group) {
THROW("Trying to add child to group named " << parent_name << ", but it's not a group."); THROW("Trying to add child to group named " << parent_name << ", but it's not a group.");
@@ -60,12 +60,12 @@ namespace Opm
if(child->isLeafNode()) { if(child->isLeafNode()) {
leaf_nodes_.push_back(static_cast<WellNode*>(child.get())); leaf_nodes_.push_back(static_cast<WellNode*>(child.get()));
} }
child->setParent(parent); child->setParent(parent);
} }
const std::vector<WellNode*>& WellCollection::getLeafNodes() const { const std::vector<WellNode*>& WellCollection::getLeafNodes() const {
return leaf_nodes_; return leaf_nodes_;
} }
@@ -81,7 +81,7 @@ namespace Opm
} }
return NULL; return NULL;
} }
const WellsGroupInterface* WellCollection::findNode(const std::string& name) const const WellsGroupInterface* WellCollection::findNode(const std::string& name) const
{ {
@@ -123,7 +123,7 @@ namespace Opm
leaf_nodes_.push_back(static_cast<WellNode*> (child_node.get())); leaf_nodes_.push_back(static_cast<WellNode*> (child_node.get()));
} }
} }
bool WellCollection::conditionsMet(const std::vector<double>& well_bhp, bool WellCollection::conditionsMet(const std::vector<double>& well_bhp,
const std::vector<double>& well_reservoirrates_phase, const std::vector<double>& well_reservoirrates_phase,
const std::vector<double>& well_surfacerates_phase) const std::vector<double>& well_surfacerates_phase)
@@ -139,13 +139,13 @@ namespace Opm
} }
return true; return true;
} }
void WellCollection::setWellsPointer(Wells* wells) { void WellCollection::setWellsPointer(Wells* wells) {
for(size_t i = 0; i < leaf_nodes_.size(); i++) { for(size_t i = 0; i < leaf_nodes_.size(); i++) {
leaf_nodes_[i]->setWellsPointer(wells, i); leaf_nodes_[i]->setWellsPointer(wells, i);
} }
} }
void WellCollection::applyGroupControls() void WellCollection::applyGroupControls()
{ {
for (size_t i = 0; i < roots_.size(); ++i) { for (size_t i = 0; i < roots_.size(); ++i) {

View File

@@ -43,14 +43,14 @@ namespace Opm
void addChild(const std::string& child, void addChild(const std::string& child,
const std::string& parent, const std::string& parent,
const EclipseGridParser& deck); const EclipseGridParser& deck);
/// Adds the child to the collection /// Adds the child to the collection
/// and appends it to parent's children. /// and appends it to parent's children.
/// \param[in] child the child node /// \param[in] child the child node
/// \param[in] parent name of parent node /// \param[in] parent name of parent node
void addChild(boost::shared_ptr<WellsGroupInterface>& child_node, void addChild(boost::shared_ptr<WellsGroupInterface>& child_node,
const std::string& parent); const std::string& parent);
/// Adds the node to the collection (as a root node) /// Adds the node to the collection (as a root node)
void addChild(boost::shared_ptr<WellsGroupInterface>& child_node); void addChild(boost::shared_ptr<WellsGroupInterface>& child_node);
@@ -65,7 +65,7 @@ namespace Opm
/// \endcode /// \endcode
/// ///
/// \note It's highly recommended to use the conditionsMet found in WellsManager. /// \note It's highly recommended to use the conditionsMet found in WellsManager.
/// \param[in] well_bhp A vector containing the bhp for each well. Is assumed /// \param[in] well_bhp A vector containing the bhp for each well. Is assumed
/// to be ordered the same way as the related Wells-struct. /// to be ordered the same way as the related Wells-struct.
/// \param[in] well_reservoirrates_phase /// \param[in] well_reservoirrates_phase
/// A vector containing reservoir rates by phase for each well. /// A vector containing reservoir rates by phase for each well.
@@ -79,26 +79,26 @@ namespace Opm
bool conditionsMet(const std::vector<double>& well_bhp, bool conditionsMet(const std::vector<double>& well_bhp,
const std::vector<double>& well_reservoirrates_phase, const std::vector<double>& well_reservoirrates_phase,
const std::vector<double>& well_surfacerates_phase); const std::vector<double>& well_surfacerates_phase);
/// Adds the well pointer to each leaf node (does not take ownership). /// Adds the well pointer to each leaf node (does not take ownership).
void setWellsPointer(Wells* wells); void setWellsPointer(Wells* wells);
/// \return A set of pointers to every well in the collection /// \return A set of pointers to every well in the collection
const std::vector<WellNode*>& getLeafNodes() const; const std::vector<WellNode*>& getLeafNodes() const;
/// Finds the group with the given name. /// Finds the group with the given name.
/// \param[in] the name of the group /// \param[in] the name of the group
/// \return the pointer to the group if found, NULL otherwise /// \return the pointer to the group if found, NULL otherwise
WellsGroupInterface* findNode(const std::string& name); WellsGroupInterface* findNode(const std::string& name);
/// Finds the group with the given name. /// Finds the group with the given name.
/// \param[in] the name of the group /// \param[in] the name of the group
/// \return the pointer to the group if found, NULL otherwise /// \return the pointer to the group if found, NULL otherwise
const WellsGroupInterface* findNode(const std::string& name) const; const WellsGroupInterface* findNode(const std::string& name) const;
/// Applies all group controls (injection and production) /// Applies all group controls (injection and production)
void applyGroupControls(); void applyGroupControls();
/// Applies explicit reinjection controls. This must be called at each timestep to be correct. /// Applies explicit reinjection controls. This must be called at each timestep to be correct.
/// \param[in] well_reservoirrates_phase /// \param[in] well_reservoirrates_phase
/// A vector containing reservoir rates by phase for each well. /// A vector containing reservoir rates by phase for each well.
@@ -110,15 +110,15 @@ namespace Opm
/// with all phase rates of a single well adjacent in the array. /// with all phase rates of a single well adjacent in the array.
void applyExplicitReinjectionControls(const std::vector<double>& well_reservoirrates_phase, void applyExplicitReinjectionControls(const std::vector<double>& well_reservoirrates_phase,
const std::vector<double>& well_surfacerates_phase); const std::vector<double>& well_surfacerates_phase);
private: private:
// To account for the possibility of a forest // To account for the possibility of a forest
std::vector<boost::shared_ptr<WellsGroupInterface> > roots_; std::vector<boost::shared_ptr<WellsGroupInterface> > roots_;
// This will be used to traverse the bottom nodes. // This will be used to traverse the bottom nodes.
std::vector<WellNode*> leaf_nodes_; std::vector<WellNode*> leaf_nodes_;
}; };
} // namespace Opm } // namespace Opm

View File

@@ -28,7 +28,7 @@ namespace Opm
// ========== WellPhasesSummed methods =========== // ========== WellPhasesSummed methods ===========
WellPhasesSummed::WellPhasesSummed() WellPhasesSummed::WellPhasesSummed()
{ {
for (int i = 0; i < 3; ++i) { for (int i = 0; i < 3; ++i) {
res_inj_rates[i] = 0.0; res_inj_rates[i] = 0.0;
@@ -38,7 +38,7 @@ namespace Opm
} }
} }
void WellPhasesSummed::operator+=(const WellPhasesSummed& other) void WellPhasesSummed::operator+=(const WellPhasesSummed& other)
{ {
for (int i = 0; i < 3; ++i) { for (int i = 0; i < 3; ++i) {
res_inj_rates[i] += other.res_inj_rates[i]; res_inj_rates[i] += other.res_inj_rates[i];
@@ -75,8 +75,8 @@ namespace Opm
{ {
return name_; return name_;
} }
const PhaseUsage& WellsGroupInterface::phaseUsage() const const PhaseUsage& WellsGroupInterface::phaseUsage() const
{ {
return phase_usage_; return phase_usage_;
} }
@@ -118,7 +118,7 @@ namespace Opm
} }
/// Calculates the correct rate for the given ProductionSpecification::ControlMode /// Calculates the correct rate for the given ProductionSpecification::ControlMode
double WellsGroupInterface::rateByMode(const double* res_rates, double WellsGroupInterface::rateByMode(const double* res_rates,
const double* surf_rates, const double* surf_rates,
const ProductionSpecification::ControlMode mode) const ProductionSpecification::ControlMode mode)
{ {
@@ -130,7 +130,7 @@ namespace Opm
case ProductionSpecification::GRAT: case ProductionSpecification::GRAT:
return surf_rates[phaseUsage().phase_pos[BlackoilPhases::Vapour]]; return surf_rates[phaseUsage().phase_pos[BlackoilPhases::Vapour]];
case ProductionSpecification::LRAT: case ProductionSpecification::LRAT:
return surf_rates[phaseUsage().phase_pos[BlackoilPhases::Liquid]] return surf_rates[phaseUsage().phase_pos[BlackoilPhases::Liquid]]
+ surf_rates[phaseUsage().phase_pos[BlackoilPhases::Aqua]]; + surf_rates[phaseUsage().phase_pos[BlackoilPhases::Aqua]];
case ProductionSpecification::RESV: case ProductionSpecification::RESV:
{ {
@@ -146,7 +146,7 @@ namespace Opm
} }
/// Calculates the correct rate for the given InjectionSpecification::ControlMode /// Calculates the correct rate for the given InjectionSpecification::ControlMode
double WellsGroupInterface::rateByMode(const double* res_rates, double WellsGroupInterface::rateByMode(const double* res_rates,
const double* surf_rates, const double* surf_rates,
const InjectionSpecification::ControlMode mode) const InjectionSpecification::ControlMode mode)
{ {
@@ -167,7 +167,7 @@ namespace Opm
} }
return tot_rate; return tot_rate;
} }
double WellsGroupInterface::getTarget(ProductionSpecification::ControlMode mode) double WellsGroupInterface::getTarget(ProductionSpecification::ControlMode mode)
{ {
double target = -1.0; double target = -1.0;
@@ -194,10 +194,10 @@ namespace Opm
THROW("Unsupported control mode to query target " << mode); THROW("Unsupported control mode to query target " << mode);
break; break;
} }
return target; return target;
} }
double WellsGroupInterface::getTarget(InjectionSpecification::ControlMode mode) double WellsGroupInterface::getTarget(InjectionSpecification::ControlMode mode)
{ {
double target = -1.0; double target = -1.0;
@@ -215,13 +215,13 @@ namespace Opm
THROW("Unsupported control mode to query target " << mode); THROW("Unsupported control mode to query target " << mode);
break; break;
} }
return target; return target;
} }
// ============== WellsGroup members ============= // ============== WellsGroup members =============
@@ -257,10 +257,10 @@ namespace Opm
/// \param[in] forced if true, all children will be set under group control, otherwise /// \param[in] forced if true, all children will be set under group control, otherwise
/// only children that are under group control will be changed. /// only children that are under group control will be changed.
void WellsGroup::applyInjGroupControl(const InjectionSpecification::ControlMode control_mode, void WellsGroup::applyInjGroupControl(const InjectionSpecification::ControlMode control_mode,
const double target, const double target,
const bool forced) const bool forced)
{ {
if (forced || injSpec().control_mode_ == InjectionSpecification::FLD if (forced || injSpec().control_mode_ == InjectionSpecification::FLD
|| injSpec().control_mode_ == InjectionSpecification::NONE) { || injSpec().control_mode_ == InjectionSpecification::NONE) {
const double my_guide_rate = injectionGuideRate(!forced); const double my_guide_rate = injectionGuideRate(!forced);
if (my_guide_rate == 0.0) { if (my_guide_rate == 0.0) {
@@ -284,7 +284,7 @@ namespace Opm
const double target, const double target,
const bool forced) const bool forced)
{ {
if (forced || (prodSpec().control_mode_ == ProductionSpecification::FLD if (forced || (prodSpec().control_mode_ == ProductionSpecification::FLD
|| prodSpec().control_mode_ == ProductionSpecification::NONE)) { || prodSpec().control_mode_ == ProductionSpecification::NONE)) {
const double my_guide_rate = productionGuideRate(!forced); const double my_guide_rate = productionGuideRate(!forced);
if (my_guide_rate == 0.0) { if (my_guide_rate == 0.0) {
@@ -334,7 +334,7 @@ namespace Opm
double my_rate = rateByMode(child_phases_summed.res_inj_rates, double my_rate = rateByMode(child_phases_summed.res_inj_rates,
child_phases_summed.surf_inj_rates, child_phases_summed.surf_inj_rates,
mode); mode);
if (my_rate > target_rate) { if (my_rate > target_rate) {
std::cout << "Group " << mode<<" target not met for group " << name() << std::endl; std::cout << "Group " << mode<<" target not met for group " << name() << std::endl;
std::cout << "target = " << target_rate << '\n' std::cout << "target = " << target_rate << '\n'
@@ -345,7 +345,7 @@ namespace Opm
} }
} }
} }
// REIN // REIN
// \TODO: Add support for REIN controls. // \TODO: Add support for REIN controls.
@@ -364,7 +364,7 @@ namespace Opm
} }
const double target_rate = getTarget(mode); const double target_rate = getTarget(mode);
if (target_rate >= 0.0) { if (target_rate >= 0.0) {
const double my_rate = rateByMode(child_phases_summed.res_prod_rates, const double my_rate = rateByMode(child_phases_summed.res_prod_rates,
child_phases_summed.surf_prod_rates, child_phases_summed.surf_prod_rates,
mode); mode);
if (std::fabs(my_rate) > target_rate) { if (std::fabs(my_rate) > target_rate) {
@@ -377,7 +377,7 @@ namespace Opm
} }
} }
} }
if (production_violated) { if (production_violated) {
switch (prodSpec().procedure_) { switch (prodSpec().procedure_) {
case ProductionSpecification::WELL: case ProductionSpecification::WELL:
@@ -387,7 +387,7 @@ namespace Opm
return false; return false;
case ProductionSpecification::RATE: case ProductionSpecification::RATE:
std::cout << "Applying group control" << std::endl; std::cout << "Applying group control" << std::endl;
applyProdGroupControl(production_mode_violated, applyProdGroupControl(production_mode_violated,
getTarget(production_mode_violated), getTarget(production_mode_violated),
true); true);
return false; return false;
@@ -396,7 +396,7 @@ namespace Opm
return false; return false;
} }
} }
summed_phases += child_phases_summed; summed_phases += child_phases_summed;
return true; return true;
} }
@@ -406,19 +406,19 @@ namespace Opm
children_.push_back(child); children_.push_back(child);
} }
int WellsGroup::numberOfLeafNodes() { int WellsGroup::numberOfLeafNodes() {
// This could probably use some caching, but seeing as how the number of // This could probably use some caching, but seeing as how the number of
// wells is relatively small, we'll do without for now. // wells is relatively small, we'll do without for now.
int sum = 0; int sum = 0;
for(size_t i = 0; i < children_.size(); i++) { for(size_t i = 0; i < children_.size(); i++) {
sum += children_[i]->numberOfLeafNodes(); sum += children_[i]->numberOfLeafNodes();
} }
return sum; return sum;
} }
std::pair<WellNode*, double> WellsGroup::getWorstOffending(const std::vector<double>& well_reservoirrates_phase, std::pair<WellNode*, double> WellsGroup::getWorstOffending(const std::vector<double>& well_reservoirrates_phase,
const std::vector<double>& well_surfacerates_phase, const std::vector<double>& well_surfacerates_phase,
ProductionSpecification::ControlMode mode) ProductionSpecification::ControlMode mode)
@@ -434,7 +434,7 @@ namespace Opm
} }
return max; return max;
} }
void WellsGroup::applyProdGroupControls() void WellsGroup::applyProdGroupControls()
{ {
ProductionSpecification::ControlMode prod_mode = prodSpec().control_mode_; ProductionSpecification::ControlMode prod_mode = prodSpec().control_mode_;
@@ -449,12 +449,12 @@ namespace Opm
THROW("Can't apply group control for group " << name() << " as the sum of guide rates for all group controlled wells is zero."); THROW("Can't apply group control for group " << name() << " as the sum of guide rates for all group controlled wells is zero.");
} }
for (size_t i = 0; i < children_.size(); ++i ) { for (size_t i = 0; i < children_.size(); ++i ) {
// Apply for all children. // Apply for all children.
// Note, we do _not_ want to call the applyProdGroupControl in this object, // Note, we do _not_ want to call the applyProdGroupControl in this object,
// as that would check if we're under group control, something we're not. // as that would check if we're under group control, something we're not.
const double children_guide_rate = children_[i]->productionGuideRate(true); const double children_guide_rate = children_[i]->productionGuideRate(true);
children_[i]->applyProdGroupControl(prod_mode, children_[i]->applyProdGroupControl(prod_mode,
(children_guide_rate / my_guide_rate) * getTarget(prod_mode), (children_guide_rate / my_guide_rate) * getTarget(prod_mode),
false); false);
} }
break; break;
@@ -470,7 +470,7 @@ namespace Opm
THROW("Unhandled group production control type " << prod_mode); THROW("Unhandled group production control type " << prod_mode);
} }
} }
void WellsGroup::applyInjGroupControls() void WellsGroup::applyInjGroupControls()
{ {
InjectionSpecification::ControlMode inj_mode = injSpec().control_mode_; InjectionSpecification::ControlMode inj_mode = injSpec().control_mode_;
@@ -480,7 +480,7 @@ namespace Opm
{ {
const double my_guide_rate = injectionGuideRate(true); const double my_guide_rate = injectionGuideRate(true);
for (size_t i = 0; i < children_.size(); ++i) { for (size_t i = 0; i < children_.size(); ++i) {
// Apply for all children. // Apply for all children.
// Note, we do _not_ want to call the applyProdGroupControl in this object, // Note, we do _not_ want to call the applyProdGroupControl in this object,
// as that would check if we're under group control, something we're not. // as that would check if we're under group control, something we're not.
const double children_guide_rate = children_[i]->injectionGuideRate(true); const double children_guide_rate = children_[i]->injectionGuideRate(true);
@@ -505,11 +505,11 @@ namespace Opm
THROW("Unhandled group injection control mode " << inj_mode); THROW("Unhandled group injection control mode " << inj_mode);
} }
} }
/// Calculates the production guide rate for the group. /// Calculates the production guide rate for the group.
/// \param[in] only_group If true, will only accumelate guide rates for /// \param[in] only_group If true, will only accumelate guide rates for
/// wells under group control /// wells under group control
double WellsGroup::productionGuideRate(bool only_group) double WellsGroup::productionGuideRate(bool only_group)
{ {
double sum = 0.0; double sum = 0.0;
for (size_t i = 0; i < children_.size(); ++i) { for (size_t i = 0; i < children_.size(); ++i) {
@@ -519,7 +519,7 @@ namespace Opm
} }
/// Calculates the injection guide rate for the group. /// Calculates the injection guide rate for the group.
/// \param[in] only_group If true, will only accumelate guide rates for /// \param[in] only_group If true, will only accumelate guide rates for
/// wells under group control /// wells under group control
double WellsGroup::injectionGuideRate(bool only_group) double WellsGroup::injectionGuideRate(bool only_group)
{ {
@@ -530,7 +530,7 @@ namespace Opm
return sum; return sum;
} }
/// Gets the total production flow of the given phase. /// Gets the total production flow of the given phase.
/// \param[in] phase_flows A vector containing rates by phase for each well. /// \param[in] phase_flows A vector containing rates by phase for each well.
/// Is assumed to be ordered the same way as the related Wells-struct, /// Is assumed to be ordered the same way as the related Wells-struct,
/// with all phase rates of a single well adjacent in the array. /// with all phase rates of a single well adjacent in the array.
@@ -576,7 +576,7 @@ namespace Opm
const double total_reinjected = - total_produced; // Production negative, injection positive const double total_reinjected = - total_produced; // Production negative, injection positive
const double my_guide_rate = injectionGuideRate(true); const double my_guide_rate = injectionGuideRate(true);
for (size_t i = 0; i < children_.size(); ++i) { for (size_t i = 0; i < children_.size(); ++i) {
// Apply for all children. // Apply for all children.
// Note, we do _not_ want to call the applyProdGroupControl in this object, // Note, we do _not_ want to call the applyProdGroupControl in this object,
// as that would check if we're under group control, something we're not. // as that would check if we're under group control, something we're not.
const double children_guide_rate = children_[i]->injectionGuideRate(true); const double children_guide_rate = children_[i]->injectionGuideRate(true);
@@ -605,7 +605,7 @@ namespace Opm
const double total_reinjected = - total_produced; // Production negative, injection positive const double total_reinjected = - total_produced; // Production negative, injection positive
const double my_guide_rate = injectionGuideRate(true); const double my_guide_rate = injectionGuideRate(true);
for (size_t i = 0; i < children_.size(); ++i) { for (size_t i = 0; i < children_.size(); ++i) {
// Apply for all children. // Apply for all children.
// Note, we do _not_ want to call the applyProdGroupControl in this object, // Note, we do _not_ want to call the applyProdGroupControl in this object,
// as that would check if we're under group control, something we're not. // as that would check if we're under group control, something we're not.
const double children_guide_rate = children_[i]->injectionGuideRate(true); const double children_guide_rate = children_[i]->injectionGuideRate(true);
@@ -613,14 +613,14 @@ namespace Opm
(children_guide_rate / my_guide_rate) * total_reinjected * injSpec().voidage_replacment_fraction_, (children_guide_rate / my_guide_rate) * total_reinjected * injSpec().voidage_replacment_fraction_,
false); false);
} }
} }
} }
// ============== WellNode members ============ // ============== WellNode members ============
WellNode::WellNode(const std::string& myname, WellNode::WellNode(const std::string& myname,
const ProductionSpecification& prod_spec, const ProductionSpecification& prod_spec,
const InjectionSpecification& inj_spec, const InjectionSpecification& inj_spec,
@@ -730,13 +730,13 @@ namespace Opm
wells_ = wells; wells_ = wells;
self_index_ = self_index; self_index_ = self_index;
} }
int WellNode::numberOfLeafNodes() int WellNode::numberOfLeafNodes()
{ {
return 1; return 1;
} }
void WellNode::shutWell() void WellNode::shutWell()
{ {
if (shut_well_) { if (shut_well_) {
// We set the tilde of the current control // We set the tilde of the current control
@@ -774,13 +774,13 @@ namespace Opm
&well_surfacerates_phase[index], &well_surfacerates_phase[index],
mode)); mode));
} }
void WellNode::applyInjGroupControl(const InjectionSpecification::ControlMode control_mode, void WellNode::applyInjGroupControl(const InjectionSpecification::ControlMode control_mode,
const double target, const double target,
const bool forced) const bool forced)
{ {
// Not changing if we're not forced to change // Not changing if we're not forced to change
if (!forced if (!forced
&& (injSpec().control_mode_ != InjectionSpecification::GRUP && injSpec().control_mode_ != InjectionSpecification::NONE)) { && (injSpec().control_mode_ != InjectionSpecification::GRUP && injSpec().control_mode_ != InjectionSpecification::NONE)) {
return; return;
} }
@@ -818,7 +818,7 @@ namespace Opm
} }
/// Gets the total production flow of the given phase. /// Gets the total production flow of the given phase.
/// \param[in] phase_flows A vector containing rates by phase for each well. /// \param[in] phase_flows A vector containing rates by phase for each well.
/// Is assumed to be ordered the same way as the related Wells-struct, /// Is assumed to be ordered the same way as the related Wells-struct,
/// with all phase rates of a single well adjacent in the array. /// with all phase rates of a single well adjacent in the array.
@@ -832,7 +832,7 @@ namespace Opm
} }
return phase_flows[self_index_*phaseUsage().num_phases + phaseUsage().phase_pos[phase]]; return phase_flows[self_index_*phaseUsage().num_phases + phaseUsage().phase_pos[phase]];
} }
WellType WellNode::type() const { WellType WellNode::type() const {
return wells_->type[self_index_]; return wells_->type[self_index_];
} }
@@ -867,7 +867,7 @@ namespace Opm
} }
// We're a producer, so we need to negate the input // We're a producer, so we need to negate the input
double ntarget = -target; double ntarget = -target;
double distr[3] = { 0.0, 0.0, 0.0 }; double distr[3] = { 0.0, 0.0, 0.0 };
const int* phase_pos = phaseUsage().phase_pos; const int* phase_pos = phaseUsage().phase_pos;
const int* phase_used = phaseUsage().phase_used; const int* phase_used = phaseUsage().phase_used;
@@ -895,7 +895,7 @@ namespace Opm
distr[phase_pos[BlackoilPhases::Vapour]] = 1.0; distr[phase_pos[BlackoilPhases::Vapour]] = 1.0;
break; break;
case ProductionSpecification::LRAT: case ProductionSpecification::LRAT:
std::cout << "applying rate" << std::endl; std::cout << "applying rate" << std::endl;
wct = SURFACE_RATE; wct = SURFACE_RATE;
if (!phase_used[BlackoilPhases::Liquid]) { if (!phase_used[BlackoilPhases::Liquid]) {
THROW("Oil phase not active and LRAT control specified."); THROW("Oil phase not active and LRAT control specified.");
@@ -929,21 +929,21 @@ namespace Opm
set_current_control(self_index_, group_control_index_, wells_); set_current_control(self_index_, group_control_index_, wells_);
} }
void WellNode::applyProdGroupControls() void WellNode::applyProdGroupControls()
{ {
// Empty // Empty
} }
void WellNode::applyInjGroupControls() void WellNode::applyInjGroupControls()
{ {
// Empty // Empty
} }
/// Calculates the production guide rate for the group. /// Calculates the production guide rate for the group.
/// \param[in] only_group If true, will only accumelate guide rates for /// \param[in] only_group If true, will only accumelate guide rates for
/// wells under group control /// wells under group control
double WellNode::productionGuideRate(bool only_group) double WellNode::productionGuideRate(bool only_group)
{ {
if (!only_group || prodSpec().control_mode_ == ProductionSpecification::GRUP) { if (!only_group || prodSpec().control_mode_ == ProductionSpecification::GRUP) {
return prodSpec().guide_rate_; return prodSpec().guide_rate_;
@@ -952,7 +952,7 @@ namespace Opm
} }
/// Calculates the injection guide rate for the group. /// Calculates the injection guide rate for the group.
/// \param[in] only_group If true, will only accumelate guide rates for /// \param[in] only_group If true, will only accumelate guide rates for
/// wells under group control /// wells under group control
double WellNode::injectionGuideRate(bool only_group) double WellNode::injectionGuideRate(bool only_group)
{ {
@@ -961,8 +961,8 @@ namespace Opm
} }
return 0.0; return 0.0;
} }
namespace namespace
{ {

View File

@@ -30,10 +30,10 @@
namespace Opm namespace Opm
{ {
// Need to forward declare this one, some of the methods in the base // Need to forward declare this one, some of the methods in the base
// class returns pointers to it. // class returns pointers to it.
class WellNode; class WellNode;
/// Basic information needed for group control (each group should typically /// Basic information needed for group control (each group should typically
/// not exceed the sum of its leaf nodes) /// not exceed the sum of its leaf nodes)
struct WellPhasesSummed struct WellPhasesSummed
@@ -59,37 +59,37 @@ namespace Opm
/// The unique identifier for the well or well group. /// The unique identifier for the well or well group.
const std::string& name(); const std::string& name();
/// Production specifications for the well or well group. /// Production specifications for the well or well group.
const ProductionSpecification& prodSpec() const; const ProductionSpecification& prodSpec() const;
/// Injection specifications for the well or well group. /// Injection specifications for the well or well group.
const InjectionSpecification& injSpec() const; const InjectionSpecification& injSpec() const;
/// Production specifications for the well or well group. /// Production specifications for the well or well group.
ProductionSpecification& prodSpec(); ProductionSpecification& prodSpec();
/// Injection specifications for the well or well group. /// Injection specifications for the well or well group.
InjectionSpecification& injSpec(); InjectionSpecification& injSpec();
/// Phase usage information. /// Phase usage information.
const PhaseUsage& phaseUsage() const; const PhaseUsage& phaseUsage() const;
/// \returns true if the object is a leaf node (WellNode), false otherwise. /// \returns true if the object is a leaf node (WellNode), false otherwise.
virtual bool isLeafNode() const; virtual bool isLeafNode() const;
/// \returns the pointer to the WellsGroupInterface with the given name. NULL if /// \returns the pointer to the WellsGroupInterface with the given name. NULL if
/// the name is not found.a /// the name is not found.a
virtual WellsGroupInterface* findGroup(const std::string& name_of_node) = 0; virtual WellsGroupInterface* findGroup(const std::string& name_of_node) = 0;
/// Sets the parent /// Sets the parent
/// \param[in] parent the pointer to the parent /// \param[in] parent the pointer to the parent
void setParent(WellsGroupInterface* parent); void setParent(WellsGroupInterface* parent);
/// Gets the parent of the group, NULL if no parent. /// Gets the parent of the group, NULL if no parent.
const WellsGroupInterface* getParent() const; const WellsGroupInterface* getParent() const;
/// Calculates the number of leaf nodes in the given group. /// Calculates the number of leaf nodes in the given group.
/// A leaf node is defined to have one leaf node in its group. /// A leaf node is defined to have one leaf node in its group.
virtual int numberOfLeafNodes() = 0; virtual int numberOfLeafNodes() = 0;
@@ -104,7 +104,7 @@ namespace Opm
/// \endcode /// \endcode
/// ///
/// \note It's highly recommended to use the conditionsMet found in WellsManager. /// \note It's highly recommended to use the conditionsMet found in WellsManager.
/// \param[in] well_bhp A vector containing the bhp for each well. Is assumed /// \param[in] well_bhp A vector containing the bhp for each well. Is assumed
/// to be ordered the same way as the related Wells-struct. /// to be ordered the same way as the related Wells-struct.
/// \param[in] well_reservoirrates_phase /// \param[in] well_reservoirrates_phase
/// A vector containing reservoir rates by phase for each well. /// A vector containing reservoir rates by phase for each well.
@@ -121,7 +121,7 @@ namespace Opm
const std::vector<double>& well_reservoirrates_phase, const std::vector<double>& well_reservoirrates_phase,
const std::vector<double>& well_surfacerates_phase, const std::vector<double>& well_surfacerates_phase,
WellPhasesSummed& summed_phases) = 0; WellPhasesSummed& summed_phases) = 0;
/// Sets the current active control to the provided one for all injectors within the group. /// Sets the current active control to the provided one for all injectors within the group.
/// After this call, the combined rate (which rate depending on control_mode) of the group /// After this call, the combined rate (which rate depending on control_mode) of the group
/// shall be equal to target. /// shall be equal to target.
@@ -154,39 +154,39 @@ namespace Opm
virtual std::pair<WellNode*, double> getWorstOffending(const std::vector<double>& well_reservoirrates_phase, virtual std::pair<WellNode*, double> getWorstOffending(const std::vector<double>& well_reservoirrates_phase,
const std::vector<double>& well_surfacerates_phase, const std::vector<double>& well_surfacerates_phase,
ProductionSpecification::ControlMode mode) = 0; ProductionSpecification::ControlMode mode) = 0;
/// Gets the target rate for the given mode. /// Gets the target rate for the given mode.
double getTarget(ProductionSpecification::ControlMode mode); double getTarget(ProductionSpecification::ControlMode mode);
/// Gets the target rate for the given mode. /// Gets the target rate for the given mode.
double getTarget(InjectionSpecification::ControlMode mode); double getTarget(InjectionSpecification::ControlMode mode);
/// Applies any production group control relevant to all children nodes. /// Applies any production group control relevant to all children nodes.
/// If no group control is set, this is called recursively to the children. /// If no group control is set, this is called recursively to the children.
virtual void applyProdGroupControls() = 0; virtual void applyProdGroupControls() = 0;
/// Applies any injection group control relevant to all children nodes. /// Applies any injection group control relevant to all children nodes.
/// If no group control is set, this is called recursively to the children. /// If no group control is set, this is called recursively to the children.
virtual void applyInjGroupControls() = 0; virtual void applyInjGroupControls() = 0;
/// Calculates the production guide rate for the group. /// Calculates the production guide rate for the group.
/// \param[in] only_group If true, will only accumelate guide rates for /// \param[in] only_group If true, will only accumelate guide rates for
/// wells under group control /// wells under group control
virtual double productionGuideRate(bool only_group) = 0; virtual double productionGuideRate(bool only_group) = 0;
/// Calculates the injection guide rate for the group. /// Calculates the injection guide rate for the group.
/// \param[in] only_group If true, will only accumelate guide rates for /// \param[in] only_group If true, will only accumelate guide rates for
/// wells under group control /// wells under group control
virtual double injectionGuideRate(bool only_group) = 0; virtual double injectionGuideRate(bool only_group) = 0;
/// Gets the total production flow of the given phase. /// Gets the total production flow of the given phase.
/// \param[in] phase_flows A vector containing rates by phase for each well. /// \param[in] phase_flows A vector containing rates by phase for each well.
/// Is assumed to be ordered the same way as the related Wells-struct, /// Is assumed to be ordered the same way as the related Wells-struct,
/// with all phase rates of a single well adjacent in the array. /// with all phase rates of a single well adjacent in the array.
/// \param[in] phase The phase for which to sum up. /// \param[in] phase The phase for which to sum up.
virtual double getTotalProductionFlow(const std::vector<double>& phase_flows, virtual double getTotalProductionFlow(const std::vector<double>& phase_flows,
const BlackoilPhases::PhaseIndex phase) = 0; const BlackoilPhases::PhaseIndex phase) = 0;
/// Applies explicit reinjection controls. This must be called at each timestep to be correct. /// Applies explicit reinjection controls. This must be called at each timestep to be correct.
/// \param[in] well_reservoirrates_phase /// \param[in] well_reservoirrates_phase
/// A vector containing reservoir rates by phase for each well. /// A vector containing reservoir rates by phase for each well.
@@ -198,16 +198,16 @@ namespace Opm
/// with all phase rates of a single well adjacent in the array. /// with all phase rates of a single well adjacent in the array.
virtual void applyExplicitReinjectionControls(const std::vector<double>& well_reservoirrates_phase, virtual void applyExplicitReinjectionControls(const std::vector<double>& well_reservoirrates_phase,
const std::vector<double>& well_surfacerates_phase) = 0; const std::vector<double>& well_surfacerates_phase) = 0;
protected: protected:
/// Calculates the correct rate for the given ProductionSpecification::ControlMode /// Calculates the correct rate for the given ProductionSpecification::ControlMode
double rateByMode(const double* res_rates, double rateByMode(const double* res_rates,
const double* surf_rates, const double* surf_rates,
const ProductionSpecification::ControlMode mode); const ProductionSpecification::ControlMode mode);
/// Calculates the correct rate for the given InjectionSpecification::ControlMode /// Calculates the correct rate for the given InjectionSpecification::ControlMode
double rateByMode(const double* res_rates, double rateByMode(const double* res_rates,
const double* surf_rates, const double* surf_rates,
const InjectionSpecification::ControlMode mode); const InjectionSpecification::ControlMode mode);
@@ -233,12 +233,12 @@ namespace Opm
virtual WellsGroupInterface* findGroup(const std::string& name_of_node); virtual WellsGroupInterface* findGroup(const std::string& name_of_node);
void addChild(boost::shared_ptr<WellsGroupInterface> child); void addChild(boost::shared_ptr<WellsGroupInterface> child);
virtual bool conditionsMet(const std::vector<double>& well_bhp, virtual bool conditionsMet(const std::vector<double>& well_bhp,
const std::vector<double>& well_reservoirrates_phase, const std::vector<double>& well_reservoirrates_phase,
const std::vector<double>& well_surfacerates_phase, const std::vector<double>& well_surfacerates_phase,
WellPhasesSummed& summed_phases); WellPhasesSummed& summed_phases);
virtual int numberOfLeafNodes(); virtual int numberOfLeafNodes();
virtual std::pair<WellNode*, double> getWorstOffending(const std::vector<double>& well_reservoirrates_phase, virtual std::pair<WellNode*, double> getWorstOffending(const std::vector<double>& well_reservoirrates_phase,
const std::vector<double>& well_surfacerates_phase, const std::vector<double>& well_surfacerates_phase,
@@ -261,33 +261,33 @@ namespace Opm
virtual void applyProdGroupControl(const ProductionSpecification::ControlMode control_mode, virtual void applyProdGroupControl(const ProductionSpecification::ControlMode control_mode,
const double target, const double target,
bool forced); bool forced);
/// Applies any production group control relevant to all children nodes. /// Applies any production group control relevant to all children nodes.
/// If no group control is set, this is called recursively to the children. /// If no group control is set, this is called recursively to the children.
virtual void applyProdGroupControls(); virtual void applyProdGroupControls();
/// Applies any injection group control relevant to all children nodes. /// Applies any injection group control relevant to all children nodes.
/// If no group control is set, this is called recursively to the children. /// If no group control is set, this is called recursively to the children.
virtual void applyInjGroupControls(); virtual void applyInjGroupControls();
/// Calculates the production guide rate for the group. /// Calculates the production guide rate for the group.
/// \param[in] only_group If true, will only accumelate guide rates for /// \param[in] only_group If true, will only accumelate guide rates for
/// wells under group control /// wells under group control
virtual double productionGuideRate(bool only_group); virtual double productionGuideRate(bool only_group);
/// Calculates the injection guide rate for the group. /// Calculates the injection guide rate for the group.
/// \param[in] only_group If true, will only accumelate guide rates for /// \param[in] only_group If true, will only accumelate guide rates for
/// wells under group control /// wells under group control
virtual double injectionGuideRate(bool only_group); virtual double injectionGuideRate(bool only_group);
/// Gets the total production flow of the given phase. /// Gets the total production flow of the given phase.
/// \param[in] phase_flows A vector containing rates by phase for each well. /// \param[in] phase_flows A vector containing rates by phase for each well.
/// Is assumed to be ordered the same way as the related Wells-struct, /// Is assumed to be ordered the same way as the related Wells-struct,
/// with all phase rates of a single well adjacent in the array. /// with all phase rates of a single well adjacent in the array.
/// \param[in] phase The phase for which to sum up. /// \param[in] phase The phase for which to sum up.
virtual double getTotalProductionFlow(const std::vector<double>& phase_flows, virtual double getTotalProductionFlow(const std::vector<double>& phase_flows,
const BlackoilPhases::PhaseIndex phase); const BlackoilPhases::PhaseIndex phase);
/// Applies explicit reinjection controls. This must be called at each timestep to be correct. /// Applies explicit reinjection controls. This must be called at each timestep to be correct.
/// \param[in] well_reservoirrates_phase /// \param[in] well_reservoirrates_phase
/// A vector containing reservoir rates by phase for each well. /// A vector containing reservoir rates by phase for each well.
@@ -319,16 +319,16 @@ namespace Opm
const std::vector<double>& well_reservoirrates_phase, const std::vector<double>& well_reservoirrates_phase,
const std::vector<double>& well_surfacerates_phase, const std::vector<double>& well_surfacerates_phase,
WellPhasesSummed& summed_phases); WellPhasesSummed& summed_phases);
virtual bool isLeafNode() const; virtual bool isLeafNode() const;
void setWellsPointer(Wells* wells, int self_index); void setWellsPointer(Wells* wells, int self_index);
virtual int numberOfLeafNodes(); virtual int numberOfLeafNodes();
// Shuts the well (in the well struct) // Shuts the well (in the well struct)
void shutWell(); void shutWell();
virtual std::pair<WellNode*, double> getWorstOffending(const std::vector<double>& well_reservoirrates_phase, virtual std::pair<WellNode*, double> getWorstOffending(const std::vector<double>& well_reservoirrates_phase,
const std::vector<double>& well_surfacerates_phase, const std::vector<double>& well_surfacerates_phase,
ProductionSpecification::ControlMode mode); ProductionSpecification::ControlMode mode);
@@ -350,26 +350,26 @@ namespace Opm
virtual void applyProdGroupControl(const ProductionSpecification::ControlMode control_mode, virtual void applyProdGroupControl(const ProductionSpecification::ControlMode control_mode,
const double target, const double target,
bool forced); bool forced);
/// Applies any production group control relevant to all children nodes. /// Applies any production group control relevant to all children nodes.
/// If no group control is set, this is called recursively to the children. /// If no group control is set, this is called recursively to the children.
virtual void applyProdGroupControls(); virtual void applyProdGroupControls();
/// Applies any injection group control relevant to all children nodes. /// Applies any injection group control relevant to all children nodes.
/// If no group control is set, this is called recursively to the children. /// If no group control is set, this is called recursively to the children.
virtual void applyInjGroupControls(); virtual void applyInjGroupControls();
/// Calculates the production guide rate for the group. /// Calculates the production guide rate for the group.
/// \param[in] only_group If true, will only accumelate guide rates for /// \param[in] only_group If true, will only accumelate guide rates for
/// wells under group control /// wells under group control
virtual double productionGuideRate(bool only_group); virtual double productionGuideRate(bool only_group);
/// Calculates the injection guide rate for the group. /// Calculates the injection guide rate for the group.
/// \param[in] only_group If true, will only accumelate guide rates for /// \param[in] only_group If true, will only accumelate guide rates for
/// wells under group control /// wells under group control
virtual double injectionGuideRate(bool only_group); virtual double injectionGuideRate(bool only_group);
/// Gets the total production flow of the given phase. /// Gets the total production flow of the given phase.
/// \param[in] phase_flows A vector containing rates by phase for each well. /// \param[in] phase_flows A vector containing rates by phase for each well.
/// Is assumed to be ordered the same way as the related Wells-struct, /// Is assumed to be ordered the same way as the related Wells-struct,
/// with all phase rates of a single well adjacent in the array. /// with all phase rates of a single well adjacent in the array.
@@ -379,7 +379,7 @@ namespace Opm
/// Returns the type of the well. /// Returns the type of the well.
WellType type() const; WellType type() const;
/// Applies explicit reinjection controls. This must be called at each timestep to be correct. /// Applies explicit reinjection controls. This must be called at each timestep to be correct.
/// \param[in] well_reservoirrates_phase /// \param[in] well_reservoirrates_phase
/// A vector containing reservoir rates by phase for each well. /// A vector containing reservoir rates by phase for each well.
@@ -402,7 +402,7 @@ namespace Opm
/// Creates the WellsGroupInterface for the given name /// Creates the WellsGroupInterface for the given name
/// \param[in] name the name of the wells group. /// \param[in] name the name of the wells group.
/// \param[in] deck the deck from which to fetch information. /// \param[in] deck the deck from which to fetch information.
boost::shared_ptr<WellsGroupInterface> createWellsGroup(const std::string& name, boost::shared_ptr<WellsGroupInterface> createWellsGroup(const std::string& name,
const EclipseGridParser& deck); const EclipseGridParser& deck);

View File

@@ -223,7 +223,7 @@ namespace Opm
: w_(0) : w_(0)
{ {
} }
/// Construct from existing wells object. /// Construct from existing wells object.
WellsManager::WellsManager(struct Wells* W) WellsManager::WellsManager(struct Wells* W)

View File

@@ -63,7 +63,7 @@ namespace Opm
/// Does the "deck" define any wells? /// Does the "deck" define any wells?
bool empty() const; bool empty() const;
/// Access the managed Wells. /// Access the managed Wells.
/// The method is named similarly to c_str() in std::string, /// The method is named similarly to c_str() in std::string,
/// to make it clear that we are returning a C-compatible struct. /// to make it clear that we are returning a C-compatible struct.
@@ -71,7 +71,7 @@ namespace Opm
/// Access the well group hierarchy. /// Access the well group hierarchy.
const WellCollection& wellCollection() const; const WellCollection& wellCollection() const;
/// Checks if each condition is met, applies well controls where needed /// Checks if each condition is met, applies well controls where needed
/// (that is, it either changes the active control of violating wells, or shuts /// (that is, it either changes the active control of violating wells, or shuts
/// down wells). Only one change is applied per invocation. Typical use will be /// down wells). Only one change is applied per invocation. Typical use will be
@@ -81,7 +81,7 @@ namespace Opm
/// solve_pressure(); /// solve_pressure();
/// } /// }
/// \endcode /// \endcode
/// \param[in] well_bhp A vector containing the bhp for each well. Is assumed /// \param[in] well_bhp A vector containing the bhp for each well. Is assumed
/// to be ordered the same way as the related Wells-struct. /// to be ordered the same way as the related Wells-struct.
/// \param[in] well_reservoirrates_phase /// \param[in] well_reservoirrates_phase
/// A vector containing reservoir rates by phase for each well. /// A vector containing reservoir rates by phase for each well.
@@ -95,7 +95,7 @@ namespace Opm
bool conditionsMet(const std::vector<double>& well_bhp, bool conditionsMet(const std::vector<double>& well_bhp,
const std::vector<double>& well_reservoirrates_phase, const std::vector<double>& well_reservoirrates_phase,
const std::vector<double>& well_surfacerates_phase); const std::vector<double>& well_surfacerates_phase);
/// Applies explicit reinjection controls. This must be called at each timestep to be correct. /// Applies explicit reinjection controls. This must be called at each timestep to be correct.
/// \param[in] well_reservoirrates_phase /// \param[in] well_reservoirrates_phase
/// A vector containing reservoir rates by phase for each well. /// A vector containing reservoir rates by phase for each well.
@@ -117,7 +117,7 @@ namespace Opm
Wells* w_; Wells* w_;
WellCollection well_collection_; WellCollection well_collection_;
}; };