Finish the first stablizeNewton().

This commit is contained in:
Kai Bao 2014-05-19 18:41:38 +02:00
parent ab8636b57d
commit 5b6c325a32
2 changed files with 25 additions and 3 deletions

View File

@ -122,6 +122,10 @@ namespace Opm {
Oil = BlackoilPropsAdInterface::Oil ,
Gas = BlackoilPropsAdInterface::Gas };
// the Newton relaxation type
enum RelaxType { DAMPEN, SOR };
// Member data
const Grid& grid_;
const BlackoilPropsAdInterface& fluid_;
@ -272,7 +276,8 @@ namespace Opm {
const int it, const double relaxRelTol,
bool &oscillate, bool &stagnate ) const;
void stablizeNewton( V &dx, const bool &oscillate, const bool &stagnate, const int omega ) const;
void stablizeNewton(V &dx, const bool &oscillate, const bool &stagnate, const double omega,
const RelaxType relax_type) const;
};
} // namespace Opm

View File

@ -1708,10 +1708,27 @@ namespace {
template<class T>
void
FullyImplicitBlackoilSolver<T>::stablizeNewton( V &dx, const bool &oscillate, const bool &stagnate,
const int omega ) const {
const V dxold = dx;
const double omega, const RelaxType relax_type) const {
switch (relax_type) {
case DAMPEN:
if (omega == 1.) {
return;
}
dx = dx*omega;
return;
case SOR:
if (omega == 1.) {
return;
}
const V dxold = dx;
dx = dx*omega + (1.-omega)*dxold;
return;
default:
OPM_THROW(std::runtime_error, "Can only handle DAMPEN and SOR relaxation type.");
}
return;
}
template<class T>