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. More... | |
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. More... | |
virtual | ~GlobalLinSys () |
const GlobalLinSysKey & | GetKey (void) const |
Returns the key associated with the system. More... | |
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. More... | |
boost::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 | DoAconjugateProjection (const int pNumRows, const Array< OneD, const NekDouble > &pInput, Array< OneD, NekDouble > &pOutput, const AssemblyMapSharedPtr &locToGloMap, const int pNumDir) |
A-conjugate projection technique. More... | |
void | DoConjugateGradient (const int pNumRows, const Array< OneD, const NekDouble > &pInput, Array< OneD, NekDouble > &pOutput, const AssemblyMapSharedPtr &locToGloMap, const int pNumDir) |
Actual iterative solve. More... | |
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. 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... | |
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 |
MultiRegions::PreconditionerType | m_precontype |
int | m_totalIterations |
bool | m_useProjection |
Whether to apply projection technique. More... | |
bool | m_root |
Root if parallel. More... | |
boost::circular_buffer< Array < OneD, NekDouble > > | m_prevLinSol |
Storage for solutions to previous linear problems. More... | |
int | m_numPrevSols |
Total counter of previous solutions. More... | |
Protected Attributes inherited from Nektar::MultiRegions::GlobalLinSys | |
const GlobalLinSysKey | m_linSysKey |
Key associated with this linear system. More... | |
const boost::weak_ptr< ExpList > | m_expList |
Local Matrix System. More... | |
const std::map< int, RobinBCInfoSharedPtr > | m_robinBCInfo |
Robin boundary info. More... | |
bool | m_verbose |
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. 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 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 51 of file GlobalLinSysIterative.cpp.
References Nektar::MultiRegions::GlobalLinSys::m_expList, m_maxiter, m_prevLinSol, m_root, m_tolerance, and m_useProjection.
|
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 Nektar::MultiRegions::GlobalLinSys::CreatePrecon(), Vmath::Dot2(), ErrorUtil::efatal, Nektar::eWrapper, Nektar::NekConstants::kNekUnsetDouble, Nektar::MultiRegions::GlobalLinSys::m_expList, m_map, m_maxiter, m_precon, m_rhs_magnitude, m_root, m_tolerance, m_totalIterations, Nektar::MultiRegions::GlobalLinSys::m_verbose, CellMLToNektar.cellml_metadata::p, Nektar::LibUtilities::ReduceSum, ROOTONLY_NEKERROR, Set_Rhs_Magnitude(), Vmath::Svtvp(), v_DoMatrixMultiply(), v_UniqueMap(), and Vmath::Zero().
Referenced by DoAconjugateProjection(), and v_SolveLinearSystem().
|
protected |
Definition at line 543 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 DoConjugateGradient(), and 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 |
Implemented in Nektar::MultiRegions::GlobalLinSysIterativeStaticCond, and Nektar::MultiRegions::GlobalLinSysIterativeFull.
Referenced by CalculateAnorm(), DoAconjugateProjection(), DoConjugateGradient(), and UpdateKnownSolutions().
|
privatevirtual |
Solve the matrix system.
Implements Nektar::MultiRegions::GlobalLinSys.
Definition at line 91 of file GlobalLinSysIterative.cpp.
References DoAconjugateProjection(), DoConjugateGradient(), and m_useProjection.
|
protectedpure virtual |
Implemented in Nektar::MultiRegions::GlobalLinSysIterativeStaticCond, and Nektar::MultiRegions::GlobalLinSysIterativeFull.
Referenced by DoConjugateGradient().
Global to universal unique map.
Definition at line 65 of file GlobalLinSysIterative.h.
Referenced by CalculateAnorm(), DoAconjugateProjection(), DoConjugateGradient(), Set_Rhs_Magnitude(), UpdateKnownSolutions(), Nektar::MultiRegions::GlobalLinSysIterativeFull::v_UniqueMap(), and Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_UniqueMap().
|
protected |
maximum iterations
Definition at line 68 of file GlobalLinSysIterative.h.
Referenced by DoConjugateGradient(), and GlobalLinSysIterative().
|
protected |
Total counter of previous solutions.
Definition at line 95 of file GlobalLinSysIterative.h.
Referenced by DoAconjugateProjection(), and UpdateKnownSolutions().
|
protected |
Definition at line 79 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(), Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_PreSolve(), and Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_Recurse().
|
protected |
Definition at line 81 of file GlobalLinSysIterative.h.
|
protected |
Storage for solutions to previous linear problems.
Definition at line 92 of file GlobalLinSysIterative.h.
Referenced by DoAconjugateProjection(), GlobalLinSysIterative(), and UpdateKnownSolutions().
|
protected |
cnt to how many times rhs_magnitude is called
Definition at line 77 of file GlobalLinSysIterative.h.
Referenced by Set_Rhs_Magnitude().
|
protected |
dot product of rhs to normalise stopping criterion
Definition at line 74 of file GlobalLinSysIterative.h.
Referenced by DoConjugateGradient(), Set_Rhs_Magnitude(), and Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_PreSolve().
|
protected |
Root if parallel.
Definition at line 89 of file GlobalLinSysIterative.h.
Referenced by DoConjugateGradient(), and GlobalLinSysIterative().
|
protected |
Tolerance of iterative solver.
Definition at line 71 of file GlobalLinSysIterative.h.
Referenced by DoConjugateGradient(), and GlobalLinSysIterative().
|
protected |
Definition at line 83 of file GlobalLinSysIterative.h.
Referenced by DoConjugateGradient().
|
protected |
Whether to apply projection technique.
Definition at line 86 of file GlobalLinSysIterative.h.
Referenced by GlobalLinSysIterative(), and v_SolveLinearSystem().