Nektar++
|
A global linear system. More...
#include <GlobalLinSysPETSc.h>
Public Member Functions | |
GlobalLinSysPETSc (const GlobalLinSysKey &pKey, const boost::weak_ptr< ExpList > &pExp, const boost::shared_ptr< AssemblyMap > &pLocToGloMap) | |
Constructor for full direct matrix solve. More... | |
virtual | ~GlobalLinSysPETSc () |
virtual void | v_SolveLinearSystem (const int pNumRows, const Array< OneD, const NekDouble > &pInput, Array< OneD, NekDouble > &pOutput, const AssemblyMapSharedPtr &locToGloMap, const int pNumDir) |
Solve linear system using PETSc. More... | |
Public Member Functions inherited from 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. 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 | |
void | SetUpScatter () |
Set up PETSc local (equivalent to Nektar++ global) and global (equivalent to universal) scatter maps. More... | |
void | SetUpMatVec () |
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... | |
Protected Member Functions inherited from Nektar::MultiRegions::GlobalLinSys | |
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... | |
Protected Attributes | |
Mat | m_matrix |
Vec | m_x |
Vec | m_b |
Vec | m_locVec |
KSP | m_ksp |
vector< int > | m_reorderedMap |
VecScatter | m_ctx |
int | m_nLocal |
Protected Attributes inherited from Nektar::MultiRegions::GlobalLinSys | |
const GlobalLinSysKey | m_linSysKey |
Key associated with this linear system. More... | |
const boost::weak_ptr< ExpList > | m_expList |
Local Matrix System. More... | |
const map< int, RobinBCInfoSharedPtr > | m_robinBCInfo |
Robin boundary info. More... | |
A global linear system.
Solves a linear system using PETSc.
Solves a linear system using single- or multi-level static condensation.
Definition at line 52 of file GlobalLinSysPETSc.h.
Nektar::MultiRegions::GlobalLinSysPETSc::GlobalLinSysPETSc | ( | const GlobalLinSysKey & | pKey, |
const boost::weak_ptr< ExpList > & | pExp, | ||
const boost::shared_ptr< AssemblyMap > & | pLocToGloMap | ||
) |
Constructor for full direct matrix solve.
Definition at line 52 of file GlobalLinSysPETSc.cpp.
References m_matrix.
|
virtual |
Definition at line 67 of file GlobalLinSysPETSc.cpp.
|
protected |
Calculate a reordering of universal IDs for PETSc.
PETSc requires a unique, contiguous index of all global and universal degrees of freedom which represents its position inside the matrix. Presently Gs does not guarantee this, so this routine constructs a new universal mapping.
Definition at line 152 of file GlobalLinSysPETSc.cpp.
References ASSERTL0, Nektar::MultiRegions::GlobalLinSys::m_expList, m_nLocal, m_reorderedMap, Nektar::LibUtilities::ReduceSum, and Vmath::Vsum().
Referenced by Nektar::MultiRegions::GlobalLinSysPETScFull::GlobalLinSysPETScFull(), and Nektar::MultiRegions::GlobalLinSysPETScStaticCond::v_AssembleSchurComplement().
|
protected |
Construct PETSc matrix and vector handles.
Definition at line 224 of file GlobalLinSysPETSc.cpp.
References m_b, m_matrix, m_nLocal, and m_x.
Referenced by Nektar::MultiRegions::GlobalLinSysPETScFull::GlobalLinSysPETScFull(), and Nektar::MultiRegions::GlobalLinSysPETScStaticCond::v_AssembleSchurComplement().
|
protected |
Set up PETSc local (equivalent to Nektar++ global) and global (equivalent to universal) scatter maps.
These maps are used in GlobalLinSysPETSc::v_SolveLinearSystem to scatter the solution vector back to each process.
Definition at line 121 of file GlobalLinSysPETSc.cpp.
References m_ctx, m_locVec, m_reorderedMap, and m_x.
Referenced by Nektar::MultiRegions::GlobalLinSysPETScFull::GlobalLinSysPETScFull(), and Nektar::MultiRegions::GlobalLinSysPETScStaticCond::v_AssembleSchurComplement().
Set up KSP solver object.
This is reasonably generic setup – most solver types can be changed using the .petscrc file.
Definition at line 247 of file GlobalLinSysPETSc.cpp.
References m_ksp, and m_matrix.
Referenced by Nektar::MultiRegions::GlobalLinSysPETScFull::GlobalLinSysPETScFull(), and Nektar::MultiRegions::GlobalLinSysPETScStaticCond::v_AssembleSchurComplement().
|
virtual |
Solve linear system using PETSc.
The general strategy being a PETSc solve is to:
Implements Nektar::MultiRegions::GlobalLinSys.
Definition at line 81 of file GlobalLinSysPETSc.cpp.
References m_b, m_ctx, m_ksp, m_locVec, m_reorderedMap, m_x, and Vmath::Vcopy().
|
protected |
Definition at line 72 of file GlobalLinSysPETSc.h.
Referenced by SetUpMatVec(), and v_SolveLinearSystem().
|
protected |
Definition at line 75 of file GlobalLinSysPETSc.h.
Referenced by SetUpScatter(), and v_SolveLinearSystem().
|
protected |
Definition at line 73 of file GlobalLinSysPETSc.h.
Referenced by SetUpSolver(), and v_SolveLinearSystem().
|
protected |
Definition at line 72 of file GlobalLinSysPETSc.h.
Referenced by SetUpScatter(), and v_SolveLinearSystem().
|
protected |
Definition at line 71 of file GlobalLinSysPETSc.h.
Referenced by GlobalLinSysPETSc(), Nektar::MultiRegions::GlobalLinSysPETScFull::GlobalLinSysPETScFull(), SetUpMatVec(), SetUpSolver(), and Nektar::MultiRegions::GlobalLinSysPETScStaticCond::v_AssembleSchurComplement().
|
protected |
Definition at line 76 of file GlobalLinSysPETSc.h.
Referenced by CalculateReordering(), and SetUpMatVec().
|
protected |
Definition at line 74 of file GlobalLinSysPETSc.h.
Referenced by CalculateReordering(), Nektar::MultiRegions::GlobalLinSysPETScFull::GlobalLinSysPETScFull(), SetUpScatter(), Nektar::MultiRegions::GlobalLinSysPETScStaticCond::v_AssembleSchurComplement(), and v_SolveLinearSystem().
|
protected |
Definition at line 72 of file GlobalLinSysPETSc.h.
Referenced by SetUpMatVec(), SetUpScatter(), and v_SolveLinearSystem().