Changed some minor bugs in the refactored code in wells_example

This commit is contained in:
Kjetil Olsen Lye 2012-05-08 12:23:58 +02:00
parent be956f2a70
commit 339a652e5d
3 changed files with 21 additions and 17 deletions

View File

@ -81,9 +81,14 @@ int main(int argc, char** argv)
std::vector<double> well_rate_per_cell;
std::vector<double> rc;
rc.resize(grid.c_grid()->number_of_cells);
int nl_pressure_maxiter = 100;
double nl_pressure_tolerance = 0.0;
if (rock_comp.isActive()) {
nl_pressure_maxiter = parameters.getDefault("nl_pressure_maxiter", 10);
nl_pressure_tolerance = parameters.getDefault("nl_pressure_tolerance", 1.0); // in Pascal
}
const int nl_pressure_maxiter = 100;
const double nl_pressure_tolerance = 1e-8;
const int num_cells = grid.c_grid()->number_of_cells;
std::vector<double> porevol;
if (rock_comp.isActive()) {
@ -117,10 +122,9 @@ int main(int argc, char** argv)
well_bhp, well_rate_per_cell);
}
// This will be refactored into a separate function once done.
const int np = incomp_properties.numPhases();
std::vector<double> fractional_flows(grid.c_grid()->number_of_cells*np, 0.0);
//computeFractionalFlow(incomp_properties, all_cells, state.saturation(), fractional_flows);
computeFractionalFlow(incomp_properties, all_cells, state.saturation(), fractional_flows);
// This will be refactored into a separate function once done
std::vector<double> well_resflows(wells.c_wells()->number_of_wells*np, 0.0);

View File

@ -521,17 +521,16 @@ namespace Opm
}
/// 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_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
/// 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,
const std::vector<double>& flow_rates_per_cell,
const std::vector<double>& flow_rates_per_well_cell,
const std::vector<double>& fractional_flows,
std::vector<double> phase_flow_per_well)
std::vector<double>& phase_flow_per_well)
{
const int np = wells.number_of_phases;
const int nw = wells.number_of_wells;
@ -542,8 +541,9 @@ namespace Opm
phase_flow_per_well[wix + np*phase] = 0.0;
}
for (int i = wells.well_connpos[wix]; i < wells.well_connpos[wix + 1]; ++i) {
const int cell = wells.well_cells[i];
for (int phase = 0; phase < np; ++phase) {
phase_flow_per_well[wix * np + phase] += flow_rates_per_cell[i] * fractional_flows[i * np + phase];
phase_flow_per_well[wix * np + phase] += flow_rates_per_well_cell[i] * fractional_flows[cell * np + phase];
}
}
}

View File

@ -216,14 +216,14 @@ namespace Opm
/// 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_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
/// \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,
const std::vector<double>& flow_rates_per_cell,
const std::vector<double>& flow_rates_per_well_cell,
const std::vector<double>& fractional_flows,
std::vector<double> phase_flow_per_well);
std::vector<double>& phase_flow_per_well);
/// Encapsulates the watercut curves.