Nektar++
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Nektar::LibUtilities::NekNonlinSysIter Class Reference

#include <NekNonlinSysIter.h>

Inheritance diagram for Nektar::LibUtilities::NekNonlinSysIter:
[legend]

Public Member Functions

 NekNonlinSysIter (const LibUtilities::SessionReaderSharedPtr &pSession, const LibUtilities::CommSharedPtr &vRowComm, const int nDimen, const NekSysKey &pKey)
 
 ~NekNonlinSysIter () override=default
 
const Array< OneD, const NekDouble > & GetRefSolution () const
 
const Array< OneD, const NekDouble > & GetRefResidual () const
 
const Array< OneD, const NekDouble > & GetRefSourceVec () const
 
const NekLinSysIterSharedPtrGetLinSys () const
 
int GetNtotLinSysIts () const
 
void SetNekLinSysTolerance (const NekDouble in)
 
void SetNekNonlinSysTolerance (const NekDouble in)
 
void SetNonlinIterTolRelativeL2 (const NekDouble in)
 
void SetNekNonlinSysMaxIterations (const int in)
 
- Public Member Functions inherited from Nektar::LibUtilities::NekSys
 NekSys (const LibUtilities::SessionReaderSharedPtr &pSession, const LibUtilities::CommSharedPtr &vRowComm, const int nDimen, const NekSysKey &pKey)
 
virtual ~NekSys ()=default
 
void InitObject ()
 
int SolveSystem (const int nGlobal, const Array< OneD, const NekDouble > &pInput, Array< OneD, NekDouble > &pOutput, const int nDir=0)
 
const NekSysOperatorsGetSysOperators ()
 
void SetSysOperators (const NekSysOperators &in)
 
void SetFlagWarnings (bool in)
 
void SetRhsMagnitude (const NekDouble mag)
 

Protected Member Functions

void v_InitObject () override
 
void v_SetSysOperators (const NekSysOperators &in) override
 
void ConvergenceCheck (const int nIteration, const Array< OneD, const NekDouble > &Residual)
 
- Protected Member Functions inherited from Nektar::LibUtilities::NekSys
virtual void v_InitObject ()
 
virtual void v_SetSysOperators (const NekSysOperators &in)
 
virtual int v_SolveSystem (const int nGlobal, const Array< OneD, const NekDouble > &pInput, Array< OneD, NekDouble > &pOutput, const int nDir)
 

Protected Attributes

NekDouble m_SysResNorm0
 
NekDouble m_SysResNorm
 
NekLinSysIterSharedPtr m_linsol
 
NekDouble m_NekLinSysTolerance
 
NekDouble m_NekNonLinSysTolerance
 
NekDouble m_NonlinIterTolRelativeL2
 
int m_NekNonlinSysMaxIterations
 
int m_totalIterations = 0
 
int m_NtotLinSysIts = 0
 
std::string m_LinSysIterSolverType
 
Array< OneD, NekDoublem_Solution
 
Array< OneD, NekDoublem_Residual
 
Array< OneD, NekDoublem_DeltSltn
 
Array< OneD, NekDoublem_SourceVec
 
- Protected Attributes inherited from Nektar::LibUtilities::NekSys
LibUtilities::CommSharedPtr m_rowComm
 
bool m_converged
 
bool m_root
 
bool m_verbose
 
bool m_FlagWarnings
 
int m_SysDimen
 
NekSysOperators m_operator
 
NekDouble m_rhs_magnitude = NekConstants::kNekUnsetDouble
 

Additional Inherited Members

- Static Public Member Functions inherited from Nektar::LibUtilities::NekSys
static NekSysSharedPtr CreateInstance (const LibUtilities::SessionReaderSharedPtr &pSession, const LibUtilities::CommSharedPtr &vRowComm, const int nDimen, const NekSysKey &pKey)
 

Detailed Description

Solves a nonlinear system using iterative methods.

Definition at line 54 of file NekNonlinSysIter.h.

Constructor & Destructor Documentation

◆ NekNonlinSysIter()

Nektar::LibUtilities::NekNonlinSysIter::NekNonlinSysIter ( const LibUtilities::SessionReaderSharedPtr pSession,
const LibUtilities::CommSharedPtr vRowComm,
const int  nDimen,
const NekSysKey pKey 
)

Definition at line 51 of file NekNonlinSysIter.cpp.

