mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
makding createWellContainer a static function.
This commit is contained in:
parent
f9b7094075
commit
a908bd7cf1
@ -205,6 +205,9 @@ namespace Opm
|
|||||||
// pressure drop between different perforations
|
// pressure drop between different perforations
|
||||||
std::vector<double> perf_pressure_diffs_;
|
std::vector<double> perf_pressure_diffs_;
|
||||||
|
|
||||||
|
// residuals of the well equations
|
||||||
|
BVectorWell resWell_;
|
||||||
|
|
||||||
// two off-diagonal matrices
|
// two off-diagonal matrices
|
||||||
OffDiagMatWell duneB_;
|
OffDiagMatWell duneB_;
|
||||||
OffDiagMatWell duneC_;
|
OffDiagMatWell duneC_;
|
||||||
@ -214,10 +217,6 @@ namespace Opm
|
|||||||
// several vector used in the matrix calculation
|
// several vector used in the matrix calculation
|
||||||
mutable BVectorWell Bx_;
|
mutable BVectorWell Bx_;
|
||||||
mutable BVectorWell invDrw_;
|
mutable BVectorWell invDrw_;
|
||||||
mutable BVector scaleAddRes_;
|
|
||||||
|
|
||||||
// residuals of the well equations
|
|
||||||
BVectorWell resWell_;
|
|
||||||
|
|
||||||
mutable std::vector<double> well_solutions_;
|
mutable std::vector<double> well_solutions_;
|
||||||
|
|
||||||
|
@ -161,14 +161,17 @@ namespace Opm {
|
|||||||
|
|
||||||
const int number_of_phases_;
|
const int number_of_phases_;
|
||||||
|
|
||||||
|
using WellInterfacePtr = std::unique_ptr<WellInterface<TypeTag> >;
|
||||||
// a vector of all the wells.
|
// a vector of all the wells.
|
||||||
// eventually, the wells_ above should be gone.
|
// eventually, the wells_ above should be gone.
|
||||||
// the name is just temporary
|
// the name is just temporary
|
||||||
// later, might make share_ptr const later.
|
// later, might make share_ptr const later.
|
||||||
std::vector<std::unique_ptr<WellInterface<TypeTag> > > well_container_;
|
std::vector<WellInterfacePtr > well_container_;
|
||||||
|
|
||||||
// TODO: forgot why returning a vector here
|
// create the well container
|
||||||
void createWellContainer(const Wells* wells_arg);
|
static std::vector<WellInterfacePtr > createWellContainer(const Wells* wells,
|
||||||
|
const std::vector<const Well*>& wells_ecl,
|
||||||
|
const int time_step);
|
||||||
|
|
||||||
// Well collection is used to enforce the group control
|
// Well collection is used to enforce the group control
|
||||||
WellCollection* well_collection_;
|
WellCollection* well_collection_;
|
||||||
@ -188,6 +191,7 @@ namespace Opm {
|
|||||||
|
|
||||||
long int global_nc_;
|
long int global_nc_;
|
||||||
|
|
||||||
|
// used to better efficiency of calcuation
|
||||||
mutable BVector scaleAddRes_;
|
mutable BVector scaleAddRes_;
|
||||||
|
|
||||||
void updateWellControls(WellState& xw) const;
|
void updateWellControls(WellState& xw) const;
|
||||||
|
@ -17,6 +17,7 @@ namespace Opm {
|
|||||||
, wells_ecl_(wells_ecl)
|
, wells_ecl_(wells_ecl)
|
||||||
, number_of_wells_(wells_arg ? (wells_arg->number_of_wells) : 0)
|
, number_of_wells_(wells_arg ? (wells_arg->number_of_wells) : 0)
|
||||||
, number_of_phases_(wells_arg ? (wells_arg->number_of_phases) : 0) // TODO: not sure if it is proper for this way
|
, number_of_phases_(wells_arg ? (wells_arg->number_of_phases) : 0) // TODO: not sure if it is proper for this way
|
||||||
|
, well_container_(createWellContainer(wells_arg, wells_ecl, current_timeIdx) )
|
||||||
, well_collection_(well_collection)
|
, well_collection_(well_collection)
|
||||||
, param_(param)
|
, param_(param)
|
||||||
, terminal_output_(terminal_output)
|
, terminal_output_(terminal_output)
|
||||||
@ -25,7 +26,6 @@ namespace Opm {
|
|||||||
, current_timeIdx_(current_timeIdx)
|
, current_timeIdx_(current_timeIdx)
|
||||||
, rate_converter_(rate_converter)
|
, rate_converter_(rate_converter)
|
||||||
{
|
{
|
||||||
createWellContainer(wells_arg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -111,27 +111,29 @@ namespace Opm {
|
|||||||
|
|
||||||
|
|
||||||
template<typename TypeTag>
|
template<typename TypeTag>
|
||||||
void
|
std::vector<typename StandardWellsDense<TypeTag>::WellInterfacePtr >
|
||||||
StandardWellsDense<TypeTag>::
|
StandardWellsDense<TypeTag>::
|
||||||
createWellContainer(const Wells* wells_arg)
|
createWellContainer(const Wells* wells,
|
||||||
|
const std::vector< const Well* >& wells_ecl,
|
||||||
|
const int time_step)
|
||||||
{
|
{
|
||||||
well_container_.clear();
|
std::vector<WellInterfacePtr> well_container;
|
||||||
// There might be no wells in the process
|
|
||||||
if (localWellsActive()) {
|
|
||||||
const int nw = number_of_wells_;
|
|
||||||
|
|
||||||
well_container_.reserve(nw);
|
const int nw = wells ? (wells->number_of_wells) : 0;
|
||||||
|
|
||||||
|
if (nw > 0) {
|
||||||
|
well_container.reserve(nw);
|
||||||
|
|
||||||
// With the following way, it will have the same order with wells struct
|
// With the following way, it will have the same order with wells struct
|
||||||
// Hopefully, it can generate the same residual history with master branch
|
// Hopefully, it can generate the same residual history with master branch
|
||||||
for (int w = 0; w < nw; ++w) {
|
for (int w = 0; w < nw; ++w) {
|
||||||
const std::string well_name = std::string(wells_arg->name[w]);
|
const std::string well_name = std::string(wells->name[w]);
|
||||||
|
|
||||||
// finding the location of the well in wells_ecl
|
// finding the location of the well in wells_ecl
|
||||||
const int nw_wells_ecl = wells_ecl_.size();
|
const int nw_wells_ecl = wells_ecl.size();
|
||||||
int index_well = 0;
|
int index_well = 0;
|
||||||
for (; index_well < nw_wells_ecl; ++index_well) {
|
for (; index_well < nw_wells_ecl; ++index_well) {
|
||||||
if (well_name == wells_ecl_[index_well]->name()) {
|
if (well_name == wells_ecl[index_well]->name()) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -141,15 +143,16 @@ namespace Opm {
|
|||||||
OPM_THROW(std::logic_error, "Could not find well " << well_name << " in wells_ecl ");
|
OPM_THROW(std::logic_error, "Could not find well " << well_name << " in wells_ecl ");
|
||||||
}
|
}
|
||||||
|
|
||||||
const Well* well_ecl = wells_ecl_[index_well];
|
const Well* well_ecl = wells_ecl[index_well];
|
||||||
if (well_ecl->isMultiSegment(current_timeIdx_)) {
|
if (well_ecl->isMultiSegment(time_step)) {
|
||||||
OPM_THROW(Opm::NumericalProblem, "Not handling Multisegment Wells for now");
|
OPM_THROW(Opm::NumericalProblem, "Not handling Multisegment Wells for now");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Basically, we are handling all the wells as StandardWell for the moment
|
// Basically, we are handling all the wells as StandardWell for the moment
|
||||||
well_container_.emplace_back(new StandardWell<TypeTag>(well_ecl, current_timeIdx_, wells_arg) );
|
well_container.emplace_back(new StandardWell<TypeTag>(well_ecl, time_step, wells) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return well_container;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user