LifeV
MonolithicBlockComposedNN Class Reference

MonolithicBlockComposedNN - Short description of the class. More...

#include <MonolithicBlockComposedNN.hpp>

+ Inheritance diagram for MonolithicBlockComposedNN:
+ Collaboration diagram for MonolithicBlockComposedNN:

Public Types

enum  Block { solid1, fluid1, solid2, fluid2 }
 
typedef MonolithicBlockComposed super_Type
 
typedef ComposedOperator< Ifpack_Preconditioner > composed_prec
 
- Public Types inherited from MonolithicBlockComposed
enum  Block { solid, fluid, mesh }
 
typedef MonolithicBlock super_Type
 
typedef super_Type::fespacePtr_Type fespacePtr_Type
 
typedef ComposedOperator< Epetra_OperatoroperatorPtr_Type
 
- Public Types inherited from MonolithicBlock
typedef VectorEpetra vector_Type
 
typedef std::shared_ptr< vector_TypevectorPtr_Type
 
typedef MatrixEpetra< Realmatrix_Type
 
typedef std::shared_ptr< matrix_TypematrixPtr_Type
 
typedef std::shared_ptr< Epetra_OperatorepetraOperatorPtr_Type
 
typedef std::shared_ptr< Preconditionerepetra_preconditioner_ptrtype
 
typedef matrix_Type::matrix_type epetraMatrix_Type
 
typedef SolverAztecOO solver_Type
 
typedef std::shared_ptr< SolverAztecOOsolverPtr_Type
 
typedef FESpace< RegionMesh< LinearTetra >, MapEpetrafespace_Type
 
typedef std::shared_ptr< fespace_TypefespacePtr_Type
 
typedef std::shared_ptr< MapEpetramapPtr_Type
 
typedef std::shared_ptr< BCHandlerbchandlerPtr_Type
 

Constructor & Destructor

 MonolithicBlockComposedNN (const std::vector< Int > &flag, const std::vector< Int > &order)
 Empty Constructor. More...
 
 ~MonolithicBlockComposedNN ()
 Destructor. More...
 

Public Methods

void setDataFromGetPot (const GetPot &data, const std::string &section)
 Sets the parameters needed by the preconditioner from data file (creates the Ifpack list) More...
 
virtual int solveSystem (const vector_Type &rhs, vector_Type &step, solverPtr_Type &linearSolver)
 Solves the preconditioned linear system (used only when dealing with a preconditioner) More...
 
virtual void coupler (mapPtr_Type &map, const std::map< ID, ID > &locDofMap, const vectorPtr_Type &numerationInterface, const Real &timeStep, const Real &coefficient, const Real &rescaleFactor)
 Computes the coupling. More...
 
void applyBoundaryConditions (const Real &time, const UInt i)
 Applies the correspondent boundary conditions to every block. More...
 
void push_back_matrix (const matrixPtr_Type &Mat, const bool recompute)
 Multiplies the block times 2 and calls super_Type::push_back_matrix(...) More...
 
void replace_matrix (const matrixPtr_Type &oper, UInt position)
 
bool set ()
 returns true if the operator is set More...
 

Factory Method

static MonolithicBlockcreateComposedNN ()
 

Protected Members

std::shared_ptr< ComposedOperator< ComposedOperator< Ifpack_Preconditioner > > > M_blockPrecs
 
Teuchos::ParameterList M_list
 
std::vector< std::shared_ptr< Ifpack_Preconditioner > > M_prec
 

Private Members

std::shared_ptr< composed_precM_firstCompPrec
 
std::shared_ptr< composed_precM_secondCompPrec
 
std::vector< matrix_TypeM_matrixVector
 
int M_overlapLevel
 
std::string M_precType
 
Ifpack M_factory
 

Additional Inherited Members

- Public Member Functions inherited from MonolithicBlockComposed
 MonolithicBlockComposed (const std::vector< Int > &flags, const std::vector< Int > &order)
 Constructor. More...
 
 ~MonolithicBlockComposed ()
 
void GlobalAssemble ()
 runs GlobalAssemble on the blocks More...
 
virtual void blockAssembling ()
 sums the coupling matrices with the corresponding blocks More...
 
