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 () |
![]() | |
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) |
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 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... | |
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 | DoMatrixMultiplyFlag (const Array< OneD, NekDouble > &pInput, Array< OneD, NekDouble > &pOutput, const bool &controlFlag) |
void | DoPreconditionerFlag (const Array< OneD, NekDouble > &pInput, Array< OneD, NekDouble > &pOutput, const bool &controlFlag) |
virtual void | v_SolveLinearSystem (const int pNumRows, const Array< OneD, const NekDouble > &pInput, Array< OneD, NekDouble > &pOutput, const AssemblyMapSharedPtr &locToGloMap, const int pNumDir) |
Solve the matrix system. More... | |
virtual void | v_DoMatrixMultiply (const Array< OneD, NekDouble > &pInput, Array< OneD, NekDouble > &pOutput)=0 |
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.
Definition at line 63 of file GlobalLinSysIterative.cpp.
References tinysimd::abs(), Nektar::MultiRegions::GlobalLinSys::m_expList, m_isAconjugate, m_linSysIterSolver, m_maxiter, m_numSuccessiveRHS, m_root, m_tolerance, m_useProjection, and WARNINGL0.
|
virtual |
Definition at line 94 of file GlobalLinSysIterative.cpp.
|
inlineprivate |
Definition at line 131 of file GlobalLinSysIterative.h.
References v_DoMatrixMultiply().
Referenced by DoProjection(), UpdateKnownSolutions(), and v_SolveLinearSystem().
|
inlineprivate |
Definition at line 141 of file GlobalLinSysIterative.h.
References m_precon.
Referenced by v_SolveLinearSystem().
|
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 156 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 v_SolveLinearSystem().
|
private |
Definition at line 280 of file GlobalLinSysIterative.cpp.
References m_numPrevSols, m_numSuccessiveRHS, m_prevBasis, and m_prevLinSol.
Referenced by DoProjection(), and UpdateKnownSolutions().
|
protected |
Definition at line 484 of file GlobalLinSysIterative.cpp.
References Vmath::Dot2(), Nektar::NekVector< DataType >::GetDimension(), Nektar::NekConstants::kNekUnsetDouble, Nektar::MultiRegions::GlobalLinSys::m_expList, 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 301 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().
|
privatepure virtual |
Implemented in Nektar::MultiRegions::GlobalLinSysIterativeStaticCond, and Nektar::MultiRegions::GlobalLinSysIterativeFull.
Referenced by DoMatrixMultiplyFlag().
|
privatevirtual |
Solve the matrix system.
Implements Nektar::MultiRegions::GlobalLinSys.
Definition at line 101 of file GlobalLinSysIterative.cpp.
References ASSERTL0, Nektar::MultiRegions::GlobalLinSys::CreatePrecon(), Nektar::LibUtilities::NekSysOperators::DefineNekSysLhsEval(), Nektar::LibUtilities::NekSysOperators::DefineNekSysPrecon(), DoMatrixMultiplyFlag(), DoPreconditionerFlag(), DoProjection(), Nektar::LibUtilities::GetNekLinSysIterFactory(), Nektar::MultiRegions::GlobalLinSys::m_expList, m_isAconjugate, m_linsol, m_linSysIterSolver, m_map, m_NekSysOp, m_precon, m_rhs_magnitude, m_tolerance, m_useProjection, and v_UniqueMap().
|
protectedpure virtual |
Implemented in Nektar::MultiRegions::GlobalLinSysIterativeStaticCond, and Nektar::MultiRegions::GlobalLinSysIterativeFull.
Referenced by v_SolveLinearSystem().
|
staticprotected |
Definition at line 107 of file GlobalLinSysIterative.h.
|
staticprotected |
Definition at line 106 of file GlobalLinSysIterative.h.
|
protected |
Definition at line 95 of file GlobalLinSysIterative.h.
Referenced by UpdateKnownSolutions().
Definition at line 96 of file GlobalLinSysIterative.h.
Referenced by DoProjection(), and UpdateKnownSolutions().
Definition at line 97 of file GlobalLinSysIterative.h.
Referenced by DoProjection(), and UpdateKnownSolutions().
|
protected |
Definition at line 99 of file GlobalLinSysIterative.h.
Referenced by GlobalLinSysIterative(), and v_SolveLinearSystem().
|
protected |
Definition at line 104 of file GlobalLinSysIterative.h.
Referenced by DoProjection(), and v_SolveLinearSystem().
|
protected |
Iterative solver: Conjugate Gradient, GMRES.
Definition at line 90 of file GlobalLinSysIterative.h.
Referenced by GlobalLinSysIterative(), and v_SolveLinearSystem().
Global to universal unique map.
Definition at line 63 of file GlobalLinSysIterative.h.
Referenced by DoProjection(), Set_Rhs_Magnitude(), UpdateKnownSolutions(), v_SolveLinearSystem(), Nektar::MultiRegions::GlobalLinSysIterativeFull::v_UniqueMap(), and Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_UniqueMap().
|
protected |
maximum iterations
Definition at line 66 of file GlobalLinSysIterative.h.
Referenced by GlobalLinSysIterative().
|
protected |
Definition at line 102 of file GlobalLinSysIterative.h.
Referenced by v_SolveLinearSystem().
|
protected |
Definition at line 100 of file GlobalLinSysIterative.h.
Referenced by DoProjection(), ResetKnownSolutionsToLatestOne(), and UpdateKnownSolutions().
|
protected |
Definition at line 98 of file GlobalLinSysIterative.h.
Referenced by GlobalLinSysIterative(), ResetKnownSolutionsToLatestOne(), and UpdateKnownSolutions().
|
protected |
Definition at line 77 of file GlobalLinSysIterative.h.
Referenced by 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(), and v_SolveLinearSystem().
|
protected |
Definition at line 79 of file GlobalLinSysIterative.h.
|
protected |
Definition at line 94 of file GlobalLinSysIterative.h.
Referenced by DoProjection(), ResetKnownSolutionsToLatestOne(), and UpdateKnownSolutions().
|
protected |
Storage for solutions to previous linear problems.
Definition at line 93 of file GlobalLinSysIterative.h.
Referenced by DoProjection(), ResetKnownSolutionsToLatestOne(), and UpdateKnownSolutions().
|
protected |
cnt to how many times rhs_magnitude is called
Definition at line 75 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 72 of file GlobalLinSysIterative.h.
Referenced by DoProjection(), Set_Rhs_Magnitude(), Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_PreSolve(), and v_SolveLinearSystem().
|
protected |
Root if parallel.
Definition at line 87 of file GlobalLinSysIterative.h.
Referenced by DoProjection(), GlobalLinSysIterative(), and UpdateKnownSolutions().
|
protected |
Tolerance of iterative solver.
Definition at line 69 of file GlobalLinSysIterative.h.
Referenced by GlobalLinSysIterative(), and v_SolveLinearSystem().
|
protected |
Definition at line 81 of file GlobalLinSysIterative.h.
|
protected |
Whether to apply projection technique.
Definition at line 84 of file GlobalLinSysIterative.h.
Referenced by GlobalLinSysIterative(), and v_SolveLinearSystem().