Advanced Multi-Physics (AMP)
On-Line Documentation
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Member Functions | Private Attributes | List of all members
AMP::Solver::GMRESSolver< T > Class Template Referenceabstract

#include <GMRESSolver.h>

Inheritance diagram for AMP::Solver::GMRESSolver< T >:
Inheritance graph
[legend]

Public Types

typedef std::shared_ptr< AMP::Solver::SolverStrategyshared_ptr
 
enum class  SolverStatus {
  ConvergedOnAbsTol , ConvergedOnRelTol , ConvergedUserCondition , MaxIterations ,
  DivergedLineSearch , DivergedStepSize , DivergedFunctionCount , DivergedOnNan ,
  DivergedNestedSolver , DivergedOther
}
 

Public Member Functions

void apply (AMP::LinearAlgebra::Vector::const_shared_ptr f, AMP::LinearAlgebra::Vector::shared_ptr u) override
 
virtual void apply (std::shared_ptr< const AMP::LinearAlgebra::Vector > f, std::shared_ptr< AMP::LinearAlgebra::Vector > u)=0
 
AMP::Scalar getAbsoluteTolerance () const
 
bool getConverged (void) const
 
SolverStatus getConvergenceStatus (void) const
 
std::string getConvergenceStatusString (void) const
 
int getDebugPrintInfoLevel (void)
 
AMP::Utilities::ExecutionSpace getExecutionSpace () const
 
std::shared_ptr< AMP::LinearAlgebra::VectorgetFunctionScaling ()
 
virtual AMP::Scalar getInitialResidual (void) const
 
virtual const std::vector< int > & getIterationHistory (void)
 
virtual int getIterations (void) const
 
int getMaxIterations (void) const
 
virtual std::shared_ptr< SolverStrategygetNestedSolver (void)
 
virtual std::shared_ptr< AMP::Operator::OperatorgetOperator (void)
 
AMP::Scalar getRelativeTolerance () const
 
virtual AMP::Scalar getResidualNorm (void) const
 
std::shared_ptr< AMP::LinearAlgebra::VectorgetSolutionScaling ()
 
int getTotalNumberOfIterations (void)
 
 GMRESSolver ()
 
 GMRESSolver (std::shared_ptr< SolverStrategyParameters > params)
 
void initialize (std::shared_ptr< const SolverStrategyParameters > params) override
 
virtual void print (std::ostream &)
 
virtual void printConvergenceStatus (SolverStrategy::SolverStatus, std::ostream &=AMP::pout) const
 
virtual void printStatistics (std::ostream &os=AMP::pout)
 
void registerOperator (std::shared_ptr< AMP::Operator::Operator > op) override
 
virtual void registerWriter (std::shared_ptr< AMP::IO::Writer > writer)
 Registers a writer with the solver.
 
virtual void reset (std::shared_ptr< SolverStrategyParameters > parameters)
 
virtual void resetOperator (std::shared_ptr< const AMP::Operator::OperatorParameters > parameters)
 
virtual void residual (std::shared_ptr< const AMP::LinearAlgebra::Vector > f, std::shared_ptr< const AMP::LinearAlgebra::Vector > u, std::shared_ptr< AMP::LinearAlgebra::Vector > r)
 
bool restarted ()
 
virtual void setAbsoluteTolerance (AMP::Scalar abs_tol)
 
void setComponentScalings (std::shared_ptr< AMP::LinearAlgebra::Vector > s, std::shared_ptr< AMP::LinearAlgebra::Vector > f)
 for multiphysics problems it may be necessary to scale the solution
 
virtual void setDebugPrintInfoLevel (int print_level)
 
void setExecutionSpace (AMP::Utilities::ExecutionSpace space)
 
virtual void setInitialGuess (std::shared_ptr< AMP::LinearAlgebra::Vector > initialGuess)
 
void setIsNestedSolver (bool is_nested)
 Tell a solver that it is nested inside some outer solver.
 
virtual void setMaxIterations (const int max_iterations)
 
virtual void setNestedSolver (std::shared_ptr< SolverStrategy > solver)
 
virtual void setRelativeTolerance (AMP::Scalar rel_tol)
 
virtual void setZeroInitialGuess (bool use_zero_guess)
 
std::string type () const override
 Return the name of the solver.
 
virtual ~GMRESSolver ()=default
 

Static Public Member Functions

static std::unique_ptr< SolverStrategycreateSolver (std::shared_ptr< SolverStrategyParameters > params)
 
static std::string statusToString (SolverStatus status)
 

Protected Member Functions

void addCorrection (const int nr, std::shared_ptr< AMP::LinearAlgebra::Vector > z, std::shared_ptr< AMP::LinearAlgebra::Vector > z1, std::shared_ptr< AMP::LinearAlgebra::Vector > u)
 
void applyGivensRotation (const int i, const int k)
 apply the i-th Givens rotation to the k-th column of the Hessenberg matrix
 
