Nektar++
NekNonlinSys.h
Go to the documentation of this file.
1///////////////////////////////////////////////////////////////////////////////
2//
3// File: NekNonlinSys.h
4//
5// For more information, please see: http://www.nektar.info
6//
7// The MIT License
8//
9// Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
10// Department of Aeronautics, Imperial College London (UK), and Scientific
11// Computing and Imaging Institute, University of Utah (USA).
12//
13// License for the specific language governing rights and limitations under
14// Permission is hereby granted, free of charge, to any person obtaining a
15// copy of this software and associated documentation files (the "Software"),
16// to deal in the Software without restriction, including without limitation
17// the rights to use, copy, modify, merge, publish, distribute, sublicense,
18// and/or sell copies of the Software, and to permit persons to whom the
19// Software is furnished to do so, subject to the following conditions:
20//
21// The above copyright notice and this permission notice shall be included
22// in all copies or substantial portions of the Software.
23//
24// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
25// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
27// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
30// DEALINGS IN THE SOFTWARE.
31//
32// Description: NekNonlinSys header
33//
34///////////////////////////////////////////////////////////////////////////////
35
36#ifndef NEKTAR_LIB_UTILITIES_LINEAR_ALGEBRA_NEK_NONLINSYS_H
37#define NEKTAR_LIB_UTILITIES_LINEAR_ALGEBRA_NEK_NONLINSYS_H
38
41
42namespace Nektar
43{
44namespace LibUtilities
45{
46class NekNonlinSys;
47
48typedef std::shared_ptr<NekNonlinSys> NekNonlinSysSharedPtr;
49
52 const LibUtilities::CommSharedPtr &, const int, const NekSysKey &>
55
56class NekNonlinSys : public NekSys
57{
58public:
61 const LibUtilities::CommSharedPtr &vRowComm, const int nDimen,
62 const NekSysKey &pKey);
64
66 const
67 {
68 return m_Solution;
69 }
70
72 const
73 {
74 return m_Residual;
75 }
76
78 const
79 {
80 return m_SourceVec;
81 }
82
84 {
85 m_tolerance = in;
86 }
87
89 const unsigned int in)
90 {
91 m_maxiter = in;
92 }
93
95 {
96 return m_linsol;
97 }
98
100 {
102 }
103
105 {
107 }
108
110 {
111 return m_NtotLinSysIts;
112 }
113
115 const int nGlobal, const Array<OneD, const NekDouble> &pInput,
116 const Array<OneD, const NekDouble> &pSource, const int nDir)
117 {
118 v_SetupNekNonlinSystem(nGlobal, pInput, pSource, nDir);
119 }
120
121protected:
123
126
128
131
136
137 virtual void v_InitObject();
138
140 const int nGlobal, const Array<OneD, const NekDouble> &pInput,
141 const Array<OneD, const NekDouble> &pSource, const int nDir) = 0;
142
143private:
144};
145} // namespace LibUtilities
146} // namespace Nektar
147#endif
#define LIB_UTILITIES_EXPORT
Provides a generic Factory class.
Definition: NekFactory.hpp:105
void SetupNekNonlinSystem(const int nGlobal, const Array< OneD, const NekDouble > &pInput, const Array< OneD, const NekDouble > &pSource, const int nDir)
Definition: NekNonlinSys.h:114
void SetLinSysRelativeTolInNonlin(const NekDouble in)
Definition: NekNonlinSys.h:104
void SetNekNonlinSysTolerance(const NekDouble in)
Definition: NekNonlinSys.h:83
const Array< OneD, const NekDouble > & GetRefResidual() const
Definition: NekNonlinSys.h:71
Array< OneD, NekDouble > m_Residual
Definition: NekNonlinSys.h:133
NekNonlinSys(const LibUtilities::SessionReaderSharedPtr &pSession, const LibUtilities::CommSharedPtr &vRowComm, const int nDimen, const NekSysKey &pKey)
const Array< OneD, const NekDouble > & GetRefSourceVec() const
Definition: NekNonlinSys.h:77
Array< OneD, NekDouble > m_DeltSltn
Definition: NekNonlinSys.h:134
const Array< OneD, const NekDouble > & GetRefSolution() const
Definition: NekNonlinSys.h:65
void SetNonlinIterTolRelativeL2(const NekDouble in)
Definition: NekNonlinSys.h:99
Array< OneD, NekDouble > m_SourceVec
Definition: NekNonlinSys.h:135
const NekLinSysIterSharedPtr & GetLinSys()
Definition: NekNonlinSys.h:94
NekLinSysIterSharedPtr m_linsol
Definition: NekNonlinSys.h:122
virtual void v_SetupNekNonlinSystem(const int nGlobal, const Array< OneD, const NekDouble > &pInput, const Array< OneD, const NekDouble > &pSource, const int nDir)=0
void SetNekNonlinSysMaxIterations(const unsigned int in)
Definition: NekNonlinSys.h:88
Array< OneD, NekDouble > m_Solution
Definition: NekNonlinSys.h:132
NekDouble m_tolerance
Tolerance of iterative solver.
Definition: NekSys.h:300
int m_maxiter
Maximum iterations.
Definition: NekSys.h:298
std::shared_ptr< NekLinSysIter > NekLinSysIterSharedPtr
Definition: NekLinSysIter.h:48
NekNonlinSysFactory & GetNekNonlinSysFactory()
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< NekNonlinSys > NekNonlinSysSharedPtr
Definition: NekNonlinSys.h:48
LibUtilities::NekFactory< std::string, NekNonlinSys, const LibUtilities::SessionReaderSharedPtr &, const LibUtilities::CommSharedPtr &, const int, const NekSysKey & > NekNonlinSysFactory
Definition: NekNonlinSys.h:53
std::shared_ptr< Comm > CommSharedPtr
Pointer to a Communicator object.
Definition: Comm.h:57
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:2
double NekDouble