mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Make BlackoilMultisegmentModel constructured from MultisegmentWells
Instead of being coustructed based StandardWells and having a MultisegmentWells member.
This commit is contained in:
parent
4254b48b57
commit
06775ee02c
@ -65,13 +65,13 @@ namespace Opm {
|
|||||||
const BlackoilPropsAdInterface& fluid,
|
const BlackoilPropsAdInterface& fluid,
|
||||||
const DerivedGeology& geo,
|
const DerivedGeology& geo,
|
||||||
const RockCompressibility* rock_comp_props,
|
const RockCompressibility* rock_comp_props,
|
||||||
const Wells* wells_arg,
|
const StandardWells& std_wells,
|
||||||
const NewtonIterationBlackoilInterface& linsolver,
|
const NewtonIterationBlackoilInterface& linsolver,
|
||||||
Opm::EclipseStateConstPtr eclState,
|
Opm::EclipseStateConstPtr eclState,
|
||||||
const bool has_disgas,
|
const bool has_disgas,
|
||||||
const bool has_vapoil,
|
const bool has_vapoil,
|
||||||
const bool terminal_output)
|
const bool terminal_output)
|
||||||
: Base(param, grid, fluid, geo, rock_comp_props, wells_arg, linsolver,
|
: Base(param, grid, fluid, geo, rock_comp_props, std_wells, linsolver,
|
||||||
eclState, has_disgas, has_vapoil, terminal_output)
|
eclState, has_disgas, has_vapoil, terminal_output)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -142,7 +142,7 @@ namespace Opm {
|
|||||||
const BlackoilPropsAdInterface& fluid,
|
const BlackoilPropsAdInterface& fluid,
|
||||||
const DerivedGeology& geo ,
|
const DerivedGeology& geo ,
|
||||||
const RockCompressibility* rock_comp_props,
|
const RockCompressibility* rock_comp_props,
|
||||||
const Wells* wells,
|
const WellModel& well_model,
|
||||||
const NewtonIterationBlackoilInterface& linsolver,
|
const NewtonIterationBlackoilInterface& linsolver,
|
||||||
Opm::EclipseStateConstPtr eclState,
|
Opm::EclipseStateConstPtr eclState,
|
||||||
const bool has_disgas,
|
const bool has_disgas,
|
||||||
|
@ -167,7 +167,7 @@ namespace detail {
|
|||||||
const BlackoilPropsAdInterface& fluid,
|
const BlackoilPropsAdInterface& fluid,
|
||||||
const DerivedGeology& geo ,
|
const DerivedGeology& geo ,
|
||||||
const RockCompressibility* rock_comp_props,
|
const RockCompressibility* rock_comp_props,
|
||||||
const Wells* wells_arg,
|
const WellModel& well_model,
|
||||||
const NewtonIterationBlackoilInterface& linsolver,
|
const NewtonIterationBlackoilInterface& linsolver,
|
||||||
Opm::EclipseStateConstPtr eclState,
|
Opm::EclipseStateConstPtr eclState,
|
||||||
const bool has_disgas,
|
const bool has_disgas,
|
||||||
@ -191,7 +191,7 @@ namespace detail {
|
|||||||
, use_threshold_pressure_(false)
|
, use_threshold_pressure_(false)
|
||||||
, rq_ (fluid.numPhases())
|
, rq_ (fluid.numPhases())
|
||||||
, phaseCondition_(AutoDiffGrid::numCells(grid))
|
, phaseCondition_(AutoDiffGrid::numCells(grid))
|
||||||
, std_wells_ (wells_arg)
|
, std_wells_ (well_model)
|
||||||
, isRs_(V::Zero(AutoDiffGrid::numCells(grid)))
|
, isRs_(V::Zero(AutoDiffGrid::numCells(grid)))
|
||||||
, isRv_(V::Zero(AutoDiffGrid::numCells(grid)))
|
, isRv_(V::Zero(AutoDiffGrid::numCells(grid)))
|
||||||
, isSg_(V::Zero(AutoDiffGrid::numCells(grid)))
|
, isSg_(V::Zero(AutoDiffGrid::numCells(grid)))
|
||||||
@ -221,6 +221,10 @@ namespace detail {
|
|||||||
|
|
||||||
std_wells_.init(&fluid_, &active_, &phaseCondition_, &vfp_properties_, gravity, depth);
|
std_wells_.init(&fluid_, &active_, &phaseCondition_, &vfp_properties_, gravity, depth);
|
||||||
|
|
||||||
|
// TODO: put this for now to avoid modify the following code.
|
||||||
|
// TODO: this code is fragile.
|
||||||
|
const Wells* wells_arg = &(asImpl().std_wells_.wells());
|
||||||
|
|
||||||
#if HAVE_MPI
|
#if HAVE_MPI
|
||||||
if ( linsolver_.parallelInformation().type() == typeid(ParallelISTLInformation) )
|
if ( linsolver_.parallelInformation().type() == typeid(ParallelISTLInformation) )
|
||||||
{
|
{
|
||||||
|
@ -51,11 +51,11 @@ namespace Opm {
|
|||||||
/// \tparam Grid UnstructuredGrid or CpGrid.
|
/// \tparam Grid UnstructuredGrid or CpGrid.
|
||||||
/// \tparam Implementation Provides concrete state types.
|
/// \tparam Implementation Provides concrete state types.
|
||||||
template<class Grid>
|
template<class Grid>
|
||||||
class BlackoilMultiSegmentModel : public BlackoilModelBase<Grid, StandardWells, BlackoilMultiSegmentModel<Grid> >
|
class BlackoilMultiSegmentModel : public BlackoilModelBase<Grid, MultisegmentWells, BlackoilMultiSegmentModel<Grid> >
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
typedef BlackoilModelBase<Grid, StandardWells, BlackoilMultiSegmentModel<Grid> > Base; // base class
|
typedef BlackoilModelBase<Grid, MultisegmentWells, BlackoilMultiSegmentModel<Grid> > Base; // base class
|
||||||
typedef typename Base::ReservoirState ReservoirState;
|
typedef typename Base::ReservoirState ReservoirState;
|
||||||
typedef typename Base::WellState WellState;
|
typedef typename Base::WellState WellState;
|
||||||
typedef BlackoilMultiSegmentSolutionState SolutionState;
|
typedef BlackoilMultiSegmentSolutionState SolutionState;
|
||||||
@ -85,13 +85,12 @@ namespace Opm {
|
|||||||
const BlackoilPropsAdInterface& fluid,
|
const BlackoilPropsAdInterface& fluid,
|
||||||
const DerivedGeology& geo ,
|
const DerivedGeology& geo ,
|
||||||
const RockCompressibility* rock_comp_props,
|
const RockCompressibility* rock_comp_props,
|
||||||
const Wells* wells,
|
const MultisegmentWells& well_model,
|
||||||
const NewtonIterationBlackoilInterface& linsolver,
|
const NewtonIterationBlackoilInterface& linsolver,
|
||||||
Opm::EclipseStateConstPtr eclState,
|
Opm::EclipseStateConstPtr eclState,
|
||||||
const bool has_disgas,
|
const bool has_disgas,
|
||||||
const bool has_vapoil,
|
const bool has_vapoil,
|
||||||
const bool terminal_output,
|
const bool terminal_output);
|
||||||
const MultisegmentWells& multisegment_wells);
|
|
||||||
|
|
||||||
/// Called once before each time step.
|
/// Called once before each time step.
|
||||||
/// \param[in] dt time step size
|
/// \param[in] dt time step size
|
||||||
@ -165,7 +164,7 @@ namespace Opm {
|
|||||||
const MultisegmentWells& msWells() const { return ms_wells_; }
|
const MultisegmentWells& msWells() const { return ms_wells_; }
|
||||||
MultisegmentWells& msWells() { return ms_wells_; }
|
MultisegmentWells& msWells() { return ms_wells_; }
|
||||||
|
|
||||||
const std::vector<WellMultiSegmentConstPtr>& wellsMultiSegment() const { return msWells().wells(); }
|
const std::vector<WellMultiSegmentConstPtr>& wellsMultiSegment() const { return msWells().msWells(); }
|
||||||
|
|
||||||
const MultisegmentWells::MultisegmentWellOps& msWellOps() const { return msWells().wellOps(); }
|
const MultisegmentWells::MultisegmentWellOps& msWellOps() const { return msWells().wellOps(); }
|
||||||
|
|
||||||
|
@ -62,16 +62,15 @@ namespace Opm {
|
|||||||
const BlackoilPropsAdInterface& fluid,
|
const BlackoilPropsAdInterface& fluid,
|
||||||
const DerivedGeology& geo ,
|
const DerivedGeology& geo ,
|
||||||
const RockCompressibility* rock_comp_props,
|
const RockCompressibility* rock_comp_props,
|
||||||
const Wells* wells_arg,
|
const MultisegmentWells& well_model,
|
||||||
const NewtonIterationBlackoilInterface& linsolver,
|
const NewtonIterationBlackoilInterface& linsolver,
|
||||||
Opm::EclipseStateConstPtr eclState,
|
Opm::EclipseStateConstPtr eclState,
|
||||||
const bool has_disgas,
|
const bool has_disgas,
|
||||||
const bool has_vapoil,
|
const bool has_vapoil,
|
||||||
const bool terminal_output,
|
const bool terminal_output)
|
||||||
const MultisegmentWells& multisegment_wells)
|
: Base(param, grid, fluid, geo, rock_comp_props, well_model, linsolver,
|
||||||
: Base(param, grid, fluid, geo, rock_comp_props, wells_arg, linsolver,
|
|
||||||
eclState, has_disgas, has_vapoil, terminal_output)
|
eclState, has_disgas, has_vapoil, terminal_output)
|
||||||
, ms_wells_(multisegment_wells)
|
, ms_wells_(well_model)
|
||||||
{
|
{
|
||||||
const double gravity = detail::getGravity(geo_.gravity(), UgGridHelpers::dimensions(grid_));
|
const double gravity = detail::getGravity(geo_.gravity(), UgGridHelpers::dimensions(grid_));
|
||||||
const V depth = Opm::AutoDiffGrid::cellCentroidsZToEigen(grid_);
|
const V depth = Opm::AutoDiffGrid::cellCentroidsZToEigen(grid_);
|
||||||
|
@ -71,7 +71,7 @@ namespace Opm {
|
|||||||
const DerivedGeology& geo,
|
const DerivedGeology& geo,
|
||||||
const RockCompressibility* rock_comp_props,
|
const RockCompressibility* rock_comp_props,
|
||||||
const SolventPropsAdFromDeck& solvent_props,
|
const SolventPropsAdFromDeck& solvent_props,
|
||||||
const Wells* wells,
|
const StandardWellsSolvent& well_model,
|
||||||
const NewtonIterationBlackoilInterface& linsolver,
|
const NewtonIterationBlackoilInterface& linsolver,
|
||||||
const EclipseStateConstPtr eclState,
|
const EclipseStateConstPtr eclState,
|
||||||
const bool has_disgas,
|
const bool has_disgas,
|
||||||
|
@ -76,7 +76,7 @@ namespace Opm {
|
|||||||
const DerivedGeology& geo,
|
const DerivedGeology& geo,
|
||||||
const RockCompressibility* rock_comp_props,
|
const RockCompressibility* rock_comp_props,
|
||||||
const SolventPropsAdFromDeck& solvent_props,
|
const SolventPropsAdFromDeck& solvent_props,
|
||||||
const Wells* wells_arg,
|
const StandardWellsSolvent& well_model,
|
||||||
const NewtonIterationBlackoilInterface& linsolver,
|
const NewtonIterationBlackoilInterface& linsolver,
|
||||||
const EclipseStateConstPtr eclState,
|
const EclipseStateConstPtr eclState,
|
||||||
const bool has_disgas,
|
const bool has_disgas,
|
||||||
@ -84,7 +84,7 @@ namespace Opm {
|
|||||||
const bool terminal_output,
|
const bool terminal_output,
|
||||||
const bool has_solvent,
|
const bool has_solvent,
|
||||||
const bool is_miscible)
|
const bool is_miscible)
|
||||||
: Base(param, grid, fluid, geo, rock_comp_props, wells_arg, linsolver,
|
: Base(param, grid, fluid, geo, rock_comp_props, well_model, linsolver,
|
||||||
eclState, has_disgas, has_vapoil, terminal_output),
|
eclState, has_disgas, has_vapoil, terminal_output),
|
||||||
has_solvent_(has_solvent),
|
has_solvent_(has_solvent),
|
||||||
solvent_pos_(detail::solventPos(fluid.phaseUsage())),
|
solvent_pos_(detail::solventPos(fluid.phaseUsage())),
|
||||||
|
@ -236,7 +236,7 @@ namespace Opm {
|
|||||||
|
|
||||||
|
|
||||||
const std::vector<WellMultiSegmentConstPtr>&
|
const std::vector<WellMultiSegmentConstPtr>&
|
||||||
MultisegmentWells::wells() const
|
MultisegmentWells::msWells() const
|
||||||
{
|
{
|
||||||
return wells_multisegment_;
|
return wells_multisegment_;
|
||||||
}
|
}
|
||||||
@ -246,7 +246,7 @@ namespace Opm {
|
|||||||
|
|
||||||
|
|
||||||
const Wells&
|
const Wells&
|
||||||
MultisegmentWells::wellsStruct() const
|
MultisegmentWells::wells() const
|
||||||
{
|
{
|
||||||
assert(wells_ != nullptr);
|
assert(wells_ != nullptr);
|
||||||
return *(wells_);
|
return *(wells_);
|
||||||
@ -270,7 +270,7 @@ namespace Opm {
|
|||||||
MultisegmentWells::
|
MultisegmentWells::
|
||||||
computeSegmentPressuresDelta(const double grav)
|
computeSegmentPressuresDelta(const double grav)
|
||||||
{
|
{
|
||||||
const int nw = wells().size();
|
const int nw = msWells().size();
|
||||||
const int nseg_total = nseg_total_;
|
const int nseg_total = nseg_total_;
|
||||||
|
|
||||||
if ( !wellOps().has_multisegment_wells ) {
|
if ( !wellOps().has_multisegment_wells ) {
|
||||||
@ -284,7 +284,7 @@ namespace Opm {
|
|||||||
Vector segment_depth_delta = Vector::Zero(nseg_total);
|
Vector segment_depth_delta = Vector::Zero(nseg_total);
|
||||||
int start_segment = 0;
|
int start_segment = 0;
|
||||||
for (int w = 0; w < nw; ++w) {
|
for (int w = 0; w < nw; ++w) {
|
||||||
WellMultiSegmentConstPtr well = wells()[w];
|
WellMultiSegmentConstPtr well = msWells()[w];
|
||||||
const int nseg = well->numberOfSegments();
|
const int nseg = well->numberOfSegments();
|
||||||
for (int s = 1; s < nseg; ++s) {
|
for (int s = 1; s < nseg; ++s) {
|
||||||
const int s_outlet = well->outletSegment()[s];
|
const int s_outlet = well->outletSegment()[s];
|
||||||
|
@ -97,10 +97,10 @@ namespace Opm {
|
|||||||
const double gravity_arg,
|
const double gravity_arg,
|
||||||
const Vector& depth_arg);
|
const Vector& depth_arg);
|
||||||
|
|
||||||
const std::vector<WellMultiSegmentConstPtr>& wells() const;
|
const std::vector<WellMultiSegmentConstPtr>& msWells() const;
|
||||||
const MultisegmentWellOps& wellOps() const;
|
const MultisegmentWellOps& wellOps() const;
|
||||||
|
|
||||||
const Wells& wellsStruct() const;
|
const Wells& wells() const;
|
||||||
|
|
||||||
int numPhases() const { return num_phases_; };
|
int numPhases() const { return num_phases_; };
|
||||||
|
|
||||||
|
@ -85,9 +85,9 @@ namespace Opm
|
|||||||
const double dpmaxrel,
|
const double dpmaxrel,
|
||||||
WellState& well_state) const
|
WellState& well_state) const
|
||||||
{
|
{
|
||||||
if (!wells().empty())
|
if (!msWells().empty())
|
||||||
{
|
{
|
||||||
const int nw = wells().size();
|
const int nw = msWells().size();
|
||||||
const int nseg_total = nseg_total_;
|
const int nseg_total = nseg_total_;
|
||||||
const int np = numPhases();
|
const int np = numPhases();
|
||||||
|
|
||||||
@ -133,7 +133,7 @@ namespace Opm
|
|||||||
wr[p + np * w] = well_state.segPhaseRates()[p + np * start_segment];
|
wr[p + np * w] = well_state.segPhaseRates()[p + np * start_segment];
|
||||||
}
|
}
|
||||||
|
|
||||||
const int nseg = wells()[w]->numberOfSegments();
|
const int nseg = msWells()[w]->numberOfSegments();
|
||||||
start_segment += nseg;
|
start_segment += nseg;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -158,10 +158,10 @@ namespace Opm
|
|||||||
Vector& aliveWells,
|
Vector& aliveWells,
|
||||||
std::vector<ADB>& cq_s) const
|
std::vector<ADB>& cq_s) const
|
||||||
{
|
{
|
||||||
if (wells().size() == 0) return;
|
if (msWells().size() == 0) return;
|
||||||
|
|
||||||
const int np = numPhases();
|
const int np = numPhases();
|
||||||
const int nw = wells().size();
|
const int nw = msWells().size();
|
||||||
|
|
||||||
aliveWells = Vector::Constant(nw, 1.0);
|
aliveWells = Vector::Constant(nw, 1.0);
|
||||||
|
|
||||||
@ -189,7 +189,7 @@ namespace Opm
|
|||||||
// Create selector for perforations of multi-segment vs. regular wells.
|
// Create selector for perforations of multi-segment vs. regular wells.
|
||||||
Vector is_multisegment_well(nw);
|
Vector is_multisegment_well(nw);
|
||||||
for (int w = 0; w < nw; ++w) {
|
for (int w = 0; w < nw; ++w) {
|
||||||
is_multisegment_well[w] = double(wells()[w]->isMultiSegmented());
|
is_multisegment_well[w] = double(msWells()[w]->isMultiSegmented());
|
||||||
}
|
}
|
||||||
// Take one flag per well and expand to one flag per perforation.
|
// Take one flag per well and expand to one flag per perforation.
|
||||||
Vector is_multisegment_perf = wellOps().w2p * is_multisegment_well.matrix();
|
Vector is_multisegment_perf = wellOps().w2p * is_multisegment_well.matrix();
|
||||||
@ -263,11 +263,11 @@ namespace Opm
|
|||||||
// TODO: involves one operations that are not valid now. (i.e. how to transverse from the leaves to the root,
|
// TODO: involves one operations that are not valid now. (i.e. how to transverse from the leaves to the root,
|
||||||
// TODO: although we can begin from the brutal force way)
|
// TODO: although we can begin from the brutal force way)
|
||||||
|
|
||||||
// TODO: stop using wells() here.
|
// TODO: stop using msWells() here.
|
||||||
std::vector<ADB> wbq(np, ADB::null());
|
std::vector<ADB> wbq(np, ADB::null());
|
||||||
ADB wbqt = ADB::constant(Vector::Zero(nseg));
|
ADB wbqt = ADB::constant(Vector::Zero(nseg));
|
||||||
|
|
||||||
const DataBlock compi = Eigen::Map<const DataBlock>(wellsStruct().comp_frac, nw, np);
|
const DataBlock compi = Eigen::Map<const DataBlock>(wells().comp_frac, nw, np);
|
||||||
|
|
||||||
for (int phase = 0; phase < np; ++phase) {
|
for (int phase = 0; phase < np; ++phase) {
|
||||||
const ADB& q_ps = wellOps().p2s * cq_ps[phase];
|
const ADB& q_ps = wellOps().p2s * cq_ps[phase];
|
||||||
@ -294,7 +294,7 @@ namespace Opm
|
|||||||
if (wbqt.value()[topseg] == 0.0) { // yes we really mean == here, no fuzzyness
|
if (wbqt.value()[topseg] == 0.0) { // yes we really mean == here, no fuzzyness
|
||||||
aliveWells[w] = 0.0;
|
aliveWells[w] = 0.0;
|
||||||
}
|
}
|
||||||
topseg += wells()[w]->numberOfSegments();
|
topseg += msWells()[w]->numberOfSegments();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -397,7 +397,7 @@ namespace Opm
|
|||||||
computeSegmentFluidProperties(const SolutionState& state)
|
computeSegmentFluidProperties(const SolutionState& state)
|
||||||
{
|
{
|
||||||
const int np = numPhases();
|
const int np = numPhases();
|
||||||
const int nw = wells().size();
|
const int nw = msWells().size();
|
||||||
const int nseg_total = nseg_total_;
|
const int nseg_total = nseg_total_;
|
||||||
|
|
||||||
if ( !wellOps().has_multisegment_wells ){
|
if ( !wellOps().has_multisegment_wells ){
|
||||||
@ -425,7 +425,7 @@ namespace Opm
|
|||||||
std::vector<int> segment_cells;
|
std::vector<int> segment_cells;
|
||||||
segment_cells.reserve(nseg_total);
|
segment_cells.reserve(nseg_total);
|
||||||
for (int w = 0; w < nw; ++w) {
|
for (int w = 0; w < nw; ++w) {
|
||||||
const std::vector<int>& segment_cells_well = wells()[w]->segmentCells();
|
const std::vector<int>& segment_cells_well = msWells()[w]->segmentCells();
|
||||||
segment_cells.insert(segment_cells.end(), segment_cells_well.begin(), segment_cells_well.end());
|
segment_cells.insert(segment_cells.end(), segment_cells_well.begin(), segment_cells_well.end());
|
||||||
}
|
}
|
||||||
assert(int(segment_cells.size()) == nseg_total);
|
assert(int(segment_cells.size()) == nseg_total);
|
||||||
@ -484,7 +484,7 @@ namespace Opm
|
|||||||
std::vector<std::vector<double>> comp_frac(np, std::vector<double>(nseg_total, 0.0));
|
std::vector<std::vector<double>> comp_frac(np, std::vector<double>(nseg_total, 0.0));
|
||||||
int start_segment = 0;
|
int start_segment = 0;
|
||||||
for (int w = 0; w < nw; ++w) {
|
for (int w = 0; w < nw; ++w) {
|
||||||
WellMultiSegmentConstPtr well = wells()[w];
|
WellMultiSegmentConstPtr well = msWells()[w];
|
||||||
const int nseg = well->numberOfSegments();
|
const int nseg = well->numberOfSegments();
|
||||||
const std::vector<double>& comp_frac_well = well->compFrac();
|
const std::vector<double>& comp_frac_well = well->compFrac();
|
||||||
for (int phase = 0; phase < np; ++phase) {
|
for (int phase = 0; phase < np; ++phase) {
|
||||||
@ -663,10 +663,10 @@ namespace Opm
|
|||||||
// the name of the function is a a little misleading.
|
// the name of the function is a a little misleading.
|
||||||
// Basically it is the function for the pressure equation.
|
// Basically it is the function for the pressure equation.
|
||||||
// And also, it work as the control equation when it is the segment
|
// And also, it work as the control equation when it is the segment
|
||||||
if( wells().empty() ) return;
|
if( msWells().empty() ) return;
|
||||||
|
|
||||||
const int np = numPhases();
|
const int np = numPhases();
|
||||||
const int nw = wells().size();
|
const int nw = msWells().size();
|
||||||
const int nseg_total = nseg_total_;
|
const int nseg_total = nseg_total_;
|
||||||
|
|
||||||
ADB aqua = ADB::constant(Vector::Zero(nseg_total));
|
ADB aqua = ADB::constant(Vector::Zero(nseg_total));
|
||||||
@ -708,14 +708,14 @@ namespace Opm
|
|||||||
//and gather info about current control
|
//and gather info about current control
|
||||||
int start_segment = 0;
|
int start_segment = 0;
|
||||||
for (int w = 0; w < nw; ++w) {
|
for (int w = 0; w < nw; ++w) {
|
||||||
const struct WellControls* wc = wells()[w]->wellControls();
|
const struct WellControls* wc = msWells()[w]->wellControls();
|
||||||
|
|
||||||
// The current control in the well state overrides
|
// The current control in the well state overrides
|
||||||
// the current control set in the Wells struct, which
|
// the current control set in the Wells struct, which
|
||||||
// is instead treated as a default.
|
// is instead treated as a default.
|
||||||
const int current = xw.currentControls()[w];
|
const int current = xw.currentControls()[w];
|
||||||
|
|
||||||
const int nseg = wells()[w]->numberOfSegments();
|
const int nseg = msWells()[w]->numberOfSegments();
|
||||||
|
|
||||||
switch (well_controls_iget_type(wc, current)) {
|
switch (well_controls_iget_type(wc, current)) {
|
||||||
case BHP:
|
case BHP:
|
||||||
@ -825,15 +825,15 @@ namespace Opm
|
|||||||
updateWellControls(const bool terminal_output,
|
updateWellControls(const bool terminal_output,
|
||||||
WellState& xw) const
|
WellState& xw) const
|
||||||
{
|
{
|
||||||
if( wells().empty() ) return ;
|
if( msWells().empty() ) return ;
|
||||||
|
|
||||||
std::string modestring[4] = { "BHP", "THP", "RESERVOIR_RATE", "SURFACE_RATE" };
|
std::string modestring[4] = { "BHP", "THP", "RESERVOIR_RATE", "SURFACE_RATE" };
|
||||||
// Find, for each well, if any constraints are broken. If so,
|
// Find, for each well, if any constraints are broken. If so,
|
||||||
// switch control to first broken constraint.
|
// switch control to first broken constraint.
|
||||||
const int np = numPhases();
|
const int np = numPhases();
|
||||||
const int nw = wells().size();
|
const int nw = msWells().size();
|
||||||
for (int w = 0; w < nw; ++w) {
|
for (int w = 0; w < nw; ++w) {
|
||||||
const WellControls* wc = wells()[w]->wellControls();
|
const WellControls* wc = msWells()[w]->wellControls();
|
||||||
// The current control in the well state overrides
|
// The current control in the well state overrides
|
||||||
// the current control set in the Wells struct, which
|
// the current control set in the Wells struct, which
|
||||||
// is instead treated as a default.
|
// is instead treated as a default.
|
||||||
@ -852,7 +852,7 @@ namespace Opm
|
|||||||
}
|
}
|
||||||
if (wellhelpers::constraintBroken(
|
if (wellhelpers::constraintBroken(
|
||||||
xw.bhp(), xw.thp(), xw.wellRates(),
|
xw.bhp(), xw.thp(), xw.wellRates(),
|
||||||
w, np, wells()[w]->wellType(), wc, ctrl_index)) {
|
w, np, msWells()[w]->wellType(), wc, ctrl_index)) {
|
||||||
// ctrl_index will be the index of the broken constraint after the loop.
|
// ctrl_index will be the index of the broken constraint after the loop.
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -862,7 +862,7 @@ namespace Opm
|
|||||||
// Constraint number ctrl_index was broken, switch to it.
|
// Constraint number ctrl_index was broken, switch to it.
|
||||||
if (terminal_output)
|
if (terminal_output)
|
||||||
{
|
{
|
||||||
std::cout << "Switching control mode for well " << wells()[w]->name()
|
std::cout << "Switching control mode for well " << msWells()[w]->name()
|
||||||
<< " from " << modestring[well_controls_iget_type(wc, current)]
|
<< " from " << modestring[well_controls_iget_type(wc, current)]
|
||||||
<< " to " << modestring[well_controls_iget_type(wc, ctrl_index)] << std::endl;
|
<< " to " << modestring[well_controls_iget_type(wc, ctrl_index)] << std::endl;
|
||||||
}
|
}
|
||||||
@ -1022,13 +1022,13 @@ namespace Opm
|
|||||||
// 2. Compute densities
|
// 2. Compute densities
|
||||||
std::vector<double> cd =
|
std::vector<double> cd =
|
||||||
WellDensitySegmented::computeConnectionDensities(
|
WellDensitySegmented::computeConnectionDensities(
|
||||||
wellsStruct(), xw, fluid_->phaseUsage(),
|
wells(), xw, fluid_->phaseUsage(),
|
||||||
b_perf, rsmax_perf, rvmax_perf, surf_dens_perf);
|
b_perf, rsmax_perf, rvmax_perf, surf_dens_perf);
|
||||||
|
|
||||||
// 3. Compute pressure deltas
|
// 3. Compute pressure deltas
|
||||||
std::vector<double> cdp =
|
std::vector<double> cdp =
|
||||||
WellDensitySegmented::computeConnectionPressureDelta(
|
WellDensitySegmented::computeConnectionPressureDelta(
|
||||||
wellsStruct(), perf_cell_depth, cd, gravity_);
|
wells(), perf_cell_depth, cd, gravity_);
|
||||||
|
|
||||||
// 4. Store the results
|
// 4. Store the results
|
||||||
well_perforation_densities_ = Eigen::Map<const Vector>(cd.data(), nperf_total); // This one is not useful for segmented wells at all
|
well_perforation_densities_ = Eigen::Map<const Vector>(cd.data(), nperf_total); // This one is not useful for segmented wells at all
|
||||||
|
@ -90,6 +90,7 @@ namespace Opm
|
|||||||
typedef typename Traits::OutputWriter OutputWriter;
|
typedef typename Traits::OutputWriter OutputWriter;
|
||||||
typedef typename Traits::Grid Grid;
|
typedef typename Traits::Grid Grid;
|
||||||
typedef typename Traits::Solver Solver;
|
typedef typename Traits::Solver Solver;
|
||||||
|
typedef typename Traits::WellModel WellModel;
|
||||||
|
|
||||||
/// Initialise from parameters and objects to observe.
|
/// Initialise from parameters and objects to observe.
|
||||||
/// \param[in] param parameters, this class accepts the following:
|
/// \param[in] param parameters, this class accepts the following:
|
||||||
@ -149,7 +150,7 @@ namespace Opm
|
|||||||
WellState& well_state,
|
WellState& well_state,
|
||||||
const Wells* wells);
|
const Wells* wells);
|
||||||
|
|
||||||
std::unique_ptr<Solver> createSolver(const Wells* wells);
|
std::unique_ptr<Solver> createSolver(const WellModel& well_model);
|
||||||
|
|
||||||
void
|
void
|
||||||
computeRESV(const std::size_t step,
|
computeRESV(const std::size_t step,
|
||||||
|
@ -169,7 +169,9 @@ namespace Opm
|
|||||||
// Run a multiple steps of the solver depending on the time step control.
|
// Run a multiple steps of the solver depending on the time step control.
|
||||||
solver_timer.start();
|
solver_timer.start();
|
||||||
|
|
||||||
auto solver = asImpl().createSolver(wells);
|
const WellModel well_model(wells);
|
||||||
|
|
||||||
|
auto solver = asImpl().createSolver(well_model);
|
||||||
|
|
||||||
// If sub stepping is enabled allow the solver to sub cycle
|
// If sub stepping is enabled allow the solver to sub cycle
|
||||||
// in case the report steps are too large for the solver to converge
|
// in case the report steps are too large for the solver to converge
|
||||||
@ -373,7 +375,7 @@ namespace Opm
|
|||||||
{ }
|
{ }
|
||||||
|
|
||||||
template <class Implementation>
|
template <class Implementation>
|
||||||
auto SimulatorBase<Implementation>::createSolver(const Wells* wells)
|
auto SimulatorBase<Implementation>::createSolver(const WellModel& well_model)
|
||||||
-> std::unique_ptr<Solver>
|
-> std::unique_ptr<Solver>
|
||||||
{
|
{
|
||||||
auto model = std::unique_ptr<Model>(new Model(model_param_,
|
auto model = std::unique_ptr<Model>(new Model(model_param_,
|
||||||
@ -381,7 +383,7 @@ namespace Opm
|
|||||||
props_,
|
props_,
|
||||||
geo_,
|
geo_,
|
||||||
rock_comp_props_,
|
rock_comp_props_,
|
||||||
wells,
|
well_model,
|
||||||
solver_,
|
solver_,
|
||||||
eclipse_state_,
|
eclipse_state_,
|
||||||
has_disgas_,
|
has_disgas_,
|
||||||
|
@ -28,6 +28,7 @@ namespace Opm {
|
|||||||
|
|
||||||
template <class GridT>
|
template <class GridT>
|
||||||
class SimulatorFullyImplicitBlackoil;
|
class SimulatorFullyImplicitBlackoil;
|
||||||
|
class StandardWells;
|
||||||
|
|
||||||
template <class GridT>
|
template <class GridT>
|
||||||
struct SimulatorTraits<SimulatorFullyImplicitBlackoil<GridT> >
|
struct SimulatorTraits<SimulatorFullyImplicitBlackoil<GridT> >
|
||||||
@ -38,6 +39,7 @@ struct SimulatorTraits<SimulatorFullyImplicitBlackoil<GridT> >
|
|||||||
typedef GridT Grid;
|
typedef GridT Grid;
|
||||||
typedef BlackoilModel<Grid> Model;
|
typedef BlackoilModel<Grid> Model;
|
||||||
typedef NonlinearSolver<Model> Solver;
|
typedef NonlinearSolver<Model> Solver;
|
||||||
|
typedef StandardWells WellModel;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// a simulator for the blackoil model
|
/// a simulator for the blackoil model
|
||||||
|
@ -33,6 +33,8 @@ namespace Opm {
|
|||||||
template <class GridT>
|
template <class GridT>
|
||||||
class SimulatorFullyImplicitBlackoilMultiSegment;
|
class SimulatorFullyImplicitBlackoilMultiSegment;
|
||||||
|
|
||||||
|
class MultisegmentWells;
|
||||||
|
|
||||||
template <class GridT>
|
template <class GridT>
|
||||||
struct SimulatorTraits<SimulatorFullyImplicitBlackoilMultiSegment<GridT> >
|
struct SimulatorTraits<SimulatorFullyImplicitBlackoilMultiSegment<GridT> >
|
||||||
{
|
{
|
||||||
@ -42,6 +44,7 @@ struct SimulatorTraits<SimulatorFullyImplicitBlackoilMultiSegment<GridT> >
|
|||||||
typedef GridT Grid;
|
typedef GridT Grid;
|
||||||
typedef BlackoilMultiSegmentModel<Grid> Model;
|
typedef BlackoilMultiSegmentModel<Grid> Model;
|
||||||
typedef NonlinearSolver<Model> Solver;
|
typedef NonlinearSolver<Model> Solver;
|
||||||
|
typedef MultisegmentWells WellModel;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// a simulator for the blackoil model
|
/// a simulator for the blackoil model
|
||||||
@ -56,6 +59,7 @@ public:
|
|||||||
typedef typename Traits::ReservoirState ReservoirState;
|
typedef typename Traits::ReservoirState ReservoirState;
|
||||||
typedef typename Traits::WellState WellState;
|
typedef typename Traits::WellState WellState;
|
||||||
typedef typename Traits::Solver Solver;
|
typedef typename Traits::Solver Solver;
|
||||||
|
typedef typename Traits::WellModel WellModel;
|
||||||
|
|
||||||
// forward the constructor to the base class
|
// forward the constructor to the base class
|
||||||
SimulatorFullyImplicitBlackoilMultiSegment(const parameter::ParameterGroup& param,
|
SimulatorFullyImplicitBlackoilMultiSegment(const parameter::ParameterGroup& param,
|
||||||
@ -80,7 +84,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
std::unique_ptr<Solver> createSolver(const Wells* wells, const MultisegmentWells& multisegment_wells);
|
std::unique_ptr<Solver> createSolver(const WellModel& well_model);
|
||||||
|
|
||||||
using Base::output_writer_;
|
using Base::output_writer_;
|
||||||
using Base::param_;
|
using Base::param_;
|
||||||
|
@ -25,7 +25,7 @@ namespace Opm
|
|||||||
|
|
||||||
template <class GridT>
|
template <class GridT>
|
||||||
auto SimulatorFullyImplicitBlackoilMultiSegment<GridT>::
|
auto SimulatorFullyImplicitBlackoilMultiSegment<GridT>::
|
||||||
createSolver(const Wells* wells, const MultisegmentWells& multisegment_wells)
|
createSolver(const WellModel& well_model)
|
||||||
-> std::unique_ptr<Solver>
|
-> std::unique_ptr<Solver>
|
||||||
{
|
{
|
||||||
typedef typename Traits::Model Model;
|
typedef typename Traits::Model Model;
|
||||||
@ -35,13 +35,12 @@ namespace Opm
|
|||||||
props_,
|
props_,
|
||||||
geo_,
|
geo_,
|
||||||
rock_comp_props_,
|
rock_comp_props_,
|
||||||
wells,
|
well_model,
|
||||||
solver_,
|
solver_,
|
||||||
eclipse_state_,
|
eclipse_state_,
|
||||||
has_disgas_,
|
has_disgas_,
|
||||||
has_vapoil_,
|
has_vapoil_,
|
||||||
terminal_output_,
|
terminal_output_));
|
||||||
multisegment_wells));
|
|
||||||
|
|
||||||
if (!Base::threshold_pressures_by_face_.empty()) {
|
if (!Base::threshold_pressures_by_face_.empty()) {
|
||||||
model->setThresholdPressures(Base::threshold_pressures_by_face_);
|
model->setThresholdPressures(Base::threshold_pressures_by_face_);
|
||||||
@ -134,7 +133,7 @@ namespace Opm
|
|||||||
// Run a multiple steps of the solver depending on the time step control.
|
// Run a multiple steps of the solver depending on the time step control.
|
||||||
solver_timer.start();
|
solver_timer.start();
|
||||||
|
|
||||||
auto solver = createSolver(wells, multisegment_wells);
|
auto solver = createSolver(multisegment_wells);
|
||||||
|
|
||||||
// If sub stepping is enabled allow the solver to sub cycle
|
// If sub stepping is enabled allow the solver to sub cycle
|
||||||
// in case the report steps are too large for the solver to converge
|
// in case the report steps are too large for the solver to converge
|
||||||
|
@ -80,6 +80,8 @@ namespace Opm
|
|||||||
template <class GridT>
|
template <class GridT>
|
||||||
class SimulatorFullyImplicitBlackoilSolvent;
|
class SimulatorFullyImplicitBlackoilSolvent;
|
||||||
|
|
||||||
|
class StandardWellsSolvent;
|
||||||
|
|
||||||
template<class GridT>
|
template<class GridT>
|
||||||
struct SimulatorTraits<SimulatorFullyImplicitBlackoilSolvent<GridT> >
|
struct SimulatorTraits<SimulatorFullyImplicitBlackoilSolvent<GridT> >
|
||||||
{
|
{
|
||||||
@ -89,6 +91,8 @@ namespace Opm
|
|||||||
typedef GridT Grid;
|
typedef GridT Grid;
|
||||||
typedef BlackoilSolventModel<Grid> Model;
|
typedef BlackoilSolventModel<Grid> Model;
|
||||||
typedef NonlinearSolver<Model> Solver;
|
typedef NonlinearSolver<Model> Solver;
|
||||||
|
typedef StandardWellsSolvent WellModel;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Class collecting all necessary components for a blackoil simulation with polymer
|
/// Class collecting all necessary components for a blackoil simulation with polymer
|
||||||
@ -102,6 +106,7 @@ namespace Opm
|
|||||||
|
|
||||||
typedef SimulatorTraits<ThisType> Traits;
|
typedef SimulatorTraits<ThisType> Traits;
|
||||||
typedef typename Traits::Solver Solver;
|
typedef typename Traits::Solver Solver;
|
||||||
|
typedef typename Traits::WellModel WellModel;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SimulatorFullyImplicitBlackoilSolvent(const parameter::ParameterGroup& param,
|
SimulatorFullyImplicitBlackoilSolvent(const parameter::ParameterGroup& param,
|
||||||
@ -120,7 +125,7 @@ namespace Opm
|
|||||||
const std::vector<double>& threshold_pressures_by_face,
|
const std::vector<double>& threshold_pressures_by_face,
|
||||||
const bool solvent);
|
const bool solvent);
|
||||||
|
|
||||||
std::unique_ptr<Solver> createSolver(const Wells* wells);
|
std::unique_ptr<Solver> createSolver(const WellModel& well_model);
|
||||||
|
|
||||||
void handleAdditionalWellInflow(SimulatorTimer& timer,
|
void handleAdditionalWellInflow(SimulatorTimer& timer,
|
||||||
WellsManager& wells_manager,
|
WellsManager& wells_manager,
|
||||||
|
@ -63,7 +63,7 @@ namespace Opm
|
|||||||
|
|
||||||
template <class GridT>
|
template <class GridT>
|
||||||
auto SimulatorFullyImplicitBlackoilSolvent<GridT>::
|
auto SimulatorFullyImplicitBlackoilSolvent<GridT>::
|
||||||
createSolver(const Wells* wells)
|
createSolver(const WellModel& well_model)
|
||||||
-> std::unique_ptr<Solver>
|
-> std::unique_ptr<Solver>
|
||||||
{
|
{
|
||||||
typedef typename Traits::Model Model;
|
typedef typename Traits::Model Model;
|
||||||
@ -75,7 +75,7 @@ namespace Opm
|
|||||||
BaseType::geo_,
|
BaseType::geo_,
|
||||||
BaseType::rock_comp_props_,
|
BaseType::rock_comp_props_,
|
||||||
solvent_props_,
|
solvent_props_,
|
||||||
wells,
|
well_model,
|
||||||
BaseType::solver_,
|
BaseType::solver_,
|
||||||
BaseType::eclipse_state_,
|
BaseType::eclipse_state_,
|
||||||
BaseType::has_disgas_,
|
BaseType::has_disgas_,
|
||||||
|
@ -67,7 +67,7 @@ namespace Opm
|
|||||||
template <class ReservoirState, class PrevWellState>
|
template <class ReservoirState, class PrevWellState>
|
||||||
void init(const MultisegmentWells& ms_wells, const ReservoirState& state, const PrevWellState& prevState)
|
void init(const MultisegmentWells& ms_wells, const ReservoirState& state, const PrevWellState& prevState)
|
||||||
{
|
{
|
||||||
const std::vector<WellMultiSegmentConstPtr>& wells = ms_wells.wells();
|
const std::vector<WellMultiSegmentConstPtr>& wells = ms_wells.msWells();
|
||||||
const int nw = wells.size();
|
const int nw = wells.size();
|
||||||
nseg_ = 0;
|
nseg_ = 0;
|
||||||
nperf_ = 0;
|
nperf_ = 0;
|
||||||
|
@ -79,7 +79,7 @@ namespace Opm {
|
|||||||
const DerivedGeology& geo,
|
const DerivedGeology& geo,
|
||||||
const RockCompressibility* rock_comp_props,
|
const RockCompressibility* rock_comp_props,
|
||||||
const PolymerPropsAd& polymer_props_ad,
|
const PolymerPropsAd& polymer_props_ad,
|
||||||
const Wells* wells,
|
const StandardWells& well_model,
|
||||||
const NewtonIterationBlackoilInterface& linsolver,
|
const NewtonIterationBlackoilInterface& linsolver,
|
||||||
EclipseStateConstPtr eclipse_state,
|
EclipseStateConstPtr eclipse_state,
|
||||||
const bool has_disgas,
|
const bool has_disgas,
|
||||||
|
@ -80,7 +80,7 @@ namespace Opm {
|
|||||||
const DerivedGeology& geo,
|
const DerivedGeology& geo,
|
||||||
const RockCompressibility* rock_comp_props,
|
const RockCompressibility* rock_comp_props,
|
||||||
const PolymerPropsAd& polymer_props_ad,
|
const PolymerPropsAd& polymer_props_ad,
|
||||||
const Wells* wells_arg,
|
const StandardWells& well_model,
|
||||||
const NewtonIterationBlackoilInterface& linsolver,
|
const NewtonIterationBlackoilInterface& linsolver,
|
||||||
EclipseStateConstPtr eclipse_state,
|
EclipseStateConstPtr eclipse_state,
|
||||||
const bool has_disgas,
|
const bool has_disgas,
|
||||||
@ -92,7 +92,7 @@ namespace Opm {
|
|||||||
const std::vector<double>& wells_perf_length,
|
const std::vector<double>& wells_perf_length,
|
||||||
const std::vector<double>& wells_bore_diameter,
|
const std::vector<double>& wells_bore_diameter,
|
||||||
const bool terminal_output)
|
const bool terminal_output)
|
||||||
: Base(param, grid, fluid, geo, rock_comp_props, wells_arg, linsolver, eclipse_state,
|
: Base(param, grid, fluid, geo, rock_comp_props, well_model, linsolver, eclipse_state,
|
||||||
has_disgas, has_vapoil, terminal_output),
|
has_disgas, has_vapoil, terminal_output),
|
||||||
polymer_props_ad_(polymer_props_ad),
|
polymer_props_ad_(polymer_props_ad),
|
||||||
has_polymer_(has_polymer),
|
has_polymer_(has_polymer),
|
||||||
|
@ -81,6 +81,8 @@ namespace Opm
|
|||||||
template <class GridT>
|
template <class GridT>
|
||||||
class SimulatorFullyImplicitBlackoilPolymer;
|
class SimulatorFullyImplicitBlackoilPolymer;
|
||||||
|
|
||||||
|
class StandardWells;
|
||||||
|
|
||||||
template<class GridT>
|
template<class GridT>
|
||||||
struct SimulatorTraits<SimulatorFullyImplicitBlackoilPolymer<GridT> >
|
struct SimulatorTraits<SimulatorFullyImplicitBlackoilPolymer<GridT> >
|
||||||
{
|
{
|
||||||
@ -90,6 +92,7 @@ namespace Opm
|
|||||||
typedef GridT Grid;
|
typedef GridT Grid;
|
||||||
typedef BlackoilPolymerModel<Grid> Model;
|
typedef BlackoilPolymerModel<Grid> Model;
|
||||||
typedef NonlinearSolver<Model> Solver;
|
typedef NonlinearSolver<Model> Solver;
|
||||||
|
typedef StandardWells WellModel;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Class collecting all necessary components for a blackoil simulation with polymer
|
/// Class collecting all necessary components for a blackoil simulation with polymer
|
||||||
@ -103,6 +106,7 @@ namespace Opm
|
|||||||
|
|
||||||
typedef SimulatorTraits<ThisType> Traits;
|
typedef SimulatorTraits<ThisType> Traits;
|
||||||
typedef typename Traits::Solver Solver;
|
typedef typename Traits::Solver Solver;
|
||||||
|
typedef typename Traits::WellModel WellModel;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SimulatorFullyImplicitBlackoilPolymer(const parameter::ParameterGroup& param,
|
SimulatorFullyImplicitBlackoilPolymer(const parameter::ParameterGroup& param,
|
||||||
@ -123,7 +127,7 @@ namespace Opm
|
|||||||
Opm::DeckConstPtr& deck,
|
Opm::DeckConstPtr& deck,
|
||||||
const std::vector<double>& threshold_pressures_by_face);
|
const std::vector<double>& threshold_pressures_by_face);
|
||||||
|
|
||||||
std::unique_ptr<Solver> createSolver(const Wells* wells);
|
std::unique_ptr<Solver> createSolver(const WellModel& well_model);
|
||||||
|
|
||||||
|
|
||||||
void handleAdditionalWellInflow(SimulatorTimer& timer,
|
void handleAdditionalWellInflow(SimulatorTimer& timer,
|
||||||
|
@ -62,7 +62,7 @@ namespace Opm
|
|||||||
|
|
||||||
template <class GridT>
|
template <class GridT>
|
||||||
auto SimulatorFullyImplicitBlackoilPolymer<GridT>::
|
auto SimulatorFullyImplicitBlackoilPolymer<GridT>::
|
||||||
createSolver(const Wells* wells)
|
createSolver(const WellModel& well_model)
|
||||||
-> std::unique_ptr<Solver>
|
-> std::unique_ptr<Solver>
|
||||||
{
|
{
|
||||||
typedef typename Traits::Model Model;
|
typedef typename Traits::Model Model;
|
||||||
@ -74,7 +74,7 @@ namespace Opm
|
|||||||
BaseType::geo_,
|
BaseType::geo_,
|
||||||
BaseType::rock_comp_props_,
|
BaseType::rock_comp_props_,
|
||||||
polymer_props_,
|
polymer_props_,
|
||||||
wells,
|
well_model,
|
||||||
BaseType::solver_,
|
BaseType::solver_,
|
||||||
BaseType::eclipse_state_,
|
BaseType::eclipse_state_,
|
||||||
BaseType::has_disgas_,
|
BaseType::has_disgas_,
|
||||||
|
Loading…
Reference in New Issue
Block a user