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... | |
virtual | ~GlobalLinSysIterative () |
void | DoMatrixMultiply (const Array< OneD, NekDouble > &pInput, Array< OneD, NekDouble > &pOutput) |
![]() | |
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 NekDouble tol, const bool isAconjugate) |
projection technique More... | |
void | Set_Rhs_Magnitude (const NekVector< NekDouble > &pIn) |
virtual void | v_UniqueMap ()=0 |
virtual void | v_DoMatrixMultiply (const Array< OneD, NekDouble > &pInput, Array< OneD, NekDouble > &pOutput)=0 |
![]() | |
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 Attributes | |
Array< OneD, int > | m_map |
Global to universal unique map. More... | |
int | m_maxiter |
maximum iterations More... | |
NekDouble | m_tolerance |
Tolerance of iterative solver. More... | |
NekDouble | m_rhs_magnitude |
dot product of rhs to normalise stopping criterion More... | |
NekDouble | m_rhs_mag_sm |
cnt to how many times rhs_magnitude is called More... | |
PreconditionerSharedPtr | m_precon |
std::string | m_precontype |
int | m_totalIterations |
bool | m_useProjection |
Whether to apply projection technique. More... | |
bool | m_root |
Root if parallel. More... | |
std::string | m_linSysIterSolver |
Iterative solver: Conjugate Gradient, GMRES. More... | |
std::vector< Array< OneD, NekDouble > > | m_prevLinSol |
Storage for solutions to previous linear problems. More... | |
std::vector< Array< OneD, NekDouble > > | m_prevBasis |
DNekMatSharedPtr | m_coeffMatrix |
Array< OneD, NekDouble > | m_coeffMatrixFactor |
Array< OneD, int > | m_ipivot |
int | m_numSuccessiveRHS |
bool | m_isAconjugate |
std::string | m_matrixType |
bool | m_isNonSymmetricLinSys |
int | m_numPrevSols |
bool | m_isAbsoluteTolerance |
LibUtilities::NekSysOperators | m_NekSysOp |
LibUtilities::NekLinSysIterSharedPtr | m_linsol |
![]() | |
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 |
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 50 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 67 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_maxiter, m_NekSysOp, m_numSuccessiveRHS, m_root, m_tolerance, m_useProjection, Nektar::StdRegions::MatrixTypeMap, and WARNINGL0.
|
virtual |
Definition at line 122 of file GlobalLinSysIterative.cpp.
|
inlineprivate |
Definition at line 154 of file GlobalLinSysIterative.h.
References m_precon.
Referenced by GlobalLinSysIterative().
|
inline |
Definition at line 60 of file GlobalLinSysIterative.h.
References v_DoMatrixMultiply().
|
inlineprivate |
Definition at line 145 of file GlobalLinSysIterative.h.
References v_DoMatrixMultiply().
Referenced by DoProjection(), GlobalLinSysIterative(), and UpdateKnownSolutions().
|
inlineprivate |
Definition at line 138 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 132 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 249 of file GlobalLinSysIterative.cpp.
References m_numPrevSols, m_numSuccessiveRHS, m_prevBasis, and m_prevLinSol.
Referenced by DoProjection(), and UpdateKnownSolutions().
|
protected |
Definition at line 463 of file GlobalLinSysIterative.cpp.
References Vmath::Dot2(), Nektar::NekVector< DataType >::GetDimension(), Nektar::NekConstants::kNekUnsetDouble, Nektar::MultiRegions::GlobalLinSys::m_expList, m_isAbsoluteTolerance, m_map, m_rhs_mag_sm, m_rhs_magnitude, and Nektar::LibUtilities::ReduceSum.
Referenced by Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_PreSolve().
|
private |
Updates the storage of previously known solutions. Performs normalisation of input vector wrt A-norm.
Definition at line 270 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 115 of file GlobalLinSysIterative.h.
|
staticprotected |
Definition at line 114 of file GlobalLinSysIterative.h.
|
protected |
Definition at line 100 of file GlobalLinSysIterative.h.
Referenced by UpdateKnownSolutions().
Definition at line 101 of file GlobalLinSysIterative.h.
Referenced by DoProjection(), and UpdateKnownSolutions().
Definition at line 102 of file GlobalLinSysIterative.h.
Referenced by DoProjection(), and UpdateKnownSolutions().
|
protected |
Definition at line 108 of file GlobalLinSysIterative.h.
Referenced by GlobalLinSysIterative(), and Set_Rhs_Magnitude().
|
protected |
Definition at line 104 of file GlobalLinSysIterative.h.
Referenced by GlobalLinSysIterative(), Nektar::MultiRegions::GlobalLinSysIterativeFull::v_SolveLinearSystem(), and Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_SolveLinearSystem().
|
protected |
Definition at line 106 of file GlobalLinSysIterative.h.
Referenced by GlobalLinSysIterative().
|
protected |
Definition at line 112 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 95 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 68 of file GlobalLinSysIterative.h.
Referenced by DoProjection(), Set_Rhs_Magnitude(), UpdateKnownSolutions(), 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 105 of file GlobalLinSysIterative.h.
Referenced by GlobalLinSysIterative().
|
protected |
maximum iterations
Definition at line 71 of file GlobalLinSysIterative.h.
Referenced by GlobalLinSysIterative().
|
protected |
Definition at line 110 of file GlobalLinSysIterative.h.
Referenced by GlobalLinSysIterative(), Nektar::MultiRegions::GlobalLinSysIterativeFull::v_SolveLinearSystem(), and Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_SolveLinearSystem().
|
protected |
Definition at line 107 of file GlobalLinSysIterative.h.
Referenced by DoProjection(), ResetKnownSolutionsToLatestOne(), and UpdateKnownSolutions().
|
protected |
Definition at line 103 of file GlobalLinSysIterative.h.
Referenced by GlobalLinSysIterative(), ResetKnownSolutionsToLatestOne(), and UpdateKnownSolutions().
|
protected |
Definition at line 82 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 84 of file GlobalLinSysIterative.h.
|
protected |
Definition at line 99 of file GlobalLinSysIterative.h.
Referenced by DoProjection(), ResetKnownSolutionsToLatestOne(), and UpdateKnownSolutions().
|
protected |
Storage for solutions to previous linear problems.
Definition at line 98 of file GlobalLinSysIterative.h.
Referenced by DoProjection(), ResetKnownSolutionsToLatestOne(), and UpdateKnownSolutions().
|
protected |
cnt to how many times rhs_magnitude is called
Definition at line 80 of file GlobalLinSysIterative.h.
Referenced by Set_Rhs_Magnitude(), and Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_PreSolve().
|
protected |
dot product of rhs to normalise stopping criterion
Definition at line 77 of file GlobalLinSysIterative.h.
Referenced by DoProjection(), Set_Rhs_Magnitude(), Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_PreSolve(), Nektar::MultiRegions::GlobalLinSysIterativeFull::v_SolveLinearSystem(), and Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_SolveLinearSystem().
|
protected |
Root if parallel.
Definition at line 92 of file GlobalLinSysIterative.h.
Referenced by DoProjection(), GlobalLinSysIterative(), and UpdateKnownSolutions().
|
protected |
Tolerance of iterative solver.
Definition at line 74 of file GlobalLinSysIterative.h.
Referenced by GlobalLinSysIterative(), Nektar::MultiRegions::GlobalLinSysIterativeFull::v_SolveLinearSystem(), and Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_SolveLinearSystem().
|
protected |
Definition at line 86 of file GlobalLinSysIterative.h.
|
protected |
Whether to apply projection technique.
Definition at line 89 of file GlobalLinSysIterative.h.
Referenced by GlobalLinSysIterative(), Nektar::MultiRegions::GlobalLinSysIterativeFull::v_SolveLinearSystem(), and Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_SolveLinearSystem().