NewtonBOCPR: allow to use either GMRes or BiCGStab. This will be revised once the new

linear solver interface is in place.
This commit is contained in:
Robert Kloefkorn 2015-03-31 11:04:31 +02:00
parent 05bee313d3
commit 20316e0a8e

View File

@ -1,5 +1,6 @@
/* /*
Copyright 2014 SINTEF ICT, Applied Mathematics. Copyright 2014 SINTEF ICT, Applied Mathematics.
Copyright 2015 IRIS AS
This file is part of the Open Porous Media project (OPM). This file is part of the Open Porous Media project (OPM).
@ -94,19 +95,29 @@ namespace Opm
parallelInformation.copyOwnerToAll(istlb, istlb); parallelInformation.copyOwnerToAll(istlb, istlb);
Preconditioner precond(opA.getmat(), istlAe, cpr_relax_, cpr_ilu_n_, cpr_use_amg_, cpr_use_bicgstab_, parallelInformation); Preconditioner precond(opA.getmat(), istlAe, cpr_relax_, cpr_ilu_n_, cpr_use_amg_, cpr_use_bicgstab_, parallelInformation);
// TODO: Revise when linear solvers interface opm-core is done
// Construct linear solver. // Construct linear solver.
// GMRes solver
if ( newton_use_gmres_ ) {
Dune::RestartedGMResSolver<Vector> linsolve(opA, *sp, precond, Dune::RestartedGMResSolver<Vector> linsolve(opA, *sp, precond,
linear_solver_reduction_, linear_solver_restart_, linear_solver_maxiter_, linear_solver_verbosity_); linear_solver_reduction_, linear_solver_restart_, linear_solver_maxiter_, linear_solver_verbosity_);
// Solve system. // Solve system.
linsolve.apply(x, istlb, result); linsolve.apply(x, istlb, result);
} }
else { // BiCGstab solver
Dune::BiCGSTABSolver<Vector> linsolve(opA, *sp, precond,
linear_solver_reduction_, linear_solver_maxiter_, linear_solver_verbosity_);
// Solve system.
linsolve.apply(x, istlb, result);
}
}
mutable int iterations_; mutable int iterations_;
double cpr_relax_; double cpr_relax_;
unsigned int cpr_ilu_n_; unsigned int cpr_ilu_n_;
bool cpr_use_amg_; bool cpr_use_amg_;
bool cpr_use_bicgstab_; bool cpr_use_bicgstab_;
bool newton_use_gmres_;
boost::any parallelInformation_; boost::any parallelInformation_;
double linear_solver_reduction_; double linear_solver_reduction_;