mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
BlackoilModelBase: added parameter singlePrecision and print residual to large at right
place.
This commit is contained in:
@@ -250,6 +250,8 @@ namespace detail {
|
|||||||
const bool converged = asImpl().getConvergence(dt, iteration);
|
const bool converged = asImpl().getConvergence(dt, iteration);
|
||||||
const bool must_solve = (iteration < nonlinear_solver.minIter()) || (!converged);
|
const bool must_solve = (iteration < nonlinear_solver.minIter()) || (!converged);
|
||||||
if (must_solve) {
|
if (must_solve) {
|
||||||
|
residual_.singlePrecision = false ;
|
||||||
|
|
||||||
// Compute the nonlinear update.
|
// Compute the nonlinear update.
|
||||||
V dx = asImpl().solveJacobianSystem();
|
V dx = asImpl().solveJacobianSystem();
|
||||||
|
|
||||||
@@ -2705,22 +2707,6 @@ namespace detail {
|
|||||||
// Residual in Pascal can have high values and still be ok.
|
// Residual in Pascal can have high values and still be ok.
|
||||||
const double maxWellResidualAllowed = 1000.0 * maxResidualAllowed();
|
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_ )
|
if ( terminal_output_ )
|
||||||
{
|
{
|
||||||
// Only rank 0 does print to std::cout
|
// Only rank 0 does print to std::cout
|
||||||
@@ -2755,6 +2741,23 @@ namespace detail {
|
|||||||
std::cout.precision(oprec);
|
std::cout.precision(oprec);
|
||||||
std::cout.flags(oflags);
|
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;
|
return converged;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -65,6 +65,8 @@ namespace Opm
|
|||||||
|
|
||||||
std::vector<double> matbalscale;
|
std::vector<double> matbalscale;
|
||||||
|
|
||||||
|
bool singlePrecision ;
|
||||||
|
|
||||||
/// The size of the non-linear system.
|
/// The size of the non-linear system.
|
||||||
int sizeNonLinear() const;
|
int sizeNonLinear() const;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -214,7 +214,7 @@ namespace Opm
|
|||||||
template <class Operator>
|
template <class Operator>
|
||||||
std::unique_ptr<SeqPreconditioner> constructPrecond(Operator& opA, const Dune::Amg::SequentialInformation&) const
|
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));
|
std::unique_ptr<SeqPreconditioner> precond(new SeqPreconditioner(opA.getmat(), relax));
|
||||||
return precond;
|
return precond;
|
||||||
}
|
}
|
||||||
@@ -227,7 +227,7 @@ namespace Opm
|
|||||||
constructPrecond(Operator& opA, const Comm& comm) const
|
constructPrecond(Operator& opA, const Comm& comm) const
|
||||||
{
|
{
|
||||||
typedef std::unique_ptr<ParPreconditioner> Pointer;
|
typedef std::unique_ptr<ParPreconditioner> Pointer;
|
||||||
const double relax = 1.0;
|
const double relax = 0.9;
|
||||||
return Pointer(new ParPreconditioner(opA.getmat(), comm, relax));
|
return Pointer(new ParPreconditioner(opA.getmat(), comm, relax));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -542,7 +542,7 @@ namespace Opm
|
|||||||
// get np and call appropriate template method
|
// get np and call appropriate template method
|
||||||
const int np = residual.material_balance_eq.size();
|
const int np = residual.material_balance_eq.size();
|
||||||
#if ! HAVE_UMFPACK
|
#if ! HAVE_UMFPACK
|
||||||
const bool singlePrecision = false ; // residual.singlePrecision ;
|
const bool singlePrecision = residual.singlePrecision ;
|
||||||
const NewtonIterationBlackoilInterface& newtonIncrement = singlePrecision ?
|
const NewtonIterationBlackoilInterface& newtonIncrement = singlePrecision ?
|
||||||
detail::NewtonIncrement< maxNumberEquations_, float > :: get( newtonIncrementSinglePrecision_, parameters_, parallelInformation_, np ) :
|
detail::NewtonIncrement< maxNumberEquations_, float > :: get( newtonIncrementSinglePrecision_, parameters_, parallelInformation_, np ) :
|
||||||
detail::NewtonIncrement< maxNumberEquations_, double > :: get( newtonIncrementDoublePrecision_, 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()),
|
, residual_ ( { std::vector<ADB>(fluid.numPhases() + 1, ADB::null()),
|
||||||
ADB::null(),
|
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
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user