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);
|
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:
|
protected:
|
||||||
// compute the connection transmissibility factor based on the effective permeability
|
// compute the connection transmissibility factor based on the effective permeability
|
||||||
// of a connection, the radius of the borehole and the skin factor.
|
// of a connection, the radius of the borehole and the skin factor.
|
||||||
|
@ -292,6 +292,28 @@ public:
|
|||||||
simulator.setEpisodeIndex(0);
|
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.
|
* \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
|
* For the ECL simulator we only write at the end of
|
||||||
* episodes/report steps...
|
* episodes/report steps...
|
||||||
*/
|
*/
|
||||||
bool shouldWriteOutput()
|
bool shouldWriteOutput() const
|
||||||
{
|
{
|
||||||
if (this->simulator().timeStepIndex() < 0)
|
if (this->simulator().timeStepIndex() < 0)
|
||||||
// always write the initial solution
|
// always write the initial solution
|
||||||
@ -799,9 +821,9 @@ private:
|
|||||||
Opm::DeckRecordConstPtr densityRecord =
|
Opm::DeckRecordConstPtr densityRecord =
|
||||||
deck->getKeyword("DENSITY")->getRecord(regionIdx);
|
deck->getKeyword("DENSITY")->getRecord(regionIdx);
|
||||||
FluidSystem::setReferenceDensities(densityRecord->getItem("OIL")->getSIDouble(0),
|
FluidSystem::setReferenceDensities(densityRecord->getItem("OIL")->getSIDouble(0),
|
||||||
densityRecord->getItem("WATER")->getSIDouble(0),
|
densityRecord->getItem("WATER")->getSIDouble(0),
|
||||||
densityRecord->getItem("GAS")->getSIDouble(0),
|
densityRecord->getItem("GAS")->getSIDouble(0),
|
||||||
regionIdx);
|
regionIdx);
|
||||||
|
|
||||||
// so far, we require the presence of the PVTO, PVTW and PVDG
|
// so far, we require the presence of the PVTO, PVTW and PVDG
|
||||||
// keywords...
|
// keywords...
|
||||||
|
@ -106,7 +106,7 @@ public:
|
|||||||
* \brief This should be called the problem before each simulation
|
* \brief This should be called the problem before each simulation
|
||||||
* episode to adapt the well controls.
|
* episode to adapt the well controls.
|
||||||
*/
|
*/
|
||||||
void beginEpisode(Opm::EclipseStateConstPtr eclState)
|
void beginEpisode(Opm::EclipseStateConstPtr eclState, bool wasRestarted=false)
|
||||||
{
|
{
|
||||||
int episodeIdx = simulator_.episodeIndex();
|
int episodeIdx = simulator_.episodeIndex();
|
||||||
|
|
||||||
@ -114,8 +114,9 @@ public:
|
|||||||
WellCompletionsMap wellCompMap;
|
WellCompletionsMap wellCompMap;
|
||||||
computeWellCompletionsMap_(episodeIdx, wellCompMap);
|
computeWellCompletionsMap_(episodeIdx, wellCompMap);
|
||||||
|
|
||||||
if (wellTopologyChanged_(eclState, episodeIdx))
|
if (wasRestarted || wellTopologyChanged_(eclState, episodeIdx)) {
|
||||||
updateWellTopology_(episodeIdx, wellCompMap);
|
updateWellTopology_(episodeIdx, wellCompMap);
|
||||||
|
}
|
||||||
|
|
||||||
// set those parameters of the wells which do not change the topology of the
|
// set those parameters of the wells which do not change the topology of the
|
||||||
// linearized system of equations
|
// linearized system of equations
|
||||||
@ -445,9 +446,7 @@ public:
|
|||||||
template <class Restarter>
|
template <class Restarter>
|
||||||
void serialize(Restarter &res)
|
void serialize(Restarter &res)
|
||||||
{
|
{
|
||||||
// iterate over all wells and serialize them individually
|
/* do nothing: Everything which we need here is provided by the deck... */
|
||||||
for (int wellIdx = 0; wellIdx < wells_.size(); ++wellIdx)
|
|
||||||
wells_[wellIdx]->serialize(res);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -459,15 +458,8 @@ public:
|
|||||||
template <class Restarter>
|
template <class Restarter>
|
||||||
void deserialize(Restarter &res)
|
void deserialize(Restarter &res)
|
||||||
{
|
{
|
||||||
// iterate over all wells and deserialize them individually
|
// initialize the wells for the current episode
|
||||||
for (int wellIdx = 0; wellIdx < wells_.size(); ++wellIdx) {
|
beginEpisode(simulator_.gridManager().eclState(), /*wasRestarted=*/true);
|
||||||
std::shared_ptr<Well> well(new Well(simulator_));
|
|
||||||
|
|
||||||
well->deserialize(res);
|
|
||||||
|
|
||||||
wells_.push_back(well);
|
|
||||||
wellNameToIndex_[well->name()] = wells_.size() - 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
Loading…
Reference in New Issue
Block a user