Adding user-specifying max iteration.

This commit is contained in:
Kai Bao 2014-05-22 22:09:54 +02:00
parent 3678464d51
commit 6e6339d8c3
2 changed files with 5 additions and 2 deletions

View File

@ -143,6 +143,7 @@ namespace Opm {
double dp_max_rel_;
double ds_max_;
double drs_max_rel_;
int max_iter_;
std::vector<ReservoirResidualQuant> rq_;
std::vector<PhasePresence> phaseCondition_;
@ -275,6 +276,7 @@ namespace Opm {
double dpMaxRel() const { return dp_max_rel_; }
double dsMax() const { return ds_max_; }
double drsMaxRel() const { return drs_max_rel_; }
double maxIter() const { return max_iter_; }
};
} // namespace Opm

View File

@ -235,6 +235,7 @@ namespace {
, dp_max_rel_ ( 1.0e9 )
, ds_max_ ( 0.2 )
, drs_max_rel_ ( 1.0e9 )
, max_iter_ (15)
, rq_ (fluid.numPhases())
, phaseCondition_(AutoDiffGrid::numCells(grid))
, residual_ ( { std::vector<ADB>(fluid.numPhases(), ADB::null()),
@ -244,6 +245,7 @@ namespace {
dp_max_rel_ = param.getDefault("dp_max_rel", dp_max_rel_);
ds_max_ = param.getDefault("ds_max", ds_max_);
drs_max_rel_ = param.getDefault("drs_max_rel", drs_max_rel_);
max_iter_ = param.getDefault("max_iter", max_iter_);
}
@ -263,7 +265,6 @@ namespace {
computeWellConnectionPressures(state, xw);
}
const int maxit = 15;
assemble(pvdt, x, xw);
@ -278,7 +279,7 @@ namespace {
<< std::setw(9) << it << std::setprecision(9)
<< std::setw(18) << r0 << std::endl;
while ((!converged) && (it < maxit)) {
while ((!converged) && (it < maxIter())) {
const V dx = solveJacobianSystem();
updateState(dx, x, xw);