Use mass balance limit from TUNING

This commit is contained in:
Vegard Kippe 2023-05-03 13:17:20 +02:00
parent 007695e849
commit 462ec3153d
2 changed files with 29 additions and 1 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/models/utils/start.hh>
@ -1595,6 +1597,7 @@ namespace Opm {
return grid_.comm().sum(errorPV);
}
ConvergenceReport getDomainReservoirConvergence(const double reportTime,
const double dt,
const int iteration,
@ -1704,6 +1707,17 @@ namespace Opm {
void updateTUNING(const Tuning& tuning) {
if (tuning.XXXMBE_has_nondefault_value) {
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,
@ -1728,7 +1742,7 @@ namespace Opm {
auto cnvErrorPvFraction = computeCnvErrorPv(B_avg, dt);
cnvErrorPvFraction /= (pvSum - numAquiferPvSum);
const double tol_mb = param_.tolerance_mb_;
const double tol_mb = param_.tolerance_mb_;
// Default value of relaxed_max_pv_fraction_ is 0.03 and min_strict_cnv_iter_ is 0.
// For each iteration, we need to determine whether to use the relaxed CNV tolerance.
// To disable the usage of relaxed CNV tolerance, you can set the relaxed_max_pv_fraction_ to be 0.

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,15 @@ public:
}
}
void updateTUNING(const Tuning& tuning) {
if (tuning.XXXMBE_has_nondefault_value) {
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 +403,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) ||