more cleaning up of StandardWellsDense.

not functional change.
This commit is contained in:
Kai Bao 2017-08-11 14:51:29 +02:00
parent 68edfd7235
commit 7a9fc2132e
3 changed files with 31 additions and 67 deletions

View File

@ -141,7 +141,6 @@ public:
ExtraData extra;
failureReport_ = SimulatorReport();
extractLegacyPoreVolume_();
extractLegacyDepth_();
// communicate the initial solution to ebos
@ -480,7 +479,6 @@ protected:
activePhases,
gravity,
legacyDepth_,
legacyPoreVolume_,
globalNumCells,
grid());
auto model = std::unique_ptr<Model>(new Model(ebosSimulator_,
@ -867,22 +865,6 @@ protected:
}
}
void extractLegacyPoreVolume_()
{
const auto& grid = ebosSimulator_.gridManager().grid();
const unsigned numCells = grid.size(/*codim=*/0);
const auto& ebosProblem = ebosSimulator_.problem();
const auto& ebosModel = ebosSimulator_.model();
legacyPoreVolume_.resize(numCells);
for (unsigned cellIdx = 0; cellIdx < numCells; ++cellIdx) {
// todo (?): respect rock compressibility
legacyPoreVolume_[cellIdx] =
ebosModel.dofTotalVolume(cellIdx)
*ebosProblem.porosity(cellIdx);
}
}
void extractLegacyDepth_()
{
const auto& grid = ebosSimulator_.gridManager().grid();
@ -1009,7 +991,6 @@ protected:
Simulator& ebosSimulator_;
std::vector<int> legacyCellPvtRegionIdx_;
std::vector<double> legacyPoreVolume_;
std::vector<double> legacyDepth_;
typedef typename Solver::SolverParameters SolverParameters;

View File

@ -104,37 +104,17 @@ namespace Opm {
const std::vector<bool>& active_arg,
const double gravity_arg,
const std::vector<double>& depth_arg,
const std::vector<double>& pv_arg,
long int global_nc,
const Grid& grid);
void setVFPProperties(const VFPProperties* vfp_properties_arg);
/// The number of components in the model.
int numComponents() const
{
if (numPhases() == 2) {
return 2;
}
int numComp = FluidSystem::numComponents;
if (has_solvent_) {
numComp ++;
}
return numComp;
}
SimulatorReport assemble(Simulator& ebosSimulator,
const int iterationIdx,
const double dt,
WellState& well_state);
void assembleWellEq(Simulator& ebosSimulator,
const double dt,
WellState& well_state,
bool only_wells) const;
// substract Binv(D)rw from r;
void apply( BVector& r) const;
@ -148,16 +128,8 @@ namespace Opm {
// xw to update Well State
void applySolutionWellState(const BVector& x, WellState& well_state) const;
int flowPhaseToEbosPhaseIdx( const int phaseIdx ) const;
int numPhases() const;
int numCells() const;
int numWells() const;
void resetWellControlFromState(const WellState& xw) const;
const Wells* wellsPointer() const;
/// return true if wells are available in the reservoir
@ -221,7 +193,8 @@ namespace Opm {
std::vector<bool> active_;
const RateConverterType& rate_converter_;
std::vector<double> pv_;
// the number of the cells in the local grid
int number_of_cells_;
long int global_nc_;
@ -269,6 +242,30 @@ namespace Opm {
void setWellVariables() const;
// The number of components in the model.
int numComponents() const
{
if (numPhases() == 2) {
return 2;
}
int numComp = FluidSystem::numComponents;
if (has_solvent_) {
numComp ++;
}
return numComp;
}
int numPhases() const;
int flowPhaseToEbosPhaseIdx( const int phaseIdx ) const;
void resetWellControlFromState(const WellState& xw) const;
void assembleWellEq(Simulator& ebosSimulator,
const double dt,
WellState& well_state,
bool only_wells) const;
};

View File

@ -39,7 +39,6 @@ namespace Opm {
const std::vector<bool>& active_arg,
const double gravity_arg,
const std::vector<double>& depth_arg,
const std::vector<double>& pv_arg,
long int global_nc,
const Grid& grid)
{
@ -52,12 +51,9 @@ namespace Opm {
phase_usage_ = phase_usage_arg;
active_ = active_arg;
pv_ = pv_arg;
calculateEfficiencyFactors();
const int nc = numCells();
#ifndef NDEBUG
const auto& pu = phase_usage_;
const int np = pu.num_phases;
@ -74,11 +70,12 @@ namespace Opm {
}
}
number_of_cells_ = Opm::UgGridHelpers::numCells(grid);
// do the initialization for all the wells
// TODO: to see whether we can postpone of the intialization of the well containers to
// optimize the usage of the following several member variables
for (auto& well : well_container_) {
well->init(&phase_usage_, &active_, depth_arg, gravity_arg, nc);
well->init(&phase_usage_, &active_, depth_arg, gravity_arg, number_of_cells_);
}
}
@ -323,18 +320,6 @@ namespace Opm {
template<typename TypeTag>
int
StandardWellsDense<TypeTag>::
numCells() const
{
return pv_.size();
}
template<typename TypeTag>
void
StandardWellsDense<TypeTag>::
@ -668,6 +653,8 @@ namespace Opm {
computeWellPotentials(ebos_simulator, well_state, well_potentials);
// update/setup guide rates for each well based on the well_potentials
// TODO: this is one of two places that still need Wells struct. In this function, only the well names
// well types are used, probably the order of the wells to locate the correct values in well_potentials.
well_collection_->setGuideRatesWithPotentials(wellsPointer(), phase_usage_, well_potentials);
}
@ -894,11 +881,10 @@ namespace Opm {
{
// TODO, the function does not work for parallel running
// to be fixed later.
int number_of_cells = Opm::UgGridHelpers::numCells(grid);
const int* global_cell = Opm::UgGridHelpers::globalCell(grid);
std::map<int,int> cartesian_to_compressed;
setupCompressedToCartesian(global_cell, number_of_cells,
setupCompressedToCartesian(global_cell, number_of_cells_,
cartesian_to_compressed);
for (const auto& well : well_container_) {