void backwardSolve (const int nr)
 
std::vector< TbasisInnerProducts (const int k, std::shared_ptr< AMP::LinearAlgebra::Vector > v)
 return the inner products of v against the first k basis vectors
 
void cgs (const int k, std::shared_ptr< AMP::LinearAlgebra::Vector > v)
 orthogonalize the vector against the existing vectors in the basis
 
void cgs2 (const int k, std::shared_ptr< AMP::LinearAlgebra::Vector > v)
 orthogonalize the vector against the existing vectors in the basis
 
virtual bool checkStoppingCriteria (AMP::Scalar res_norm, bool check_iters=true)
 
void computeGivensRotation (const int k)
 
void computeInitialResidual (bool use_zero_guess, std::shared_ptr< const AMP::LinearAlgebra::Vector > f, std::shared_ptr< AMP::LinearAlgebra::Vector > u, std::shared_ptr< AMP::LinearAlgebra::Vector > tmp, std::shared_ptr< AMP::LinearAlgebra::Vector > res)
 
void getBaseFromInput (std::shared_ptr< AMP::Database > db)
 
void getFromInput (std::shared_ptr< AMP::Database > db)
 
virtual void orthogonalize (const int k, std::shared_ptr< AMP::LinearAlgebra::Vector > v)
 orthogonalize the vector against the existing vectors in the basis
 

Protected Attributes

bool d_bComputeResidual = false
 
bool d_bIsNestedSolver = false
 
bool d_bUseZeroInitialGuess = true
 
SolverStatus d_ConvergenceStatus = SolverStatus::DivergedOther
 
AMP::Scalar d_dAbsoluteTolerance = 1.0e-14
 
std::shared_ptr< AMP::Databased_db = nullptr
 
AMP::Scalar d_dInitialResidual
 
AMP::Scalar d_dRelativeTolerance = 1.0e-09
 
AMP::Scalar d_dResidualNorm
 
AMP::Utilities::ExecutionSpace d_exec_space = AMP::Utilities::ExecutionSpace::unspecified
 execution space for the solver
 
std::shared_ptr< AMP::Databased_global_db = nullptr
 
int d_iDebugPrintInfoLevel = 0
 
int d_iMaxIterations = 0
 
int d_iNumberIterations = 0
 
int d_iObjectId
 
std::vector< intd_iterationHistory
 keeps track of iteration statistics over solver lifetime
 
AMP::Utilities::MemoryType d_memory_location = AMP::Utilities::MemoryType::none
 memory storage address space
 
std::shared_ptr< AMP::LinearAlgebra::Vectord_pFunctionScaling
 
std::shared_ptr< AMP::Solver::SolverStrategyd_pNestedSolver = nullptr
 nested solver used by this solver
 
std::shared_ptr< AMP::Operator::Operatord_pOperator = nullptr
 
std::shared_ptr< AMP::LinearAlgebra::Vectord_pSolutionScaling
 
std::string d_sName
 
std::shared_ptr< AMP::IO::Writerd_writer = nullptr
 

Static Protected Attributes

static int d_iInstanceId
 

Private Member Functions

void allocateBasis (std::shared_ptr< const AMP::LinearAlgebra::Vector > u=nullptr)
 

Private Attributes

bool d_bFlexibleGMRES = false
 
bool d_bRestart = false
 
bool d_bUsesPreconditioner = false
 boolean, for whether a preconditioner present or not
 
std::vector< Td_dcos
 stores the cosine and sine values required for Givens rotations
 
AMP::Array< Td_dHessenberg
 stores the upper Hessenberg matrix formed during the GMRES iteration
 
std::vector< Td_dsin
 
std::vector< Td_dw
 stores the right hand side for the Hessenberg least squares system
 
std::vector< Td_dy
 stores the solution for the least squares system
 
int d_iBasisAllocSize = 4
 
int d_iMaxKrylovDimension = 50
 whether to restart
 
std::string d_preconditioner_side = "right"
 
int d_restarts
 size of the allocation increases for the vector basis
 
std::string d_sOrthogonalizationMethod = "MGS"
 logs number of times the solver is restarted
 
std::vector< std::shared_ptr< AMP::LinearAlgebra::Vector > > d_vBasis
 
std::shared_ptr< AMP::LinearAlgebra::Vectord_z
 stores the vectors needed for right and left preconditioning
 
std::shared_ptr< AMP::LinearAlgebra::Vectord_z1
 
std::vector< std::shared_ptr< AMP::LinearAlgebra::Vector > > d_zBasis
 

Detailed Description

template<typename T = double>
class AMP::Solver::GMRESSolver< T >

The GMRESSolver class implements the GMRES method for non-symmetric linear systems introduced by Saad and Schultz Y. Saad and M.H. Schultz "GMRES: A generalized minimal residual algorithm for solving nonsymmetric linear systems", SIAM J. Sci. Stat. Comput., 7:856-869, 1986. doi:10.1137/0907058 If a preconditioner is provided right preconditioning is done

