opm-simulators
Loading...
Searching...
No Matches
Opm::ISTLSolverGpuBridge< TypeTag > Class Template Reference

This class solves the fully implicit black-oil system by solving the reduced system (after eliminating well variables) as a block-structured matrix (one block for all cell variables) for a fixed number of cell variables np . More...

#include <ISTLSolverGpuBridge.hpp>

Inheritance diagram for Opm::ISTLSolverGpuBridge< TypeTag >:
Opm::ISTLSolver< TypeTag > Opm::AbstractISTLSolver< TypeTag >

Public Types

using AssembledLinearOperatorType = Dune::AssembledLinearOperator< Matrix, Vector, Vector >
Public Types inherited from Opm::ISTLSolver< TypeTag >
using AssembledLinearOperatorType = Dune::AssembledLinearOperator< Matrix, Vector, Vector >
Public Types inherited from Opm::AbstractISTLSolver< TypeTag >
using CommunicationType = Dune::Communication<int>
using SparseMatrixAdapter = GetPropType<TypeTag, Properties::SparseMatrixAdapter>
using Vector = GetPropType<TypeTag, Properties::GlobalEqVector>
using Matrix = typename SparseMatrixAdapter::IstlMatrix

Public Member Functions

 ISTLSolverGpuBridge (const Simulator &simulator, const FlowLinearSolverParameters &parameters)
 Construct a system solver.
 ISTLSolverGpuBridge (const Simulator &simulator)
 Construct a system solver.
void initializeGpu ()
void prepare (const Matrix &M, Vector &b)
 Prepare the solver with the given matrix and right-hand side vector.
void setResidual (Vector &)
 Set the residual vector.
void getResidual (Vector &b) const
 Get the residual vector.
void setMatrix (const SparseMatrixAdapter &)
 Set the matrix for the solver.
bool solve (Vector &x)
 Solve the system of equations Ax = b.
Public Member Functions inherited from Opm::ISTLSolver< TypeTag >
 ISTLSolver (const Simulator &simulator, const FlowLinearSolverParameters &parameters, bool forceSerial=false)
 Construct a system solver.
 ISTLSolver (const Simulator &simulator)
 Construct a system solver.
void initialize ()
void eraseMatrix () override
 Signals that the memory for the matrix internally in the solver could be erased.
void setActiveSolver (const int num) override
 Set the active solver by its index.
int numAvailableSolvers () const override
 Get the number of available solvers.
void initPrepare (const Matrix &M, Vector &b)
void prepare (const SparseMatrixAdapter &M, Vector &b) override
 Prepare the solver with the given sparse matrix and right-hand side vector.
int getSolveCount () const override
 Get the count of how many times the solver has been called.
void resetSolveCount ()
int iterations () const override
 Solve the system of linear equations Ax = b, with A being the combined derivative matrix of the residual and b being the residual itself.
const std::any & parallelInformation () const
const CommunicationType * comm () const override
 Get the communication object used by the solver.
void setDomainIndex (const int index)
bool isNlddLocalSolver () const

Protected Types

using ParentType = ISTLSolver<TypeTag>
using GridView = GetPropType<TypeTag, Properties::GridView>
using Scalar = GetPropType<TypeTag, Properties::Scalar>
using SparseMatrixAdapter = GetPropType<TypeTag, Properties::SparseMatrixAdapter>
using Vector = GetPropType<TypeTag, Properties::GlobalEqVector>
using Indices = GetPropType<TypeTag, Properties::Indices>
using WellModel = GetPropType<TypeTag, Properties::WellModel>
using Simulator = GetPropType<TypeTag, Properties::Simulator>
using Matrix = typename SparseMatrixAdapter::IstlMatrix
using ThreadManager = GetPropType<TypeTag, Properties::ThreadManager>
using ElementContext = GetPropType<TypeTag, Properties::ElementContext>
using AbstractSolverType = Dune::InverseOperator<Vector, Vector>
using AbstractOperatorType = Dune::AssembledLinearOperator<Matrix, Vector, Vector>
using AbstractPreconditionerType = Dune::PreconditionerWithUpdate<Vector, Vector>
using WellModelOperator = WellModelAsLinearOperator<WellModel, Vector, Vector>
using ElementMapper = GetPropType<TypeTag, Properties::ElementMapper>
using CommunicationType = Dune::Communication<int>
Protected Types inherited from Opm::ISTLSolver< TypeTag >
enum  { enablePolymerMolarWeight = getPropValue<TypeTag, Properties::EnablePolymerMW>() }
using GridView = GetPropType<TypeTag, Properties::GridView>
using Scalar = GetPropType<TypeTag, Properties::Scalar>
using SparseMatrixAdapter = GetPropType<TypeTag, Properties::SparseMatrixAdapter>
using Vector = GetPropType<TypeTag, Properties::GlobalEqVector>
using Indices = GetPropType<TypeTag, Properties::Indices>
using WellModel = GetPropType<TypeTag, Properties::WellModel>
using Simulator = GetPropType<TypeTag, Properties::Simulator>
using Matrix = typename SparseMatrixAdapter::IstlMatrix
using ThreadManager = GetPropType<TypeTag, Properties::ThreadManager>
using ElementContext = GetPropType<TypeTag, Properties::ElementContext>
using AbstractSolverType = Dune::InverseOperator<Vector, Vector>
using AbstractOperatorType = Dune::AssembledLinearOperator<Matrix, Vector, Vector>
using AbstractPreconditionerType = Dune::PreconditionerWithUpdate<Vector, Vector>
using WellModelOperator = WellModelAsLinearOperator<WellModel, Vector, Vector>
using ElementMapper = GetPropType<TypeTag, Properties::ElementMapper>
using ElementChunksType = ElementChunks<GridView, Dune::Partitions::All>
using CommunicationType = Dune::Communication<int>

