mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
ebos/black oil model: make the restart work
only the restart from ERS files, using ECL restart files (i.e., *.UNRST) is still unsupported (but should not be much work).
This commit is contained in:
parent
c4f169e01e
commit
a4f1aa95cc
@ -1034,63 +1034,6 @@ public:
|
||||
Valgrind::CheckDefined(q);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief This method writes the complete state of the well
|
||||
* to the harddisk.
|
||||
*/
|
||||
template <class Restarter>
|
||||
void serialize(Restarter &res)
|
||||
{
|
||||
res.serializeSectionBegin("PeacemanWell");
|
||||
|
||||
res.serializeStream()
|
||||
<< thpLimit_ << " "
|
||||
<< bhpLimit_ << " "
|
||||
<< controlMode_ << " "
|
||||
<< wellType_ << " "
|
||||
<< maximumSurfaceRate_ << " "
|
||||
<< maximumReservoirRate_ << " "
|
||||
<< wellStatus_ << " "
|
||||
<< injectedPhaseIdx_ << " ";
|
||||
|
||||
// fluid state
|
||||
for (int phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx)
|
||||
res.serializeStream()
|
||||
<< volumetricWeight_[phaseIdx] << " ";
|
||||
res.serializeSectionEnd();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief This method restores the complete state of the well
|
||||
* from disk.
|
||||
*
|
||||
* It is the inverse of the serialize() method.
|
||||
*
|
||||
* \tparam Restarter The deserializer type
|
||||
*
|
||||
* \param res The deserializer object
|
||||
*/
|
||||
template <class Restarter>
|
||||
void deserialize(Restarter &res)
|
||||
{
|
||||
res.deserializeSectionBegin("PeacemanWell");
|
||||
res.deserializeStream()
|
||||
>> thpLimit_
|
||||
>> bhpLimit_
|
||||
>> controlMode_
|
||||
>> wellType_
|
||||
>> maximumSurfaceRate_
|
||||
>> maximumReservoirRate_
|
||||
>> wellStatus_
|
||||
>> injectedPhaseIdx_;
|
||||
|
||||
// fluid state
|
||||
for (int phaseIdx = 0; phaseIdx < numPhases; ++ phaseIdx)
|
||||
res.serializeStream()
|
||||
>> volumetricWeight_[phaseIdx];
|
||||
res.deserializeSectionEnd();
|
||||
}
|
||||
|
||||
protected:
|
||||
// compute the connection transmissibility factor based on the effective permeability
|
||||
// of a connection, the radius of the borehole and the skin factor.
|
||||
|
@ -292,6 +292,28 @@ public:
|
||||
simulator.setEpisodeIndex(0);
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief This method restores the complete state of the well
|
||||
* from disk.
|
||||
*
|
||||
* It is the inverse of the serialize() method.
|
||||
*
|
||||
* \tparam Restarter The deserializer type
|
||||
*
|
||||
* \param res The deserializer object
|
||||
*/
|
||||
template <class Restarter>
|
||||
void deserialize(Restarter &res)
|
||||
{ wellManager_.deserialize(res); }
|
||||
|
||||
/*!
|
||||
* \brief This method writes the complete state of the well
|
||||
* to the harddisk.
|
||||
*/
|
||||
template <class Restarter>
|
||||
void serialize(Restarter &res)
|
||||
{ wellManager_.serialize(res); }
|
||||
|
||||
/*!
|
||||
* \brief Called by the simulator before an episode begins.
|
||||
*/
|
||||
@ -362,7 +384,7 @@ public:
|
||||
* For the ECL simulator we only write at the end of
|
||||
* episodes/report steps...
|
||||
*/
|
||||
bool shouldWriteOutput()
|
||||
bool shouldWriteOutput() const
|
||||
{
|
||||
if (this->simulator().timeStepIndex() < 0)
|
||||
// always write the initial solution
|
||||
@ -799,9 +821,9 @@ private:
|
||||
Opm::DeckRecordConstPtr densityRecord =
|
||||
deck->getKeyword("DENSITY")->getRecord(regionIdx);
|
||||
FluidSystem::setReferenceDensities(densityRecord->getItem("OIL")->getSIDouble(0),
|
||||
densityRecord->getItem("WATER")->getSIDouble(0),
|
||||
densityRecord->getItem("GAS")->getSIDouble(0),
|
||||
regionIdx);
|
||||
densityRecord->getItem("WATER")->getSIDouble(0),
|
||||
densityRecord->getItem("GAS")->getSIDouble(0),
|
||||
regionIdx);
|
||||
|
||||
// so far, we require the presence of the PVTO, PVTW and PVDG
|
||||
// keywords...
|
||||
|
@ -106,7 +106,7 @@ public:
|
||||
* \brief This should be called the problem before each simulation
|
||||
* episode to adapt the well controls.
|
||||
*/
|
||||
void beginEpisode(Opm::EclipseStateConstPtr eclState)
|
||||
void beginEpisode(Opm::EclipseStateConstPtr eclState, bool wasRestarted=false)
|
||||
{
|
||||
int episodeIdx = simulator_.episodeIndex();
|
||||
|
||||
@ -114,8 +114,9 @@ public:
|
||||
WellCompletionsMap wellCompMap;
|
||||
computeWellCompletionsMap_(episodeIdx, wellCompMap);
|
||||
|
||||
if (wellTopologyChanged_(eclState, episodeIdx))
|
||||
if (wasRestarted || wellTopologyChanged_(eclState, episodeIdx)) {
|
||||
updateWellTopology_(episodeIdx, wellCompMap);
|
||||
}
|
||||
|
||||
// set those parameters of the wells which do not change the topology of the
|
||||
// linearized system of equations
|
||||
@ -445,9 +446,7 @@ public:
|
||||
template <class Restarter>
|
||||
void serialize(Restarter &res)
|
||||
{
|
||||
// iterate over all wells and serialize them individually
|
||||
for (int wellIdx = 0; wellIdx < wells_.size(); ++wellIdx)
|
||||
wells_[wellIdx]->serialize(res);
|
||||
/* do nothing: Everything which we need here is provided by the deck... */
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -459,15 +458,8 @@ public:
|
||||
template <class Restarter>
|
||||
void deserialize(Restarter &res)
|
||||
{
|
||||
// iterate over all wells and deserialize them individually
|
||||
for (int wellIdx = 0; wellIdx < wells_.size(); ++wellIdx) {
|
||||
std::shared_ptr<Well> well(new Well(simulator_));
|
||||
|
||||
well->deserialize(res);
|
||||
|
||||
wells_.push_back(well);
|
||||
wellNameToIndex_[well->name()] = wells_.size() - 1;
|
||||
}
|
||||
// initialize the wells for the current episode
|
||||
beginEpisode(simulator_.gridManager().eclState(), /*wasRestarted=*/true);
|
||||
}
|
||||
|
||||
protected:
|
||||
|
Loading…
Reference in New Issue
Block a user