Nektar++
|
A global linear system. More...
#include <GlobalLinSysIterative.h>
Public Member Functions | |
GlobalLinSysIterative (const GlobalLinSysKey &pKey, const boost::weak_ptr< ExpList > &pExpList, const boost::shared_ptr< AssemblyMap > &pLocToGloMap) | |
Constructor for full direct matrix solve. | |
virtual | ~GlobalLinSysIterative () |
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. | |
virtual | ~GlobalLinSys () |
const GlobalLinSysKey & | GetKey (void) const |
Returns the key associated with the system. | |
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. | |
boost::shared_ptr< GlobalLinSys > | GetSharedThisPtr () |
Returns a shared pointer to the current object. | |
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. |
Protected Member Functions | |
void | DoAconjugateProjection (const int pNumRows, const Array< OneD, const NekDouble > &pInput, Array< OneD, NekDouble > &pOutput, const AssemblyMapSharedPtr &locToGloMap, const int pNumDir) |
A-conjugate projection technique. | |
void | DoConjugateGradient (const int pNumRows, const Array< OneD, const NekDouble > &pInput, Array< OneD, NekDouble > &pOutput, const AssemblyMapSharedPtr &locToGloMap, const int pNumDir) |
Actual iterative solve. | |
void | Set_Rhs_Magnitude (const NekVector< NekDouble > &pIn) |
virtual void | v_UniqueMap ()=0 |
Protected Member Functions inherited from Nektar::MultiRegions::GlobalLinSys | |
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 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. |
Protected Attributes | |
Array< OneD, int > | m_map |
Global to universal unique map. | |
NekDouble | m_tolerance |
Tolerance of iterative solver. | |
NekDouble | m_rhs_magnitude |
dot product of rhs to normalise stopping criterion | |
PreconditionerSharedPtr | m_precon |
MultiRegions::PreconditionerType | m_precontype |
int | m_totalIterations |
bool | m_useProjection |
Whether to apply projection technique. | |
bool | m_root |
Provide verbose output and root if parallel. | |
bool | m_verbose |
boost::circular_buffer< Array < OneD, NekDouble > > | m_prevLinSol |
Storage for solutions to previous linear problems. | |
int | m_numPrevSols |
Total counter of previous solutions. | |
Protected Attributes inherited from Nektar::MultiRegions::GlobalLinSys | |
const GlobalLinSysKey | m_linSysKey |
Key associated with this linear system. | |
const boost::weak_ptr< ExpList > | m_expList |
Local Matrix System. | |
const map< int, RobinBCInfoSharedPtr > | m_robinBCInfo |
Robin boundary info. |
Private Member Functions | |
void | UpdateKnownSolutions (const int pGlobalBndDofs, const Array< OneD, const NekDouble > &pSolution, const int pNumDirBndDofs) |
NekDouble | CalculateAnorm (const int nGlobal, const Array< OneD, const NekDouble > &in, const int nDir) |
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. | |
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 52 of file GlobalLinSysIterative.h.
Nektar::MultiRegions::GlobalLinSysIterative::GlobalLinSysIterative | ( | const GlobalLinSysKey & | pKey, |
const boost::weak_ptr< ExpList > & | pExpList, | ||
const boost::shared_ptr< AssemblyMap > & | pLocToGloMap | ||
) |
Constructor for full direct matrix solve.
Definition at line 49 of file GlobalLinSysIterative.cpp.
References Nektar::MultiRegions::GlobalLinSys::m_expList, m_prevLinSol, m_root, m_tolerance, m_useProjection, and m_verbose.
|
virtual |
Definition at line 83 of file GlobalLinSysIterative.cpp.
|
private |
Calculating A-norm of an input vector, A-norm(x) := sqrt( < x, Ax > )
Definition at line 225 of file GlobalLinSysIterative.cpp.
References Vmath::Dot2(), Nektar::MultiRegions::GlobalLinSys::m_expList, m_map, Nektar::LibUtilities::ReduceSum, and v_DoMatrixMultiply().
Referenced by UpdateKnownSolutions().
|
protected |
A-conjugate projection technique.
This method implements A-conjugate projection technique 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 116 of file GlobalLinSysIterative.cpp.
References DoConjugateGradient(), Vmath::Dot2(), Nektar::eWrapper, Nektar::NekConstants::kNekZeroTol, Nektar::MultiRegions::GlobalLinSys::m_expList, m_map, m_numPrevSols, m_prevLinSol, Nektar::LibUtilities::ReduceSum, UpdateKnownSolutions(), v_DoMatrixMultiply(), Vmath::Vcopy(), and Vmath::Zero().
Referenced by v_SolveLinearSystem().
|
protected |
Actual iterative solve.
Solve a global linear system using the conjugate gradient method. We solve only for the non-Dirichlet modes. The operator is evaluated using an auxiliary function v_DoMatrixMultiply defined by the specific solver. Distributed math routines are used to support parallel execution of the solver. The implemented algorithm uses a reduced-communication reordering of the standard PCG method (Demmel, Heath and Vorst, 1993)
pInput | Input residual of all DOFs. |
pOutput | Solution vector of all DOFs. |
Definition at line 355 of file GlobalLinSysIterative.cpp.
References ASSERTL0, Nektar::LibUtilities::NekFactory< tKey, tBase, >::CreateInstance(), Vmath::Dot2(), Nektar::eWrapper, Nektar::MultiRegions::GetPreconFactory(), Nektar::MultiRegions::GlobalLinSys::GetSharedThisPtr(), Nektar::NekConstants::kNekUnsetDouble, Nektar::MultiRegions::GlobalLinSys::m_expList, m_map, m_precon, m_rhs_magnitude, m_root, m_tolerance, m_totalIterations, m_verbose, Nektar::MultiRegions::PreconditionerTypeMap, Nektar::LibUtilities::ReduceSum, Vmath::Svtvp(), v_DoMatrixMultiply(), v_UniqueMap(), and Vmath::Zero().
Referenced by DoAconjugateProjection(), and v_SolveLinearSystem().
|
protected |
Definition at line 534 of file GlobalLinSysIterative.cpp.
References Nektar::Dot(), Nektar::NekVector< DataType >::GetDimension(), Nektar::MultiRegions::GlobalLinSys::m_expList, 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 254 of file GlobalLinSysIterative.cpp.
References CalculateAnorm(), Vmath::Dot2(), Nektar::eWrapper, Nektar::NekConstants::kNekZeroTol, Nektar::MultiRegions::GlobalLinSys::m_expList, m_map, m_numPrevSols, m_prevLinSol, Nektar::LibUtilities::ReduceSum, Vmath::Smul(), v_DoMatrixMultiply(), and Vmath::Vcopy().
Referenced by DoAconjugateProjection().
|
privatepure virtual |
Referenced by CalculateAnorm(), DoAconjugateProjection(), DoConjugateGradient(), and UpdateKnownSolutions().
|
privatevirtual |
Solve the matrix system.
Definition at line 91 of file GlobalLinSysIterative.cpp.
References DoAconjugateProjection(), DoConjugateGradient(), and m_useProjection.
|
protectedpure virtual |
Referenced by DoConjugateGradient().
|
protected |
Global to universal unique map.
Definition at line 65 of file GlobalLinSysIterative.h.
Referenced by CalculateAnorm(), DoAconjugateProjection(), DoConjugateGradient(), UpdateKnownSolutions(), Nektar::MultiRegions::GlobalLinSysIterativeFull::v_UniqueMap(), and Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_UniqueMap().
|
protected |
Total counter of previous solutions.
Definition at line 90 of file GlobalLinSysIterative.h.
Referenced by DoAconjugateProjection(), and UpdateKnownSolutions().
|
protected |
Definition at line 73 of file GlobalLinSysIterative.h.
Referenced by DoConjugateGradient(), Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::GlobalLinSysIterativeStaticCond(), Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_AssembleSchurComplement(), Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_BasisInvTransform(), Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_BasisTransform(), Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_InitObject(), and Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_Recurse().
|
protected |
Definition at line 75 of file GlobalLinSysIterative.h.
|
protected |
Storage for solutions to previous linear problems.
Definition at line 87 of file GlobalLinSysIterative.h.
Referenced by DoAconjugateProjection(), GlobalLinSysIterative(), and UpdateKnownSolutions().
|
protected |
dot product of rhs to normalise stopping criterion
Definition at line 71 of file GlobalLinSysIterative.h.
Referenced by DoConjugateGradient(), and Set_Rhs_Magnitude().
|
protected |
Provide verbose output and root if parallel.
Definition at line 83 of file GlobalLinSysIterative.h.
Referenced by DoConjugateGradient(), and GlobalLinSysIterative().
|
protected |
Tolerance of iterative solver.
Definition at line 68 of file GlobalLinSysIterative.h.
Referenced by DoConjugateGradient(), and GlobalLinSysIterative().
|
protected |
Definition at line 77 of file GlobalLinSysIterative.h.
Referenced by DoConjugateGradient().
|
protected |
Whether to apply projection technique.
Definition at line 80 of file GlobalLinSysIterative.h.
Referenced by GlobalLinSysIterative(), and v_SolveLinearSystem().
|
protected |
Definition at line 84 of file GlobalLinSysIterative.h.
Referenced by DoConjugateGradient(), and GlobalLinSysIterative().