LifeV
MonolithicBlockMatrixRN Class Reference

MonolithicBlockMatrixRN - class for handling a 2-blocks matrix with Robin-Neumann coupling. More...

#include <MonolithicBlockMatrixRN.hpp>

+ Inheritance diagram for MonolithicBlockMatrixRN:
+ Collaboration diagram for MonolithicBlockMatrixRN:

Public Types

typedef MonolithicBlockMatrix super_Type
 
typedef MonolithicRobinInterface superRobin
 

Constructor & Destructor

 MonolithicBlockMatrixRN (const std::vector< Int > &flags)
 Empty Constructor. More...
 
 ~MonolithicBlockMatrixRN ()
 Destructor. More...
 

Public methods

void setDataFromGetPot (const GetPot &data, const std::string &section)
 sets the data relative to Robin (e.g. the coefficients $\alpha_f$ and $\alpha_s$). More...
 
void GlobalAssemble ()
 Adds to the r.h.s. the part due to the Robin Coupling and runs MonolithicBlockMatrix::GlobalAssemble() 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 couplingFlag)
 Computes the specific coupling for a block. 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)
 Computes the coupling. More...
 
void blockAssembling ()
 Sums all the blocks and the couplings into the system matrix, adds the robin coupling part. More...
 
void setRobin (matrixPtr_Type &matrix, vectorPtr_Type &vec)
 sets the matrix where the Robin contribution will be assembled (which have to passed from outside) and the More...
 
void setRobin (matrixPtr_Type &matrix)
 sets the matrix where the Robin contribution will be assembled More...
 

Factory Method

static MonolithicBlockMatrixcreateAdditiveSchwarzRN ()
 

Additional Inherited Members

- Public Types inherited from MonolithicBlockMatrix
typedef MonolithicBlock super_Type
 
typedef super_Type::fespacePtr_Type fespacePtr_Type
 
typedef super_Type::vector_Type vector_Type
 
typedef super_Type::vectorPtr_Type vectorPtr_Type
 
typedef super_Type::solverPtr_Type solverPtr_Type
 
typedef super_Type::matrix_Type matrix_Type
 
typedef super_Type::matrixPtr_Type matrixPtr_Type
 
typedef super_Type::epetraOperatorPtr_Type epetraOperatorPtr_Type
 
typedef super_Type::mapPtr_Type mapPtr_Type
 
typedef FactorySingleton< Factory< MonolithicBlockMatrix, std::string > > Factory_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
 
- Public Member Functions inherited from MonolithicBlockMatrix
 MonolithicBlockMatrix (const std::vector< Int > &flags)
 
 ~MonolithicBlockMatrix ()
 
virtual void setupSolver (solver_Type &solver, const GetPot &data)
 Sets the parameters needed by the preconditioner from data file. More...
 
virtual bool set ()
 returns true if the operator has at least one block More...
 
int solveSystem (const vector_Type &rhs, vector_Type &step, solverPtr_Type &linearSolver)
 Solves the preconditioned linear system (used only when blockMatrix is used as a preconditioner) More...
 
void push_back_matrix (const matrixPtr_Type &Mat, bool)
 pushes a block at the end of the vector More...
 
void replace_matrix (const matrixPtr_Type &Mat, UInt index)
 replaces a block More...
 
void replace_coupling (const matrixPtr_Type &, UInt)
 replaces the coupling matrix without copies More...
 
void replace_precs (const epetraOperatorPtr_Type &Mat, UInt index)
 never used within this class More...
 
matrixPtr_Typematrix ()
 returns the global matrix, with all the blocks and the coupling parts More...
 
void applyPreconditioner (matrixPtr_Type robinCoupling, matrixPtr_Type prec, vectorPtr_Type &rhs)
 multiplies the whole system times a matrix More...
 
void applyPreconditioner (const matrixPtr_Type robinCoupling, matrixPtr_Type &prec)
 multiplies two matrices More...
 
void applyPreconditioner (const matrixPtr_Type matrix, vectorPtr_Type &rhsFull)
 applies a matrix to the system More...
 
void createInterfaceMap (const MapEpetra &interfaceMap, const std::map< ID, ID > &locDofMap, const UInt subdomainMaxId, const std::shared_ptr< Epetra_Comm > epetraWorldComm)
 creates the map for the coupling More...
 
void applyBoundaryConditions (const Real &time)
 applies the b.c. to every block More...
 
void applyBoundaryConditions (const Real &time, const UInt block)
 applies the b.c. to a specific block More...
 
void applyBoundaryConditions (const Real &time, vectorPtr_Type &rhs)
 applies all the b.c.s to the global matrix, updates the rhs More...
 
void applyBoundaryConditions (const Real &time, vectorPtr_Type &rhs, const UInt block)
 applies the b.c. to the a specific block, updates the rhs More...
 
void addToCoupling (const matrixPtr_Type &Mat, UInt)
 adds a block to the coupling matrix More...
 
void addToCoupling (const Real &entry, UInt row, UInt col, UInt position)
 
void addToGlobalMatrix (const matrixPtr_Type &Mat)
 adds a block to the coupling matrix More...
 
void push_back_coupling (matrixPtr_Type &coupling)
 adds a coupling block to the coupling matrix More...
 
UInt interface ()
 returns the dimension of the interface More...
 
mapPtr_Type interfaceMap () const
 returns the map built for theLagrange multipliers More...
 
matrixPtr_Type coupling () const
 
void numerationInterface (vectorPtr_Type &numeration)
 returns the numeration of the interface More...
 
const UInt whereIsBlock (UInt) const
 
