make the ebos-Newton specific parameters setable from the command line

also, tweak them a bit: increase the sum tolerance before scaling to
1e-3 and reduce the default number of strict iterations to 4.
This commit is contained in:
Andreas Lauser 2019-01-07 13:26:10 +01:00
parent c08f0008ad
commit ec391f529d
2 changed files with 48 additions and 13 deletions

View File

@ -35,7 +35,10 @@
BEGIN_PROPERTIES
NEW_PROP_TAG(NewtonSumTolerance);
NEW_PROP_TAG(EclNewtonSumTolerance);
NEW_PROP_TAG(EclNewtonStrictIterations);
NEW_PROP_TAG(EclNewtonRelaxedVolumeFraction);
NEW_PROP_TAG(EclNewtonRelaxedTolerance);
END_PROPERTIES
@ -75,8 +78,12 @@ public:
EclNewtonMethod(Simulator& simulator) : ParentType(simulator)
{
errorPvFraction_ = 1.0;
sumTolerance_ = EWOMS_GET_PARAM(TypeTag, Scalar, NewtonSumTolerance);
relaxedTolerance_ = 1e9;
relaxedMaxPvFraction_ = EWOMS_GET_PARAM(TypeTag, Scalar, EclNewtonRelaxedVolumeFraction);
sumTolerance_ = 0.0; // this gets determined in the error calculation proceedure
relaxedTolerance_ = EWOMS_GET_PARAM(TypeTag, Scalar, EclNewtonRelaxedTolerance);
numStrictIterations_ = EWOMS_GET_PARAM(TypeTag, int, EclNewtonStrictIterations);
}
/*!
@ -86,10 +93,21 @@ public:
{
ParentType::registerParameters();
EWOMS_REGISTER_PARAM(TypeTag, Scalar, NewtonSumTolerance,
EWOMS_REGISTER_PARAM(TypeTag, Scalar, EclNewtonSumTolerance,
"The maximum error tolerated by the Newton"
"method for considering a solution to be "
"converged");
EWOMS_REGISTER_PARAM(TypeTag, int, EclNewtonStrictIterations,
"The number of Newton iterations where the"
" volumetric error is considered.");
EWOMS_REGISTER_PARAM(TypeTag, Scalar, EclNewtonRelaxedVolumeFraction,
"The fraction of the pore volume of the reservoir "
"where the volumetric error may be voilated during "
"strict Newton iterations.");
EWOMS_REGISTER_PARAM(TypeTag, Scalar, EclNewtonRelaxedTolerance,
"The maximum error which the volumetric residual "
"may exhibit if it is in a 'relaxed' "
"region during a strict iteration.");
}
/*!
@ -98,9 +116,9 @@ public:
*/
bool converged() const
{
if (errorPvFraction_ < 0.03)
if (errorPvFraction_ < relaxedMaxPvFraction_)
return (this->error_ < relaxedTolerance_ && errorSum_ < sumTolerance_) ;
else if (this->numIterations() > 8)
else if (this->numIterations() > numStrictIterations_)
return (this->error_ < relaxedTolerance_ && errorSum_ < sumTolerance_) ;
return this->error_ <= this->tolerance() && errorSum_ <= sumTolerance_;
@ -180,7 +198,7 @@ public:
// reservoir that exhibits 1 m^3 of pore volume. A reservoir with a total pore
// volume of 10^3 m^3 will tolerate 10 times as much.
sumTolerance_ =
EWOMS_GET_PARAM(TypeTag, Scalar, NewtonSumTolerance)
EWOMS_GET_PARAM(TypeTag, Scalar, EclNewtonSumTolerance)
* std::cbrt(sumPv);
// make sure that the error never grows beyond the maximum
@ -203,8 +221,11 @@ private:
Scalar errorSum_;
Scalar relaxedTolerance_;
Scalar relaxedMaxPvFraction_;
Scalar sumTolerance_;
int numStrictIterations_;
};
} // namespace Ewoms

View File

@ -236,14 +236,28 @@ SET_SCALAR_PROP(EclBaseProblem, EndTime, 1e100);
// not millions of trillions of years, that is...)
SET_SCALAR_PROP(EclBaseProblem, InitialTimeStepSize, 1e100);
// set the tolerated amount of "incorrect" mass to ~1e-4 kg of oil per time step for a
// reservoir that exhibits a pore volume of 1 m^3. larger reservoirs will tolerate larger
// residuals.
SET_SCALAR_PROP(EclBaseProblem, NewtonSumTolerance, 1e-4);
// the default for the volumetric error for oil per second is 10^-2 kg/(m^3 * s).
// the default for the allowed volumetric error for oil per second
SET_SCALAR_PROP(EclBaseProblem, NewtonRawTolerance, 1e-2);
// the tolerated amount of "incorrect" amount of oil per time step for the complete
// reservoi. this is scaled by the pore volume of the reservoir, i.e., larger reservoirs
// will tolerate larger residuals.
SET_SCALAR_PROP(EclBaseProblem, EclNewtonSumTolerance, 1e-3);
// set number of Newton iterations where the volumetric residual is considered for
// convergence
SET_INT_PROP(EclBaseProblem, EclNewtonStrictIterations, 4);
// set fraction of the pore volume where the volumetric residual may be violated during
// strict Newton iterations
SET_SCALAR_PROP(EclBaseProblem, EclNewtonRelaxedVolumeFraction, 0.03);
// the maximum volumetric error of a cell in the relaxed region
SET_SCALAR_PROP(EclBaseProblem, EclNewtonRelaxedTolerance, 1e9);
// Ignore the maximum error mass for early termination of the newton method.
SET_SCALAR_PROP(EclBaseProblem, NewtonMaxError, 10e9);
// set the maximum number of Newton iterations to 14 because the likelyhood that a time
// step succeeds at more than 14 Newton iteration is rather small
SET_INT_PROP(EclBaseProblem, NewtonMaxIterations, 14);