mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Add the residuals() function.
This commit is contained in:
parent
a969025c5e
commit
341f727467
@ -248,7 +248,6 @@ namespace {
|
|||||||
BlackoilState& x ,
|
BlackoilState& x ,
|
||||||
WellStateFullyImplicitBlackoil& xw)
|
WellStateFullyImplicitBlackoil& xw)
|
||||||
{
|
{
|
||||||
std::vector <std::vector<double>> residual_history;
|
|
||||||
const V pvdt = geo_.poreVolume() / dt;
|
const V pvdt = geo_.poreVolume() / dt;
|
||||||
|
|
||||||
classifyCondition(x);
|
classifyCondition(x);
|
||||||
@ -259,6 +258,7 @@ namespace {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const int maxit = 15;
|
const int maxit = 15;
|
||||||
|
std::vector <std::vector<double>> residual_history;
|
||||||
|
|
||||||
assemble(pvdt, x, xw);
|
assemble(pvdt, x, xw);
|
||||||
|
|
||||||
@ -1593,6 +1593,34 @@ namespace {
|
|||||||
FullyImplicitBlackoilSolver<T>::residuals() const
|
FullyImplicitBlackoilSolver<T>::residuals() const
|
||||||
{
|
{
|
||||||
std::vector<double> residual;
|
std::vector<double> residual;
|
||||||
|
|
||||||
|
std::vector<ADB>::const_iterator massBalanceIt = residual_.material_balance_eq.begin();
|
||||||
|
const std::vector<ADB>::const_iterator endMassBalanceIt = residual_.material_balance_eq.end();
|
||||||
|
|
||||||
|
for (; massBalanceIt != endMassBalanceIt; ++massBalanceIt) {
|
||||||
|
const double massBalanceResid = (*massBalanceIt).value().matrix().template lpNorm<Eigen::Infinity>();
|
||||||
|
if (!std::isfinite(massBalanceResid)) {
|
||||||
|
OPM_THROW(Opm::NumericalProblem,
|
||||||
|
"Encountered a non-finite residual");
|
||||||
|
}
|
||||||
|
residual.push_back(massBalanceResid);
|
||||||
|
}
|
||||||
|
|
||||||
|
// the following residuals are not used in the oscillation detection now
|
||||||
|
const double wellFluxResid = residual_.well_flux_eq.value().matrix().template lpNorm<Eigen::Infinity>();
|
||||||
|
if (!std::isfinite(wellFluxResid)) {
|
||||||
|
OPM_THROW(Opm::NumericalProblem,
|
||||||
|
"Encountered a non-finite residual");
|
||||||
|
}
|
||||||
|
residual.push_back(wellFluxResid);
|
||||||
|
|
||||||
|
const double wellResid = residual_.well_eq.value().matrix().template lpNorm<Eigen::Infinity>();
|
||||||
|
if (!std::isfinite(wellResid)) {
|
||||||
|
OPM_THROW(Opm::NumericalProblem,
|
||||||
|
"Encountered a non-finite residual");
|
||||||
|
}
|
||||||
|
residual.push_back(wellResid);
|
||||||
|
|
||||||
return residual;
|
return residual;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user