- Public Member Functions inherited from MonolithicBlock
virtual void replace_bch (bchandlerPtr_Type &, UInt)
 replaces a BCHandler 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...
 
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 setRecompute (UInt, bool)
 If not present in the derived class it must not be called (gives an assertion fail) 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...
 
- Static Public Member Functions inherited from MonolithicBlockMatrix
static MonolithicBlockMatrixcreateAdditiveSchwarz ()
 
- Protected Member Functions inherited from MonolithicBlock
virtual void blockAssembling (const UInt)
 sums the coupling matrix in the specified position with the corresponding block More...
 
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 MonolithicBlockMatrix
matrixPtr_Type M_globalMatrix
 
matrixPtr_Type M_coupling
 
mapPtr_Type M_interfaceMap
 
UInt M_interface
 
- 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
 
- Private Member Functions inherited from MonolithicRobinInterface
 MonolithicRobinInterface ()
 
 ~MonolithicRobinInterface ()
 
void setRobinData (const GetPot &data, const std::string &section)
 method to set the data relative to the Robin coupling from GetPot More...
 
void setRobinMatrix (MonolithicBlock::matrixPtr_Type &robinMatrix)
 method to initialize the pointer to the robin coupling part of the matrix More...
 
void setRobinRhs (MonolithicBlock::vectorPtr_Type &vec)
 method to initialize the pointer to the robin RHS More...
 
void applyRobinCoupling (std::vector< MonolithicBlock::matrixPtr_Type > blockVector)
 method to apply the robin coupling to the blocks. More...
 
void applyRobinCoupling (MonolithicBlock::matrixPtr_Type firstBlock)
 
- Private Attributes inherited from MonolithicRobinInterface
Real M_alphaf
 
Real M_alphas
 
MonolithicBlock::matrixPtr_Type M_robinCoupling
 
MonolithicBlock::matrixPtr_Type M_robinPart
 
MonolithicBlock::vectorPtr_Type M_rhsVec
 

Detailed Description

MonolithicBlockMatrixRN - class for handling a 2-blocks matrix with Robin-Neumann coupling.

Author
Paolo Crosetto

This class derives both from MonolithicBlock, which is the base class for the block operators, and from MonolithicRobinInterface, which is a class holding some general methods and attributes for the robin coupling.

NOTE: this class has been tested for both the GE and GI time discretizations (method = monolithicGE and method = monolithicGI). NOTE: as the same block matrices are shared between the system matrix and the preconditioner, the preconditioner choices available are in principle automatically adapted to the RN case. The preconditioners tested for this case are the modular composedDN and the algebraic additive Schwarz AdditiveSchwarz.

Definition at line 63 of file MonolithicBlockMatrixRN.hpp.

Member Typedef Documentation

◆ super_Type

Definition at line 69 of file MonolithicBlockMatrixRN.hpp.

◆ superRobin

Constructor & Destructor Documentation

◆ MonolithicBlockMatrixRN()

MonolithicBlockMatrixRN ( const std::vector< Int > &  flags)
inline

Empty Constructor.

Definition at line 78 of file MonolithicBlockMatrixRN.hpp.

◆ ~MonolithicBlockMatrixRN()

Destructor.

Definition at line 84 of file MonolithicBlockMatrixRN.hpp.

Member Function Documentation

◆ setDataFromGetPot()

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

sets the data relative to Robin (e.g. the coefficients $\alpha_f$ and $\alpha_s$).

Public Methods.

Reimplemented from MonolithicBlockMatrix.

Definition at line 41 of file MonolithicBlockMatrixRN.cpp.

◆ GlobalAssemble()

void GlobalAssemble ( )
virtual

Adds to the r.h.s. the part due to the Robin Coupling and runs MonolithicBlockMatrix::GlobalAssemble()

Reimplemented from MonolithicBlockMatrix.

Definition at line 73 of file MonolithicBlockMatrixRN.cpp.

◆ coupler() [1/2]

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  couplingFlag 
)
virtual

Computes the specific coupling for a block.

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
timeStepthe time step
coefficientcoefficient, usually is the term multiplying the mass in the time discretization
couplingFlaginteger parameter identifying which block is coupled with which. See the method 'couplingMatrix' in
See also
MonolithicBlock class for a more detailed explanation.

Reimplemented from MonolithicBlockMatrix.

Definition at line 47 of file MonolithicBlockMatrixRN.cpp.

◆ coupler() [2/2]

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.

Reimplemented from MonolithicBlockMatrix.

Definition at line 59 of file MonolithicBlockMatrixRN.cpp.

◆ blockAssembling()

void blockAssembling ( )
virtual

Sums all the blocks and the couplings into the system matrix, adds the robin coupling part.

Reimplemented from MonolithicBlockMatrix.

Definition at line 80 of file MonolithicBlockMatrixRN.cpp.

◆ setRobin() [1/2]

void setRobin ( matrixPtr_Type matrix,
vectorPtr_Type vec 
)
inlinevirtual

sets the matrix where the Robin contribution will be assembled (which have to passed from outside) and the

right hand side vector of the linear system, which will be updated with the Robin part.

Reimplemented from MonolithicBlock.

Definition at line 136 of file MonolithicBlockMatrixRN.hpp.

◆ setRobin() [2/2]

void setRobin ( matrixPtr_Type matrix)
inline

sets the matrix where the Robin contribution will be assembled

Definition at line 143 of file MonolithicBlockMatrixRN.hpp.

◆ createAdditiveSchwarzRN()

static MonolithicBlockMatrix* createAdditiveSchwarzRN ( )
inlinestatic

Definition at line 152 of file MonolithicBlockMatrixRN.hpp.


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