![]() |
|
#include <trilinos_solver.h>
Inheritance diagram for oomph::TrilinosAztecOOSolver:Public Types | |
| enum | AztecOO_solver_types { CG , GMRES , BiCGStab } |
| Enumerated list to define which AztecOO solver is used. More... | |
Public Member Functions | |
| TrilinosAztecOOSolver () | |
| Constructor. More... | |
| ~TrilinosAztecOOSolver () | |
| Destructor - delete the solver and the matrices. More... | |
| TrilinosAztecOOSolver (const TrilinosAztecOOSolver &)=delete | |
| Broken copy constructor. More... | |
| void | operator= (const TrilinosAztecOOSolver &)=delete |
| Broken assignment operator. More... | |
| void | enable_aztecoo_workaround_for_epetra_matrix_setup () |
| void | disable_aztecoo_workaround_for_epetra_matrix_setup () |
| bool | is_aztecoo_workaround_for_epetra_matrix_setup_enabled () |
| void | clean_up_memory () |
| void | solve (Problem *const &problem_pt, DoubleVector &solution) |
| void | solve (DoubleMatrixBase *const &matrix_pt, const DoubleVector &rhs, DoubleVector &solution) |
| void | resolve (const DoubleVector &rhs, DoubleVector &solution) |
| void | disable_resolve () |
| void | enable_delete_matrix () |
| Call if the matrix can be deleted. More... | |
| void | disable_delete_matrix () |
| Call if the matrix can not be deleted (default) More... | |
| unsigned & | max_iter () |
| Access function to Max_iter. More... | |
| unsigned | iterations () const |
| Acess function to Iterations. More... | |
| double & | tolerance () |
| Access function to Tolerance. More... | |
| unsigned & | solver_type () |
| Access function to Solver_type. More... | |
| double | jacobian_setup_time () |
| Function to return Jacobian_setup_time;. More... | |
| double | linear_solver_solution_time () |
| Function to return Linear_solver_solution_time. More... | |
| void | enable_assemble_serial_jacobian () |
| void | disable_assemble_serial_jacobian () |
| Unset the assembly of the serial jacobian. More... | |
Public Member Functions inherited from oomph::IterativeLinearSolver | |
| IterativeLinearSolver () | |
| IterativeLinearSolver (const IterativeLinearSolver &)=delete | |
| Broken copy constructor. More... | |
| void | operator= (const IterativeLinearSolver &)=delete |
| Broken assignment operator. More... | |
| virtual | ~IterativeLinearSolver () |
| Destructor (empty) More... | |
| Preconditioner *& | preconditioner_pt () |
| Access function to preconditioner. More... | |
| Preconditioner *const & | preconditioner_pt () const |
| Access function to preconditioner (const version) More... | |
| double & | tolerance () |
| Access to convergence tolerance. More... | |
| unsigned & | max_iter () |
| Access to max. number of iterations. More... | |
| void | enable_doc_convergence_history () |
| Enable documentation of the convergence history. More... | |
| void | disable_doc_convergence_history () |
| Disable documentation of the convergence history. More... | |
| void | open_convergence_history_file_stream (const std::string &file_name, const std::string &zone_title="") |
| void | close_convergence_history_file_stream () |
| Close convergence history output stream. More... | |
| double | jacobian_setup_time () const |
| double | linear_solver_solution_time () const |
| return the time taken to solve the linear system More... | |
| virtual double | preconditioner_setup_time () const |
| returns the the time taken to setup the preconditioner More... | |
| void | enable_setup_preconditioner_before_solve () |
| Setup the preconditioner before the solve. More... | |
| void | disable_setup_preconditioner_before_solve () |
| Don't set up the preconditioner before the solve. More... | |
| void | enable_error_after_max_iter () |
| Throw an error if we don't converge within max_iter. More... | |
| void | disable_error_after_max_iter () |
| Don't throw an error if we don't converge within max_iter (default). More... | |
| void | enable_iterative_solver_as_preconditioner () |
| void | disable_iterative_solver_as_preconditioner () |
Public Member Functions inherited from oomph::LinearSolver | |
| LinearSolver () | |
| Empty constructor, initialise the member data. More... | |
| LinearSolver (const LinearSolver &dummy)=delete | |
| Broken copy constructor. More... | |
| void | operator= (const LinearSolver &)=delete |
| Broken assignment operator. More... | |
| virtual | ~LinearSolver () |
| Empty virtual destructor. More... | |
| void | enable_doc_time () |
| Enable documentation of solve times. More... | |
| void | disable_doc_time () |
| Disable documentation of solve times. More... | |
| bool | is_doc_time_enabled () const |
| Is documentation of solve times enabled? More... | |
| bool | is_resolve_enabled () const |
| Boolean flag indicating if resolves are enabled. More... | |
| virtual void | enable_resolve () |
| virtual void | solve (DoubleMatrixBase *const &matrix_pt, const Vector< double > &rhs, Vector< double > &result) |
| virtual void | solve_transpose (Problem *const &problem_pt, DoubleVector &result) |
| virtual void | solve_transpose (DoubleMatrixBase *const &matrix_pt, const DoubleVector &rhs, DoubleVector &result) |
| virtual void | solve_transpose (DoubleMatrixBase *const &matrix_pt, const Vector< double > &rhs, Vector< double > &result) |
| virtual void | resolve_transpose (const DoubleVector &rhs, DoubleVector &result) |
| virtual void | enable_computation_of_gradient () |
| void | disable_computation_of_gradient () |
| void | reset_gradient () |
| void | get_gradient (DoubleVector &gradient) |
| function to access the gradient, provided it has been computed More... | |
Public Member Functions inherited from oomph::DistributableLinearAlgebraObject | |
| DistributableLinearAlgebraObject () | |
| Default constructor - create a distribution. More... | |
| DistributableLinearAlgebraObject (const DistributableLinearAlgebraObject &matrix)=delete | |
| Broken copy constructor. More... | |
| void | operator= (const DistributableLinearAlgebraObject &)=delete |
| Broken assignment operator. More... | |
| virtual | ~DistributableLinearAlgebraObject () |
| Destructor. More... | |
| LinearAlgebraDistribution * | distribution_pt () const |
| access to the LinearAlgebraDistribution More... | |
| unsigned | nrow () const |
| access function to the number of global rows. More... | |
| unsigned | nrow_local () const |
| access function for the num of local rows on this processor. More... | |
| unsigned | nrow_local (const unsigned &p) const |
| access function for the num of local rows on this processor. More... | |
| unsigned | first_row () const |
| access function for the first row on this processor More... | |
| unsigned | first_row (const unsigned &p) const |
| access function for the first row on this processor More... | |
| bool | distributed () const |
| distribution is serial or distributed More... | |
| bool | distribution_built () const |
| void | build_distribution (const LinearAlgebraDistribution *const dist_pt) |
| void | build_distribution (const LinearAlgebraDistribution &dist) |
Protected Member Functions | |
| void | solve_using_AztecOO (Epetra_Vector *&rhs_pt, Epetra_Vector *&soln_pt) |
| void | solver_setup (DoubleMatrixBase *const &matrix_pt) |
Protected Member Functions inherited from oomph::DistributableLinearAlgebraObject | |
| void | clear_distribution () |
Additional Inherited Members | |
Static Protected Attributes inherited from oomph::IterativeLinearSolver | |
| static IdentityPreconditioner | Default_preconditioner |
An interface to the Trilinos AztecOO classes allowing it to be used as an Oomph-lib LinearSolver. The AztecOO solver is a Krylov Subspace solver; the solver type (either CG, GMRES or BiCGStab) can be set using solver_type(). This solver can be preconditioned with Trilinos Preconditioners (derived from TrilinosPreconditionerBase) or Oomph-lib preconditioners (derived from Preconditioner). Preconditioners are set using preconditioner_pt().
Enumerated list to define which AztecOO solver is used.
if this solver is using an oomph-lib preconditioner then the vectors passed to preconditioner_solve(...) should be using the values in the epetra vector as external data. If the vectors are using external data then rebuild(...) methods cannot be used be used in the preconditioner.
| Enumerator | |
|---|---|
| CG | |
| GMRES | |
| BiCGStab | |
|
inline |
Constructor.
References Assemble_serial_jacobian, AztecOO_solver_pt, Delete_matrix, e(), Epetra_matrix_pt, Epetra_preconditioner_pt, GMRES, If_oomphlib_preconditioner_use_epetra_values, Problem_pt, Solver_type, oomph::IterativeLinearSolver::Tolerance, Use_aztecoo_workaround_for_epetra_matrix_setup, and Using_problem_based_solve.
|
inline |
Destructor - delete the solver and the matrices.
References clean_up_memory(), Oomph_matrix_pt, and Using_problem_based_solve.
|
delete |
Broken copy constructor.
|
inlinevirtual |
Clean up method - deletes the solver, the matrices and the preconditioner
Reimplemented from oomph::LinearSolver.
References AztecOO_solver_pt, oomph::Preconditioner::clean_up_memory(), Epetra_matrix_pt, Epetra_preconditioner_pt, and oomph::IterativeLinearSolver::preconditioner_pt().
Referenced by disable_resolve(), solve(), solver_setup(), and ~TrilinosAztecOOSolver().
|
inline |
Unset the assembly of the serial jacobian.
References Assemble_serial_jacobian.
|
inline |
Disable workaround for creating of epetra matrix that respects aztecoo's ordering requirements
References Use_aztecoo_workaround_for_epetra_matrix_setup.
|
inline |
Call if the matrix can not be deleted (default)
References Delete_matrix.
|
inlinevirtual |
Disable resolve function (overloads the LinearSolver disable_resolve function).
Reimplemented from oomph::LinearSolver.
References clean_up_memory(), and oomph::LinearSolver::Enable_resolve.
|
inline |
Set the assembly of the serial jacobian when performing a problem-based solve
References Assemble_serial_jacobian.
|
inline |
Enable workaround for creating of epetra matrix that respects aztecoo's ordering requirements
References Use_aztecoo_workaround_for_epetra_matrix_setup.
|
inline |
|
inline |
Is workaround for creating of epetra matrix that respects aztecoo's ordering requirements enabled?
References Use_aztecoo_workaround_for_epetra_matrix_setup.
|
inlinevirtual |
Acess function to Iterations.
Implements oomph::IterativeLinearSolver.
References Iterations.
|
inline |
Function to return Jacobian_setup_time;.
References Jacobian_setup_time.
|
inline |
Function to return Linear_solver_solution_time.
References Linear_solver_solution_time.
|
inline |
Access function to Max_iter.
References oomph::IterativeLinearSolver::Max_iter.
Referenced by PseudoElasticCollapsibleChannelProblem< FLUID_ELEMENT, SOLID_ELEMENT >::set_pseudo_elastic_fsi_solver().
|
delete |
Broken assignment operator.
|
virtual |
Function to resolve a linear system using the existing solver data, allowing a solve with a new right hand side vector. This function must be used after a call to solve(...) with enable_resolve set to true.
Reimplemented from oomph::LinearSolver.
References oomph::TrilinosEpetraHelpers::copy_to_oomphlib_vector(), oomph::TrilinosEpetraHelpers::create_distributed_epetra_vector(), oomph::DistributableLinearAlgebraObject::distribution_pt(), oomph::LinearSolver::Doc_time, Epetra_matrix_pt, Linear_solver_solution_time, oomph::DistributableLinearAlgebraObject::nrow(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, oomph::oomph_info, BiharmonicTestFunctions1::solution(), solve_using_AztecOO(), and oomph::TimingHelpers::timer().
|
virtual |
Function to solve the linear system defined by matrix_pt and rhs. NOTE 1. The matrix has to be of type CRDoubleMatrix or DistributedCRDoubleMatrix. NOTE 2. This function will delete any existing internal data and generate a new AztecOO solver.
Reimplemented from oomph::LinearSolver.
References oomph::DoubleVector::build(), oomph::DoubleVector::built(), clean_up_memory(), oomph::LinearAlgebraDistribution::communicator_pt(), oomph::TrilinosEpetraHelpers::copy_to_oomphlib_vector(), oomph::TrilinosEpetraHelpers::create_distributed_epetra_vector(), oomph::DistributableLinearAlgebraObject::distribution_pt(), oomph::LinearSolver::Doc_time, oomph::LinearSolver::Enable_resolve, oomph::IterativeLinearSolver::First_time_solve_when_used_as_preconditioner, Linear_solver_solution_time, oomph::DoubleMatrixBase::ncol(), oomph::DistributableLinearAlgebraObject::nrow(), oomph::DoubleMatrixBase::nrow(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, oomph::oomph_info, solve_using_AztecOO(), solver_setup(), oomph::TimingHelpers::timer(), and oomph::IterativeLinearSolver::Use_iterative_solver_as_preconditioner.
|
virtual |
Function which uses problem_pt's get_jacobian(...) function to generate a linear system which is then solved. This function deletes any existing internal data and then generates a new AztecOO solver.
//////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// Function which uses problem_pt's get_jacobian(...) function to generate a linear system which is then solved. This function deletes any existing internal data and then generates a new AztecOO solver.
Implements oomph::LinearSolver.
References oomph::DistributableLinearAlgebraObject::build_distribution(), clean_up_memory(), oomph::DistributableLinearAlgebraObject::distribution_pt(), oomph::LinearSolver::Doc_time, oomph::Problem::get_jacobian(), Jacobian_setup_time, oomph::oomph_info, Oomph_matrix_pt, Problem_pt, BiharmonicTestFunctions1::solution(), oomph::TimingHelpers::timer(), and Using_problem_based_solve.
|
protected |
Helper function performs the actual solve once the AztecOO solver is set up
Helper function performs the actual solve once the AztecOO solver is set up (i.e. solver_setup() is called)
References AztecOO_solver_pt, oomph::LinearSolver::Doc_time, Iterations, oomph::IterativeLinearSolver::Max_iter, OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, oomph::oomph_info, and oomph::IterativeLinearSolver::Tolerance.
|
protected |
Helper function for setting up the solver. Converts the oomph-lib matrices to Epetra matrices, sets up the preconditioner, creates the Trilinos Aztec00 solver and passes in the matrix, preconditioner and parameters.
References AztecOO_solver_pt, BiCGStab, oomph::DistributableLinearAlgebraObject::build_distribution(), CG, clean_up_memory(), oomph::TrilinosEpetraHelpers::create_distributed_epetra_matrix(), oomph::TrilinosEpetraHelpers::create_distributed_epetra_matrix_for_aztecoo(), Delete_matrix, oomph::DistributableLinearAlgebraObject::distribution_pt(), oomph::LinearSolver::Doc_time, Epetra_matrix_pt, oomph::TrilinosPreconditionerBase::epetra_operator_pt(), Epetra_preconditioner_pt, GMRES, oomph::IterativeLinearSolver::Max_iter, OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, oomph::oomph_info, Oomph_matrix_pt, oomph::IterativeLinearSolver::Preconditioner_pt, oomph::Preconditioner::set_matrix_pt(), oomph::TrilinosPreconditionerBase::setup(), oomph::Preconditioner::setup(), oomph::IterativeLinearSolver::Setup_preconditioner_before_solve, Solver_type, oomph::TimingHelpers::timer(), Use_aztecoo_workaround_for_epetra_matrix_setup, and Using_problem_based_solve.
Referenced by solve().
|
inline |
Access function to Solver_type.
References Solver_type.
Referenced by main(), parallel_test(), PseudoElasticCollapsibleChannelProblem< FLUID_ELEMENT, SOLID_ELEMENT >::set_pseudo_elastic_fsi_solver(), set_pseudo_elastic_fsi_solver(), and TiltedCavityProblem< ELEMENT >::TiltedCavityProblem().
|
inline |
Access function to Tolerance.
References oomph::IterativeLinearSolver::Tolerance.
Referenced by main(), PseudoElasticCollapsibleChannelProblem< FLUID_ELEMENT, SOLID_ELEMENT >::set_pseudo_elastic_fsi_solver(), and set_pseudo_elastic_fsi_solver().
|
protected |
If true, when performing a problem based solve a serial matrix will be requested from Problem::get_jacobian(...). Defaults to true
Referenced by disable_assemble_serial_jacobian(), enable_assemble_serial_jacobian(), and TrilinosAztecOOSolver().
|
protected |
Pointer to the AztecOO solver.
Referenced by clean_up_memory(), solve_using_AztecOO(), solver_setup(), and TrilinosAztecOOSolver().
|
protected |
Trilinos copies matrix data from oomph-lib's own CRDoubleMatrix or DistributedCRDoubleMatrix to Trilinos's Epetra format - the Trilinos solver no longer requires the oomph-lib matrices and therefore they could be deleted to save memory. This must be requested explicitly by setting this flag to TRUE. NOTE: The matrix is deleted after the preconditioner is setup.
Referenced by disable_delete_matrix(), enable_delete_matrix(), solver_setup(), and TrilinosAztecOOSolver().
|
protected |
A pointer for the linear system matrix in Epetra_CrsMatrix format.
Referenced by clean_up_memory(), resolve(), solver_setup(), and TrilinosAztecOOSolver().
|
protected |
A pointer to the Epetra_Operator for the preconditioner. This is only used if the preconditioner NOT a Trilinos preconditioner.
Referenced by clean_up_memory(), solver_setup(), and TrilinosAztecOOSolver().
|
protected |
if this solver is using an oomph-lib preconditioner then the vectors passed to preconditioner_solve(...) should be using the values in the epetra vector as external data. If the vectors are using external data then rebuild(...) methods cannot be used.
Referenced by TrilinosAztecOOSolver().
|
protected |
Stores number of iterations used.
Referenced by iterations(), and solve_using_AztecOO().
|
protected |
Stores set up time for Jacobian.
Referenced by jacobian_setup_time(), and solve().
|
protected |
Stores time for the solution (excludes time to set up preconditioner)
Referenced by linear_solver_solution_time(), resolve(), and solve().
|
protected |
Oomph lib matrix pointer.
Referenced by solve(), solver_setup(), and ~TrilinosAztecOOSolver().
|
protected |
A pointer to the underlying problem (NULL if MATRIX based solve) The problem_pt is stored here in a problem based solve for the preconditioner
Referenced by solve(), and TrilinosAztecOOSolver().
|
protected |
Defines which solver is set up - available types are defined in AztecOO_solver_types
Referenced by solver_setup(), solver_type(), and TrilinosAztecOOSolver().
|
protected |
Use workaround for creating of epetra matrix that respects aztecoo's ordering requirements
Referenced by disable_aztecoo_workaround_for_epetra_matrix_setup(), enable_aztecoo_workaround_for_epetra_matrix_setup(), is_aztecoo_workaround_for_epetra_matrix_setup_enabled(), solver_setup(), and TrilinosAztecOOSolver().
|
protected |
Helper flag keeping track of whether we called the linear algebra or problem-based solve function.
Referenced by solve(), solver_setup(), TrilinosAztecOOSolver(), and ~TrilinosAztecOOSolver().