void coupler (mapPtr_Type &map, const std::map< ID, ID > &locDofMap, const vectorPtr_Type &numerationInterface, const Real &timeStep, const Real &coefficient, const Real &rescaleFactor, UInt couplingBlock)
 adds a default coupling matrix for a specified block. More...
 
virtual void push_back_oper (MonolithicBlockComposed &Oper)
 Merges an input MonolithicBlockComposed operator with this one. More...
 
virtual void push_back_coupling (matrixPtr_Type &coupling)
 Pushes an extra coupling matrix at the end of the vector of coupling matrices. More...
 
virtual void replace_coupling (const matrixPtr_Type &Mat, UInt index)
 replaces a coupling block More...
 
virtual void addToCoupling (const matrixPtr_Type &Mat, UInt position)
 pushes a block at the end of the vector More...
 
void addToCoupling (const Real &entry, UInt row, UInt col, UInt position)
 
const std::vector< bool > & recompute ()
 returns the vector of flags (by const reference). More...
 
const std::vector< matrixPtr_Type > & couplingVector () const
 returns the vector of pointers to the coupling blocks (by const reference). More...
 
void setRecompute (UInt position, bool flag)
 turns on/off the recomputation of the preconditioner for a specified factor More...
 
const UInt whereIsBlock (UInt position) const
 
- Public Member Functions inherited from MonolithicBlock
virtual void replace_bch (bchandlerPtr_Type &, UInt)
 replaces a BCHandler More...
 
virtual void applyBoundaryConditions (const Real &time)
 Applies the correspondent boundary conditions to every block. More...
 
virtual void resetBlocks ()
 resets the blocks (frees the shared pointers) More...
 
virtual void setComm (std::shared_ptr< Epetra_Comm > comm)
 sets the communicator More...
 
virtual void reset ()
 resets the blocks, boundary conditions, FE spaces. More...
 
virtual void setRobin (matrixPtr_Type &, vectorPtr_Type &)
 Applies the robin preconditioners. More...
 
void couplingMatrix (matrixPtr_Type &bigMatrix, Int flag, const std::vector< fespacePtr_Type > &problem, const std::vector< UInt > &offset, const std::map< ID, ID > &locDofMap, const vectorPtr_Type &numerationInterface, const Real &timeStep=1.e-3, const Real &value=1., const Real &coefficient=1., const Real &rescaleFactor=1.)
 builds the coupling matrix. More...
 
void setConditions (std::vector< bchandlerPtr_Type > &vec)
 sets the vector of raw pointer to the BCHandler More...
 
void setSpaces (std::vector< fespacePtr_Type > &vec)
 sets the vector of raw pointer to the FESpaces More...
 
void setOffsets (UInt blocks,...)
 sets the vector of raw pointer to the offsets of the different blocks More...
 
void robinCoupling (MonolithicBlock::matrixPtr_Type &matrix, Real &alphaf, Real &alphas, UInt coupling, const MonolithicBlock::fespacePtr_Type &FESpace1, const UInt &offset1, const MonolithicBlock::fespacePtr_Type &FESpace2, const UInt &offset2, const std::map< ID, ID > &locDofMap, const MonolithicBlock::vectorPtr_Type &numerationInterface)
 computes the Robin coupling matrix More...
 
virtual void addToBlock (const matrixPtr_Type &Mat, UInt position)
 
virtual void push_back_oper (MonolithicBlock &Oper)
 Pushes a new block. More...
 
 MonolithicBlock ()
 Empty Constructor. More...
 
virtual ~MonolithicBlock ()
 Destructor. More...
 
virtual void setupSolver (solver_Type &, const GetPot &)
 Sets the parameters needed by the preconditioner from data file. More...
 
virtual void replace_precs (const epetraOperatorPtr_Type &, UInt)
 replace a block preconditioner More...
 
virtual void push_back_precs (const epetraOperatorPtr_Type &)
 pushes back a block preconditioner More...
 
const std::vector< matrixPtr_Type > & blockVector ()
 returns the vector of pointers to the blocks (by const reference). More...
 
const std::vector< bchandlerPtr_Type > & BChVector ()
 returns the vector of pointers to the BCHandlers (by const reference). More...
 
const std::vector< fespacePtr_Type > & FESpaceVector ()
 returns the vector of pointers to the FE spaces (by const reference). More...
 
const std::vector< UInt > & offsetVector ()
 returns the vector of the offsets (by const reference). More...
 