Protected Attributes

std::unique_ptr< detail::GpuSolverInfo< Matrix, Vector > > gpuBridge_
Protected Attributes inherited from Opm::ISTLSolver< TypeTag >
const Simulator & simulator_
int iterations_
int solveCount_
std::any parallelInformation_
Matrix * matrix_
Vector * rhs_
int activeSolverNum_ = 0
std::vector< detail::FlexibleSolverInfo< Matrix, Vector, CommunicationType > > flexibleSolver_
std::vector< int > overlapRows_
std::vector< int > interiorRows_
int domainIndex_ = -1
bool useWellConn_
std::vector< FlowLinearSolverParametersparameters_
bool forceSerial_ = false
std::vector< PropertyTreeprm_
std::shared_ptr< CommunicationType > comm_
std::unique_ptr< ElementChunksType > element_chunks_

Static Protected Attributes

static constexpr std::size_t pressureIndex = GetPropType<TypeTag, Properties::Indices>::pressureSwitchIdx
Static Protected Attributes inherited from Opm::ISTLSolver< TypeTag >
static constexpr std::size_t pressureIndex = GetPropType<TypeTag, Properties::Indices>::pressureSwitchIdx
static constexpr bool isIncompatibleWithCprw = enablePolymerMolarWeight

Additional Inherited Members

Static Public Member Functions inherited from Opm::ISTLSolver< TypeTag >
static void registerParameters ()
Protected Member Functions inherited from Opm::ISTLSolver< TypeTag >
bool checkConvergence (const Dune::InverseOperatorResult &result) const
bool isParallel () const
void prepareFlexibleSolver ()
bool shouldCreateSolver () const
 Return true if we should (re)create the whole solver, instead of just calling update() on the preconditioner.
std::function< Vector()> getWeightsCalculator (const PropertyTree &prm, const Matrix &matrix, std::size_t pressIndex) const
Matrix & getMatrix ()
const Matrix & getMatrix () const
Static Protected Member Functions inherited from Opm::AbstractISTLSolver< TypeTag >
static bool checkConvergence (const Dune::InverseOperatorResult &result, const FlowLinearSolverParameters &parameters)
 Check the convergence of the linear solver.

Detailed Description

template<class TypeTag>
class Opm::ISTLSolverGpuBridge< TypeTag >

This class solves the fully implicit black-oil system by solving the reduced system (after eliminating well variables) as a block-structured matrix (one block for all cell variables) for a fixed number of cell variables np .

Constructor & Destructor Documentation

◆ ISTLSolverGpuBridge() [1/2]

template<class TypeTag>
Opm::ISTLSolverGpuBridge< TypeTag >::ISTLSolverGpuBridge ( const Simulator & simulator,
const FlowLinearSolverParameters & parameters )
inline

Construct a system solver.

Parameters
[in]simulatorThe opm-models simulator object
[in]parametersExplicit parameters for solver setup, do not read them from command line parameters.

◆ ISTLSolverGpuBridge() [2/2]

template<class TypeTag>
Opm::ISTLSolverGpuBridge< TypeTag >::ISTLSolverGpuBridge ( const Simulator & simulator)
inlineexplicit

Construct a system solver.

Parameters
[in]simulatorThe opm-models simulator object

Member Function Documentation

◆ getResidual()

template<class TypeTag>
void Opm::ISTLSolverGpuBridge< TypeTag >::getResidual ( Vector & b) const
inlinevirtual

Get the residual vector.

This method retrieves the current residual vector from the solver.

Parameters
bThe vector to store the residual.

Reimplemented from Opm::ISTLSolver< TypeTag >.

◆ prepare()

template<class TypeTag>
void Opm::ISTLSolverGpuBridge< TypeTag >::prepare ( const Matrix & M,
Vector & b )
inlinevirtual

Prepare the solver with the given matrix and right-hand side vector.

This method initializes the solver with the provided matrix and vector, preparing it for solving the system of equations.

Parameters
MThe matrix representing the system of equations.
bThe right-hand side vector.

Reimplemented from Opm::ISTLSolver< TypeTag >.

◆ setMatrix()

template<class TypeTag>
void Opm::ISTLSolverGpuBridge< TypeTag >::setMatrix ( const SparseMatrixAdapter & M)
inlinevirtual

Set the matrix for the solver.

This method sets the matrix that the solver will use to solve the system of equations.

Parameters
MThe sparse matrix adapter containing the matrix data.
Note
This method should be called in addition to prepare() and setResidual() before calling solve().

Reimplemented from Opm::ISTLSolver< TypeTag >.

◆ setResidual()

template<class TypeTag>
void Opm::ISTLSolverGpuBridge< TypeTag >::setResidual ( Vector & b)
inlinevirtual

Set the residual vector.

This method sets the residual vector for the solver.

Parameters
bThe residual vector to set.
Note
This method should be called in addition to prepare() and setMatrix() before calling solve().

Reimplemented from Opm::ISTLSolver< TypeTag >.

◆ solve()

template<class TypeTag>
bool Opm::ISTLSolverGpuBridge< TypeTag >::solve ( Vector & x)
inlinevirtual

Solve the system of equations Ax = b.

This method solves the linear system represented by the matrix A and the right-hand side vector b, storing the solution in vector x.

Parameters
xThe vector to store the solution.
Returns
true if the solver converged, false otherwise.

Before this function is called, the following function calls should have been made:

Reimplemented from Opm::ISTLSolver< TypeTag >.


The documentation for this class was generated from the following files: