Merge pull request #4621 from vkip/use_mb_from_tuning

Use mass balance limit (XXXMBE) from TUNING with --enable-tuning=true
This commit is contained in:
Bård Skaflestad
2023-06-30 13:04:49 +02:00
committed by GitHub
6 changed files with 227 additions and 6 deletions

View File

@@ -24,6 +24,8 @@
#ifndef OPM_BLACKOILMODELEBOS_HEADER_INCLUDED
#define OPM_BLACKOILMODELEBOS_HEADER_INCLUDED
#include <fmt/format.h>
#include <ebos/eclproblem.hh>
#include <opm/common/ErrorMacros.hpp>
@@ -1523,6 +1525,7 @@ namespace Opm {
return grid_.comm().sum(errorPV);
}
ConvergenceReport getDomainReservoirConvergence(const double reportTime,
const double dt,
const int iteration,
@@ -1632,6 +1635,14 @@ namespace Opm {
void updateTUNING(const Tuning& tuning) {
param_.tolerance_mb_ = tuning.XXXMBE;
if ( terminal_output_ ) {
OpmLog::debug(fmt::format("Setting BlackoilModelEbos mass balance limit (XXXMBE) to {:.2e}", tuning.XXXMBE));
}
}
ConvergenceReport getReservoirConvergence(const double reportTime,
const double dt,
const int iteration,

View File

@@ -23,6 +23,7 @@
#define OPM_SIMULATORFULLYIMPLICITBLACKOILEBOS_HEADER_INCLUDED
#include <dune/common/hash.hh>
#include <fmt/format.h>
#include <opm/simulators/flow/BlackoilModelEbos.hpp>
#include <opm/simulators/flow/BlackoilModelParametersEbos.hpp>
@@ -320,6 +321,13 @@ public:
}
}
void updateTUNING(const Tuning& tuning) {
modelParam_.tolerance_mb_ = tuning.XXXMBE;
if (terminalOutput_) {
OpmLog::debug(fmt::format("Setting SimulatorFullyImplicitBlackoilEbos mass balance limit (XXXMBE) to {:.2e}", tuning.XXXMBE));
}
}
bool runStep(SimulatorTimer& timer)
{
if (schedule().exitStatus().has_value()) {
@@ -393,6 +401,10 @@ public:
const auto& tuning = sched_state.tuning();
const auto& max_next_tstep = sched_state.max_next_tstep();
adaptiveTimeStepping_->updateTUNING(max_next_tstep, tuning);
// \Note: Assumes TUNING is only used with adaptive time-stepping
// \Note: Need to update both solver (model) and simulator since solver is re-created each report step.
solver_->model().updateTUNING(tuning);
this->updateTUNING(tuning);
}
}
bool event = events.hasEvent(ScheduleEvents::NEW_WELL) ||