MAST
MAST::NonlinearSystem Class Reference

This class implements a system for solution of nonlinear systems. More...

#include <nonlinear_system.h>

Inheritance diagram for MAST::NonlinearSystem:
Collaboration diagram for MAST::NonlinearSystem:

Public Types

enum  Operation {
  NONLINEAR_SOLVE, EIGENPROBLEM_SOLVE, FORWARD_SENSITIVITY_SOLVE, ADJOINT_SOLVE,
  NONE
}
 

Public Member Functions

 NonlinearSystem (libMesh::EquationSystems &es, const std::string &name, const unsigned int number)
 Default constructor. More...
 
virtual ~NonlinearSystem ()
 
MAST::NonlinearSystem::Operation operation ()
 
void set_operation (MAST::NonlinearSystem::Operation op)
 sets the current operation of the system More...
 
void set_init_B_matrix ()
 flag to also initialize the B matrix. More...
 
virtual void clear () libmesh_override
 Clear all the data structures associated with the system. More...
 
virtual void reinit () libmesh_override
 Reinitializes the member data fields associated with the system, so that, e.g., assemble() may be used. More...
 
virtual std::pair< unsigned int, Realget_linear_solve_parameters ()
 calls NonlinearImplicitSystem::set_solver_parameters() before accessing the values. More...
 
virtual void solve (MAST::AssemblyElemOperations &elem_ops, MAST::AssemblyBase &assembly)
 solves the nonlinear problem with the specified assembly operation object More...
 
virtual void sensitivity_solve (MAST::AssemblyElemOperations &elem_ops, MAST::AssemblyBase &assembly, const MAST::FunctionBase &p, bool if_assemble_jacobian=true)
 Solves the sensitivity problem for the provided parameter. More...
 
virtual void adjoint_solve (MAST::AssemblyElemOperations &elem_ops, MAST::OutputAssemblyElemOperations &output, MAST::AssemblyBase &assembly, bool if_assemble_jacobian=true)
 solves the adjoint problem for the provided output function. More...
 
virtual void eigenproblem_solve (MAST::AssemblyElemOperations &elem_ops, MAST::EigenproblemAssembly &assembly)
 Assembles & solves the eigen system. More...
 
virtual void eigenproblem_sensitivity_solve (MAST::AssemblyElemOperations &elem_ops, MAST::EigenproblemAssembly &assembly, const MAST::FunctionBase &f, std::vector< Real > &sens, const std::vector< unsigned int > *indices=nullptr)
 Solves the sensitivity system, for the provided parameters. More...
 
virtual void get_eigenvalue (unsigned int i, Real &re, Real &im)
 gets the real and imaginary parts of the ith eigenvalue for the eigenproblem $ {\bf A} {\bf x} = \lambda {\bf B} {\bf x} $, and the associated eigenvector. More...
 
virtual void get_eigenpair (unsigned int i, Real &re, Real &im, libMesh::NumericVector< Real > &vec_re, libMesh::NumericVector< Real > *vec_im=nullptr)
 gets the real and imaginary parts of the ith eigenvalue for the eigenproblem $ {\bf A} {\bf x} = \lambda {\bf B} {\bf x} $, and the associated eigenvector. More...
 
void set_exchange_A_and_B (bool flag)
 sets the flag to exchange the A and B matrices for a generalized eigenvalue problem. More...
 
void set_n_requested_eigenvalues (unsigned int n)
 sets the number of eigenvalues requested More...
 
unsigned int get_n_converged_eigenvalues () const
 
unsigned int get_n_requested_eigenvalues () const
 
unsigned int get_n_iterations () const
 
void set_eigenproblem_type (libMesh::EigenProblemType ept)
 Sets the type of the current eigen problem. More...
 
libMesh::EigenProblemType get_eigenproblem_type () const
 
bool generalized () const
 
void initialize_condensed_dofs (MAST::PhysicsDisciplineBase &physics)
 Loop over the dofs on each processor to initialize the list of non-condensed dofs. More...
 
unsigned int n_global_non_condensed_dofs () const
 
void write_out_vector (libMesh::NumericVector< Real > &vec, const std::string &directory_name, const std::string &data_name, const bool write_binary_vectors)
 writes the specified vector with the specified name in a directory. More...
 
void read_in_vector (libMesh::NumericVector< Real > &vec, const std::string &directory_name, const std::string &data_name, const bool read_binary_vectors)
 reads the specified vector with the specified name in a directory. More...
 
void project_vector_without_dirichlet (libMesh::NumericVector< Real > &new_vector, libMesh::FunctionBase< Real > &f) const
 

Public Attributes

libMesh::SparseMatrix< Real > * matrix_A
 The system matrix for standard eigenvalue problems. More...
 
