Nektar++
|
A global linear system. More...
#include <GlobalLinSysPETScStaticCond.h>
Public Member Functions | |
GlobalLinSysPETScStaticCond (const GlobalLinSysKey &mkey, const std::weak_ptr< ExpList > &pExpList, const std::shared_ptr< AssemblyMap > &locToGloMap) | |
Constructor for full direct matrix solve. More... | |
GlobalLinSysPETScStaticCond (const GlobalLinSysKey &mkey, const std::weak_ptr< ExpList > &pExpList, const DNekScalBlkMatSharedPtr pSchurCompl, const DNekScalBlkMatSharedPtr pBinvD, const DNekScalBlkMatSharedPtr pC, const DNekScalBlkMatSharedPtr pInvD, const std::shared_ptr< AssemblyMap > &locToGloMap, const PreconditionerSharedPtr pPrecon=PreconditionerSharedPtr()) | |
Constructor for full direct matrix solve. More... | |
~GlobalLinSysPETScStaticCond () override | |
Public Member Functions inherited from Nektar::MultiRegions::GlobalLinSysPETSc | |
GlobalLinSysPETSc (const GlobalLinSysKey &pKey, const std::weak_ptr< ExpList > &pExp, const std::shared_ptr< AssemblyMap > &pLocToGloMap) | |
Constructor for full direct matrix solve. More... | |
~GlobalLinSysPETSc () override | |
Clean up PETSc objects. More... | |
Public Member Functions inherited from Nektar::MultiRegions::GlobalLinSys | |
GlobalLinSys (const GlobalLinSysKey &pKey, const std::weak_ptr< ExpList > &pExpList, const std::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 std::weak_ptr< ExpList > & | GetLocMat (void) const |
void | InitObject () |
void | Initialise (const std::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... | |
std::shared_ptr< GlobalLinSys > | GetSharedThisPtr () |
Returns a shared pointer to the current object. More... | |
int | GetNumBlocks () |
DNekScalMatSharedPtr | GetBlock (unsigned int n) |
void | DropBlock (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... | |
Public Member Functions inherited from Nektar::MultiRegions::GlobalLinSysStaticCond | |
GlobalLinSysStaticCond (const GlobalLinSysKey &mkey, const std::weak_ptr< ExpList > &pExpList, const std::shared_ptr< AssemblyMap > &locToGloMap) | |
Constructor for full direct matrix solve. More... | |
~GlobalLinSysStaticCond () override | |
Static Public Member Functions | |
static GlobalLinSysSharedPtr | create (const GlobalLinSysKey &pLinSysKey, const std::weak_ptr< ExpList > &pExpList, const std::shared_ptr< AssemblyMap > &pLocToGloMap) |
Creates an instance of this class. More... | |
Static Public Attributes | |
static std::string | className |
Name of class. More... | |
static std::string | className2 |
Protected Member Functions | |
void | v_InitObject () override |
void | v_AssembleSchurComplement (std::shared_ptr< AssemblyMap > locToGloMap) override |
Assemble the Schur complement matrix. More... | |
void | v_DoMatrixMultiply (const Array< OneD, const NekDouble > &input, Array< OneD, NekDouble > &output) override |
Apply matrix-vector multiplication using local approach and the assembly map. More... | |
DNekScalBlkMatSharedPtr | v_GetStaticCondBlock (unsigned int n) override |
Retrieves a the static condensation block matrices from n-th expansion using the matrix key provided by the m_linSysKey. More... | |
void | v_PreSolve (int scLevel, Array< OneD, NekDouble > &F_bBnd) override |
void | v_SolveLinearSystem (const int pNumRows, const Array< OneD, const NekDouble > &pInput, Array< OneD, NekDouble > &pOutput, const AssemblyMapSharedPtr &locToGloMap, const int pNumDir) override |
Solve linear system using PETSc. More... | |
void | v_BasisFwdTransform (Array< OneD, NekDouble > &pInOut) override |
void | v_CoeffsBwdTransform (Array< OneD, NekDouble > &pInOut) override |
void | v_CoeffsFwdTransform (const Array< OneD, NekDouble > &pInput, Array< OneD, NekDouble > &pOutput) override |
GlobalLinSysStaticCondSharedPtr | v_Recurse (const GlobalLinSysKey &mkey, const std::weak_ptr< ExpList > &pExpList, const DNekScalBlkMatSharedPtr pSchurCompl, const DNekScalBlkMatSharedPtr pBinvD, const DNekScalBlkMatSharedPtr pC, const DNekScalBlkMatSharedPtr pInvD, const std::shared_ptr< AssemblyMap > &locToGloMap) override |
Protected Member Functions inherited from Nektar::MultiRegions::GlobalLinSysPETSc | |
void | SetUpScatter () |
Set up PETSc local (equivalent to Nektar++ global) and global (equivalent to universal) scatter maps. More... | |
void | SetUpMatVec (int nGlobal, int nDir) |
Construct PETSc matrix and vector handles. More... | |
void | SetUpSolver (NekDouble tolerance) |
Set up KSP solver object. More... | |
void | CalculateReordering (const Array< OneD, const int > &glo2uniMap, const Array< OneD, const int > &glo2unique, const AssemblyMapSharedPtr &pLocToGloMap) |
Calculate a reordering of universal IDs for PETSc. More... | |
void | v_SolveLinearSystem (const int pNumRows, const Array< OneD, const NekDouble > &pInput, Array< OneD, NekDouble > &pOutput, const AssemblyMapSharedPtr &locToGloMap, const int pNumDir) override |
Solve linear system using PETSc. More... | |
virtual void | v_DoMatrixMultiply (const Array< OneD, const NekDouble > &pInput, Array< OneD, NekDouble > &pOutput)=0 |
Protected Member Functions inherited from Nektar::MultiRegions::GlobalLinSys | |
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 std::shared_ptr< AssemblyMap > &pLocToGloMap) |
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 void | v_DropBlock (unsigned int n) |
Releases the local block matrix from NekManager of 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 Member Functions inherited from Nektar::MultiRegions::GlobalLinSysStaticCond | |
virtual void | v_PreSolve (int scLevel, Array< OneD, NekDouble > &F_bnd) |
virtual void | v_BasisFwdTransform (Array< OneD, NekDouble > &pInOut) |
virtual void | v_CoeffsBwdTransform (Array< OneD, NekDouble > &pInOut) |
virtual void | v_CoeffsFwdTransform (const Array< OneD, NekDouble > &pInput, Array< OneD, NekDouble > &pOutput) |
virtual void | v_AssembleSchurComplement (std::shared_ptr< AssemblyMap > pLoctoGloMap) |
int | v_GetNumBlocks () override |
Get the number of blocks in this system. More... | |
virtual GlobalLinSysStaticCondSharedPtr | v_Recurse (const GlobalLinSysKey &mkey, const std::weak_ptr< ExpList > &pExpList, const DNekScalBlkMatSharedPtr pSchurCompl, const DNekScalBlkMatSharedPtr pBinvD, const DNekScalBlkMatSharedPtr pC, const DNekScalBlkMatSharedPtr pInvD, const std::shared_ptr< AssemblyMap > &locToGloMap)=0 |
void | v_Solve (const Array< OneD, const NekDouble > &in, Array< OneD, NekDouble > &out, const AssemblyMapSharedPtr &locToGloMap, const Array< OneD, const NekDouble > &dirForcing=NullNekDouble1DArray) override |
Solve the linear system for given input and output vectors using a specified local to global map. More... | |
void | v_InitObject () override |
void | v_Initialise (const std::shared_ptr< AssemblyMap > &locToGloMap) override |
Initialise this object. More... | |
void | SetupTopLevel (const std::shared_ptr< AssemblyMap > &locToGloMap) |
Set up the storage for the Schur complement or the top level of the multi-level Schur complement. More... | |
void | ConstructNextLevelCondensedSystem (const std::shared_ptr< AssemblyMap > &locToGloMap) |
Additional Inherited Members | |
Protected Attributes inherited from Nektar::MultiRegions::GlobalLinSysPETSc | |
Mat | m_matrix |
PETSc matrix object. More... | |
Vec | m_x |
PETSc vector objects used for local storage. More... | |
Vec | m_b |
Vec | m_locVec |
KSP | m_ksp |
KSP object that represents solver system. More... | |
PC | m_pc |
PCShell for preconditioner. More... | |
PETScMatMult | m_matMult |
Enumerator to select matrix multiplication type. More... | |
std::vector< int > | m_reorderedMap |
Reordering that takes universal IDs to a unique row in the PETSc matrix. More... | |
VecScatter | m_ctx |
PETSc scatter context that takes us between Nektar++ global ordering and PETSc vector ordering. More... | |
int | m_nLocal |
Number of unique degrees of freedom on this process. More... | |
PreconditionerSharedPtr | m_precon |
Protected Attributes inherited from Nektar::MultiRegions::GlobalLinSys | |
const GlobalLinSysKey | m_linSysKey |
Key associated with this linear system. More... | |
const std::weak_ptr< ExpList > | m_expList |
Local Matrix System. More... | |
const std::map< int, RobinBCInfoSharedPtr > | m_robinBCInfo |
Robin boundary info. More... | |
bool | m_verbose |
Protected Attributes inherited from Nektar::MultiRegions::GlobalLinSysStaticCond | |
GlobalLinSysStaticCondSharedPtr | m_recursiveSchurCompl |
Schur complement for Direct Static Condensation. More... | |
DNekScalBlkMatSharedPtr | m_schurCompl |
Block Schur complement matrix. More... | |
DNekScalBlkMatSharedPtr | m_BinvD |
Block \( BD^{-1} \) matrix. More... | |
DNekScalBlkMatSharedPtr | m_C |
Block \( C \) matrix. More... | |
DNekScalBlkMatSharedPtr | m_invD |
Block \( D^{-1} \) matrix. More... | |
std::weak_ptr< AssemblyMap > | m_locToGloMap |
Local to global map. More... | |
Array< OneD, NekDouble > | m_wsp |
Workspace array for matrix multiplication. More... | |
Array< OneD, const NekDouble > | m_sign |
A global linear system.
Definition at line 52 of file GlobalLinSysPETScStaticCond.h.
Nektar::MultiRegions::GlobalLinSysPETScStaticCond::GlobalLinSysPETScStaticCond | ( | const GlobalLinSysKey & | pKey, |
const std::weak_ptr< ExpList > & | pExpList, | ||
const std::shared_ptr< AssemblyMap > & | pLocToGloMap | ||
) |
Constructor for full direct matrix solve.
For a matrix system of the form
\[ \left[ \begin{array}{cc} \boldsymbol{A} & \boldsymbol{B}\\ \boldsymbol{C} & \boldsymbol{D} \end{array} \right] \left[ \begin{array}{c} \boldsymbol{x_1}\\ \boldsymbol{x_2} \end{array}\right] = \left[ \begin{array}{c} \boldsymbol{y_1}\\ \boldsymbol{y_2} \end{array}\right], \]
where \(\boldsymbol{D}\) and \((\boldsymbol{A-BD^{-1}C})\) are invertible, store and assemble a static condensation system, according to a given local to global mapping. #m_linSys is constructed by AssembleSchurComplement().
mKey | Associated matrix key. |
pLocMatSys | LocalMatrixSystem |
locToGloMap | Local to global mapping. |
Definition at line 84 of file GlobalLinSysPETScStaticCond.cpp.
References ASSERTL1, Nektar::MultiRegions::ePETScMultiLevelStaticCond, Nektar::MultiRegions::ePETScStaticCond, and Nektar::MultiRegions::GlobalLinSysKey::GetGlobalSysSolnType().
Nektar::MultiRegions::GlobalLinSysPETScStaticCond::GlobalLinSysPETScStaticCond | ( | const GlobalLinSysKey & | mkey, |
const std::weak_ptr< ExpList > & | pExpList, | ||
const DNekScalBlkMatSharedPtr | pSchurCompl, | ||
const DNekScalBlkMatSharedPtr | pBinvD, | ||
const DNekScalBlkMatSharedPtr | pC, | ||
const DNekScalBlkMatSharedPtr | pInvD, | ||
const std::shared_ptr< AssemblyMap > & | locToGloMap, | ||
const PreconditionerSharedPtr | pPrecon = PreconditionerSharedPtr() |
||
) |
Constructor for full direct matrix solve.
Definition at line 104 of file GlobalLinSysPETScStaticCond.cpp.
References Nektar::MultiRegions::GlobalLinSysStaticCond::m_BinvD, Nektar::MultiRegions::GlobalLinSysStaticCond::m_C, Nektar::MultiRegions::GlobalLinSysStaticCond::m_invD, Nektar::MultiRegions::GlobalLinSysPETSc::m_precon, and Nektar::MultiRegions::GlobalLinSysStaticCond::m_schurCompl.
|
override |
Definition at line 125 of file GlobalLinSysPETScStaticCond.cpp.
|
inlinestatic |
Creates an instance of this class.
Definition at line 57 of file GlobalLinSysPETScStaticCond.h.
References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), and CellMLToNektar.cellml_metadata::p.
|
overrideprotectedvirtual |
Assemble the Schur complement matrix.
Assemble the schur complement matrix from the block matrices stored in #m_blkMatrices and the given local to global mapping information.
locToGloMap | Local to global mapping information. |
Reimplemented from Nektar::MultiRegions::GlobalLinSysStaticCond.
Definition at line 167 of file GlobalLinSysPETScStaticCond.cpp.
References Nektar::MultiRegions::GlobalLinSysPETSc::CalculateReordering(), Nektar::MultiRegions::GlobalLinSys::CreatePrecon(), Nektar::MultiRegions::ePETScMatMultShell, Nektar::MultiRegions::ePETScMultiLevelStaticCond, Nektar::MultiRegions::GlobalLinSysKey::GetGlobalSysSolnType(), Nektar::MultiRegions::GlobalLinSysStaticCond::m_BinvD, Nektar::MultiRegions::GlobalLinSysStaticCond::m_C, Nektar::MultiRegions::GlobalLinSysStaticCond::m_invD, Nektar::MultiRegions::GlobalLinSys::m_linSysKey, Nektar::MultiRegions::GlobalLinSysStaticCond::m_locToGloMap, Nektar::MultiRegions::GlobalLinSysPETSc::m_matMult, Nektar::MultiRegions::GlobalLinSysPETSc::m_matrix, Nektar::MultiRegions::GlobalLinSysPETSc::m_precon, Nektar::MultiRegions::GlobalLinSysPETSc::m_reorderedMap, Nektar::MultiRegions::GlobalLinSysStaticCond::m_schurCompl, Nektar::MultiRegions::GlobalLinSysPETSc::SetUpMatVec(), Nektar::MultiRegions::GlobalLinSysPETSc::SetUpScatter(), and Nektar::MultiRegions::GlobalLinSysPETSc::SetUpSolver().
|
overrideprotectedvirtual |
Reimplemented from Nektar::MultiRegions::GlobalLinSysStaticCond.
Definition at line 332 of file GlobalLinSysPETScStaticCond.cpp.
References Nektar::MultiRegions::GlobalLinSysPETSc::m_precon.
|
overrideprotectedvirtual |
Reimplemented from Nektar::MultiRegions::GlobalLinSysStaticCond.
Definition at line 338 of file GlobalLinSysPETScStaticCond.cpp.
References Nektar::MultiRegions::GlobalLinSysPETSc::m_precon.
|
overrideprotectedvirtual |
Reimplemented from Nektar::MultiRegions::GlobalLinSysStaticCond.
Definition at line 344 of file GlobalLinSysPETScStaticCond.cpp.
References Nektar::MultiRegions::GlobalLinSysPETSc::m_precon.
|
overrideprotectedvirtual |
Apply matrix-vector multiplication using local approach and the assembly map.
input | Vector input. |
output | Result of multiplication. |
Implements Nektar::MultiRegions::GlobalLinSysPETSc.
Definition at line 361 of file GlobalLinSysPETScStaticCond.cpp.
References Nektar::NekVector< DataType >::GetPtr(), and Nektar::MultiRegions::GlobalLinSysStaticCond::m_locToGloMap.
|
overrideprotectedvirtual |
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 from Nektar::MultiRegions::GlobalLinSys.
Definition at line 246 of file GlobalLinSysPETScStaticCond.cpp.
References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), and Nektar::MultiRegions::GlobalLinSysStaticCond::m_schurCompl.
|
overrideprotectedvirtual |
Reimplemented from Nektar::MultiRegions::GlobalLinSys.
Definition at line 129 of file GlobalLinSysPETScStaticCond.cpp.
References Nektar::MultiRegions::GlobalLinSys::CreatePrecon(), Nektar::StdRegions::eHybridDGHelmBndLam, Nektar::MultiRegions::GlobalMatrixKey::GetMatrixType(), Nektar::MultiRegions::GlobalLinSys::Initialise(), Nektar::MultiRegions::GlobalLinSys::m_expList, Nektar::MultiRegions::GlobalLinSys::m_linSysKey, Nektar::MultiRegions::GlobalLinSysStaticCond::m_locToGloMap, Nektar::MultiRegions::GlobalLinSysPETSc::m_precon, Nektar::MultiRegions::GlobalLinSysStaticCond::m_schurCompl, and Nektar::MultiRegions::GlobalLinSysStaticCond::SetupTopLevel().
|
overrideprotectedvirtual |
Reimplemented from Nektar::MultiRegions::GlobalLinSysStaticCond.
Definition at line 262 of file GlobalLinSysPETScStaticCond.cpp.
References Nektar::MultiRegions::GlobalLinSys::CreatePrecon(), Nektar::MultiRegions::GlobalLinSysStaticCond::m_locToGloMap, and Nektar::MultiRegions::GlobalLinSysPETSc::m_precon.
|
overrideprotectedvirtual |
Implements Nektar::MultiRegions::GlobalLinSysStaticCond.
Definition at line 375 of file GlobalLinSysPETScStaticCond.cpp.
References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), and Nektar::MultiRegions::GlobalLinSysPETSc::m_precon.
|
overrideprotectedvirtual |
Solve linear system using PETSc.
The general strategy being a PETSc solve is to:
Reimplemented from Nektar::MultiRegions::GlobalLinSysPETSc.
Definition at line 287 of file GlobalLinSysPETScStaticCond.cpp.
References ASSERTL0, Nektar::MultiRegions::GlobalLinSys::CreatePrecon(), Nektar::MultiRegions::ePETScMatMultShell, Nektar::MultiRegions::GlobalLinSysPETSc::m_b, Nektar::MultiRegions::GlobalLinSysPETSc::m_ctx, Nektar::MultiRegions::GlobalLinSysPETSc::m_ksp, Nektar::MultiRegions::GlobalLinSysPETSc::m_locVec, Nektar::MultiRegions::GlobalLinSysPETSc::m_matMult, Nektar::MultiRegions::GlobalLinSysPETSc::m_precon, Nektar::MultiRegions::GlobalLinSysPETSc::m_reorderedMap, Nektar::MultiRegions::GlobalLinSysPETSc::m_x, Vmath::Vcopy(), and Vmath::Zero().
|
static |
Name of class.
Registers the class with the Factory.
Definition at line 70 of file GlobalLinSysPETScStaticCond.h.
|
static |
Definition at line 71 of file GlobalLinSysPETScStaticCond.h.