55 : NekSys(pSession, vRowComm, nDimen, pKey)
56{
57 m_NekLinSysTolerance = pKey.m_NekLinSysTolerance;
58 m_NekNonLinSysTolerance = pKey.m_NekNonLinSysTolerance;
59 m_NonlinIterTolRelativeL2 = pKey.m_NonlinIterTolRelativeL2;
60 m_NekNonlinSysMaxIterations = pKey.m_NekNonlinSysMaxIterations;
61 m_LinSysIterSolverType = pKey.m_LinSysIterSolverTypeInNonlin;
62
65 "NekLinSysIter '" + m_LinSysIterSolverType +
66 "' is not defined.\n");
67
70 m_linsol->SetFlagWarnings(false);
71}
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:208
tBaseSharedPtr CreateInstance(tKey idKey, tParam... args)
Create an instance of the class referred to by idKey.
LibUtilities::CommSharedPtr m_rowComm
Definition: NekSys.h:291
NekSys(const LibUtilities::SessionReaderSharedPtr &pSession, const LibUtilities::CommSharedPtr &vRowComm, const int nDimen, const NekSysKey &pKey)
Definition: NekSys.cpp:46
NekLinSysIterFactory & GetNekLinSysIterFactory()

References ASSERTL0, Nektar::LibUtilities::NekFactory< tKey, tBase, tParam >::CreateInstance(), Nektar::LibUtilities::GetNekLinSysIterFactory(), m_linsol, m_LinSysIterSolverType, Nektar::LibUtilities::NekSysKey::m_LinSysIterSolverTypeInNonlin, m_NekLinSysTolerance, Nektar::LibUtilities::NekSysKey::m_NekLinSysTolerance, m_NekNonlinSysMaxIterations, Nektar::LibUtilities::NekSysKey::m_NekNonlinSysMaxIterations, m_NekNonLinSysTolerance, Nektar::LibUtilities::NekSysKey::m_NekNonLinSysTolerance, m_NonlinIterTolRelativeL2, Nektar::LibUtilities::NekSysKey::m_NonlinIterTolRelativeL2, Nektar::LibUtilities::NekSys::m_rowComm, and Nektar::LibUtilities::NekSys::m_SysDimen.

◆ ~NekNonlinSysIter()

Nektar::LibUtilities::NekNonlinSysIter::~NekNonlinSysIter ( )
overridedefault

Member Function Documentation

◆ ConvergenceCheck()

void Nektar::LibUtilities::NekNonlinSysIter::ConvergenceCheck ( const int  nIteration,
const Array< OneD, const NekDouble > &  Residual 
)
protected

Definition at line 86 of file NekNonlinSysIter.cpp.

88{
89 m_SysResNorm = Vmath::Dot(Residual.size(), Residual, Residual);
91
92 if (nIteration == 0)
93 {
95 }
96
100
102 {
103 m_rhs_magnitude = 1.0;
104 }
105
106 m_converged = resratio < restol * restol ||
107 m_SysResNorm < tol * tol * m_rhs_magnitude;
108}
static const NekDouble kNekUnsetDouble
double NekDouble
T Dot(int n, const T *w, const T *x)
dot product
Definition: Vmath.hpp:761

References Vmath::Dot(), Nektar::NekConstants::kNekUnsetDouble, Nektar::LibUtilities::NekSys::m_converged, m_NekNonLinSysTolerance, m_NonlinIterTolRelativeL2, Nektar::LibUtilities::NekSys::m_rhs_magnitude, Nektar::LibUtilities::NekSys::m_rowComm, m_SysResNorm, m_SysResNorm0, and Nektar::LibUtilities::ReduceSum.

Referenced by Nektar::LibUtilities::NekNonlinSysIterNewton::v_SolveSystem().

◆ GetLinSys()

const NekLinSysIterSharedPtr & Nektar::LibUtilities::NekNonlinSysIter::GetLinSys ( ) const
inline

Definition at line 81 of file NekNonlinSysIter.h.

82 {
83 return m_linsol;
84 }

References m_linsol.

◆ GetNtotLinSysIts()

int Nektar::LibUtilities::NekNonlinSysIter::GetNtotLinSysIts ( ) const
inline

Definition at line 86 of file NekNonlinSysIter.h.

References m_NtotLinSysIts.

◆ GetRefResidual()

const Array< OneD, const NekDouble > & Nektar::LibUtilities::NekNonlinSysIter::GetRefResidual ( ) const
inline

Definition at line 69 of file NekNonlinSysIter.h.

71 {
72 return m_Residual;
73 }

References m_Residual.

◆ GetRefSolution()

const Array< OneD, const NekDouble > & Nektar::LibUtilities::NekNonlinSysIter::GetRefSolution ( ) const
inline

