Nektar++
|
A global linear system. More...
#include <GlobalLinSys.h>
Public Member Functions | |
GlobalLinSys (const GlobalLinSysKey &pKey, const boost::weak_ptr< ExpList > &pExpList, const boost::shared_ptr< AssemblyMap > &pLocToGloMap) | |
Constructor for full direct matrix solve. More... | |
virtual | ~GlobalLinSys () |
const GlobalLinSysKey & | GetKey (void) const |
Returns the key associated with the system. More... | |
const boost::weak_ptr< ExpList > & | GetLocMat (void) const |
void | InitObject () |
void | Initialise (const boost::shared_ptr< AssemblyMap > &pLocToGloMap) |
void | Solve (const Array< OneD, const NekDouble > &in, Array< OneD, NekDouble > &out, const AssemblyMapSharedPtr &locToGloMap, const Array< OneD, const NekDouble > &dirForcing=NullNekDouble1DArray) |
Solve the linear system for given input and output vectors using a specified local to global map. More... | |
boost::shared_ptr< GlobalLinSys > | GetSharedThisPtr () |
Returns a shared pointer to the current object. More... | |
int | GetNumBlocks () |
DNekScalMatSharedPtr | GetBlock (unsigned int n) |
DNekScalBlkMatSharedPtr | GetStaticCondBlock (unsigned int n) |
void | DropStaticCondBlock (unsigned int n) |
void | SolveLinearSystem (const int pNumRows, const Array< OneD, const NekDouble > &pInput, Array< OneD, NekDouble > &pOutput, const AssemblyMapSharedPtr &locToGloMap, const int pNumDir=0) |
Solve the linear system for given input and output vectors. More... | |
Protected Member Functions | |
virtual int | v_GetNumBlocks () |
Get the number of blocks in this system. More... | |
virtual DNekScalMatSharedPtr | v_GetBlock (unsigned int n) |
Retrieves the block matrix from n-th expansion using the matrix key provided by the m_linSysKey. More... | |
virtual DNekScalBlkMatSharedPtr | v_GetStaticCondBlock (unsigned int n) |
Retrieves a the static condensation block matrices from n-th expansion using the matrix key provided by the m_linSysKey. More... | |
virtual void | v_DropStaticCondBlock (unsigned int n) |
Releases the static condensation block matrices from NekManager of n-th expansion using the matrix key provided by the m_linSysKey. More... | |
PreconditionerSharedPtr | CreatePrecon (AssemblyMapSharedPtr asmMap) |
Create a preconditioner object from the parameters defined in the supplied assembly map. More... | |
Protected Attributes | |
const GlobalLinSysKey | m_linSysKey |
Key associated with this linear system. More... | |
const boost::weak_ptr< ExpList > | m_expList |
Local Matrix System. More... | |
const std::map< int, RobinBCInfoSharedPtr > | m_robinBCInfo |
Robin boundary info. More... | |
bool | m_verbose |
Private Member Functions | |
virtual void | v_Solve (const Array< OneD, const NekDouble > &in, Array< OneD, NekDouble > &out, const AssemblyMapSharedPtr &locToGloMap, const Array< OneD, const NekDouble > &dirForcing=NullNekDouble1DArray)=0 |
Solve a linear system based on mapping. More... | |
virtual void | v_SolveLinearSystem (const int pNumRows, const Array< OneD, const NekDouble > &pInput, Array< OneD, NekDouble > &pOutput, const AssemblyMapSharedPtr &locToGloMap, const int pNumDir)=0 |
Solve a basic matrix system. More... | |
virtual void | v_InitObject () |
virtual void | v_Initialise (const boost::shared_ptr< AssemblyMap > &pLocToGloMap) |
Static Private Attributes | |
static std::string | lookupIds [] |
static std::string | def |
A global linear system.
Consider the linear system . Distinguishing between the boundary and interior components of and using , and , respectively, this system can be split into its constituent parts as
where represents the components of resulting from boundary-boundary mode interactions, and represent the components resulting from coupling between the boundary-interior modes, and represents the components of resulting from interior-interior mode interactions.
The solution of the linear system can now be determined in two steps:
As the inverse of is
and the following operations can be evaluated as,
where is the permutation matrix which scatters from global to local degrees of freedom, only the following four matrices should be constructed:
The first three matrices are just a concatenation of the corresponding local matrices and they can be created as such. They also allow for an elemental evaluation of the operations concerned.
The global Schur complement however should be assembled from the concatenation of the local elemental Schur complements, that is,
and it is the only matrix operation that need to be evaluated on a global level when using static condensation. However, due to the size and sparsity of the matrix , it is more efficient to assemble the global Schur matrix using the mapping array bmap contained in the input argument locToGloMap. The global Schur complement is then constructed as:
All four matrices are stored in the GlobalLinSys returned by this function.
Definition at line 74 of file GlobalLinSys.h.
Nektar::MultiRegions::GlobalLinSys::GlobalLinSys | ( | const GlobalLinSysKey & | pKey, |
const boost::weak_ptr< ExpList > & | pExpList, | ||
const boost::shared_ptr< AssemblyMap > & | pLocToGloMap | ||
) |
Constructor for full direct matrix solve.
Given a block matrix, construct a global matrix system according to a local to global mapping. #m_linSys is constructed by AssembleFullMatrix().
pkey | Associated linear system key. |
locToGloMap | Local to global mapping. |
Definition at line 189 of file GlobalLinSys.cpp.
|
inlinevirtual |
Definition at line 84 of file GlobalLinSys.h.
|
protected |
Create a preconditioner object from the parameters defined in the supplied assembly map.
asmMap | Assembly map used to construct the global system. |
Definition at line 219 of file GlobalLinSys.cpp.
References Nektar::LibUtilities::NekFactory< tKey, tBase, >::CreateInstance(), Nektar::MultiRegions::GetPreconFactory(), GetSharedThisPtr(), and Nektar::MultiRegions::PreconditionerTypeMap.
Referenced by Nektar::MultiRegions::GlobalLinSysIterative::DoConjugateGradient(), Nektar::MultiRegions::GlobalLinSysPETScStaticCond::v_AssembleSchurComplement(), Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_AssembleSchurComplement(), Nektar::MultiRegions::GlobalLinSysPETScStaticCond::v_InitObject(), Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_InitObject(), Nektar::MultiRegions::GlobalLinSysPETScStaticCond::v_PreSolve(), Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_PreSolve(), and Nektar::MultiRegions::GlobalLinSysPETSc::v_SolveLinearSystem().
|
inline |
Definition at line 232 of file GlobalLinSys.h.
References v_DropStaticCondBlock().
|
inline |
Definition at line 222 of file GlobalLinSys.h.
References v_GetBlock().
Referenced by Nektar::MultiRegions::GlobalLinSysDirectFull::AssembleFullMatrix(), Nektar::MultiRegions::GlobalLinSysXxtFull::AssembleMatrixArrays(), and Nektar::MultiRegions::GlobalLinSysPETScFull::GlobalLinSysPETScFull().
|
inline |
Returns the key associated with the system.
Definition at line 171 of file GlobalLinSys.h.
References m_linSysKey.
|
inline |
Definition at line 179 of file GlobalLinSys.h.
References m_expList.
|
inline |
Definition at line 237 of file GlobalLinSys.h.
References v_GetNumBlocks().
|
inline |
Returns a shared pointer to the current object.
Definition at line 107 of file GlobalLinSys.h.
Referenced by CreatePrecon().
|
inline |
Definition at line 227 of file GlobalLinSys.h.
References v_GetStaticCondBlock().
|
inline |
Definition at line 216 of file GlobalLinSys.h.
References v_Initialise().
Referenced by Nektar::MultiRegions::GlobalLinSysPETScStaticCond::v_InitObject(), Nektar::MultiRegions::GlobalLinSysStaticCond::v_InitObject(), and Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_InitObject().
|
inline |
Definition at line 211 of file GlobalLinSys.h.
References v_InitObject().
|
inline |
Solve the linear system for given input and output vectors using a specified local to global map.
Definition at line 188 of file GlobalLinSys.h.
References v_Solve().
|
inline |
Solve the linear system for given input and output vectors.
Definition at line 201 of file GlobalLinSys.h.
References v_SolveLinearSystem().
Referenced by Nektar::MultiRegions::GlobalLinSysDirectFull::v_Solve(), Nektar::MultiRegions::GlobalLinSysXxtFull::v_Solve(), Nektar::MultiRegions::GlobalLinSysIterativeFull::v_Solve(), Nektar::MultiRegions::GlobalLinSysPETScFull::v_Solve(), and Nektar::MultiRegions::GlobalLinSysStaticCond::v_Solve().
|
protectedvirtual |
Releases the static condensation block matrices from NekManager of n-th expansion using the matrix key provided by the m_linSysKey.
n | Number of the expansion |
Definition at line 396 of file GlobalLinSys.cpp.
References Nektar::MultiRegions::GlobalMatrixKey::GetConstFactors(), Nektar::MultiRegions::GlobalMatrixKey::GetMatrixType(), Nektar::MultiRegions::GlobalMatrixKey::GetNVarCoeffs(), Nektar::MultiRegions::GlobalMatrixKey::GetVarCoeffs(), m_expList, and m_linSysKey.
Referenced by DropStaticCondBlock(), and Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::PrepareLocalSchurComplement().
|
protectedvirtual |
Retrieves the block matrix from n-th expansion using the matrix key provided by the m_linSysKey.
n | Number of the expansion. |
Definition at line 246 of file GlobalLinSys.cpp.
References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), Nektar::MultiRegions::GlobalMatrixKey::GetConstFactors(), Nektar::MultiRegions::GlobalMatrixKey::GetMatrixType(), Nektar::MultiRegions::GlobalMatrixKey::GetNVarCoeffs(), Nektar::MultiRegions::GlobalMatrixKey::GetVarCoeffs(), m_expList, m_linSysKey, and m_robinBCInfo.
Referenced by GetBlock(), and Nektar::MultiRegions::GlobalLinSysStaticCond::SetupTopLevel().
|
protectedvirtual |
Get the number of blocks in this system.
At the top level this corresponds to the number of elements in the expansion list.
Reimplemented in Nektar::MultiRegions::GlobalLinSysStaticCond.
Definition at line 234 of file GlobalLinSys.cpp.
References m_expList.
Referenced by GetNumBlocks().
|
protectedvirtual |
Retrieves a the static condensation block matrices from n-th expansion using the matrix key provided by the m_linSysKey.
n | Number of the expansion |
Reimplemented in Nektar::MultiRegions::GlobalLinSysIterativeStaticCond, and Nektar::MultiRegions::GlobalLinSysPETScStaticCond.
Definition at line 316 of file GlobalLinSys.cpp.
References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), Nektar::MultiRegions::GlobalMatrixKey::GetConstFactors(), Nektar::MultiRegions::GlobalMatrixKey::GetMatrixType(), Nektar::MultiRegions::GlobalMatrixKey::GetNVarCoeffs(), Nektar::MultiRegions::GlobalMatrixKey::GetVarCoeffs(), m_expList, m_linSysKey, and m_robinBCInfo.
Referenced by GetStaticCondBlock(), and Nektar::MultiRegions::GlobalLinSysStaticCond::SetupTopLevel().
|
privatevirtual |
Reimplemented in Nektar::MultiRegions::GlobalLinSysStaticCond.
Definition at line 432 of file GlobalLinSys.cpp.
References ErrorUtil::efatal, and NEKERROR.
Referenced by Initialise().
|
privatevirtual |
Reimplemented in Nektar::MultiRegions::GlobalLinSysIterativeStaticCond, Nektar::MultiRegions::GlobalLinSysStaticCond, and Nektar::MultiRegions::GlobalLinSysPETScStaticCond.
Definition at line 427 of file GlobalLinSys.cpp.
References ErrorUtil::efatal, and NEKERROR.
Referenced by InitObject().
|
privatepure virtual |
Solve a linear system based on mapping.
Implemented in Nektar::MultiRegions::GlobalLinSysStaticCond, Nektar::MultiRegions::GlobalLinSysPETScFull, Nektar::MultiRegions::GlobalLinSysIterativeFull, Nektar::MultiRegions::GlobalLinSysXxtFull, and Nektar::MultiRegions::GlobalLinSysDirectFull.
Referenced by Solve().
|
privatepure virtual |
Solve a basic matrix system.
Implemented in Nektar::MultiRegions::GlobalLinSysIterative, Nektar::MultiRegions::GlobalLinSysPETSc, Nektar::MultiRegions::GlobalLinSysDirect, and Nektar::MultiRegions::GlobalLinSysXxt.
Referenced by SolveLinearSystem().
|
staticprivate |
Definition at line 164 of file GlobalLinSys.h.
|
staticprivate |
Definition at line 163 of file GlobalLinSys.h.
|
protected |
Local Matrix System.
Definition at line 129 of file GlobalLinSys.h.
Referenced by Nektar::MultiRegions::GlobalLinSysDirectFull::AssembleFullMatrix(), Nektar::MultiRegions::GlobalLinSysXxtFull::AssembleMatrixArrays(), Nektar::MultiRegions::GlobalLinSysIterative::CalculateAnorm(), Nektar::MultiRegions::GlobalLinSysPETSc::CalculateReordering(), Nektar::MultiRegions::GlobalLinSysStaticCond::ConstructNextLevelCondensedSystem(), Nektar::MultiRegions::GlobalLinSysIterative::DoAconjugateProjection(), Nektar::MultiRegions::GlobalLinSysIterative::DoConjugateGradient(), GetLocMat(), Nektar::MultiRegions::GlobalLinSysIterative::GlobalLinSysIterative(), Nektar::MultiRegions::GlobalLinSysPETScFull::GlobalLinSysPETScFull(), Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::PrepareLocalSchurComplement(), Nektar::MultiRegions::GlobalLinSysIterative::Set_Rhs_Magnitude(), Nektar::MultiRegions::GlobalLinSysStaticCond::SetupTopLevel(), Nektar::MultiRegions::GlobalLinSysIterative::UpdateKnownSolutions(), Nektar::MultiRegions::GlobalLinSysXxtStaticCond::v_AssembleSchurComplement(), Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_AssembleSchurComplement(), Nektar::MultiRegions::GlobalLinSysPETScFull::v_DoMatrixMultiply(), Nektar::MultiRegions::GlobalLinSysIterativeFull::v_DoMatrixMultiply(), Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_DoMatrixMultiply(), v_DropStaticCondBlock(), v_GetBlock(), v_GetNumBlocks(), v_GetStaticCondBlock(), Nektar::MultiRegions::GlobalLinSysPETScStaticCond::v_InitObject(), Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_InitObject(), Nektar::MultiRegions::GlobalLinSysDirectFull::v_Solve(), Nektar::MultiRegions::GlobalLinSysXxtFull::v_Solve(), Nektar::MultiRegions::GlobalLinSysIterativeFull::v_Solve(), and Nektar::MultiRegions::GlobalLinSysPETScFull::v_Solve().
|
protected |
Key associated with this linear system.
Definition at line 127 of file GlobalLinSys.h.
Referenced by Nektar::MultiRegions::GlobalLinSysDirectFull::AssembleFullMatrix(), Nektar::MultiRegions::GlobalLinSysXxtFull::AssembleMatrixArrays(), Nektar::MultiRegions::GlobalLinSysStaticCond::ConstructNextLevelCondensedSystem(), Nektar::MultiRegions::GlobalLinSysDirectStaticCond::DetermineMatrixStorage(), GetKey(), Nektar::MultiRegions::GlobalLinSysDirectFull::GlobalLinSysDirectFull(), Nektar::MultiRegions::GlobalLinSysIterativeFull::GlobalLinSysIterativeFull(), Nektar::MultiRegions::GlobalLinSysXxtFull::GlobalLinSysXxtFull(), Nektar::MultiRegions::GlobalLinSysStaticCond::SetupTopLevel(), Nektar::MultiRegions::GlobalLinSysPETScStaticCond::v_AssembleSchurComplement(), Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_AssembleSchurComplement(), Nektar::MultiRegions::GlobalLinSysPETScFull::v_DoMatrixMultiply(), Nektar::MultiRegions::GlobalLinSysIterativeFull::v_DoMatrixMultiply(), Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_DoMatrixMultiply(), v_DropStaticCondBlock(), v_GetBlock(), v_GetStaticCondBlock(), Nektar::MultiRegions::GlobalLinSysPETScStaticCond::v_InitObject(), Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_InitObject(), Nektar::MultiRegions::GlobalLinSysDirectFull::v_Solve(), Nektar::MultiRegions::GlobalLinSysXxtFull::v_Solve(), Nektar::MultiRegions::GlobalLinSysIterativeFull::v_Solve(), and Nektar::MultiRegions::GlobalLinSysPETScFull::v_Solve().
|
protected |
Robin boundary info.
Definition at line 131 of file GlobalLinSys.h.
Referenced by v_GetBlock(), and v_GetStaticCondBlock().
|
protected |