mirror of
https://github.com/OPM/opm-simulators.git
synced 2026-10-31 09:44:07 -05:00
Fix bug in NLDD relaxed tolerance logic
This commit is contained in:
1 parent
bf0fd3fafd
commit
2c4769845d
1 file changed
+41
-8
@@ -784,20 +784,53 @@ private:
|
||||
auto cnvErrorPvFraction = computeCnvErrorPvLocal(domain, B_avg, dt);
|
||||
cnvErrorPvFraction /= (pvSum - numAquiferPvSum);
|
||||
|
||||
// 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.
|
||||
const bool use_relaxed_cnv = cnvErrorPvFraction < model_.param().relaxed_max_pv_fraction_ &&
|
||||
iteration >= model_.param().min_strict_cnv_iter_;
|
||||
// For each iteration, we need to determine whether to use the relaxed tolerances.
|
||||
// To disable the usage of relaxed tolerances, you can set the relaxed tolerances
|
||||
// equal to the strict tolerances.
|
||||
//
|
||||
// If min_strict_mb_iter_ = -1 (default) we use a relaxed tolerance for the mass
|
||||
// balance only on the last local iteration. For non-negative values we use the
|
||||
// relaxed tolerance after the given number of iterations.
|
||||
const int maxLocalIter = model_.param().max_local_solve_iterations_;
|
||||
|
||||
const bool relax_final_iteration_mb =
|
||||
model_.param().min_strict_mb_iter_ < 0 && iteration == maxLocalIter;
|
||||
|
||||
const bool relax_iter_mb =
|
||||
model_.param().min_strict_mb_iter_ >= 0 &&
|
||||
iteration >= model_.param().min_strict_mb_iter_;
|
||||
|
||||
const bool use_relaxed_mb = relax_final_iteration_mb || relax_iter_mb;
|
||||
|
||||
const Scalar tol_mb = model_.param().local_tolerance_scaling_mb_
|
||||
* (use_relaxed_mb ? model_.param().tolerance_mb_relaxed_ : model_.param().tolerance_mb_);
|
||||
|
||||
// If min_strict_cnv_iter_ = -1 (default) we use a relaxed tolerance for the CNV
|
||||
// only on the last local iteration. For non-negative values we use the relaxed
|
||||
// tolerance after the given number of iterations. We also use relaxed tolerances
|
||||
// for cells with total pore-volume less than relaxed_max_pv_fraction_.
|
||||
const bool relax_final_iteration_cnv =
|
||||
model_.param().min_strict_cnv_iter_ < 0 && iteration == maxLocalIter;
|
||||
|
||||
const bool relax_iter_cnv =
|
||||
model_.param().min_strict_cnv_iter_ >= 0 &&
|
||||
iteration >= model_.param().min_strict_cnv_iter_;
|
||||
|
||||
const bool relax_pv_fraction_cnv =
|
||||
cnvErrorPvFraction < model_.param().relaxed_max_pv_fraction_;
|
||||
|
||||
const bool use_relaxed_cnv = relax_final_iteration_cnv ||
|
||||
relax_iter_cnv ||
|
||||
relax_pv_fraction_cnv;
|
||||
|
||||
// Tighter bound for local convergence should increase the
|
||||
// likelyhood of: local convergence => global convergence
|
||||
const Scalar tol_cnv = model_.param().local_tolerance_scaling_cnv_
|
||||
* (use_relaxed_cnv ? model_.param().tolerance_cnv_relaxed_
|
||||
: model_.param().tolerance_cnv_);
|
||||
|
||||
const bool use_relaxed_mb = iteration >= model_.param().min_strict_mb_iter_;
|
||||
const Scalar tol_mb = model_.param().local_tolerance_scaling_mb_
|
||||
* (use_relaxed_mb ? model_.param().tolerance_mb_relaxed_ : model_.param().tolerance_mb_);
|
||||
// TODO: Energy-specific tolerances are not currently applied. A closer analysis
|
||||
// is needed to determine if everything in NLDD is compatible with thermal simulations.
|
||||
|
||||
// Finish computation
|
||||
std::vector<Scalar> CNV(numComp);
|
||||
|
||||
Reference in new issue
Block a user