mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-11-25 18:50:19 -06:00
Finish the first stablizeNewton().
This commit is contained in:
parent
ab8636b57d
commit
5b6c325a32
@ -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
|
||||
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user