IncompTpfa now takes a linear solver as a constructor argument.

This commit is contained in:
Atgeirr Flø Rasmussen 2012-02-21 21:45:04 +01:00
parent d9ed7cadad
commit 8d74253c64
3 changed files with 17 additions and 7 deletions

View File

@ -38,6 +38,7 @@
#endif // HAVE_CONFIG_H
#include <opm/core/linalg/sparse_sys.h>
#include <opm/core/linalg/LinearSolverUmfpack.hpp>
#include <opm/core/pressure/IncompTpfa.hpp>
@ -52,7 +53,7 @@
#include <opm/core/fluid/SimpleFluid2p.hpp>
#include <opm/core/fluid/IncompPropertiesBasic.hpp>
#include <opm/core/fluid/IncompPropertiesFromDeck.hpp>
#include <opm/core/transport/transport_source.h>
#include <opm/core/transport/CSRMatrixUmfpackSolver.hpp>
#include <opm/core/transport/NormSupport.hpp>
@ -423,7 +424,11 @@ main(int argc, char** argv)
// Solvers init.
// Pressure solver.
Opm::IncompTpfa psolver(*grid->c_grid(), props->permeability(), use_gravity ? gravity : 0);
Opm::LinearSolverUmfpack linsolver;
Opm::IncompTpfa psolver(*grid->c_grid(),
props->permeability(),
use_gravity ? gravity : 0,
linsolver);
// Non-reordering solver.
TransportModel model (fluid, *grid->c_grid(), porevol, 0, guess_old_solution);
TransportSolver tsolver(model);

View File

@ -21,7 +21,7 @@
#include <opm/core/pressure/tpfa/ifs_tpfa.h>
#include <opm/core/pressure/tpfa/trans_tpfa.h>
#include <opm/core/pressure/mimetic/mimetic.h>
#include <opm/core/linalg/LinearSolverUmfpack.hpp>
#include <opm/core/linalg/LinearSolverInterface.hpp>
#include <opm/core/utility/ErrorMacros.hpp>
namespace Opm
@ -38,8 +38,10 @@ namespace Opm
/// have D elements.
IncompTpfa::IncompTpfa(const UnstructuredGrid& g,
const double* permeability,
const double* gravity)
const double* gravity,
const LinearSolverInterface& linsolver)
: grid_(g),
linsolver_(linsolver),
htrans_(g.cell_facepos[ g.number_of_cells ]),
trans_ (g.number_of_faces)
{
@ -105,8 +107,7 @@ namespace Opm
ifs_tpfa_assemble(gg, &trans_[0], &src[0], &gpress_omegaweighted_[0], h_);
LinearSolverUmfpack linsolve;
linsolve.solve(h_->A, h_->b, h_->x);
linsolver_.solve(h_->A, h_->b, h_->x);
pressure.resize(grid_.number_of_cells);
faceflux.resize(grid_.number_of_faces);

View File

@ -30,6 +30,8 @@ struct ifs_tpfa_data;
namespace Opm
{
class LinearSolverInterface;
/// Encapsulating a tpfa pressure solver for the incompressible case.
/// Supports gravity and simple sources as driving forces.
/// Below we use the shortcuts D for the number of dimensions, N
@ -47,7 +49,8 @@ namespace Opm
/// have D elements.
IncompTpfa(const UnstructuredGrid& g,
const double* permeability,
const double* gravity);
const double* gravity,
const LinearSolverInterface& linsolver);
/// Destructor.
~IncompTpfa();
@ -71,6 +74,7 @@ namespace Opm
private:
const UnstructuredGrid& grid_;
const LinearSolverInterface& linsolver_;
::std::vector<double> htrans_;
::std::vector<double> trans_ ;
::std::vector<double> gpress_;