mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Finish the first stablizeNewton().
This commit is contained in:
@@ -122,6 +122,10 @@ namespace Opm {
|
|||||||
Oil = BlackoilPropsAdInterface::Oil ,
|
Oil = BlackoilPropsAdInterface::Oil ,
|
||||||
Gas = BlackoilPropsAdInterface::Gas };
|
Gas = BlackoilPropsAdInterface::Gas };
|
||||||
|
|
||||||
|
// the Newton relaxation type
|
||||||
|
enum RelaxType { DAMPEN, SOR };
|
||||||
|
|
||||||
|
|
||||||
// Member data
|
// Member data
|
||||||
const Grid& grid_;
|
const Grid& grid_;
|
||||||
const BlackoilPropsAdInterface& fluid_;
|
const BlackoilPropsAdInterface& fluid_;
|
||||||
@@ -272,7 +276,8 @@ namespace Opm {
|
|||||||
const int it, const double relaxRelTol,
|
const int it, const double relaxRelTol,
|
||||||
bool &oscillate, bool &stagnate ) const;
|
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
|
} // namespace Opm
|
||||||
|
|||||||
@@ -1708,10 +1708,27 @@ namespace {
|
|||||||
template<class T>
|
template<class T>
|
||||||
void
|
void
|
||||||
FullyImplicitBlackoilSolver<T>::stablizeNewton( V &dx, const bool &oscillate, const bool &stagnate,
|
FullyImplicitBlackoilSolver<T>::stablizeNewton( V &dx, const bool &oscillate, const bool &stagnate,
|
||||||
const int omega ) const {
|
const double omega, const RelaxType relax_type) const {
|
||||||
const V dxold = dx;
|
|
||||||
|
|
||||||
|
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>
|
template<class T>
|
||||||
|
|||||||
Reference in New Issue
Block a user