libMesh::SparseMatrix< Real > * matrix_B
 A second system matrix for generalized eigenvalue problems. More...
 
std::unique_ptr< MAST::SlepcEigenSolvereigen_solver
 The EigenSolver, definig which interface, i.e solver package to use. More...
 
std::unique_ptr< libMesh::LinearSolver< Real > > linear_solver
 The LinearSolver for solution of the linear equations. More...
 

Protected Member Functions

virtual void init_data () libmesh_override
 Initializes the member data fields associated with the system, so that, e.g., assemble() may be used. More...
 
void set_n_converged (unsigned int nconv)
 Set the _n_converged_eigenpairs member, useful for subclasses of EigenSystem. More...
 
void set_n_iterations (unsigned int its)
 Set the _n_iterations member, useful for subclasses of EigenSystem. More...
 

Protected Attributes

bool _initialize_B_matrix
 initialize the B matrix in addition to A, which might be needed for solution of complex system of equations using PC field split More...
 
bool _condensed_dofs_initialized
 A private flag to indicate whether the condensed dofs have been initialized. More...
 
unsigned int _n_requested_eigenpairs
 The number of requested eigenpairs. More...
 
bool _exchange_A_and_B
 flag to exchange the A and B matrices in the eigenproblem solution More...
 
unsigned int _n_converged_eigenpairs
 The number of converged eigenpairs. More...
 
unsigned int _n_iterations
 The number of iterations of the eigen solver algorithm. More...
 
bool _is_generalized_eigenproblem
 A boolean flag to indicate whether we are dealing with a generalized eigenvalue problem. More...
 
libMesh::EigenProblemType _eigen_problem_type
 The type of the eigenvalue problem. More...
 
MAST::NonlinearSystem::Operation _operation
 current operation of the system More...
 
std::vector< libMesh::dof_id_type > _local_non_condensed_dofs_vector
 Vector storing the local dof indices that will not be condensed. More...
 

Detailed Description

This class implements a system for solution of nonlinear systems.

The class also provides a mechanism to solve associated eigenproblems $ {\bf A} {\bf x} = \lambda {\bf B} {\bf x} $. The user needs to provide an eigenproblem assembly class to assemble the A and B matrices.

Definition at line 56 of file nonlinear_system.h.

Member Enumeration Documentation

Enumerator
NONLINEAR_SOLVE 
EIGENPROBLEM_SOLVE 
FORWARD_SENSITIVITY_SOLVE 
ADJOINT_SOLVE 
NONE 

Definition at line 72 of file nonlinear_system.h.

Constructor & Destructor Documentation

MAST::NonlinearSystem::NonlinearSystem ( libMesh::EquationSystems &  es,
const std::string &  name,
const unsigned int  number 
)

Default constructor.

Definition at line 52 of file nonlinear_system.cpp.

MAST::NonlinearSystem::~NonlinearSystem ( )
virtual

Definition at line 73 of file nonlinear_system.cpp.

Here is the call graph for this function:

Member Function Documentation

void MAST::NonlinearSystem::adjoint_solve ( MAST::AssemblyElemOperations elem_ops,
MAST::OutputAssemblyElemOperations output,
MAST::AssemblyBase assembly,
bool  if_assemble_jacobian = true 
)
virtual

solves the adjoint problem for the provided output function.

The Jacobian will be assembled before adjoint solve if if_assemble_jacobian is true.

Definition at line 792 of file nonlinear_system.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void MAST::NonlinearSystem::clear ( )
virtual

Clear all the data structures associated with the system.

Reimplemented in MAST::StructuralSystem.

Definition at line 83 of file nonlinear_system.cpp.

Here is the caller graph for this function:

void MAST::NonlinearSystem::eigenproblem_sensitivity_solve ( MAST::AssemblyElemOperations elem_ops,
MAST::EigenproblemAssembly assembly,
const MAST::FunctionBase f,
std::vector< Real > &  sens,
const std::vector< unsigned int > *  indices = nullptr 
)
virtual

Solves the sensitivity system, for the provided parameters.

Sensitivity of eigenvalues are returned in sens. This is more If only a subset of sensitivities are needed, then the indices can be passed in the last argument. If the last argument is not provided, then sensitivity of all eigenvalues will be computed and returned in sens.

Definition at line 551 of file nonlinear_system.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void MAST::NonlinearSystem::eigenproblem_solve ( MAST::AssemblyElemOperations elem_ops,
MAST::EigenproblemAssembly assembly 
)
virtual

Assembles & solves the eigen system.

Definition at line 235 of file nonlinear_system.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool MAST::NonlinearSystem::generalized ( ) const
inline
Returns
true if the underlying problem is generalized , false otherwise.

Definition at line 257 of file nonlinear_system.h.

Here is the caller graph for this function:

void MAST::NonlinearSystem::get_eigenpair ( unsigned int  i,
Real re,
Real im,
libMesh::NumericVector< Real > &  vec_re,
libMesh::NumericVector< Real > *  vec_im = nullptr 
)
virtual

gets the real and imaginary parts of the ith eigenvalue for the eigenproblem $ {\bf A} {\bf x} = \lambda {\bf B} {\bf x} $, and the associated eigenvector.

The returned eigenvector will be scaled such that it has a unit inner product with respect to the B matrix.

Note that eigen problem type HEP or GHEP, vec_im must be nullptr, and for eigenproblem type NHEP or GNHEP, the real and imag parts of the eigenvector are copied to vec_re and vec_im, respectively. If vec_im is not provided, then only the real part will be copied to vec_re.

Definition at line 403 of file nonlinear_system.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

libMesh::EigenProblemType MAST::NonlinearSystem::get_eigenproblem_type ( ) const
inline
Returns
the eigen problem type.

Definition at line 251 of file nonlinear_system.h.

void MAST::NonlinearSystem::get_eigenvalue ( unsigned int  i,
Real re,
Real im 
)
virtual

gets the real and imaginary parts of the ith eigenvalue for the eigenproblem $ {\bf A} {\bf x} = \lambda {\bf B} {\bf x} $, and the associated eigenvector.

Definition at line 383 of file nonlinear_system.cpp.

Here is the caller graph for this function:

std::pair< unsigned int, Real > MAST::NonlinearSystem::get_linear_solve_parameters ( )
virtual

calls NonlinearImplicitSystem::set_solver_parameters() before accessing the values.

Definition at line 201 of file nonlinear_system.cpp.

Here is the caller graph for this function:

unsigned int MAST::NonlinearSystem::get_n_converged_eigenvalues ( ) const
inline
Returns
the number of converged eigenpairs.

Definition at line 229 of file nonlinear_system.h.

unsigned int MAST::NonlinearSystem::get_n_iterations ( ) const
inline
Returns
the number of eigen solver iterations.

Definition at line 240 of file nonlinear_system.h.

Here is the call graph for this function:

unsigned int MAST::NonlinearSystem::get_n_requested_eigenvalues ( ) const
inline
Returns
the number of requested eigenpairs.

Definition at line 235 of file nonlinear_system.h.

void MAST::NonlinearSystem::init_data ( )
protectedvirtual

Initializes the member data fields associated with the system, so that, e.g., assemble() may be used.

Definition at line 114 of file nonlinear_system.cpp.

void MAST::NonlinearSystem::initialize_condensed_dofs ( MAST::PhysicsDisciplineBase physics)

Loop over the dofs on each processor to initialize the list of non-condensed dofs.

These are the dofs in the system that are not contained in global_dirichlet_dofs_set.

Definition at line 686 of file nonlinear_system.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

unsigned int MAST::NonlinearSystem::n_global_non_condensed_dofs ( ) const
Returns
the global number of non-condensed dofs in the system.
MAST::NonlinearSystem::Operation MAST::NonlinearSystem::operation ( )
inline
Returns
the current operation of the system

Definition at line 84 of file nonlinear_system.h.

Here is the caller graph for this function:

void MAST::NonlinearSystem::project_vector_without_dirichlet ( libMesh::NumericVector< Real > &  new_vector,
libMesh::FunctionBase< Real > &  f 
) const

Definition at line 977 of file nonlinear_system.cpp.

Here is the caller graph for this function:

void MAST::NonlinearSystem::read_in_vector ( libMesh::NumericVector< Real > &  vec,
const std::string &  directory_name,
const std::string &  data_name,
const bool  read_binary_vectors 
)

reads the specified vector with the specified name in a directory.

Definition at line 902 of file nonlinear_system.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void MAST::NonlinearSystem::reinit ( )
virtual

Reinitializes the member data fields associated with the system, so that, e.g., assemble() may be used.

Definition at line 163 of file nonlinear_system.cpp.

Here is the caller graph for this function:

void MAST::NonlinearSystem::sensitivity_solve ( MAST::AssemblyElemOperations elem_ops,
MAST::AssemblyBase assembly,
const MAST::FunctionBase p,
bool  if_assemble_jacobian = true 
)
virtual

Solves the sensitivity problem for the provided parameter.

The Jacobian will be assembled before adjoint solve if if_assemble_jacobian is true.

Definition at line 737 of file nonlinear_system.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void MAST::NonlinearSystem::set_eigenproblem_type ( libMesh::EigenProblemType  ept)

Sets the type of the current eigen problem.

Definition at line 104 of file nonlinear_system.cpp.

Here is the caller graph for this function:

void MAST::NonlinearSystem::set_exchange_A_and_B ( bool  flag)
inline