- Protected Member Functions inherited from MonolithicBlockComposed
void blockAssembling (const UInt k)
 sums the coupling matrix in the specified position with the corresponding block More...
 
virtual void swap (const UInt i, const UInt j)
 swaps the blocks More...
 
- Protected Member Functions inherited from MonolithicBlock
template<typename Operator >
void swap (std::shared_ptr< Operator > &operFrom, std::shared_ptr< Operator > &OperTo)
 swaps two std::shared_ptr. The tamplate argument of the shared_ptr is templated More...
 
template<typename Operator >
void insert (std::vector< Operator > &operFrom, std::vector< Operator > &OperTo)
 swaps two std::shared_ptr. The tamplate argument of the shared_ptr is templated More...
 
- Protected Attributes inherited from MonolithicBlockComposed
std::vector< bool > M_recompute
 vector of flags saying if the matrix is to be recomputed every time More...
 
std::vector< matrixPtr_TypeM_coupling
 vector of coupling matrices More...
 
std::unique_ptr< std::vector< Int > > M_couplingFlags
 vector of flags specifying the coupling strategy for each block. More...
 
std::unique_ptr< std::vector< Int > > M_blockReordering
 vector of reordering for the different blocks. More...
 
- Protected Attributes inherited from MonolithicBlock
std::vector< bchandlerPtr_TypeM_bch
 
std::vector< matrixPtr_TypeM_blocks
 
std::vector< fespacePtr_TypeM_FESpace
 
std::vector< UIntM_offset
 
vectorPtr_Type M_numerationInterface
 
std::shared_ptr< Epetra_Comm > M_comm
 

Detailed Description

MonolithicBlockComposedNN - Short description of the class.

Author
Paolo Crosetto

Class implementing a Neumann-Neumann composed preconditioner of the following type: given the matrix $A=A_1A_2+A_3A_4\approx P_1P_2+P_3P_4$ then we compute the preconditioner $P^1=P_4^{-1}P_3^{-1}+P_2^{-1}P_1^{-1}$. In particular in this case we use for $A_1$ and $A_2$ Dirichlet problems, for $A_3$ and $A_4$ Neumann problems.

Notice that if $P^{-1}=(2A)^{-1}+(2A)^{-1}=A^{-1}$. Thus the factors that we push_back in the preconditioners should be as close as possible to $2A$

Definition at line 56 of file MonolithicBlockComposedNN.hpp.

Member Typedef Documentation

◆ super_Type

◆ composed_prec

typedef ComposedOperator<Ifpack_Preconditioner> composed_prec

Definition at line 62 of file MonolithicBlockComposedNN.hpp.

Member Enumeration Documentation

◆ Block

enum Block
Enumerator
solid1 
fluid1 
solid2 
fluid2 

Definition at line 60 of file MonolithicBlockComposedNN.hpp.

Constructor & Destructor Documentation

◆ MonolithicBlockComposedNN()

MonolithicBlockComposedNN ( const std::vector< Int > &  flag,
const std::vector< Int > &  order 
)
inline

Empty Constructor.

Definition at line 69 of file MonolithicBlockComposedNN.hpp.

◆ ~MonolithicBlockComposedNN()

Destructor.

Definition at line 77 of file MonolithicBlockComposedNN.hpp.

Member Function Documentation

◆ setDataFromGetPot()

void setDataFromGetPot ( const GetPot data,
const std::string &  section 
)
virtual

Sets the parameters needed by the preconditioner from data file (creates the Ifpack list)

Parameters
dataGetPot object reading the text data file
sectionstring specifying the path in the data file where to find the options for the operator

Implements MonolithicBlockComposed.

Definition at line 138 of file MonolithicBlockComposedNN.cpp.

◆ solveSystem()

int solveSystem ( const vector_Type rhs,
vector_Type step,
solverPtr_Type linearSolver 
)
virtual

Solves the preconditioned linear system (used only when dealing with a preconditioner)

Public Methods.

Provided the linear solver and the right hand side this method computes the preconditioners, builds the composed operator (of type ComposedOperator) and solves the preconditioned linear system.

Parameters
rhsright hand side of the linear system
resultoutput result
linearSolverthe linear system

Implements MonolithicBlockComposed.

Definition at line 41 of file MonolithicBlockComposedNN.cpp.

◆ coupler()