Definition at line 22 of file GMRESSolver.h.

Member Typedef Documentation

◆ shared_ptr

Definition at line 30 of file SolverStrategy.h.

Member Enumeration Documentation

◆ SolverStatus

Enumerator
ConvergedOnAbsTol 
ConvergedOnRelTol 
ConvergedUserCondition 
MaxIterations 
DivergedLineSearch 
DivergedStepSize 
DivergedFunctionCount 
DivergedOnNan 
DivergedNestedSolver 
DivergedOther 

Definition at line 62 of file SolverStrategy.h.

Constructor & Destructor Documentation

◆ GMRESSolver() [1/2]

template<typename T = double>
AMP::Solver::GMRESSolver< T >::GMRESSolver ( )

default constructor

◆ GMRESSolver() [2/2]

template<typename T = double>
AMP::Solver::GMRESSolver< T >::GMRESSolver ( std::shared_ptr< SolverStrategyParameters params)
explicit

main constructor

Parameters
[in]paramsThe parameters object contains a database objects containing the following fields:
  1. type: double, name : relative_tolerance, default value of $1.0e-9$, relative tolerance for GMRES solver acceptable values (non-negative real values)
  2. type: bool, name : uses_preconditioner, default value false acceptable values (false, true), side effect: if false sets string pc_type to "none"
  3. type: string, name : pc_side, default value "RIGHT", acceptable values ("RIGHT", "LEFT" ) active only when uses_preconditioner set to true

◆ ~GMRESSolver()

template<typename T = double>
virtual AMP::Solver::GMRESSolver< T >::~GMRESSolver ( )
virtualdefault

Default destructor

Member Function Documentation

◆ addCorrection()

template<typename T = double>
void AMP::Solver::GMRESSolver< T >::addCorrection ( const int  nr,
std::shared_ptr< AMP::LinearAlgebra::Vector z,
std::shared_ptr< AMP::LinearAlgebra::Vector z1,
std::shared_ptr< AMP::LinearAlgebra::Vector u 
)
protected

update current approximation with the correction.

Parameters
[in]nrdimension of least squares system.
[in]zshared pointer to temporary vector used if there is right preconditioning.
[in]z1shared pointer to temporary vector used if there is right preconditioning.
[out]ushared pointer to approximate computed solution to correct.

◆ allocateBasis()

template<typename T = double>
void AMP::Solver::GMRESSolver< T >::allocateBasis ( std::shared_ptr< const AMP::LinearAlgebra::Vector u = nullptr)
private

Allocate the vector basis in d_iBasisAllocSize chunks (d_vBasis & d_zBasis)

◆ apply() [1/2]

Solve the system Au=f. The implementation is based on the paper "Implementations of the GMRES method", H. Walker Computer Physics Communications 53 (1989) 311-320

Parameters
[in]f: const shared pointer to right hand side vector
[out]u: shared pointer to approximate computed solution

◆ apply() [2/2]

virtual void AMP::Solver::SolverStrategy::apply ( std::shared_ptr< const AMP::LinearAlgebra::Vector f,
std::shared_ptr< AMP::LinearAlgebra::Vector u 
)
pure virtualinherited

◆ applyGivensRotation()

template<typename T = double>
void AMP::Solver::GMRESSolver< T >::applyGivensRotation ( const int  i,
const int  k 
)
protected

apply the i-th Givens rotation to the k-th column of the Hessenberg matrix

◆ backwardSolve()

template<typename T = double>
void AMP::Solver::GMRESSolver< T >::backwardSolve ( const int  nr)
protected

perform a back solve for the upper triangular system generated for the least squares minimization problem

Parameters
[in]nrdimension of least squares system.

◆ basisInnerProducts()

template<typename T = double>
std::vector< T > AMP::Solver::GMRESSolver< T >::basisInnerProducts ( const int  k,
std::shared_ptr< AMP::LinearAlgebra::Vector v 
)
protected

return the inner products of v against the first k basis vectors

◆ cgs()

template<typename T = double>
void AMP::Solver::GMRESSolver< T >::cgs ( const int  k,
std::shared_ptr< AMP::LinearAlgebra::Vector v 
)
protected

orthogonalize the vector against the existing vectors in the basis

◆ cgs2()

template<typename T = double>
void AMP::Solver::GMRESSolver< T >::cgs2 ( const int  k,
std::shared_ptr< AMP::LinearAlgebra::Vector v 
)
protected

orthogonalize the vector against the existing vectors in the basis

◆ checkStoppingCriteria()

virtual bool AMP::Solver::SolverStrategy::checkStoppingCriteria ( AMP::Scalar  res_norm,
bool  check_iters = true 
)
protectedvirtualinherited

◆ computeGivensRotation()

