mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
moving variableWellStateInitials to StandardWells.
This commit is contained in:
parent
15380fd370
commit
08e691e262
@ -356,9 +356,6 @@ namespace Opm {
|
||||
void
|
||||
variableReservoirStateInitials(const ReservoirState& x,
|
||||
std::vector<V>& vars0) const;
|
||||
void
|
||||
variableWellStateInitials(const WellState& xw,
|
||||
std::vector<V>& vars0) const;
|
||||
|
||||
std::vector<int>
|
||||
variableStateIndices() const;
|
||||
|
@ -507,7 +507,7 @@ namespace detail {
|
||||
// and bhp and Q for the wells
|
||||
vars0.reserve(np + 1);
|
||||
variableReservoirStateInitials(x, vars0);
|
||||
asImpl().variableWellStateInitials(xw, vars0);
|
||||
asImpl().stdWells().variableWellStateInitials(xw, vars0);
|
||||
return vars0;
|
||||
}
|
||||
|
||||
@ -554,41 +554,6 @@ namespace detail {
|
||||
|
||||
|
||||
|
||||
template <class Grid, class WellModel, class Implementation>
|
||||
void
|
||||
BlackoilModelBase<Grid, WellModel, Implementation>::
|
||||
variableWellStateInitials(const WellState& xw, std::vector<V>& vars0) const
|
||||
{
|
||||
// Initial well rates.
|
||||
if ( stdWells().localWellsActive() )
|
||||
{
|
||||
// Need to reshuffle well rates, from phase running fastest
|
||||
// to wells running fastest.
|
||||
const int nw = wells().number_of_wells;
|
||||
const int np = wells().number_of_phases;
|
||||
|
||||
// The transpose() below switches the ordering.
|
||||
const DataBlock wrates = Eigen::Map<const DataBlock>(& xw.wellRates()[0], nw, np).transpose();
|
||||
const V qs = Eigen::Map<const V>(wrates.data(), nw*np);
|
||||
vars0.push_back(qs);
|
||||
|
||||
// Initial well bottom-hole pressure.
|
||||
assert (not xw.bhp().empty());
|
||||
const V bhp = Eigen::Map<const V>(& xw.bhp()[0], xw.bhp().size());
|
||||
vars0.push_back(bhp);
|
||||
}
|
||||
else
|
||||
{
|
||||
// push null states for qs and bhp
|
||||
vars0.push_back(V());
|
||||
vars0.push_back(V());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <class Grid, class WellModel, class Implementation>
|
||||
std::vector<int>
|
||||
BlackoilModelBase<Grid, WellModel, Implementation>::
|
||||
@ -1100,7 +1065,7 @@ namespace detail {
|
||||
// bhp and Q for the wells
|
||||
std::vector<V> vars0;
|
||||
vars0.reserve(2);
|
||||
asImpl().variableWellStateInitials(well_state, vars0);
|
||||
asImpl().stdWells().variableWellStateInitials(well_state, vars0);
|
||||
std::vector<ADB> vars = ADB::variables(vars0);
|
||||
|
||||
SolutionState wellSolutionState = state0;
|
||||
|
@ -225,6 +225,7 @@ namespace Opm {
|
||||
using Base::variableState;
|
||||
// using Base::variableWellStateIndices;
|
||||
using Base::asImpl;
|
||||
using Base::variableReservoirStateInitials;
|
||||
|
||||
const std::vector<WellMultiSegmentConstPtr>& wellsMultiSegment() const { return wells_multisegment_; }
|
||||
|
||||
@ -234,6 +235,10 @@ namespace Opm {
|
||||
void updateWellState(const V& dwells,
|
||||
WellState& well_state);
|
||||
|
||||
std::vector<V>
|
||||
variableStateInitials(const ReservoirState& x,
|
||||
const WellState& xw) const;
|
||||
|
||||
void
|
||||
variableWellStateInitials(const WellState& xw,
|
||||
std::vector<V>& vars0) const;
|
||||
|
@ -1653,6 +1653,28 @@ namespace Opm {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <class Grid>
|
||||
std::vector<V>
|
||||
BlackoilMultiSegmentModel<Grid>::
|
||||
variableStateInitials(const ReservoirState& x,
|
||||
const WellState& xw) const
|
||||
{
|
||||
assert(active_[ Oil ]);
|
||||
|
||||
const int np = x.numPhases();
|
||||
|
||||
std::vector<V> vars0;
|
||||
// p, Sw and Rs, Rv or Sg is used as primary depending on solution conditions
|
||||
// and bhp and Q for the wells
|
||||
vars0.reserve(np + 1);
|
||||
variableReservoirStateInitials(x, vars0);
|
||||
variableWellStateInitials(xw, vars0);
|
||||
return vars0;
|
||||
}
|
||||
|
||||
} // namespace Opm
|
||||
|
||||
#endif // OPM_BLACKOILMODELBASE_IMPL_HEADER_INCLUDED
|
||||
|
@ -188,6 +188,11 @@ namespace Opm {
|
||||
std::vector<int>
|
||||
variableWellStateIndices() const;
|
||||
|
||||
template <class WellState>
|
||||
void
|
||||
variableWellStateInitials(const WellState& xw,
|
||||
std::vector<Vector>& vars0) const;
|
||||
|
||||
protected:
|
||||
bool wells_active_;
|
||||
const Wells* wells_;
|
||||
|
@ -1148,4 +1148,39 @@ namespace Opm
|
||||
return indices;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <class WellState>
|
||||
void
|
||||
StandardWells::variableWellStateInitials(const WellState& xw,
|
||||
std::vector<Vector>& vars0) const
|
||||
{
|
||||
// Initial well rates.
|
||||
if ( localWellsActive() )
|
||||
{
|
||||
// Need to reshuffle well rates, from phase running fastest
|
||||
// to wells running fastest.
|
||||
const int nw = wells().number_of_wells;
|
||||
const int np = wells().number_of_phases;
|
||||
|
||||
// The transpose() below switches the ordering.
|
||||
const DataBlock wrates = Eigen::Map<const DataBlock>(& xw.wellRates()[0], nw, np).transpose();
|
||||
const V qs = Eigen::Map<const V>(wrates.data(), nw*np);
|
||||
vars0.push_back(qs);
|
||||
|
||||
// Initial well bottom-hole pressure.
|
||||
assert (not xw.bhp().empty());
|
||||
const V bhp = Eigen::Map<const V>(& xw.bhp()[0], xw.bhp().size());
|
||||
vars0.push_back(bhp);
|
||||
}
|
||||
else
|
||||
{
|
||||
// push null states for qs and bhp
|
||||
vars0.push_back(V());
|
||||
vars0.push_back(V());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user