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... | |
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 217 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 230 of file GlobalLinSys.h.
References v_DropStaticCondBlock().
|
inline |
Definition at line 220 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 169 of file GlobalLinSys.h.
References m_linSysKey.
|
inline |
Definition at line 177 of file GlobalLinSys.h.
References m_expList.
|
inline |
Definition at line 235 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 225 of file GlobalLinSys.h.
References v_GetStaticCondBlock().
|
inline |
Definition at line 214 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 209 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 186 of file GlobalLinSys.h.
References v_Solve().
|
inline |
Solve the linear system for given input and output vectors.
Definition at line 199 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 394 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 244 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 232 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 314 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 430 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 425 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 162 of file GlobalLinSys.h.
|
staticprivate |
Definition at line 161 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().