IncompTpfa now takes a linear solver as a constructor argument.
This commit is contained in:
@@ -38,6 +38,7 @@
|
|||||||
#endif // HAVE_CONFIG_H
|
#endif // HAVE_CONFIG_H
|
||||||
|
|
||||||
#include <opm/core/linalg/sparse_sys.h>
|
#include <opm/core/linalg/sparse_sys.h>
|
||||||
|
#include <opm/core/linalg/LinearSolverUmfpack.hpp>
|
||||||
|
|
||||||
#include <opm/core/pressure/IncompTpfa.hpp>
|
#include <opm/core/pressure/IncompTpfa.hpp>
|
||||||
|
|
||||||
@@ -423,7 +424,11 @@ main(int argc, char** argv)
|
|||||||
|
|
||||||
// Solvers init.
|
// Solvers init.
|
||||||
// Pressure solver.
|
// 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.
|
// Non-reordering solver.
|
||||||
TransportModel model (fluid, *grid->c_grid(), porevol, 0, guess_old_solution);
|
TransportModel model (fluid, *grid->c_grid(), porevol, 0, guess_old_solution);
|
||||||
TransportSolver tsolver(model);
|
TransportSolver tsolver(model);
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
#include <opm/core/pressure/tpfa/ifs_tpfa.h>
|
#include <opm/core/pressure/tpfa/ifs_tpfa.h>
|
||||||
#include <opm/core/pressure/tpfa/trans_tpfa.h>
|
#include <opm/core/pressure/tpfa/trans_tpfa.h>
|
||||||
#include <opm/core/pressure/mimetic/mimetic.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>
|
#include <opm/core/utility/ErrorMacros.hpp>
|
||||||
|
|
||||||
namespace Opm
|
namespace Opm
|
||||||
@@ -38,8 +38,10 @@ namespace Opm
|
|||||||
/// have D elements.
|
/// have D elements.
|
||||||
IncompTpfa::IncompTpfa(const UnstructuredGrid& g,
|
IncompTpfa::IncompTpfa(const UnstructuredGrid& g,
|
||||||
const double* permeability,
|
const double* permeability,
|
||||||
const double* gravity)
|
const double* gravity,
|
||||||
|
const LinearSolverInterface& linsolver)
|
||||||
: grid_(g),
|
: grid_(g),
|
||||||
|
linsolver_(linsolver),
|
||||||
htrans_(g.cell_facepos[ g.number_of_cells ]),
|
htrans_(g.cell_facepos[ g.number_of_cells ]),
|
||||||
trans_ (g.number_of_faces)
|
trans_ (g.number_of_faces)
|
||||||
{
|
{
|
||||||
@@ -105,8 +107,7 @@ namespace Opm
|
|||||||
|
|
||||||
ifs_tpfa_assemble(gg, &trans_[0], &src[0], &gpress_omegaweighted_[0], h_);
|
ifs_tpfa_assemble(gg, &trans_[0], &src[0], &gpress_omegaweighted_[0], h_);
|
||||||
|
|
||||||
LinearSolverUmfpack linsolve;
|
linsolver_.solve(h_->A, h_->b, h_->x);
|
||||||
linsolve.solve(h_->A, h_->b, h_->x);
|
|
||||||
|
|
||||||
pressure.resize(grid_.number_of_cells);
|
pressure.resize(grid_.number_of_cells);
|
||||||
faceflux.resize(grid_.number_of_faces);
|
faceflux.resize(grid_.number_of_faces);
|
||||||
|
|||||||
@@ -30,6 +30,8 @@ struct ifs_tpfa_data;
|
|||||||
namespace Opm
|
namespace Opm
|
||||||
{
|
{
|
||||||
|
|
||||||
|
class LinearSolverInterface;
|
||||||
|
|
||||||
/// Encapsulating a tpfa pressure solver for the incompressible case.
|
/// Encapsulating a tpfa pressure solver for the incompressible case.
|
||||||
/// Supports gravity and simple sources as driving forces.
|
/// Supports gravity and simple sources as driving forces.
|
||||||
/// Below we use the shortcuts D for the number of dimensions, N
|
/// Below we use the shortcuts D for the number of dimensions, N
|
||||||
@@ -47,7 +49,8 @@ namespace Opm
|
|||||||
/// have D elements.
|
/// have D elements.
|
||||||
IncompTpfa(const UnstructuredGrid& g,
|
IncompTpfa(const UnstructuredGrid& g,
|
||||||
const double* permeability,
|
const double* permeability,
|
||||||
const double* gravity);
|
const double* gravity,
|
||||||
|
const LinearSolverInterface& linsolver);
|
||||||
|
|
||||||
/// Destructor.
|
/// Destructor.
|
||||||
~IncompTpfa();
|
~IncompTpfa();
|
||||||
@@ -71,6 +74,7 @@ namespace Opm
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
const UnstructuredGrid& grid_;
|
const UnstructuredGrid& grid_;
|
||||||
|
const LinearSolverInterface& linsolver_;
|
||||||
::std::vector<double> htrans_;
|
::std::vector<double> htrans_;
|
||||||
::std::vector<double> trans_ ;
|
::std::vector<double> trans_ ;
|
||||||
::std::vector<double> gpress_;
|
::std::vector<double> gpress_;
|
||||||
|
|||||||
Reference in New Issue
Block a user