void coupler ( mapPtr_Type map,
const std::map< ID, ID > &  locDofMap,
const vectorPtr_Type numerationInterface,
const Real timeStep,
const Real coefficient,
const Real rescaleFactor 
)
virtual

Computes the coupling.

computes all the coupling blocks specific for the chosen preconditioner. The coupling is handled through an augmented formulation, introducing new variables (multipliers). Needs as input: the global map of the problem, the FESpaces of the subproblems to be coupled with their offsets, a std::map holding the two numerations of the interface between the two subproblems (the numeration can be different but the nodes must be matching in each subdomain), an EpetraVector defined on the multipliers map containing the corresponding dof at the interface (NB: the multipliers map should be constructed from the second numeration in the std::map). Note that the FESpaces and the offsets have to be set before calling this method.

Parameters
mapthe map of the global problem
locDofMapstd::map with the correspondence between the interface dofs for the two different maps in the subproblems
numerationInterfacevector containing the correspondence of the Lagrange multipliers with the interface dofs

Implements MonolithicBlock.

Definition at line 143 of file MonolithicBlockComposedNN.cpp.

◆ applyBoundaryConditions()

void applyBoundaryConditions ( const Real time,
const UInt  i 
)
virtual

Applies the correspondent boundary conditions to every block.

note that this method must be called after blockAssembling(), that sums the coupling conditions to the blocks. For this type of preconditioners this method is overloaded. In fact in the diagonalization for the essential boundary conditions the value replaced on the diagonal must be 2 instead of 1.

Parameters
timetime

Reimplemented from MonolithicBlock.

Definition at line 193 of file MonolithicBlockComposedNN.cpp.

◆ push_back_matrix()

void push_back_matrix ( const matrixPtr_Type Mat,
const bool  recompute 
)
virtual

Multiplies the block times 2 and calls super_Type::push_back_matrix(...)

Parameters
Matblock matrix
recomputeflag stating if the matrix need to be recomputed

Reimplemented from MonolithicBlockComposed.

Definition at line 205 of file MonolithicBlockComposedNN.cpp.

◆ replace_matrix()

void replace_matrix ( const matrixPtr_Type oper,
UInt  position 
)
virtual

Multiplies the block times 2 and calls super_Type::replace_matrix(...) in the position "position" specified in input and in the shifted position "position"+2

Parameters
operinput matrix
positionposition

Reimplemented from MonolithicBlockComposed.

Definition at line 214 of file MonolithicBlockComposedNN.cpp.

◆ set()

bool set ( )
inlinevirtual

returns true if the operator is set

returns the length of the vector M_blocks

Implements MonolithicBlockComposed.

Definition at line 148 of file MonolithicBlockComposedNN.hpp.

◆ createComposedNN()

static MonolithicBlock* createComposedNN ( )
inlinestatic

Definition at line 158 of file MonolithicBlockComposedNN.hpp.

Field Documentation

◆ M_blockPrecs

std::shared_ptr<ComposedOperator<ComposedOperator<Ifpack_Preconditioner> > > M_blockPrecs
protected

Definition at line 175 of file MonolithicBlockComposedNN.hpp.

◆ M_list

Teuchos::ParameterList M_list
protected

Definition at line 176 of file MonolithicBlockComposedNN.hpp.

◆ M_prec

std::vector<std::shared_ptr<Ifpack_Preconditioner> > M_prec
protected

Definition at line 177 of file MonolithicBlockComposedNN.hpp.

◆ M_firstCompPrec

std::shared_ptr< composed_prec > M_firstCompPrec
private

Definition at line 186 of file MonolithicBlockComposedNN.hpp.

◆ M_secondCompPrec

std::shared_ptr< composed_prec > M_secondCompPrec
private

Definition at line 187 of file MonolithicBlockComposedNN.hpp.

◆ M_matrixVector

std::vector<matrix_Type> M_matrixVector
private

Definition at line 189 of file MonolithicBlockComposedNN.hpp.

◆ M_overlapLevel

int M_overlapLevel
private

Definition at line 190 of file MonolithicBlockComposedNN.hpp.

◆ M_precType

std::string M_precType
private

Definition at line 191 of file MonolithicBlockComposedNN.hpp.

◆ M_factory

Ifpack M_factory
private

Definition at line 195 of file MonolithicBlockComposedNN.hpp.


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