cleaning up for StandardWellsDense.

This commit is contained in:
Kai Bao 2017-08-10 15:27:05 +02:00
parent 49df0c12f6
commit f1c0e84878
3 changed files with 58 additions and 81 deletions

View File

@ -1539,13 +1539,10 @@ namespace Opm {
const StandardWellsDense<TypeTag>&
wellModel() const { return well_model_; }
/// return the Well struct in the StandardWells
const Wells& wells() const { return well_model_.wells(); }
/// return true if wells are available in the reservoir
bool wellsActive() const { return well_model_.wellsActive(); }
int numWells() const { return wellsActive() ? wells().number_of_wells : 0; }
int numWells() const { return well_model_.numWells(); }
/// return true if wells are available on this process
bool localWellsActive() const { return well_model_.localWellsActive(); }

View File

@ -135,7 +135,7 @@ namespace Opm {
void assembleWellEq(Simulator& ebosSimulator,
const double dt,
WellState& well_state,
bool only_wells);
bool only_wells) const;
// substract Binv(D)rw from r;
void apply( BVector& r) const;
@ -158,9 +158,9 @@ namespace Opm {
int numCells() const;
void resetWellControlFromState(const WellState& xw) const;
int numWells() const;
const Wells& wells() const;
void resetWellControlFromState(const WellState& xw) const;
const Wells* wellsPointer() const;
@ -172,26 +172,11 @@ namespace Opm {
/// return true if wells are available on this process
bool localWellsActive() const;
void setWellVariables();
void computeAccumWells();
SimulatorReport solveWellEq(Simulator& ebosSimulator,
const double dt,
WellState& well_state);
void printIf(const int c, const double x, const double y, const double eps, const std::string type) const;
std::vector<double> residual() const;
bool getWellConvergence(Simulator& ebosSimulator,
const std::vector<Scalar>& B_avg) const;
void computeWellConnectionPressures(const Simulator& ebosSimulator,
const WellState& xw);
void updateWellControls(WellState& xw) const;
/// upate the dynamic lists related to economic limits
void updateListEconLimited(const Schedule& schedule,
const int current_step,
@ -199,12 +184,6 @@ namespace Opm {
const WellState& well_state,
DynamicListEconLimited& list_econ_limited) const;
// Calculating well potentials for each well
// TODO: getBhp() will be refactored to reduce the duplication of the code calculating the bhp from THP.
void computeWellPotentials(const Simulator& ebosSimulator,
const WellState& well_state,
std::vector<double>& well_potentials) const;
// TODO: some preparation work, mostly related to group control and RESV,
// at the beginning of each time step (Not report step)
void prepareTimeStep(const Simulator& ebos_simulator,
@ -212,21 +191,6 @@ namespace Opm {
WellCollection* wellCollection() const;
const std::vector<double>&
wellPerfEfficiencyFactors() const;
void calculateEfficiencyFactors();
void computeWellVoidageRates(const WellState& well_state,
std::vector<double>& well_voidage_rates,
std::vector<double>& voidage_conversion_coeffs) const;
void applyVREPGroupControl(WellState& well_state) const;
void updateGroupControls(WellState& well_state) const;
/// setting the well_solutions_ based on well_state.
void setWellSolutions(const WellState& well_state) const;
protected:
bool wells_active_;
@ -265,14 +229,17 @@ namespace Opm {
std::vector<double> pv_;
std::vector<double> wells_rep_radius_;
std::vector<double> wells_perf_length_;
std::vector<double> wells_bore_diameter_;
long int global_nc_;
mutable BVector scaleAddRes_;
void updateWellControls(WellState& xw) const;
void updateGroupControls(WellState& well_state) const;
// setting the well_solutions_ based on well_state.
void setWellSolutions(const WellState& well_state) const;
void setupCompressedToCartesian(const int* global_cell, int number_of_cells, std::map<int,int>& cartesian_to_compressed ) const;
void computeRepRadiusPerfLength(const Grid& grid);
@ -280,6 +247,34 @@ namespace Opm {
void computeAverageFormationFactor(Simulator& ebosSimulator,
std::vector<double>& B_avg) const;
void applyVREPGroupControl(WellState& well_state) const;
void computeWellVoidageRates(const WellState& well_state,
std::vector<double>& well_voidage_rates,
std::vector<double>& voidage_conversion_coeffs) const;
// Calculating well potentials for each well
// TODO: getBhp() will be refactored to reduce the duplication of the code calculating the bhp from THP.
void computeWellPotentials(const Simulator& ebosSimulator,
const WellState& well_state,
std::vector<double>& well_potentials) const;
const std::vector<double>& wellPerfEfficiencyFactors() const;
void calculateEfficiencyFactors();
void computeWellConnectionPressures(const Simulator& ebosSimulator,
const WellState& xw) const;
SimulatorReport solveWellEq(Simulator& ebosSimulator,
const double dt,
WellState& well_state) const;
void computeAccumWells() const;
void setWellVariables() const;
};

View File

@ -102,6 +102,18 @@ namespace Opm {
template<typename TypeTag>
int
StandardWellsDense<TypeTag>::
numWells() const
{
return number_of_wells_;
}
template<typename TypeTag>
void
StandardWellsDense<TypeTag>::
@ -168,7 +180,6 @@ namespace Opm {
}
updateWellControls(well_state);
updateGroupControls(well_state);
// Set the primary variables for the wells
setWellVariables();
@ -197,7 +208,7 @@ namespace Opm {
assembleWellEq(Simulator& ebosSimulator,
const double dt,
WellState& well_state,
bool only_wells)
bool only_wells) const
{
for (int w = 0; w < number_of_wells_; ++w) {
well_container_[w]->assembleWellEq(ebosSimulator, dt, well_state, only_wells);
@ -362,19 +373,6 @@ namespace Opm {
template<typename TypeTag>
const Wells&
StandardWellsDense<TypeTag>::
wells() const
{
assert(wells_ != 0);
return *(wells_);
}
template<typename TypeTag>
const Wells*
StandardWellsDense<TypeTag>::
@ -426,7 +424,7 @@ namespace Opm {
template<typename TypeTag>
void
StandardWellsDense<TypeTag>::
setWellVariables()
setWellVariables() const
{
for (auto& well : well_container_) {
well->setWellVariables();
@ -440,7 +438,7 @@ namespace Opm {
template<typename TypeTag>
void
StandardWellsDense<TypeTag>::
computeAccumWells()
computeAccumWells() const
{
for (auto& well : well_container_) {
well->computeAccumWell();
@ -456,7 +454,7 @@ namespace Opm {
StandardWellsDense<TypeTag>::
solveWellEq(Simulator& ebosSimulator,
const double dt,
WellState& well_state)
WellState& well_state) const
{
const int nw = number_of_wells_;
WellState well_state0 = well_state;
@ -494,7 +492,6 @@ namespace Opm {
if( wellsActive() )
{
updateWellControls(well_state);
updateGroupControls(well_state);
setWellVariables();
}
} while (it < 15);
@ -519,20 +516,6 @@ namespace Opm {
template<typename TypeTag>
void
StandardWellsDense<TypeTag>::
printIf(const int c, const double x, const double y, const double eps, const std::string type) const
{
if (std::abs(x-y) > eps) {
std::cout << type << " " << c << ": "<<x << " " << y << std::endl;
}
}
template<typename TypeTag>
std::vector<double>
StandardWellsDense<TypeTag>::
@ -630,7 +613,7 @@ namespace Opm {
void
StandardWellsDense<TypeTag>::
computeWellConnectionPressures(const Simulator& ebosSimulator,
const WellState& xw)
const WellState& xw) const
{
if( ! localWellsActive() ) return ;
@ -659,6 +642,8 @@ namespace Opm {
for (const auto& well : well_container_) {
well->updateWellControl(xw, logger);
}
updateGroupControls(xw);
}