Merge pull request #5743 from vkip/thpres_restart

Restore threshold pressures from restart
This commit is contained in:
Atgeirr Flø Rasmussen 2024-11-27 15:16:38 +01:00 committed by GitHub
commit 92c9d88c1b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 4 deletions

View File

@ -85,7 +85,7 @@ public:
void finishInit()
{
this->BaseType::finishInit();
if (this->enableThresholdPressure_ && !this->thpresDefault_.empty()) {
if (this->enableThresholdPressure_ && !this->thpresDefault_.empty() && !this->restart_) {
this->computeDefaultThresholdPressures_();
this->applyExplicitThresholdPressures_();
}

View File

@ -75,7 +75,11 @@ public:
* This is used for the restart capability.
*/
void setFromRestart(const std::vector<double>& values)
{ thpres_.assign(values.begin(), values.end()); }
{
this->restart_ = true;
thpres_.assign(values.begin(), values.end());
thpresDefault_.assign(values.begin(), values.end());
}
//! \brief Returns a fully expanded vector for restart file writing.
//! \details Returns the union of explicitly configured entries and defaulted values.
@ -113,6 +117,7 @@ protected:
std::vector<int> cartElemFaultIdx_;
bool enableThresholdPressure_ {false};
bool restart_ {false};
};
} // namespace Opm

View File

@ -134,8 +134,8 @@ finishInit()
/*
If this is a restart run the ThresholdPressure object will be active,
but it will *not* be properly initialized with numerical values. The
values must instead come from the THPRES vector in the restart file.
and already properly initialized with numerical values from the restart.
Done using GenericThresholdPressure::setFromRestart() in EclWriter::beginRestart().
*/
if (simConfig.getThresholdPressure().restart())
return;