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. | |
virtual | ~GlobalLinSys () |
const GlobalLinSysKey & | GetKey (void) const |
Returns the key associated with the system. | |
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. | |
boost::shared_ptr< GlobalLinSys > | GetSharedThisPtr () |
Returns a shared pointer to the current object. | |
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. |
Protected Member Functions | |
virtual int | v_GetNumBlocks () |
Get the number of blocks in this system. | |
virtual DNekScalMatSharedPtr | v_GetBlock (unsigned int n) |
Retrieves the block matrix from n-th expansion using the matrix key provided by the m_linSysKey. | |
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. | |
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. |
Protected Attributes | |
const GlobalLinSysKey | m_linSysKey |
Key associated with this linear system. | |
const boost::weak_ptr< ExpList > | m_expList |
Local Matrix System. | |
const map< int, RobinBCInfoSharedPtr > | m_robinBCInfo |
Robin boundary info. |
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. | |
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. | |
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 70 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 188 of file GlobalLinSys.cpp.
|
inlinevirtual |
Definition at line 80 of file GlobalLinSys.h.
|
inline |
Definition at line 224 of file GlobalLinSys.h.
References v_DropStaticCondBlock().
|
inline |
Definition at line 214 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 163 of file GlobalLinSys.h.
References m_linSysKey.
|
inline |
Definition at line 229 of file GlobalLinSys.h.
References v_GetNumBlocks().
|
inline |
Returns a shared pointer to the current object.
Definition at line 103 of file GlobalLinSys.h.
Referenced by Nektar::MultiRegions::GlobalLinSysIterative::DoConjugateGradient(), Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_AssembleSchurComplement(), and Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_InitObject().
|
inline |
Definition at line 219 of file GlobalLinSys.h.
References v_GetStaticCondBlock().
|
inline |
Definition at line 208 of file GlobalLinSys.h.
References v_Initialise().
Referenced by Nektar::MultiRegions::GlobalLinSysStaticCond::v_InitObject(), and Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_InitObject().
|
inline |
|
inline |
Solve the linear system for given input and output vectors using a specified local to global map.
Definition at line 180 of file GlobalLinSys.h.
References v_Solve().
Referenced by Nektar::MultiRegions::GlobalLinSysXxt::v_SolveLinearSystem().
|
inline |
Solve the linear system for given input and output vectors.
Definition at line 193 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 367 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 227 of file GlobalLinSys.cpp.
References 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 215 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.
Definition at line 297 of file GlobalLinSys.cpp.
References 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 403 of file GlobalLinSys.cpp.
References ErrorUtil::efatal, and NEKERROR.
Referenced by Initialise().
|
privatevirtual |
Reimplemented in Nektar::MultiRegions::GlobalLinSysStaticCond.
Definition at line 398 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.
Referenced by Solve().
|
privatepure virtual |
Solve a basic matrix system.
Implemented in Nektar::MultiRegions::GlobalLinSysDirect, Nektar::MultiRegions::GlobalLinSysPETSc, and Nektar::MultiRegions::GlobalLinSysXxt.
Referenced by SolveLinearSystem().
|
staticprivate |
Definition at line 156 of file GlobalLinSys.h.
|
staticprivate |
Definition at line 155 of file GlobalLinSys.h.
|
protected |
Local Matrix System.
Definition at line 125 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::GlobalLinSysIterativeFull::v_DoMatrixMultiply(), Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_DoMatrixMultiply(), v_DropStaticCondBlock(), v_GetBlock(), v_GetNumBlocks(), v_GetStaticCondBlock(), 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 123 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::GlobalLinSysPETScFull::GlobalLinSysPETScFull(), Nektar::MultiRegions::GlobalLinSysXxtFull::GlobalLinSysXxtFull(), Nektar::MultiRegions::GlobalLinSysStaticCond::SetupTopLevel(), Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_AssembleSchurComplement(), Nektar::MultiRegions::GlobalLinSysIterativeFull::v_DoMatrixMultiply(), Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_DoMatrixMultiply(), v_DropStaticCondBlock(), v_GetBlock(), v_GetStaticCondBlock(), 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 127 of file GlobalLinSys.h.
Referenced by v_GetBlock(), and v_GetStaticCondBlock().