template<typename T = double>
void AMP::Solver::GMRESSolver< T >::computeGivensRotation ( const int  k)
protected

compute the Givens rotation required to zero out the sbub-diagonal element on the k-th column of the Hessenberg matrix and add it to the stored rotations Note that zero based indexing is being used

◆ computeInitialResidual()

template<typename T = double>
void AMP::Solver::GMRESSolver< T >::computeInitialResidual ( bool  use_zero_guess,
std::shared_ptr< const AMP::LinearAlgebra::Vector f,
std::shared_ptr< AMP::LinearAlgebra::Vector u,
std::shared_ptr< AMP::LinearAlgebra::Vector tmp,
std::shared_ptr< AMP::LinearAlgebra::Vector res 
)
protected

Compute initial residual for a GMRES cycle.

Parameters
[in]use_zero_guessspecify if zero should be used for the initial guess.
[in]fright hand side for residual.
[in,out]uinitial guess if use_zero_guess is false (set to zero otherwise).
[in]tmptemporary vector needed if preconditiong is used.
[out]resresidual vector.

◆ createSolver()

template<typename T = double>
static std::unique_ptr< SolverStrategy > AMP::Solver::GMRESSolver< T >::createSolver ( std::shared_ptr< SolverStrategyParameters params)
inlinestatic

static create routine that is used by SolverFactory

Parameters
[in]paramsThe parameters object contains a database objects with the fields listed for the constructor above

Definition at line 55 of file GMRESSolver.h.

◆ getAbsoluteTolerance()

AMP::Scalar AMP::Solver::SolverStrategy::getAbsoluteTolerance ( ) const
inlineinherited

◆ getBaseFromInput()

void AMP::Solver::SolverStrategy::getBaseFromInput ( std::shared_ptr< AMP::Database db)
protectedinherited

◆ getConverged()

bool AMP::Solver::SolverStrategy::getConverged ( void  ) const
inlineinherited

◆ getConvergenceStatus()

SolverStatus AMP::Solver::SolverStrategy::getConvergenceStatus ( void  ) const
inlineinherited

◆ getConvergenceStatusString()

std::string AMP::Solver::SolverStrategy::getConvergenceStatusString ( void  ) const
inlineinherited

◆ getDebugPrintInfoLevel()

int AMP::Solver::SolverStrategy::getDebugPrintInfoLevel ( void  )
inlineinherited

Get level of diagnostic information printed during iterations.

Definition at line 137 of file SolverStrategy.h.

References AMP::Solver::SolverStrategy::d_iDebugPrintInfoLevel.

◆ getExecutionSpace()

AMP::Utilities::ExecutionSpace AMP::Solver::SolverStrategy::getExecutionSpace ( ) const
inlineinherited

Definition at line 269 of file SolverStrategy.h.

References AMP::Solver::SolverStrategy::d_exec_space.

◆ getFromInput()

template<typename T = double>
void AMP::Solver::GMRESSolver< T >::getFromInput ( std::shared_ptr< AMP::Database db)
protected

◆ getFunctionScaling()

std::shared_ptr< AMP::LinearAlgebra::Vector > AMP::Solver::SolverStrategy::getFunctionScaling ( )
inlineinherited

Definition at line 267 of file SolverStrategy.h.

References AMP::Solver::SolverStrategy::d_pFunctionScaling.

◆ getInitialResidual()

virtual AMP::Scalar AMP::Solver::SolverStrategy::getInitialResidual ( void  ) const
inlinevirtualinherited

Definition at line 241 of file SolverStrategy.h.

References AMP::Solver::SolverStrategy::d_dInitialResidual.

◆ getIterationHistory()

virtual const std::vector< int > & AMP::Solver::SolverStrategy::getIterationHistory ( void  )
inlinevirtualinherited

Definition at line 243 of file SolverStrategy.h.

References AMP::Solver::SolverStrategy::d_iterationHistory.

◆ getIterations()

virtual int AMP::Solver::SolverStrategy::getIterations ( void  ) const
inlinevirtualinherited

Return the number of iterations taken by the solver to converge.

Definition at line 142 of file SolverStrategy.h.

References AMP::Solver::SolverStrategy::d_iNumberIterations.

◆ getMaxIterations()

int AMP::Solver::SolverStrategy::getMaxIterations ( void  ) const
inlineinherited

Definition at line 218 of file SolverStrategy.h.

References AMP::Solver::SolverStrategy::d_iMaxIterations.

◆ getNestedSolver()

virtual std::shared_ptr< SolverStrategy > AMP::Solver::SolverStrategy::getNestedSolver ( void  )
inlinevirtualinherited

Return a nested solver (eg preconditioner) if it exists. By default return a nullptr

Reimplemented in AMP::Solver::PetscSNESSolver.

Definition at line 172 of file SolverStrategy.h.

References AMP::Solver::SolverStrategy::d_pNestedSolver.

◆ getOperator()

