mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-12-26 17:20:59 -06:00
BlackoilModelBase: added parameter singlePrecision and print residual to large at right
place.
This commit is contained in:
parent
915177979c
commit
4111797822
@ -250,6 +250,8 @@ namespace detail {
|
||||
const bool converged = asImpl().getConvergence(dt, iteration);
|
||||
const bool must_solve = (iteration < nonlinear_solver.minIter()) || (!converged);
|
||||
if (must_solve) {
|
||||
residual_.singlePrecision = false ;
|
||||
|
||||
// Compute the nonlinear update.
|
||||
V dx = asImpl().solveJacobianSystem();
|
||||
|
||||
@ -2705,22 +2707,6 @@ namespace detail {
|
||||
// Residual in Pascal can have high values and still be ok.
|
||||
const double maxWellResidualAllowed = 1000.0 * maxResidualAllowed();
|
||||
|
||||
for (int idx = 0; idx < nm; ++idx) {
|
||||
if (std::isnan(mass_balance_residual[idx])
|
||||
|| std::isnan(CNV[idx])
|
||||
|| (idx < np && std::isnan(well_flux_residual[idx]))) {
|
||||
OPM_THROW(Opm::NumericalProblem, "NaN residual for phase " << materialName(idx));
|
||||
}
|
||||
if (mass_balance_residual[idx] > maxResidualAllowed()
|
||||
|| CNV[idx] > maxResidualAllowed()
|
||||
|| (idx < np && well_flux_residual[idx] > maxResidualAllowed())) {
|
||||
OPM_THROW(Opm::NumericalProblem, "Too large residual for phase " << materialName(idx));
|
||||
}
|
||||
}
|
||||
if (std::isnan(residualWell) || residualWell > maxWellResidualAllowed) {
|
||||
OPM_THROW(Opm::NumericalProblem, "NaN or too large residual for well control equation");
|
||||
}
|
||||
|
||||
if ( terminal_output_ )
|
||||
{
|
||||
// Only rank 0 does print to std::cout
|
||||
@ -2755,6 +2741,23 @@ namespace detail {
|
||||
std::cout.precision(oprec);
|
||||
std::cout.flags(oflags);
|
||||
}
|
||||
|
||||
for (int idx = 0; idx < nm; ++idx) {
|
||||
if (std::isnan(mass_balance_residual[idx])
|
||||
|| std::isnan(CNV[idx])
|
||||
|| (idx < np && std::isnan(well_flux_residual[idx]))) {
|
||||
OPM_THROW(Opm::NumericalProblem, "NaN residual for phase " << materialName(idx));
|
||||
}
|
||||
if (mass_balance_residual[idx] > maxResidualAllowed()
|
||||
|| CNV[idx] > maxResidualAllowed()
|
||||
|| (idx < np && well_flux_residual[idx] > maxResidualAllowed())) {
|
||||
OPM_THROW(Opm::NumericalProblem, "Too large residual for phase " << materialName(idx));
|
||||
}
|
||||
}
|
||||
if (std::isnan(residualWell) || residualWell > maxWellResidualAllowed) {
|
||||
OPM_THROW(Opm::NumericalProblem, "NaN or too large residual for well control equation");
|
||||
}
|
||||
|
||||
return converged;
|
||||
}
|
||||
|
||||
|
@ -65,6 +65,8 @@ namespace Opm
|
||||
|
||||
std::vector<double> matbalscale;
|
||||
|
||||
bool singlePrecision ;
|
||||
|
||||
/// The size of the non-linear system.
|
||||
int sizeNonLinear() const;
|
||||
};
|
||||
|
@ -214,7 +214,7 @@ namespace Opm
|
||||
template <class Operator>
|
||||
std::unique_ptr<SeqPreconditioner> constructPrecond(Operator& opA, const Dune::Amg::SequentialInformation&) const
|
||||
{
|
||||
const double relax = 1.0;
|
||||
const double relax = 0.9;
|
||||
std::unique_ptr<SeqPreconditioner> precond(new SeqPreconditioner(opA.getmat(), relax));
|
||||
return precond;
|
||||
}
|
||||
@ -227,7 +227,7 @@ namespace Opm
|
||||
constructPrecond(Operator& opA, const Comm& comm) const
|
||||
{
|
||||
typedef std::unique_ptr<ParPreconditioner> Pointer;
|
||||
const double relax = 1.0;
|
||||
const double relax = 0.9;
|
||||
return Pointer(new ParPreconditioner(opA.getmat(), comm, relax));
|
||||
}
|
||||
#endif
|
||||
@ -542,7 +542,7 @@ namespace Opm
|
||||
// get np and call appropriate template method
|
||||
const int np = residual.material_balance_eq.size();
|
||||
#if ! HAVE_UMFPACK
|
||||
const bool singlePrecision = false ; // residual.singlePrecision ;
|
||||
const bool singlePrecision = residual.singlePrecision ;
|
||||
const NewtonIterationBlackoilInterface& newtonIncrement = singlePrecision ?
|
||||
detail::NewtonIncrement< maxNumberEquations_, float > :: get( newtonIncrementSinglePrecision_, parameters_, parallelInformation_, np ) :
|
||||
detail::NewtonIncrement< maxNumberEquations_, double > :: get( newtonIncrementDoublePrecision_, parameters_, parallelInformation_, np );
|
||||
|
@ -189,7 +189,8 @@ namespace {
|
||||
, residual_ ( { std::vector<ADB>(fluid.numPhases() + 1, ADB::null()),
|
||||
ADB::null(),
|
||||
ADB::null(),
|
||||
{ 1.1169, 1.0031, 0.0031, 1.0 }} ) // default scaling
|
||||
{ 1.1169, 1.0031, 0.0031, 1.0 },
|
||||
false } ) // default scaling
|
||||
{
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user