Adjust white-space for readability

This is mostly just splitting long lines and aligning parameters where
appropriate.  No functional changes.
This commit is contained in:
Bård Skaflestad 2014-08-29 12:22:26 +02:00
parent b35362f1e9
commit c3375da14f

View File

@ -187,7 +187,7 @@ void WellsManager::createWellsFromSpecs(std::vector<WellConstPtr>& wells, size_t
const int num_wells = well_data.size(); const int num_wells = well_data.size();
int num_perfs = 0; int num_perfs = 0;
assert(dimensions == 3); assert (dimensions == 3);
for (int w = 0; w < num_wells; ++w) { for (int w = 0; w < num_wells; ++w) {
num_perfs += wellperf_data[w].size(); num_perfs += wellperf_data[w].size();
if (well_data[w].reference_bhp_depth == -1e100) { if (well_data[w].reference_bhp_depth == -1e100) {
@ -195,13 +195,19 @@ void WellsManager::createWellsFromSpecs(std::vector<WellConstPtr>& wells, size_t
double min_depth = 1e100; double min_depth = 1e100;
int num_wperfs = wellperf_data[w].size(); int num_wperfs = wellperf_data[w].size();
for (int perf = 0; perf < num_wperfs; ++perf) { for (int perf = 0; perf < num_wperfs; ++perf) {
double depth = UgGridHelpers using UgGridHelpers::increment;
::getCoordinate(UgGridHelpers::increment(begin_cell_centroids, using UgGridHelpers::getCoordinate;
wellperf_data[w][perf].cell,
dimensions), const CC& cc =
2); increment(begin_cell_centroids,
wellperf_data[w][perf].cell,
dimensions);
const double depth = getCoordinate(cc, 2);
min_depth = std::min(min_depth, depth); min_depth = std::min(min_depth, depth);
} }
well_data[w].reference_bhp_depth = min_depth; well_data[w].reference_bhp_depth = min_depth;
} }
} }
@ -215,66 +221,86 @@ void WellsManager::createWellsFromSpecs(std::vector<WellConstPtr>& wells, size_t
// Add wells. // Add wells.
for (int w = 0; w < num_wells; ++w) { for (int w = 0; w < num_wells; ++w) {
const int w_num_perf = wellperf_data[w].size(); const int w_num_perf = wellperf_data[w].size();
std::vector<int> perf_cells(w_num_perf); std::vector<int> perf_cells (w_num_perf);
std::vector<double> perf_prodind(w_num_perf); std::vector<double> perf_prodind(w_num_perf);
for (int perf = 0; perf < w_num_perf; ++perf) { for (int perf = 0; perf < w_num_perf; ++perf) {
perf_cells[perf] = wellperf_data[w][perf].cell; perf_cells [perf] = wellperf_data[w][perf].cell;
perf_prodind[perf] = wellperf_data[w][perf].well_index; perf_prodind[perf] = wellperf_data[w][perf].well_index;
} }
const double* comp_frac = NULL; const double* comp_frac = NULL;
// We initialize all wells with a null component fraction, // We initialize all wells with a null component fraction,
// and must (for injection wells) overwrite it later. // and must (for injection wells) overwrite it later.
int ok = add_well(well_data[w].type, well_data[w].reference_bhp_depth, w_num_perf, const int ok =
comp_frac, &perf_cells[0], &perf_prodind[0], well_names[w].c_str(), w_); add_well(well_data[w].type,
well_data[w].reference_bhp_depth,
w_num_perf,
comp_frac,
& perf_cells [0],
& perf_prodind[0],
well_names[w].c_str(),
w_);
if (!ok) { if (!ok) {
OPM_THROW(std::runtime_error, "Failed adding well " << well_names[w] << " to Wells data structure."); OPM_THROW(std::runtime_error,
"Failed adding well "
<< well_names[w]
<< " to Wells data structure.");
} }
} }
} }
template<class CC, class C2F, class FC> template <class CC, class C2F, class FC>
WellsManager::WellsManager(const Opm::EclipseStateConstPtr eclipseState, WellsManager::
const size_t timeStep, WellsManager(const Opm::EclipseStateConstPtr eclipseState,
int number_of_cells, const size_t timeStep,
const int* global_cell, int number_of_cells,
const int* cart_dims, const int* global_cell,
int dimensions, const int* cart_dims,
CC begin_cell_centroids, int dimensions,
const C2F& cell_to_faces, CC begin_cell_centroids,
FC begin_face_centroids, const C2F& cell_to_faces,
const double* permeability) FC begin_face_centroids,
const double* permeability)
: w_(0) : w_(0)
{ {
init(eclipseState, timeStep, number_of_cells, global_cell, cart_dims, dimensions, init(eclipseState, timeStep, number_of_cells, global_cell,
begin_cell_centroids, cell_to_faces, begin_face_centroids, permeability); cart_dims, dimensions, begin_cell_centroids,
cell_to_faces, begin_face_centroids, permeability);
} }
/// Construct wells from deck. /// Construct wells from deck.
template<class CC, class C2F, class FC> template <class CC, class C2F, class FC>
void WellsManager::init(const Opm::EclipseStateConstPtr eclipseState, void
const size_t timeStep, WellsManager::init(const Opm::EclipseStateConstPtr eclipseState,
int number_of_cells, const size_t timeStep,
const int* global_cell, int number_of_cells,
const int* cart_dims, const int* global_cell,
int dimensions, const int* cart_dims,
CC begin_cell_centroids, int dimensions,
const C2F& cell_to_faces, CC begin_cell_centroids,
FC begin_face_centroids, const C2F& cell_to_faces,
const double* permeability) FC begin_face_centroids,
const double* permeability)
{ {
if (dimensions != 3) { if (dimensions != 3) {
OPM_THROW(std::runtime_error, "We cannot initialize wells from a deck unless the corresponding grid is 3-dimensional."); OPM_THROW(std::runtime_error,
"We cannot initialize wells from a deck unless "
"the corresponding grid is 3-dimensional.");
} }
if (eclipseState->getSchedule()->numWells() == 0) { if (eclipseState->getSchedule()->numWells() == 0) {
OPM_MESSAGE("No wells specified in Schedule section, initializing no wells"); OPM_MESSAGE("No wells specified in Schedule section, "
"initializing no wells");
return; return;
} }
std::map<int,int> cartesian_to_compressed; std::map<int,int> cartesian_to_compressed;
setupCompressedToCartesian(global_cell, setupCompressedToCartesian(global_cell, number_of_cells,
number_of_cells, cartesian_to_compressed); cartesian_to_compressed);
// Obtain phase usage data. // Obtain phase usage data.
PhaseUsage pu = phaseUsageFromDeck(eclipseState); PhaseUsage pu = phaseUsageFromDeck(eclipseState);
@ -288,8 +314,8 @@ void WellsManager::init(const Opm::EclipseStateConstPtr eclipseState,
// For easy lookup: // For easy lookup:
std::map<std::string, int> well_names_to_index; std::map<std::string, int> well_names_to_index;
ScheduleConstPtr schedule = eclipseState->getSchedule(); ScheduleConstPtr schedule = eclipseState->getSchedule();
std::vector<WellConstPtr> wells = schedule->getWells(timeStep); std::vector<WellConstPtr> wells = schedule->getWells(timeStep);
well_names.reserve(wells.size()); well_names.reserve(wells.size());
well_data.reserve(wells.size()); well_data.reserve(wells.size());
@ -299,24 +325,29 @@ void WellsManager::init(const Opm::EclipseStateConstPtr eclipseState,
begin_face_centroids, begin_face_centroids,
begin_cell_centroids, begin_cell_centroids,
dimensions, dimensions,
well_names, well_data, well_names_to_index, pu, cartesian_to_compressed, permeability); well_names, well_data, well_names_to_index,
pu, cartesian_to_compressed, permeability);
setupWellControls(wells, timeStep, well_names, pu); setupWellControls(wells, timeStep, well_names, pu);
{ {
GroupTreeNodeConstPtr fieldNode = eclipseState->getSchedule()->getGroupTree(timeStep)->getNode("FIELD"); GroupTreeNodeConstPtr fieldNode =
GroupConstPtr fieldGroup = eclipseState->getSchedule()->getGroup(fieldNode->name()); schedule->getGroupTree(timeStep)->getNode("FIELD");
GroupConstPtr fieldGroup =
schedule->getGroup(fieldNode->name());
well_collection_.addField(fieldGroup, timeStep, pu); well_collection_.addField(fieldGroup, timeStep, pu);
addChildGroups(fieldNode, eclipseState->getSchedule(), timeStep, pu); addChildGroups(fieldNode, schedule, timeStep, pu);
} }
for (auto wellIter = wells.begin(); wellIter != wells.end(); ++wellIter ) { for (auto w = wells.begin(), e = wells.end(); w != e; ++w) {
well_collection_.addWell((*wellIter), timeStep, pu); well_collection_.addWell(*w, timeStep, pu);
} }
well_collection_.setWellsPointer(w_); well_collection_.setWellsPointer(w_);
well_collection_.applyGroupControls(); well_collection_.applyGroupControls();
setupGuideRates(wells, timeStep, well_data, well_names_to_index); setupGuideRates(wells, timeStep, well_data, well_names_to_index);
// Debug output. // Debug output.