virtual std::shared_ptr< AMP::Operator::Operator > AMP::Solver::SolverStrategy::getOperator ( void  )
virtualinherited

Return a shared pointer to the operator registered with the solver.

◆ getRelativeTolerance()

AMP::Scalar AMP::Solver::SolverStrategy::getRelativeTolerance ( ) const
inlineinherited

◆ getResidualNorm()

virtual AMP::Scalar AMP::Solver::SolverStrategy::getResidualNorm ( void  ) const
inlinevirtualinherited

Definition at line 239 of file SolverStrategy.h.

References AMP::Solver::SolverStrategy::d_dResidualNorm.

◆ getSolutionScaling()

std::shared_ptr< AMP::LinearAlgebra::Vector > AMP::Solver::SolverStrategy::getSolutionScaling ( )
inlineinherited

Definition at line 266 of file SolverStrategy.h.

References AMP::Solver::SolverStrategy::d_pSolutionScaling.

◆ getTotalNumberOfIterations()

int AMP::Solver::SolverStrategy::getTotalNumberOfIterations ( void  )
inherited

◆ initialize()

template<typename T = double>
void AMP::Solver::GMRESSolver< T >::initialize ( std::shared_ptr< const SolverStrategyParameters params)
overridevirtual

Initialize the GMRESSolver. Should not be necessary for the user to call in general.

Parameters
params

Reimplemented from AMP::Solver::SolverStrategy.

◆ orthogonalize()

template<typename T = double>
virtual void AMP::Solver::GMRESSolver< T >::orthogonalize ( const int  k,
std::shared_ptr< AMP::LinearAlgebra::Vector v 
)
protectedvirtual

orthogonalize the vector against the existing vectors in the basis

◆ print()

virtual void AMP::Solver::SolverStrategy::print ( std::ostream &  )
inlinevirtualinherited

Definition at line 237 of file SolverStrategy.h.

◆ printConvergenceStatus()

virtual void AMP::Solver::SolverStrategy::printConvergenceStatus ( SolverStrategy::SolverStatus  ,
std::ostream &  = AMP::pout 
) const
inlinevirtualinherited

Reimplemented in AMP::Solver::PetscSNESSolver.

Definition at line 251 of file SolverStrategy.h.

◆ printStatistics()

virtual void AMP::Solver::SolverStrategy::printStatistics ( std::ostream &  os = AMP::pout)
inlinevirtualinherited

Reimplemented in AMP::Solver::NonlinearKrylovAccelerator< T >.

Definition at line 220 of file SolverStrategy.h.

◆ registerOperator()

template<typename T = double>
void AMP::Solver::GMRESSolver< T >::registerOperator ( std::shared_ptr< AMP::Operator::Operator op)
overridevirtual

Register the operator that the solver will use during solves

Parameters
[in]opshared pointer to operator $A()$ for equation \(A(u) = f\)

Reimplemented from AMP::Solver::SolverStrategy.

◆ registerWriter()

virtual void AMP::Solver::SolverStrategy::registerWriter ( std::shared_ptr< AMP::IO::Writer writer)
inlinevirtualinherited

Registers a writer with the solver.

This function will register a writer with the solver. The solver may then register any vector components it "owns" with the writer.

Parameters
writerThe writer to register

Definition at line 186 of file SolverStrategy.h.

References AMP::Solver::SolverStrategy::d_writer.

◆ reset()

virtual void AMP::Solver::SolverStrategy::reset ( std::shared_ptr< SolverStrategyParameters parameters)
virtualinherited

◆ resetOperator()

virtual void AMP::Solver::SolverStrategy::resetOperator ( std::shared_ptr< const AMP::Operator::OperatorParameters parameters)
virtualinherited

Resets the operator registered with the solver with new parameters if necessary

Parameters
parametersOperatorParameters object that is NULL by default

Reimplemented in AMP::Solver::PetscKrylovSolver, AMP::Solver::BandedSolver, AMP::Solver::ColumnSolver, AMP::Solver::HypreSolver, AMP::Solver::CoupledFlow1DSolver, AMP::Solver::Flow1DSolver, AMP::Solver::PelletStackMechanicsSolver, AMP::Solver::TrilinosMLSolver, and AMP::Solver::TrilinosMueLuSolver.

◆ residual()

virtual void AMP::Solver::SolverStrategy::residual ( std::shared_ptr< const AMP::LinearAlgebra::Vector f,
std::shared_ptr< const AMP::LinearAlgebra::Vector u,
std::shared_ptr< AMP::LinearAlgebra::Vector r 
)
virtualinherited

◆ restarted()

template<typename T = double>
bool AMP::Solver::GMRESSolver< T >::restarted ( )
inline

Checks if the restart is allowed

Definition at line 93 of file GMRESSolver.h.

References AMP::Solver::GMRESSolver< T >::d_bRestart.

◆ setAbsoluteTolerance()

