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);
}
void LinearSolverFactory::setTolerance(const double tol)
void LinearSolverFactory::setTolerance(const double tol)
{
solver_->setTolerance(tol);
}

View File

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

View File

@ -97,7 +97,7 @@ namespace Opm
int linsolver_smooth_steps_;
/** \brief The factor to scale the coarse grid correction with. */
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_);
if (!ok) {
THROW("Failed to append pressure boundary conditions for side " << sideString(side));
}
}
}

View File

@ -23,8 +23,8 @@
#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)
{
@ -35,7 +35,7 @@ void dfs (int size, int *ia, int *ja, int *ncolors, int *color, int* work)
int *bottom = stack;
*ncolors = 0; /* colors are nonnegative */
for (i=0; i<size; ++i) {
color [i] = UNVISITED;
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 ) {
c = *(stack-1); /* peek */
if (count[c] > 0){
int child = ja[ia[c] + count[c]-1];
count[c]--;
if (color[child] == UNVISITED) {
*stack++ = child;
color[c] = VISITED;
}
} else {
color[c] = *ncolors;
--stack; /* pop c */
@ -104,9 +104,9 @@ int main (int argc, char *argv [])
fprintf(stderr, "ncolors = %d\n", ncolors);
for (j=0; j<size; ++j) {
fprintf(stderr, "%d\n", color[j]);
fprintf(stderr, "%d\n", color[j]);
}
free (color);
free (work);

View File

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

View File

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

View File

@ -507,7 +507,7 @@ namespace Opm
if (!deck.hasField("SGAS")) {
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 opos = pu.phase_pos[BlackoilPhases::Liquid];
for (int c = 0; c < num_cells; ++c) {

View File

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

View File

@ -141,7 +141,7 @@ namespace Opm
const std::vector<int>& cells,
const std::vector<double>& s ,
std::vector<double>& pmobc);
/// Computes the fractional flow for each cell in the cells argument
/// @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
/// single-perforation.
void wellsToSrc(const Wells& wells, const int num_cells, std::vector<double>& src);
/// Computes the WDP for each well.
/// \param[in] wells Wells that need their wdp calculated.
/// \param[in] grid The associated grid to make cell lookups.
/// \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,
/// \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,
/// saturations[i*densities.size() + p] should give the weight
/// of phase p in cell i.
/// \param[in] densities Density for each phase.
/// \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.
void computeWDP(const Wells& wells, const UnstructuredGrid& grid, const std::vector<double>& saturations,
const double* densities, const double gravity, const bool per_grid_cell,
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] 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.
/// \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,
std::vector<double>& flow_rates_per_well);
/// Computes the phase flow rate per well
/// \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
/// way as the wells struct
/// \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
void computePhaseFlowRatesPerWell(const Wells& wells,
void computePhaseFlowRatesPerWell(const Wells& wells,
const std::vector<double>& flow_rates_per_well_cell,
const std::vector<double>& fractional_flows,
std::vector<double>& phase_flow_per_well);
/// Encapsulates the watercut curves.
class Watercut
{

View File

@ -5,7 +5,7 @@ namespace Opm
{
ProductionSpecification::ProductionSpecification()
:
:
control_mode_(NONE),
procedure_(NONE_P),
oil_max_rate_(-1e100),
@ -15,7 +15,7 @@ namespace Opm
reservoir_flow_max_rate_(-1e100),
BHP_limit_(-1e100),
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
};
enum GuideRateType
{
OIL, NONE_GRT
};
ProductionSpecification();
ControlMode control_mode_;
Procedure procedure_;

View File

@ -27,7 +27,7 @@ namespace Opm
void WellCollection::addChild(const std::string& child_name,
const std::string& parent_name,
const EclipseGridParser& deck)
{
{
WellsGroupInterface* parent = findNode(parent_name);
if (!parent) {
roots_.push_back(createWellsGroup(parent_name, deck));
@ -42,7 +42,7 @@ namespace Opm
for(size_t j = i; j < roots_.size() - 1; ++j) {
roots_[j] = roots_[j+1];
}
roots_.resize(roots_.size()-1);
break;
}
@ -50,7 +50,7 @@ namespace Opm
if (!child.get()) {
child = createWellsGroup(child_name, deck);
}
WellsGroup* parent_as_group = static_cast<WellsGroup*> (parent);
if (!parent_as_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()) {
leaf_nodes_.push_back(static_cast<WellNode*>(child.get()));
}
child->setParent(parent);
}
const std::vector<WellNode*>& WellCollection::getLeafNodes() const {
return leaf_nodes_;
}
@ -81,7 +81,7 @@ namespace Opm
}
return NULL;
}
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()));
}
}
bool WellCollection::conditionsMet(const std::vector<double>& well_bhp,
const std::vector<double>& well_reservoirrates_phase,
const std::vector<double>& well_surfacerates_phase)
@ -139,13 +139,13 @@ namespace Opm
}
return true;
}
void WellCollection::setWellsPointer(Wells* wells) {
for(size_t i = 0; i < leaf_nodes_.size(); i++) {
leaf_nodes_[i]->setWellsPointer(wells, i);
}
}
void WellCollection::applyGroupControls()
{
for (size_t i = 0; i < roots_.size(); ++i) {

View File

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

View File

@ -28,7 +28,7 @@ namespace Opm
// ========== WellPhasesSummed methods ===========
WellPhasesSummed::WellPhasesSummed()
WellPhasesSummed::WellPhasesSummed()
{
for (int i = 0; i < 3; ++i) {
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) {
res_inj_rates[i] += other.res_inj_rates[i];
@ -75,8 +75,8 @@ namespace Opm
{
return name_;
}
const PhaseUsage& WellsGroupInterface::phaseUsage() const
const PhaseUsage& WellsGroupInterface::phaseUsage() const
{
return phase_usage_;
}
@ -118,7 +118,7 @@ namespace Opm
}
/// 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 ProductionSpecification::ControlMode mode)
{
@ -130,7 +130,7 @@ namespace Opm
case ProductionSpecification::GRAT:
return surf_rates[phaseUsage().phase_pos[BlackoilPhases::Vapour]];
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]];
case ProductionSpecification::RESV:
{
@ -146,7 +146,7 @@ namespace Opm
}
/// 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 InjectionSpecification::ControlMode mode)
{
@ -167,7 +167,7 @@ namespace Opm
}
return tot_rate;
}
double WellsGroupInterface::getTarget(ProductionSpecification::ControlMode mode)
{
double target = -1.0;
@ -194,10 +194,10 @@ namespace Opm
THROW("Unsupported control mode to query target " << mode);
break;
}
return target;
}
double WellsGroupInterface::getTarget(InjectionSpecification::ControlMode mode)
{
double target = -1.0;
@ -215,13 +215,13 @@ namespace Opm
THROW("Unsupported control mode to query target " << mode);
break;
}
return target;
}
// ============== WellsGroup members =============
@ -257,10 +257,10 @@ namespace Opm
/// \param[in] forced if true, all children will be set under group control, otherwise
/// only children that are under group control will be changed.
void WellsGroup::applyInjGroupControl(const InjectionSpecification::ControlMode control_mode,
const double target,
const double target,
const bool forced)
{
if (forced || injSpec().control_mode_ == InjectionSpecification::FLD
if (forced || injSpec().control_mode_ == InjectionSpecification::FLD
|| injSpec().control_mode_ == InjectionSpecification::NONE) {
const double my_guide_rate = injectionGuideRate(!forced);
if (my_guide_rate == 0.0) {
@ -284,7 +284,7 @@ namespace Opm
const double target,
const bool forced)
{
if (forced || (prodSpec().control_mode_ == ProductionSpecification::FLD
if (forced || (prodSpec().control_mode_ == ProductionSpecification::FLD
|| prodSpec().control_mode_ == ProductionSpecification::NONE)) {
const double my_guide_rate = productionGuideRate(!forced);
if (my_guide_rate == 0.0) {
@ -334,7 +334,7 @@ namespace Opm
double my_rate = rateByMode(child_phases_summed.res_inj_rates,
child_phases_summed.surf_inj_rates,
mode);
if (my_rate > target_rate) {
std::cout << "Group " << mode<<" target not met for group " << name() << std::endl;
std::cout << "target = " << target_rate << '\n'
@ -345,7 +345,7 @@ namespace Opm
}
}
}
// REIN
// \TODO: Add support for REIN controls.
@ -364,7 +364,7 @@ namespace Opm
}
const double target_rate = getTarget(mode);
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,
mode);
if (std::fabs(my_rate) > target_rate) {
@ -377,7 +377,7 @@ namespace Opm
}
}
}
if (production_violated) {
switch (prodSpec().procedure_) {
case ProductionSpecification::WELL:
@ -387,7 +387,7 @@ namespace Opm
return false;
case ProductionSpecification::RATE:
std::cout << "Applying group control" << std::endl;
applyProdGroupControl(production_mode_violated,
applyProdGroupControl(production_mode_violated,
getTarget(production_mode_violated),
true);
return false;
@ -396,7 +396,7 @@ namespace Opm
return false;
}
}
summed_phases += child_phases_summed;
return true;
}
@ -406,19 +406,19 @@ namespace Opm
children_.push_back(child);
}
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.
int sum = 0;
for(size_t i = 0; i < children_.size(); i++) {
sum += children_[i]->numberOfLeafNodes();
}
return sum;
}
std::pair<WellNode*, double> WellsGroup::getWorstOffending(const std::vector<double>& well_reservoirrates_phase,
const std::vector<double>& well_surfacerates_phase,
ProductionSpecification::ControlMode mode)
@ -434,7 +434,7 @@ namespace Opm
}
return max;
}
void WellsGroup::applyProdGroupControls()
{
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.");
}
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,
// as that would check if we're under group control, something we're not.
const double children_guide_rate = children_[i]->productionGuideRate(true);
children_[i]->applyProdGroupControl(prod_mode,
(children_guide_rate / my_guide_rate) * getTarget(prod_mode),
children_[i]->applyProdGroupControl(prod_mode,
(children_guide_rate / my_guide_rate) * getTarget(prod_mode),
false);
}
break;
@ -470,7 +470,7 @@ namespace Opm
THROW("Unhandled group production control type " << prod_mode);
}
}
void WellsGroup::applyInjGroupControls()
{
InjectionSpecification::ControlMode inj_mode = injSpec().control_mode_;
@ -480,7 +480,7 @@ namespace Opm
{
const double my_guide_rate = injectionGuideRate(true);
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,
// as that would check if we're under group control, something we're not.
const double children_guide_rate = children_[i]->injectionGuideRate(true);
@ -505,11 +505,11 @@ namespace Opm
THROW("Unhandled group injection control mode " << inj_mode);
}
}
/// 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
double WellsGroup::productionGuideRate(bool only_group)
double WellsGroup::productionGuideRate(bool only_group)
{
double sum = 0.0;
for (size_t i = 0; i < children_.size(); ++i) {
@ -519,7 +519,7 @@ namespace Opm
}
/// 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
double WellsGroup::injectionGuideRate(bool only_group)
{
@ -530,7 +530,7 @@ namespace Opm
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.
/// 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.
@ -576,7 +576,7 @@ namespace Opm
const double total_reinjected = - total_produced; // Production negative, injection positive
const double my_guide_rate = injectionGuideRate(true);
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,
// as that would check if we're under group control, something we're not.
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 my_guide_rate = injectionGuideRate(true);
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,
// as that would check if we're under group control, something we're not.
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_,
false);
}
}
}
// ============== WellNode members ============
WellNode::WellNode(const std::string& myname,
const ProductionSpecification& prod_spec,
const InjectionSpecification& inj_spec,
@ -730,13 +730,13 @@ namespace Opm
wells_ = wells;
self_index_ = self_index;
}
int WellNode::numberOfLeafNodes()
int WellNode::numberOfLeafNodes()
{
return 1;
}
void WellNode::shutWell()
void WellNode::shutWell()
{
if (shut_well_) {
// We set the tilde of the current control
@ -774,13 +774,13 @@ namespace Opm
&well_surfacerates_phase[index],
mode));
}
void WellNode::applyInjGroupControl(const InjectionSpecification::ControlMode control_mode,
const double target,
const bool forced)
{
// Not changing if we're not forced to change
if (!forced
if (!forced
&& (injSpec().control_mode_ != InjectionSpecification::GRUP && injSpec().control_mode_ != InjectionSpecification::NONE)) {
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.
/// 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.
@ -832,7 +832,7 @@ namespace Opm
}
return phase_flows[self_index_*phaseUsage().num_phases + phaseUsage().phase_pos[phase]];
}
WellType WellNode::type() const {
return wells_->type[self_index_];
}
@ -867,7 +867,7 @@ namespace Opm
}
// We're a producer, so we need to negate the input
double ntarget = -target;
double distr[3] = { 0.0, 0.0, 0.0 };
const int* phase_pos = phaseUsage().phase_pos;
const int* phase_used = phaseUsage().phase_used;
@ -895,7 +895,7 @@ namespace Opm
distr[phase_pos[BlackoilPhases::Vapour]] = 1.0;
break;
case ProductionSpecification::LRAT:
std::cout << "applying rate" << std::endl;
std::cout << "applying rate" << std::endl;
wct = SURFACE_RATE;
if (!phase_used[BlackoilPhases::Liquid]) {
THROW("Oil phase not active and LRAT control specified.");
@ -929,21 +929,21 @@ namespace Opm
set_current_control(self_index_, group_control_index_, wells_);
}
void WellNode::applyProdGroupControls()
{
// Empty
}
void WellNode::applyInjGroupControls()
{
// Empty
}
/// 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
double WellNode::productionGuideRate(bool only_group)
double WellNode::productionGuideRate(bool only_group)
{
if (!only_group || prodSpec().control_mode_ == ProductionSpecification::GRUP) {
return prodSpec().guide_rate_;
@ -952,7 +952,7 @@ namespace Opm
}
/// 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
double WellNode::injectionGuideRate(bool only_group)
{
@ -961,8 +961,8 @@ namespace Opm
}
return 0.0;
}
namespace
{

View File

@ -30,10 +30,10 @@
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 WellNode;
/// Basic information needed for group control (each group should typically
/// not exceed the sum of its leaf nodes)
struct WellPhasesSummed
@ -59,37 +59,37 @@ namespace Opm
/// The unique identifier for the well or well group.
const std::string& name();
/// Production specifications for the well or well group.
const ProductionSpecification& prodSpec() const;
/// Injection specifications for the well or well group.
const InjectionSpecification& injSpec() const;
/// Production specifications for the well or well group.
ProductionSpecification& prodSpec();
/// Injection specifications for the well or well group.
InjectionSpecification& injSpec();
/// Phase usage information.
const PhaseUsage& phaseUsage() const;
/// \returns true if the object is a leaf node (WellNode), false otherwise.
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
virtual WellsGroupInterface* findGroup(const std::string& name_of_node) = 0;
/// Sets the parent
/// \param[in] parent the pointer to the parent
void setParent(WellsGroupInterface* parent);
/// Gets the parent of the group, NULL if no parent.
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.
virtual int numberOfLeafNodes() = 0;
@ -104,7 +104,7 @@ namespace Opm
/// \endcode
///
/// \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.
/// \param[in] well_reservoirrates_phase
/// 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_surfacerates_phase,
WellPhasesSummed& summed_phases) = 0;
/// 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
/// shall be equal to target.
@ -154,39 +154,39 @@ namespace Opm
virtual std::pair<WellNode*, double> getWorstOffending(const std::vector<double>& well_reservoirrates_phase,
const std::vector<double>& well_surfacerates_phase,
ProductionSpecification::ControlMode mode) = 0;
/// Gets the target rate for the given mode.
double getTarget(ProductionSpecification::ControlMode mode);
/// Gets the target rate for the given mode.
double getTarget(InjectionSpecification::ControlMode mode);
/// Applies any production group control relevant to all children nodes.
/// If no group control is set, this is called recursively to the children.
virtual void applyProdGroupControls() = 0;
/// Applies any injection group control relevant to all children nodes.
/// If no group control is set, this is called recursively to the children.
virtual void applyInjGroupControls() = 0;
/// 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
virtual double productionGuideRate(bool only_group) = 0;
/// 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
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.
/// 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.
/// \param[in] phase The phase for which to sum up.
virtual double getTotalProductionFlow(const std::vector<double>& phase_flows,
const BlackoilPhases::PhaseIndex phase) = 0;
/// Applies explicit reinjection controls. This must be called at each timestep to be correct.
/// \param[in] well_reservoirrates_phase
/// 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.
virtual void applyExplicitReinjectionControls(const std::vector<double>& well_reservoirrates_phase,
const std::vector<double>& well_surfacerates_phase) = 0;
protected:
/// 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 ProductionSpecification::ControlMode mode);
/// 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 InjectionSpecification::ControlMode mode);
@ -233,12 +233,12 @@ namespace Opm
virtual WellsGroupInterface* findGroup(const std::string& name_of_node);
void addChild(boost::shared_ptr<WellsGroupInterface> child);
virtual bool conditionsMet(const std::vector<double>& well_bhp,
const std::vector<double>& well_reservoirrates_phase,
const std::vector<double>& well_surfacerates_phase,
WellPhasesSummed& summed_phases);
virtual int numberOfLeafNodes();
virtual std::pair<WellNode*, double> getWorstOffending(const std::vector<double>& well_reservoirrates_phase,
const std::vector<double>& well_surfacerates_phase,
@ -261,33 +261,33 @@ namespace Opm
virtual void applyProdGroupControl(const ProductionSpecification::ControlMode control_mode,
const double target,
bool forced);
/// Applies any production group control relevant to all children nodes.
/// If no group control is set, this is called recursively to the children.
virtual void applyProdGroupControls();
/// Applies any injection group control relevant to all children nodes.
/// If no group control is set, this is called recursively to the children.
virtual void applyInjGroupControls();
/// 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
virtual double productionGuideRate(bool only_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
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.
/// 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.
/// \param[in] phase The phase for which to sum up.
virtual double getTotalProductionFlow(const std::vector<double>& phase_flows,
const BlackoilPhases::PhaseIndex phase);
/// Applies explicit reinjection controls. This must be called at each timestep to be correct.
/// \param[in] well_reservoirrates_phase
/// 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_surfacerates_phase,
WellPhasesSummed& summed_phases);
virtual bool isLeafNode() const;
void setWellsPointer(Wells* wells, int self_index);
virtual int numberOfLeafNodes();
// Shuts the well (in the well struct)
void shutWell();
virtual std::pair<WellNode*, double> getWorstOffending(const std::vector<double>& well_reservoirrates_phase,
const std::vector<double>& well_surfacerates_phase,
ProductionSpecification::ControlMode mode);
@ -350,26 +350,26 @@ namespace Opm
virtual void applyProdGroupControl(const ProductionSpecification::ControlMode control_mode,
const double target,
bool forced);
/// Applies any production group control relevant to all children nodes.
/// If no group control is set, this is called recursively to the children.
virtual void applyProdGroupControls();
/// Applies any injection group control relevant to all children nodes.
/// If no group control is set, this is called recursively to the children.
virtual void applyInjGroupControls();
/// 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
virtual double productionGuideRate(bool only_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
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.
/// 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.
@ -379,7 +379,7 @@ namespace Opm
/// Returns the type of the well.
WellType type() const;
/// Applies explicit reinjection controls. This must be called at each timestep to be correct.
/// \param[in] well_reservoirrates_phase
/// A vector containing reservoir rates by phase for each well.
@ -402,7 +402,7 @@ namespace Opm
/// Creates the WellsGroupInterface for the given name
/// \param[in] name the name of the wells group.
/// \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);

View File

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

View File

@ -63,7 +63,7 @@ namespace Opm
/// Does the "deck" define any wells?
bool empty() const;
/// Access the managed Wells.
/// The method is named similarly to c_str() in std::string,
/// to make it clear that we are returning a C-compatible struct.
@ -71,7 +71,7 @@ namespace Opm
/// Access the well group hierarchy.
const WellCollection& wellCollection() const;
/// Checks if each condition is met, applies well controls where needed
/// (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
@ -81,7 +81,7 @@ namespace Opm
/// solve_pressure();
/// }
/// \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.
/// \param[in] well_reservoirrates_phase
/// A vector containing reservoir rates by phase for each well.
@ -95,7 +95,7 @@ namespace Opm
bool conditionsMet(const std::vector<double>& well_bhp,
const std::vector<double>& well_reservoirrates_phase,
const std::vector<double>& well_surfacerates_phase);
/// Applies explicit reinjection controls. This must be called at each timestep to be correct.
/// \param[in] well_reservoirrates_phase
/// A vector containing reservoir rates by phase for each well.
@ -117,7 +117,7 @@ namespace Opm
Wells* w_;
WellCollection well_collection_;
};