sets the flag to exchange the A and B matrices for a generalized eigenvalue problem.

This is needed typically when the B matrix is not positive semi-definite.

Definition at line 216 of file nonlinear_system.h.

void MAST::NonlinearSystem::set_init_B_matrix ( )
inline

flag to also initialize the B matrix.

Must be called before EquationsSystems::init(). This is false by default.

Definition at line 102 of file nonlinear_system.h.

Here is the call graph for this function:

void MAST::NonlinearSystem::set_n_converged ( unsigned int  nconv)
inlineprotected

Set the _n_converged_eigenpairs member, useful for subclasses of EigenSystem.

Definition at line 330 of file nonlinear_system.h.

void MAST::NonlinearSystem::set_n_iterations ( unsigned int  its)
inlineprotected

Set the _n_iterations member, useful for subclasses of EigenSystem.

Definition at line 337 of file nonlinear_system.h.

void MAST::NonlinearSystem::set_n_requested_eigenvalues ( unsigned int  n)
inline

sets the number of eigenvalues requested

Definition at line 221 of file nonlinear_system.h.

void MAST::NonlinearSystem::set_operation ( MAST::NonlinearSystem::Operation  op)
inline

sets the current operation of the system

Definition at line 93 of file nonlinear_system.h.

Here is the caller graph for this function:

void MAST::NonlinearSystem::solve ( MAST::AssemblyElemOperations elem_ops,
MAST::AssemblyBase assembly 
)
virtual

solves the nonlinear problem with the specified assembly operation object

Reimplemented in MAST::StructuralSystem.

Definition at line 209 of file nonlinear_system.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void MAST::NonlinearSystem::write_out_vector ( libMesh::NumericVector< Real > &  vec,
const std::string &  directory_name,
const std::string &  data_name,
const bool  write_binary_vectors 
)

writes the specified vector with the specified name in a directory.

Definition at line 845 of file nonlinear_system.cpp.

Member Data Documentation

bool MAST::NonlinearSystem::_condensed_dofs_initialized
protected

A private flag to indicate whether the condensed dofs have been initialized.

Definition at line 352 of file nonlinear_system.h.

libMesh::EigenProblemType MAST::NonlinearSystem::_eigen_problem_type
protected

The type of the eigenvalue problem.

Definition at line 383 of file nonlinear_system.h.

bool MAST::NonlinearSystem::_exchange_A_and_B
protected

flag to exchange the A and B matrices in the eigenproblem solution

Definition at line 362 of file nonlinear_system.h.

bool MAST::NonlinearSystem::_initialize_B_matrix
protected

initialize the B matrix in addition to A, which might be needed for solution of complex system of equations using PC field split

Definition at line 345 of file nonlinear_system.h.

bool MAST::NonlinearSystem::_is_generalized_eigenproblem
protected

A boolean flag to indicate whether we are dealing with a generalized eigenvalue problem.

Definition at line 378 of file nonlinear_system.h.

std::vector<libMesh::dof_id_type> MAST::NonlinearSystem::_local_non_condensed_dofs_vector
protected

Vector storing the local dof indices that will not be condensed.

All dofs that are not in this vector will be eliminated from the system when we perform a solve.

Definition at line 395 of file nonlinear_system.h.

unsigned int MAST::NonlinearSystem::_n_converged_eigenpairs
protected

The number of converged eigenpairs.

Definition at line 367 of file nonlinear_system.h.

unsigned int MAST::NonlinearSystem::_n_iterations
protected

The number of iterations of the eigen solver algorithm.

Definition at line 372 of file nonlinear_system.h.

unsigned int MAST::NonlinearSystem::_n_requested_eigenpairs
protected

The number of requested eigenpairs.

Definition at line 357 of file nonlinear_system.h.

MAST::NonlinearSystem::Operation MAST::NonlinearSystem::_operation
protected

current operation of the system

Definition at line 388 of file nonlinear_system.h.

std::unique_ptr<MAST::SlepcEigenSolver> MAST::NonlinearSystem::eigen_solver

The EigenSolver, definig which interface, i.e solver package to use.

Definition at line 275 of file nonlinear_system.h.

std::unique_ptr<libMesh::LinearSolver<Real> > MAST::NonlinearSystem::linear_solver

The LinearSolver for solution of the linear equations.

Definition at line 280 of file nonlinear_system.h.

libMesh::SparseMatrix<Real>* MAST::NonlinearSystem::matrix_A

The system matrix for standard eigenvalue problems.

Definition at line 263 of file nonlinear_system.h.

libMesh::SparseMatrix<Real>* MAST::NonlinearSystem::matrix_B

A second system matrix for generalized eigenvalue problems.

Definition at line 268 of file nonlinear_system.h.


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