virtual void AMP::Solver::SolverStrategy::setAbsoluteTolerance ( AMP::Scalar  abs_tol)
inlinevirtualinherited

◆ setComponentScalings()

void AMP::Solver::SolverStrategy::setComponentScalings ( std::shared_ptr< AMP::LinearAlgebra::Vector s,
std::shared_ptr< AMP::LinearAlgebra::Vector f 
)
inlineinherited

for multiphysics problems it may be necessary to scale the solution

Definition at line 259 of file SolverStrategy.h.

References AMP::Solver::SolverStrategy::d_pFunctionScaling, and AMP::Solver::SolverStrategy::d_pSolutionScaling.

◆ setDebugPrintInfoLevel()

virtual void AMP::Solver::SolverStrategy::setDebugPrintInfoLevel ( int  print_level)
inlinevirtualinherited

Specify level of diagnostic information printed during iterations.

Parameters
[in]print_levelinteger level value with permissible values 0 and higher. Setting to zero should provide minimial debugging information with higher values resulting in increasingly verbose information being printed out.

Definition at line 132 of file SolverStrategy.h.

References AMP::Solver::SolverStrategy::d_iDebugPrintInfoLevel.

◆ setExecutionSpace()

void AMP::Solver::SolverStrategy::setExecutionSpace ( AMP::Utilities::ExecutionSpace  space)
inlineinherited

Definition at line 270 of file SolverStrategy.h.

References AMP::Solver::SolverStrategy::d_exec_space.

◆ setInitialGuess()

virtual void AMP::Solver::SolverStrategy::setInitialGuess ( std::shared_ptr< AMP::LinearAlgebra::Vector initialGuess)
virtualinherited

Provide the initial guess for the solver. This is a pure virtual function that the derived classes need to provide an implementation of.

Parameters
[in]initialGuessshared pointer to the initial guess vector.

Reimplemented in AMP::Solver::ColumnSolver, AMP::Solver::CoupledFlow1DSolver, AMP::Solver::Flow1DSolver, AMP::Solver::PetscSNESSolver, and AMP::Solver::TrilinosNOXSolver.

◆ setIsNestedSolver()

void AMP::Solver::SolverStrategy::setIsNestedSolver ( bool  is_nested)
inlineinherited

Tell a solver that it is nested inside some outer solver.

Definition at line 166 of file SolverStrategy.h.

References AMP::Solver::SolverStrategy::d_bIsNestedSolver.

◆ setMaxIterations()

virtual void AMP::Solver::SolverStrategy::setMaxIterations ( const int  max_iterations)
inlinevirtualinherited

Definition at line 216 of file SolverStrategy.h.

References AMP::Solver::SolverStrategy::d_iMaxIterations.

◆ setNestedSolver()

virtual void AMP::Solver::SolverStrategy::setNestedSolver ( std::shared_ptr< SolverStrategy solver)
inlinevirtualinherited

Set a nested solver, eg, Krylov for Newton, preconditioner for Krylov etc. Null op in base class

Definition at line 159 of file SolverStrategy.h.

References AMP::Solver::SolverStrategy::d_pNestedSolver.

◆ setRelativeTolerance()

virtual void AMP::Solver::SolverStrategy::setRelativeTolerance ( AMP::Scalar  rel_tol)
inlinevirtualinherited

◆ setZeroInitialGuess()

virtual void AMP::Solver::SolverStrategy::setZeroInitialGuess ( bool  use_zero_guess)
inlinevirtualinherited

Tells the solver to use an initial guess of zero and not try to copy an initial guess into the solution vector

Parameters
[in]use_zero_guessboolean to specify whether zero initial guess should be used or not.

Reimplemented in AMP::Solver::PetscKrylovSolver.

Definition at line 150 of file SolverStrategy.h.

References AMP::Solver::SolverStrategy::d_bUseZeroInitialGuess.

◆ statusToString()

static std::string AMP::Solver::SolverStrategy::statusToString ( SolverStatus  status)
inlinestaticinherited

◆ type()

template<typename T = double>
std::string AMP::Solver::GMRESSolver< T >::type ( ) const
inlineoverridevirtual

Return the name of the solver.

Implements AMP::Solver::SolverStrategy.

Definition at line 65 of file GMRESSolver.h.

Member Data Documentation

◆ d_bComputeResidual

bool AMP::Solver::SolverStrategy::d_bComputeResidual = false
protectedinherited

Definition at line 295 of file SolverStrategy.h.

◆ d_bFlexibleGMRES

template<typename T = double>
bool AMP::Solver::GMRESSolver< T >::d_bFlexibleGMRES = false
private

boolean, for whether the flexible version of GMRES is used note that it makes sense to use it only if right preconditioning is on

Definition at line 188 of file GMRESSolver.h.

◆ d_bIsNestedSolver

bool AMP::Solver::SolverStrategy::d_bIsNestedSolver = false
protectedinherited