Definition at line 63 of file NekNonlinSysIter.h.

65 {
66 return m_Solution;
67 }

References m_Solution.

◆ GetRefSourceVec()

const Array< OneD, const NekDouble > & Nektar::LibUtilities::NekNonlinSysIter::GetRefSourceVec ( ) const
inline

Definition at line 75 of file NekNonlinSysIter.h.

77 {
78 return m_SourceVec;
79 }

References m_SourceVec.

◆ SetNekLinSysTolerance()

void Nektar::LibUtilities::NekNonlinSysIter::SetNekLinSysTolerance ( const NekDouble  in)
inline

Definition at line 91 of file NekNonlinSysIter.h.

92 {
94 }

References m_NekLinSysTolerance.

◆ SetNekNonlinSysMaxIterations()

void Nektar::LibUtilities::NekNonlinSysIter::SetNekNonlinSysMaxIterations ( const int  in)
inline

Definition at line 106 of file NekNonlinSysIter.h.

107 {
109 }

References m_NekNonlinSysMaxIterations.

◆ SetNekNonlinSysTolerance()

void Nektar::LibUtilities::NekNonlinSysIter::SetNekNonlinSysTolerance ( const NekDouble  in)
inline

Definition at line 96 of file NekNonlinSysIter.h.

97 {
99 }

References m_NekNonLinSysTolerance.

◆ SetNonlinIterTolRelativeL2()

void Nektar::LibUtilities::NekNonlinSysIter::SetNonlinIterTolRelativeL2 ( const NekDouble  in)
inline

Definition at line 101 of file NekNonlinSysIter.h.

102 {
104 }

References m_NonlinIterTolRelativeL2.

◆ v_InitObject()

void Nektar::LibUtilities::NekNonlinSysIter::v_InitObject ( )
overrideprotectedvirtual

◆ v_SetSysOperators()

void Nektar::LibUtilities::NekNonlinSysIter::v_SetSysOperators ( const NekSysOperators in)
overrideprotectedvirtual

Reimplemented from Nektar::LibUtilities::NekSys.

Definition at line 80 of file NekNonlinSysIter.cpp.

81{
83 m_linsol->SetSysOperators(in);
84}
virtual void v_SetSysOperators(const NekSysOperators &in)
Definition: NekSys.h:306

References m_linsol, and Nektar::LibUtilities::NekSys::v_SetSysOperators().

Member Data Documentation

◆ m_DeltSltn

Array<OneD, NekDouble> Nektar::LibUtilities::NekNonlinSysIter::m_DeltSltn
protected

◆ m_linsol

NekLinSysIterSharedPtr Nektar::LibUtilities::NekNonlinSysIter::m_linsol
protected

◆ m_LinSysIterSolverType

std::string Nektar::LibUtilities::NekNonlinSysIter::m_LinSysIterSolverType
protected

Definition at line 125 of file NekNonlinSysIter.h.

Referenced by NekNonlinSysIter().

◆ m_NekLinSysTolerance

NekDouble Nektar::LibUtilities::NekNonlinSysIter::m_NekLinSysTolerance
protected

◆ m_NekNonlinSysMaxIterations

int Nektar::LibUtilities::NekNonlinSysIter::m_NekNonlinSysMaxIterations
protected

◆ m_NekNonLinSysTolerance

NekDouble Nektar::LibUtilities::NekNonlinSysIter::m_NekNonLinSysTolerance
protected

◆ m_NonlinIterTolRelativeL2

NekDouble Nektar::LibUtilities::NekNonlinSysIter::m_NonlinIterTolRelativeL2
protected

◆ m_NtotLinSysIts

int Nektar::LibUtilities::NekNonlinSysIter::m_NtotLinSysIts = 0
protected

◆ m_Residual

Array<OneD, NekDouble> Nektar::LibUtilities::NekNonlinSysIter::m_Residual
protected

◆ m_Solution

Array<OneD, NekDouble> Nektar::LibUtilities::NekNonlinSysIter::m_Solution
protected

◆ m_SourceVec

Array<OneD, NekDouble> Nektar::LibUtilities::NekNonlinSysIter::m_SourceVec
protected

◆ m_SysResNorm

NekDouble Nektar::LibUtilities::NekNonlinSysIter::m_SysResNorm
protected

◆ m_SysResNorm0

NekDouble Nektar::LibUtilities::NekNonlinSysIter::m_SysResNorm0
protected

◆ m_totalIterations

int Nektar::LibUtilities::NekNonlinSysIter::m_totalIterations = 0
protected

Definition at line 122 of file NekNonlinSysIter.h.