|
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. | |
| ~GlobalLinSysIterative () override | |
| void | DoMatrixMultiply (const Array< OneD, NekDouble > &pInput, Array< OneD, NekDouble > &pOutput) |
| void | DoPreconditionerFlag (const Array< OneD, NekDouble > &pInput, Array< OneD, NekDouble > &pOutput, const bool &isLocal=false) |
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. | |
| virtual | ~GlobalLinSys () |
| const GlobalLinSysKey & | GetKey (void) const |
| Returns the key associated with the system. | |
| 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. | |
| std::shared_ptr< GlobalLinSys > | GetSharedThisPtr () |
| Returns a shared pointer to the current object. | |
| 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. | |
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 | |
| bool | isNonSymmetricLinSys (StdRegions::MatrixType mt) |
| 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. | |
| 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. | |
| 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. | |
| virtual DNekScalMatSharedPtr | v_GetBlock (unsigned int n) |
| Retrieves the block matrix from n-th expansion using the matrix key provided by the m_linSysKey. | |
| 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. | |
| 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. | |
| 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. | |
| PreconditionerSharedPtr | CreatePrecon (AssemblyMapSharedPtr asmMap) |
| Create a preconditioner object from the parameters defined in the supplied assembly map. | |
Protected Attributes | |
| Array< OneD, int > | m_map |
| Global to universal unique map. | |
| NekDouble | m_rhs_magnitude |
| dot product of rhs to normalise stopping criterion | |
| NekDouble | m_rhs_mag_sm |
| cnt to how many times rhs_magnitude is called | |
| PreconditionerSharedPtr | m_precon |
| std::string | m_precontype |
| int | m_totalIterations |
| bool | m_useProjection |
| Whether to apply projection technique. | |
| bool | m_isConjugateGradient |
| bool | m_isLocalSolver |
| bool | m_root |
| Root if parallel. | |
| std::string | m_linSysIterSolver |
| Iterative solver: Conjugate Gradient, GMRES. | |
| std::vector< Array< OneD, NekDouble > > | m_prevLinSol |
| Storage for solutions to previous linear problems. | |
| 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 |
| int | m_numPrevSols |
| bool | m_isAbsoluteTolerance |
| LibUtilities::NekSysOperators | m_NekSysOp |
| LibUtilities::NekLinSysIterSharedPtr | m_linsol |
Protected Attributes inherited from Nektar::MultiRegions::GlobalLinSys | |
| const GlobalLinSysKey | m_linSysKey |
| Key associated with this linear system. | |
| const std::weak_ptr< ExpList > | m_expList |
| Local Matrix System. | |
| const std::map< int, RobinBCInfoSharedPtr > | m_robinBCInfo |
| Robin boundary info. | |
| 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 | 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 67 of file GlobalLinSysIterative.cpp.
References Nektar::LibUtilities::NekSysOperators::DefineAssembleLoc(), Nektar::LibUtilities::NekSysOperators::DefineNekSysLhsEval(), Nektar::LibUtilities::NekSysOperators::DefineNekSysPrecon(), DoAssembleLocFlag(), DoMatrixMultiplyFlag(), DoPreconditionerFlag(), Nektar::MultiRegions::GlobalMatrixKey::GetMatrixType(), isNonSymmetricLinSys(), Nektar::MultiRegions::GlobalLinSys::m_expList, m_isAbsoluteTolerance, m_isAconjugate, m_isConjugateGradient, m_isLocalSolver, m_linSysIterSolver, m_NekSysOp, m_numSuccessiveRHS, m_root, m_useProjection, and WARNINGL0.
|
override |
Definition at line 120 of file GlobalLinSysIterative.cpp.
|
inlineprivate |
Definition at line 149 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 142 of file GlobalLinSysIterative.h.
References v_DoMatrixMultiply().
Referenced by DoProjection(), GlobalLinSysIterative(), and UpdateKnownSolutions().
|
inline |
Definition at line 64 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 130 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().
|
protected |
Check if the matrix type is non-symmetric to allow swtiching to a capable iterative solver.
| mt | type of the Matrix using StdRegions::MatrixType |
Definition at line 488 of file GlobalLinSysIterative.cpp.
References Nektar::StdRegions::eLinearAdvection, Nektar::StdRegions::eLinearAdvectionDiffusionReaction, Nektar::StdRegions::eLinearAdvectionDiffusionReactionGJP, and Nektar::StdRegions::eLinearAdvectionReaction.
Referenced by GlobalLinSysIterative().
|
private |
Definition at line 250 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 271 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 119 of file GlobalLinSysIterative.h.
|
staticprotected |
Definition at line 118 of file GlobalLinSysIterative.h.
|
protected |
Definition at line 105 of file GlobalLinSysIterative.h.
Referenced by UpdateKnownSolutions().
Definition at line 106 of file GlobalLinSysIterative.h.
Referenced by DoProjection(), and UpdateKnownSolutions().
Definition at line 107 of file GlobalLinSysIterative.h.
Referenced by DoProjection(), and UpdateKnownSolutions().
|
protected |
Definition at line 112 of file GlobalLinSysIterative.h.
Referenced by GlobalLinSysIterative(), Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_PreSolve(), and Nektar::MultiRegions::GlobalLinSysIterativeFull::v_SolveLinearSystem().
|
protected |
Definition at line 109 of file GlobalLinSysIterative.h.
Referenced by GlobalLinSysIterative(), Nektar::MultiRegions::GlobalLinSysIterativeFull::v_SolveLinearSystem(), and Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_SolveLinearSystem().
|
protected |
Definition at line 91 of file GlobalLinSysIterative.h.
Referenced by GlobalLinSysIterative().
|
protected |
Definition at line 94 of file GlobalLinSysIterative.h.
Referenced by GlobalLinSysIterative().
|
protected |
Definition at line 116 of file GlobalLinSysIterative.h.
Referenced by DoProjection(), Nektar::MultiRegions::GlobalLinSysIterativeFull::Initialise(), 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 100 of file GlobalLinSysIterative.h.
Referenced by GlobalLinSysIterative(), Nektar::MultiRegions::GlobalLinSysIterativeFull::Initialise(), and Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_SolveLinearSystem().
Global to universal unique map.
Definition at line 73 of file GlobalLinSysIterative.h.
Referenced by DoProjection(), Nektar::MultiRegions::GlobalLinSysIterativeFull::Initialise(), UpdateKnownSolutions(), Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_PreSolve(), Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_SolveLinearSystem(), Nektar::MultiRegions::GlobalLinSysIterativeFull::v_UniqueMap(), and Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_UniqueMap().
|
protected |
Definition at line 110 of file GlobalLinSysIterative.h.
|
protected |
Definition at line 114 of file GlobalLinSysIterative.h.
Referenced by GlobalLinSysIterative(), Nektar::MultiRegions::GlobalLinSysIterativeFull::Initialise(), and Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_SolveLinearSystem().
|
protected |
Definition at line 111 of file GlobalLinSysIterative.h.
Referenced by DoProjection(), ResetKnownSolutionsToLatestOne(), and UpdateKnownSolutions().
|
protected |
Definition at line 108 of file GlobalLinSysIterative.h.
Referenced by GlobalLinSysIterative(), ResetKnownSolutionsToLatestOne(), and UpdateKnownSolutions().
|
protected |
Definition at line 81 of file GlobalLinSysIterative.h.
Referenced by DoAssembleLocFlag(), DoPreconditionerFlag(), Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::GlobalLinSysIterativeStaticCond(), Nektar::MultiRegions::GlobalLinSysIterativeFull::Initialise(), 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 Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_SolveLinearSystem().
|
protected |
Definition at line 83 of file GlobalLinSysIterative.h.
|
protected |
Definition at line 104 of file GlobalLinSysIterative.h.
Referenced by DoProjection(), ResetKnownSolutionsToLatestOne(), and UpdateKnownSolutions().
|
protected |
Storage for solutions to previous linear problems.
Definition at line 103 of file GlobalLinSysIterative.h.
Referenced by DoProjection(), ResetKnownSolutionsToLatestOne(), and UpdateKnownSolutions().
|
protected |
cnt to how many times rhs_magnitude is called
Definition at line 79 of file GlobalLinSysIterative.h.
Referenced by Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_PreSolve().
|
protected |
dot product of rhs to normalise stopping criterion
Definition at line 76 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 97 of file GlobalLinSysIterative.h.
Referenced by DoProjection(), GlobalLinSysIterative(), and UpdateKnownSolutions().
|
protected |
Definition at line 85 of file GlobalLinSysIterative.h.
|
protected |
Whether to apply projection technique.
Definition at line 88 of file GlobalLinSysIterative.h.
Referenced by GlobalLinSysIterative(), Nektar::MultiRegions::GlobalLinSysIterativeFull::v_SolveLinearSystem(), and Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_SolveLinearSystem().