Definition at line 294 of file SolverStrategy.h.

Referenced by AMP::Solver::SolverStrategy::setIsNestedSolver().

◆ d_bRestart

template<typename T = double>
bool AMP::Solver::GMRESSolver< T >::d_bRestart = false
private

Definition at line 161 of file GMRESSolver.h.

Referenced by AMP::Solver::GMRESSolver< T >::restarted().

◆ d_bUsesPreconditioner

template<typename T = double>
bool AMP::Solver::GMRESSolver< T >::d_bUsesPreconditioner = false
private

boolean, for whether a preconditioner present or not

Definition at line 184 of file GMRESSolver.h.

◆ d_bUseZeroInitialGuess

bool AMP::Solver::SolverStrategy::d_bUseZeroInitialGuess = true
protectedinherited

◆ d_ConvergenceStatus

SolverStatus AMP::Solver::SolverStrategy::d_ConvergenceStatus = SolverStatus::DivergedOther
protectedinherited

◆ d_dAbsoluteTolerance

AMP::Scalar AMP::Solver::SolverStrategy::d_dAbsoluteTolerance = 1.0e-14
protectedinherited

◆ d_db

std::shared_ptr<AMP::Database> AMP::Solver::SolverStrategy::d_db = nullptr
protectedinherited

Definition at line 304 of file SolverStrategy.h.

◆ d_dcos

template<typename T = double>
std::vector<T> AMP::Solver::GMRESSolver< T >::d_dcos
private

stores the cosine and sine values required for Givens rotations

Definition at line 195 of file GMRESSolver.h.

◆ d_dHessenberg

template<typename T = double>
AMP::Array<T> AMP::Solver::GMRESSolver< T >::d_dHessenberg
private

stores the upper Hessenberg matrix formed during the GMRES iteration

Definition at line 191 of file GMRESSolver.h.

◆ d_dInitialResidual

AMP::Scalar AMP::Solver::SolverStrategy::d_dInitialResidual
protectedinherited

Definition at line 285 of file SolverStrategy.h.

Referenced by AMP::Solver::SolverStrategy::getInitialResidual().

◆ d_dRelativeTolerance

AMP::Scalar AMP::Solver::SolverStrategy::d_dRelativeTolerance = 1.0e-09
protectedinherited

◆ d_dResidualNorm

AMP::Scalar AMP::Solver::SolverStrategy::d_dResidualNorm
protectedinherited

Definition at line 284 of file SolverStrategy.h.

Referenced by AMP::Solver::SolverStrategy::getResidualNorm().

◆ d_dsin

template<typename T = double>
std::vector<T> AMP::Solver::GMRESSolver< T >::d_dsin
private

Definition at line 196 of file GMRESSolver.h.

◆ d_dw

template<typename T = double>
std::vector<T> AMP::Solver::GMRESSolver< T >::d_dw
private

stores the right hand side for the Hessenberg least squares system

Definition at line 199 of file GMRESSolver.h.

◆ d_dy

template<typename T = double>
std::vector<T> AMP::Solver::GMRESSolver< T >::d_dy
private

stores the solution for the least squares system

Definition at line 202 of file GMRESSolver.h.

◆ d_exec_space

AMP::Utilities::ExecutionSpace AMP::Solver::SolverStrategy::d_exec_space = AMP::Utilities::ExecutionSpace::unspecified
protectedinherited

execution space for the solver

Definition at line 324 of file SolverStrategy.h.

Referenced by AMP::Solver::SolverStrategy::getExecutionSpace(), and AMP::Solver::SolverStrategy::setExecutionSpace().

◆ d_global_db

std::shared_ptr<AMP::Database> AMP::Solver::SolverStrategy::d_global_db = nullptr
protectedinherited

Pointer to global database This is temporary fix and eventually either d_global_db or d_db should go away This is introduced to allow for solver factories to access databases in the global database for the construction of nested solvers

Definition at line 311 of file SolverStrategy.h.

◆ d_iBasisAllocSize

template<typename T = double>
int AMP::Solver::GMRESSolver< T >::d_iBasisAllocSize = 4
private

maximum dimension of the Krylov subspace before a restart or termination happens

Definition at line 166 of file GMRESSolver.h.

◆ d_iDebugPrintInfoLevel

int AMP::Solver::SolverStrategy::d_iDebugPrintInfoLevel = 0
protectedinherited

◆ d_iInstanceId

int AMP::Solver::SolverStrategy::d_iInstanceId
staticprotectedinherited

Definition at line 299 of file SolverStrategy.h.

◆ d_iMaxIterations

int AMP::Solver::SolverStrategy::d_iMaxIterations = 0
protectedinherited

◆ d_iMaxKrylovDimension

template<typename T = double>
int AMP::Solver::GMRESSolver< T >::d_iMaxKrylovDimension = 50
private

whether to restart

Definition at line 163 of file GMRESSolver.h.

◆ d_iNumberIterations

