Nektar++
|
A global linear system. More...
#include <GlobalLinSysIterative.h>
Public Member Functions | |
GlobalLinSysIterative (const GlobalLinSysKey &pKey, const std::weak_ptr< ExpList > &pExpList, const std::shared_ptr< AssemblyMap > &pLocToGloMap) | |
Constructor for full direct matrix solve. More... | |
~GlobalLinSysIterative () override | |
void | DoMatrixMultiply (const Array< OneD, NekDouble > &pInput, Array< OneD, NekDouble > &pOutput) |
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... | |
Protected Member Functions | |
void | DoProjection (const int pNumRows, const Array< OneD, const NekDouble > &pInput, Array< OneD, NekDouble > &pOutput, const int pNumDir, const bool isAconjugate) |
projection technique More... | |
virtual void | v_UniqueMap ()=0 |
virtual void | v_DoMatrixMultiply (const Array< OneD, 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... | |
Static Protected Attributes | |
static std::string | IteratSolverlookupIds [] |
static std::string | IteratSolverdef |
Private Member Functions | |
void | UpdateKnownSolutions (const int pGlobalBndDofs, const Array< OneD, const NekDouble > &pSolution, const int pNumDirBndDofs, const bool isAconjugate) |
int | ResetKnownSolutionsToLatestOne () |
void | DoPreconditionerFlag (const Array< OneD, NekDouble > &pInput, Array< OneD, NekDouble > &pOutput, const bool &isLocal=false) |
void | DoMatrixMultiplyFlag (const Array< OneD, NekDouble > &pInput, Array< OneD, NekDouble > &pOutput, const bool &controlFlag) |
void | DoAssembleLocFlag (const Array< OneD, NekDouble > &pInput, Array< OneD, NekDouble > &pOutput, const bool &ZeroDir) |
A global linear system.
Solves a linear system using iterative methods.
Definition at line 48 of file GlobalLinSysIterative.h.
Nektar::MultiRegions::GlobalLinSysIterative::GlobalLinSysIterative | ( | const GlobalLinSysKey & | pKey, |
const std::weak_ptr< ExpList > & | pExpList, | ||
const std::shared_ptr< AssemblyMap > & | pLocToGloMap | ||
) |
Constructor for full direct matrix solve.
Constructor for full iterative matrix solve.
Definition at line 65 of file GlobalLinSysIterative.cpp.
References tinysimd::abs(), Nektar::LibUtilities::NekSysOperators::DefineAssembleLoc(), Nektar::LibUtilities::NekSysOperators::DefineNekSysLhsEval(), Nektar::LibUtilities::NekSysOperators::DefineNekSysPrecon(), DoAssembleLocFlag(), DoMatrixMultiplyFlag(), DoPreconditionerFlag(), Nektar::MultiRegions::GlobalMatrixKey::GetMatrixType(), Nektar::MultiRegions::GlobalLinSys::m_expList, m_isAbsoluteTolerance, m_isAconjugate, m_isNonSymmetricLinSys, m_linSysIterSolver, m_matrixType, m_NekSysOp, m_numSuccessiveRHS, m_root, m_useProjection, Nektar::StdRegions::MatrixTypeMap, and WARNINGL0.
|
override |
Definition at line 118 of file GlobalLinSysIterative.cpp.
|
inlineprivate |
Definition at line 142 of file GlobalLinSysIterative.h.
References m_precon.
Referenced by GlobalLinSysIterative().
|
inline |
Definition at line 58 of file GlobalLinSysIterative.h.
References v_DoMatrixMultiply().
|
inlineprivate |
Definition at line 135 of file GlobalLinSysIterative.h.
References v_DoMatrixMultiply().
Referenced by DoProjection(), GlobalLinSysIterative(), and UpdateKnownSolutions().
|
inlineprivate |
Definition at line 128 of file GlobalLinSysIterative.h.
References m_precon.
Referenced by GlobalLinSysIterative().
|
protected |
projection technique
This method implements projection techniques in order to speed up successive linear solves with right-hand sides arising from time-dependent discretisations. (P.F.Fischer, Comput. Methods Appl. Mech. Engrg. 163, 1998)
Definition at line 128 of file GlobalLinSysIterative.cpp.
References DoMatrixMultiplyFlag(), Vmath::Dot2(), Lapack::Dsptrs(), Nektar::eWrapper, m_coeffMatrixFactor, Nektar::MultiRegions::GlobalLinSys::m_expList, m_ipivot, m_linsol, m_map, m_numPrevSols, m_prevBasis, m_prevLinSol, m_rhs_magnitude, m_root, Nektar::MultiRegions::GlobalLinSys::m_verbose, Nektar::LibUtilities::ReduceSum, ResetKnownSolutionsToLatestOne(), tinysimd::sqrt(), UpdateKnownSolutions(), Vmath::Vcopy(), and Vmath::Zero().
Referenced by Nektar::MultiRegions::GlobalLinSysIterativeFull::v_SolveLinearSystem(), and Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_SolveLinearSystem().
|
private |
Definition at line 248 of file GlobalLinSysIterative.cpp.
References m_numPrevSols, m_numSuccessiveRHS, m_prevBasis, and m_prevLinSol.
Referenced by DoProjection(), and UpdateKnownSolutions().
|
private |
Updates the storage of previously known solutions. Performs normalisation of input vector wrt A-norm.
Definition at line 269 of file GlobalLinSysIterative.cpp.
References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), DoMatrixMultiplyFlag(), Vmath::Dot2(), Lapack::Dsptrf(), Lapack::Dsptrs(), Nektar::eSYMMETRIC, Nektar::NekConstants::kNekSparseNonZeroTol, Nektar::NekConstants::kNekZeroTol, m_coeffMatrix, m_coeffMatrixFactor, Nektar::MultiRegions::GlobalLinSys::m_expList, m_ipivot, m_map, m_numPrevSols, m_numSuccessiveRHS, m_prevBasis, m_prevLinSol, m_root, Nektar::MultiRegions::GlobalLinSys::m_verbose, Nektar::LibUtilities::ReduceSum, ResetKnownSolutionsToLatestOne(), Vmath::Smul(), tinysimd::sqrt(), and Vmath::Vcopy().
Referenced by DoProjection().
|
protectedpure virtual |
Implemented in Nektar::MultiRegions::GlobalLinSysIterativeFull, and Nektar::MultiRegions::GlobalLinSysIterativeStaticCond.
Referenced by DoMatrixMultiply(), and DoMatrixMultiplyFlag().
|
protectedpure virtual |
|
staticprotected |
Definition at line 107 of file GlobalLinSysIterative.h.
|
staticprotected |
Definition at line 106 of file GlobalLinSysIterative.h.
|
protected |
Definition at line 92 of file GlobalLinSysIterative.h.
Referenced by UpdateKnownSolutions().
Definition at line 93 of file GlobalLinSysIterative.h.
Referenced by DoProjection(), and UpdateKnownSolutions().
Definition at line 94 of file GlobalLinSysIterative.h.
Referenced by DoProjection(), and UpdateKnownSolutions().
|
protected |
Definition at line 100 of file GlobalLinSysIterative.h.
Referenced by GlobalLinSysIterative(), Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_PreSolve(), and Nektar::MultiRegions::GlobalLinSysIterativeFull::v_SolveLinearSystem().
|
protected |
Definition at line 96 of file GlobalLinSysIterative.h.
Referenced by GlobalLinSysIterative(), Nektar::MultiRegions::GlobalLinSysIterativeFull::v_SolveLinearSystem(), and Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_SolveLinearSystem().
|
protected |
Definition at line 98 of file GlobalLinSysIterative.h.
Referenced by GlobalLinSysIterative().
|
protected |
Definition at line 104 of file GlobalLinSysIterative.h.
Referenced by DoProjection(), Nektar::MultiRegions::GlobalLinSysIterativeFull::v_DoMatrixMultiply(), Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_DoMatrixMultiply(), Nektar::MultiRegions::GlobalLinSysIterativeFull::v_SolveLinearSystem(), and Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_SolveLinearSystem().
|
protected |
Iterative solver: Conjugate Gradient, GMRES.
Definition at line 87 of file GlobalLinSysIterative.h.
Referenced by GlobalLinSysIterative(), Nektar::MultiRegions::GlobalLinSysIterativeFull::v_SolveLinearSystem(), and Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_SolveLinearSystem().
Global to universal unique map.
Definition at line 66 of file GlobalLinSysIterative.h.
Referenced by DoProjection(), UpdateKnownSolutions(), Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_PreSolve(), Nektar::MultiRegions::GlobalLinSysIterativeFull::v_SolveLinearSystem(), Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_SolveLinearSystem(), Nektar::MultiRegions::GlobalLinSysIterativeFull::v_UniqueMap(), and Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_UniqueMap().
|
protected |
Definition at line 97 of file GlobalLinSysIterative.h.
Referenced by GlobalLinSysIterative().
|
protected |
Definition at line 102 of file GlobalLinSysIterative.h.
Referenced by GlobalLinSysIterative(), Nektar::MultiRegions::GlobalLinSysIterativeFull::v_SolveLinearSystem(), and Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_SolveLinearSystem().
|
protected |
Definition at line 99 of file GlobalLinSysIterative.h.
Referenced by DoProjection(), ResetKnownSolutionsToLatestOne(), and UpdateKnownSolutions().
|
protected |
Definition at line 95 of file GlobalLinSysIterative.h.
Referenced by GlobalLinSysIterative(), ResetKnownSolutionsToLatestOne(), and UpdateKnownSolutions().
|
protected |
Definition at line 74 of file GlobalLinSysIterative.h.
Referenced by DoAssembleLocFlag(), DoPreconditionerFlag(), Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::GlobalLinSysIterativeStaticCond(), Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_AssembleSchurComplement(), Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_BasisFwdTransform(), Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_CoeffsBwdTransform(), Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_CoeffsFwdTransform(), Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_InitObject(), Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_PreSolve(), Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_Recurse(), Nektar::MultiRegions::GlobalLinSysIterativeFull::v_SolveLinearSystem(), and Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_SolveLinearSystem().
|
protected |
Definition at line 76 of file GlobalLinSysIterative.h.
|
protected |
Definition at line 91 of file GlobalLinSysIterative.h.
Referenced by DoProjection(), ResetKnownSolutionsToLatestOne(), and UpdateKnownSolutions().
|
protected |
Storage for solutions to previous linear problems.
Definition at line 90 of file GlobalLinSysIterative.h.
Referenced by DoProjection(), ResetKnownSolutionsToLatestOne(), and UpdateKnownSolutions().
|
protected |
cnt to how many times rhs_magnitude is called
Definition at line 72 of file GlobalLinSysIterative.h.
Referenced by Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_PreSolve().
|
protected |
dot product of rhs to normalise stopping criterion
Definition at line 69 of file GlobalLinSysIterative.h.
Referenced by DoProjection(), Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_PreSolve(), Nektar::MultiRegions::GlobalLinSysIterativeFull::v_SolveLinearSystem(), and Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_SolveLinearSystem().
|
protected |
Root if parallel.
Definition at line 84 of file GlobalLinSysIterative.h.
Referenced by DoProjection(), GlobalLinSysIterative(), and UpdateKnownSolutions().
|
protected |
Definition at line 78 of file GlobalLinSysIterative.h.
|
protected |
Whether to apply projection technique.
Definition at line 81 of file GlobalLinSysIterative.h.
Referenced by GlobalLinSysIterative(), Nektar::MultiRegions::GlobalLinSysIterativeFull::v_SolveLinearSystem(), and Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_SolveLinearSystem().