mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-12-28 18:21:00 -06:00
fixing a bug related to adding ms well during simulation.
When there is not ms well involved, all the ms well related is not initialized. It causes problem when we want to add ms well after some time of running. The bug fix the running with model 2.
This commit is contained in:
parent
c3a368e58e
commit
78a28abf91
@ -63,7 +63,8 @@ namespace Opm
|
||||
/// to give useful initial values to the bhp(), wellRates()
|
||||
/// and perfPhaseRates() fields, depending on controls
|
||||
template <class PrevWellState>
|
||||
void init(const Wells* wells, const std::vector<double>& cellPressures, const PrevWellState& prevState, const PhaseUsage& pu)
|
||||
void init(const Wells* wells, const std::vector<double>& cellPressures,
|
||||
const PrevWellState& prevState, const PhaseUsage& pu)
|
||||
{
|
||||
|
||||
// call init on base class
|
||||
@ -109,6 +110,17 @@ namespace Opm
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
// we need to create a trival segment related values to avoid there will be some
|
||||
// multi-segment wells added later.
|
||||
top_segment_loc_.reserve(nw);
|
||||
for (int w = 0; w < nw; ++w) {
|
||||
top_segment_loc_.push_back(w);
|
||||
}
|
||||
segpress_ = bhp();
|
||||
segrates_ = wellRates();
|
||||
}
|
||||
}
|
||||
|
||||
/// init the MS well related.
|
||||
@ -122,6 +134,13 @@ namespace Opm
|
||||
return;
|
||||
}
|
||||
|
||||
top_segment_loc_.clear();
|
||||
top_segment_loc_.reserve(nw);
|
||||
segpress_.clear();
|
||||
segpress_.reserve(nw);
|
||||
segrates_.clear();
|
||||
segrates_.reserve(nw * numPhases());
|
||||
|
||||
nseg_ = 0.;
|
||||
// in the init function, the well rates and perforation rates have been initialized or copied from prevState
|
||||
// what we do here, is to set the segment rates and perforation rates
|
||||
@ -358,6 +377,7 @@ namespace Opm
|
||||
int topSegmentLocation(const int w) const
|
||||
{
|
||||
assert(w < int(top_segment_loc_.size()) );
|
||||
|
||||
return top_segment_loc_[w];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user