int AMP::Solver::SolverStrategy::d_iNumberIterations = 0
protectedinherited

Definition at line 280 of file SolverStrategy.h.

Referenced by AMP::Solver::SolverStrategy::getIterations().

◆ d_iObjectId

int AMP::Solver::SolverStrategy::d_iObjectId
protectedinherited

Definition at line 297 of file SolverStrategy.h.

◆ d_iterationHistory

std::vector<int> AMP::Solver::SolverStrategy::d_iterationHistory
protectedinherited

keeps track of iteration statistics over solver lifetime

Definition at line 302 of file SolverStrategy.h.

Referenced by AMP::Solver::SolverStrategy::getIterationHistory().

◆ d_memory_location

AMP::Utilities::MemoryType AMP::Solver::SolverStrategy::d_memory_location = AMP::Utilities::MemoryType::none
protectedinherited

memory storage address space

Definition at line 327 of file SolverStrategy.h.

◆ d_pFunctionScaling

std::shared_ptr<AMP::LinearAlgebra::Vector> AMP::Solver::SolverStrategy::d_pFunctionScaling
protectedinherited

◆ d_pNestedSolver

std::shared_ptr<AMP::Solver::SolverStrategy> AMP::Solver::SolverStrategy::d_pNestedSolver = nullptr
protectedinherited

nested solver used by this solver

Definition at line 319 of file SolverStrategy.h.

Referenced by AMP::Solver::SolverStrategy::getNestedSolver(), and AMP::Solver::SolverStrategy::setNestedSolver().

◆ d_pOperator

std::shared_ptr<AMP::Operator::Operator> AMP::Solver::SolverStrategy::d_pOperator = nullptr
protectedinherited

Definition at line 316 of file SolverStrategy.h.

◆ d_preconditioner_side

template<typename T = double>
std::string AMP::Solver::GMRESSolver< T >::d_preconditioner_side = "right"
private

string, determining left, right or both side preconditioning this flag only applies if d_bUsesPreconditioner is true valid values are "left", "right", "both" currently only right and left are implemented

Definition at line 181 of file GMRESSolver.h.

◆ d_pSolutionScaling

std::shared_ptr<AMP::LinearAlgebra::Vector> AMP::Solver::SolverStrategy::d_pSolutionScaling
protectedinherited

◆ d_restarts

template<typename T = double>
int AMP::Solver::GMRESSolver< T >::d_restarts
private

size of the allocation increases for the vector basis

Definition at line 168 of file GMRESSolver.h.

◆ d_sName

std::string AMP::Solver::SolverStrategy::d_sName
protectedinherited

Definition at line 278 of file SolverStrategy.h.

◆ d_sOrthogonalizationMethod

template<typename T = double>
std::string AMP::Solver::GMRESSolver< T >::d_sOrthogonalizationMethod = "MGS"
private

logs number of times the solver is restarted

string, determines orthogonalization method in Arnoldi options are "CGS", "MGS", "HR", where "CGS" : classical Gram-Schmidt ( fast but potentially unstable ) "MGS" : modified Gram-Schmidt ( stable ) "HR" : Householder reflections (use when highly ill conditioned)

Definition at line 175 of file GMRESSolver.h.

◆ d_vBasis

template<typename T = double>
std::vector<std::shared_ptr<AMP::LinearAlgebra::Vector> > AMP::Solver::GMRESSolver< T >::d_vBasis
private

stores the orthonormal basis for the Krylov space we do not preallocate by default

Definition at line 206 of file GMRESSolver.h.

◆ d_writer

std::shared_ptr<AMP::IO::Writer> AMP::Solver::SolverStrategy::d_writer = nullptr
protectedinherited

Definition at line 321 of file SolverStrategy.h.

Referenced by AMP::Solver::SolverStrategy::registerWriter().

◆ d_z

template<typename T = double>
std::shared_ptr<AMP::LinearAlgebra::Vector> AMP::Solver::GMRESSolver< T >::d_z
private

stores the vectors needed for right and left preconditioning

Definition at line 213 of file GMRESSolver.h.

◆ d_z1

template<typename T = double>
std::shared_ptr<AMP::LinearAlgebra::Vector> AMP::Solver::GMRESSolver< T >::d_z1
private

Definition at line 214 of file GMRESSolver.h.

◆ d_zBasis

template<typename T = double>
std::vector<std::shared_ptr<AMP::LinearAlgebra::Vector> > AMP::Solver::GMRESSolver< T >::d_zBasis
private

stores the orthonormal basis for the Krylov space in case of FGMRES we do not preallocate by default

Definition at line 210 of file GMRESSolver.h.


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



Advanced Multi-Physics (AMP)
Oak Ridge National Laboratory
Idaho National Laboratory
Los Alamos National Laboratory
This page automatically produced from the
source code by doxygen
Last updated: Tue Mar 10 2026 13:06:45.
Comments on this page