Xyce  6.1
N_NLS_NOX_PseudoTransientSolver.h
Go to the documentation of this file.
1 //-------------------------------------------------------------------------
2 // Copyright Notice
3 //
4 // Copyright 2002 Sandia Corporation. Under the terms
5 // of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S.
6 // Government retains certain rights in this software.
7 //
8 // Xyce(TM) Parallel Electrical Simulator
9 // Copyright (C) 2002-2015 Sandia Corporation
10 //
11 // This program is free software: you can redistribute it and/or modify
12 // it under the terms of the GNU General Public License as published by
13 // the Free Software Foundation, either version 3 of the License, or
14 // (at your option) any later version.
15 //
16 // This program is distributed in the hope that it will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 // GNU General Public License for more details.
20 //
21 // You should have received a copy of the GNU General Public License
22 // along with this program. If not, see <http://www.gnu.org/licenses/>.
23 //-------------------------------------------------------------------------
24 
25 //-------------------------------------------------------------------------
26 // Filename : $RCSfile: N_NLS_NOX_PseudoTransientSolver.h,v $
27 //
28 // Purpose :
29 //
30 // Special Notes :
31 //
32 // Creator :
33 //
34 // Creation Date :
35 //
36 // Revision Information:
37 // ---------------------
38 //
39 // Revision Number: $Revision: 1.19 $
40 //
41 // Revision Date : $Date: 2015/04/08 19:18:29 $
42 //
43 // Current Owner : $Author: tvrusso $
44 //-------------------------------------------------------------------------
45 
46 
47 #ifndef NOX_SOLVER_PSEUDOTRANSIENTSOLVER_H
48 #define NOX_SOLVER_PSEUDOTRANSIENTSOLVER_H
49 
50 #include <N_NLS_fwd.h>
51 
52 #include "NOX_Solver_Generic.H" // base class
53 
54 #include "NOX_LineSearch_Generic.H" // class data element
55 #include "NOX_Direction_Generic.H" // class data element
56 
57 #include "NOX_Solver_PrePostOperator.H" // class data element
58 #include "NOX_Utils.H" // class data element
59 #include "NOX_StatusTest_FiniteValue.H"
60 #include "Teuchos_RCP.hpp"
61 #include "Teuchos_ParameterList.hpp"
62 
63 namespace Xyce {
64 namespace Nonlinear {
65 namespace N_NLS_NOX {
66 
67  class PseudoTransientBased : public NOX::Solver::Generic {
68 
69 public:
70 
71  //! Constructor
72  PseudoTransientBased(const Teuchos::RCP<AugmentLinSys>& als,
73  const Teuchos::RCP<NOX::Abstract::Group>& grp,
74  const Teuchos::RCP<NOX::StatusTest::Generic>& tests,
75  const Teuchos::RCP<Teuchos::ParameterList>& params,
76  double initialStepSize,
77  double minStepSize,
78  double maxStepSize);
79 
80  //! Destructor
81  virtual ~PseudoTransientBased();
82 
83  virtual void reset(const NOX::Abstract::Vector& initial_guess);
84  virtual void reset(const NOX::Abstract::Vector& initial_guess,
85  const Teuchos::RCP<NOX::StatusTest::Generic>& test);
86  virtual NOX::StatusTest::StatusType getStatus();
87  virtual NOX::StatusTest::StatusType step();
88  virtual NOX::StatusTest::StatusType solve();
89  virtual const NOX::Abstract::Group& getSolutionGroup() const;
90  virtual const NOX::Abstract::Group& getPreviousSolutionGroup() const;
91  virtual int getNumIterations() const;
92  virtual const Teuchos::ParameterList& getList() const;
93 
94  //! Return the line search step size from the current iteration
95  virtual double getStepSize() const;
96 
97  //! Return the pseudo transient step size.
98  virtual double getPseudoTransientStepSize() const;
99 
100 protected:
101 
102  //! Print out initialization information and calcuation the RHS.
103  virtual void init();
104 
105  //! Prints the current iteration information.
106  virtual void printUpdate();
107 
108 protected:
109 
110  //! Global Data.
111  Teuchos::RCP<NOX::GlobalData> globalData;
112 
113  //! RCP to the strategy for augmenting the linear system.
114  Teuchos::RCP<AugmentLinSys> augmentLSStrategy;
115 
116  //! Current solution.
117  Teuchos::RCP<NOX::Abstract::Group> solnPtr;
118 
119  //! Previous solution pointer.
120  /*! We have both a pointer and a reference because we need to create
121  a DERIVED object and then want to have a reference to it. */
122  Teuchos::RCP<NOX::Abstract::Group> oldSolnPtr;
123  //! Previous solution reference.
124  NOX::Abstract::Group& oldSoln;
125 
126  //! Current search direction.pointer.
127  /*! We have both a pointer and a reference because we need to create
128  a DERIVED object and then want to have a reference to it. */
129  Teuchos::RCP<NOX::Abstract::Vector> dirPtr;
130  //! Current search direction.reference.
131  NOX::Abstract::Vector& dir;
132 
133  //! Stopping test.
134  Teuchos::RCP<NOX::StatusTest::Generic> testPtr;
135 
136  //! Input parameters.
137  Teuchos::RCP<Teuchos::ParameterList> paramsPtr;
138 
139  //! Utils
140  NOX::Utils& utils;
141 
142  //! Linesearch.
143  Teuchos::RCP<NOX::LineSearch::Generic> lineSearch;
144 
145  //! %Search %Direction.
146  Teuchos::RCP<NOX::Direction::Generic> direction;
147 
148  //! Current step.
149  double step_;
150 
151  //! Number of nonlinear iterations.
152  int nIter;
153 
154  //! %Status of nonlinear solver.
155  NOX::StatusTest::StatusType status;
156 
157  //! Pointer to a user defined NOX::Abstract::PrePostOperator object.
158  NOX::Solver::PrePostOperator prePostOperator;
159 
161  double minStepSize_;
162  double maxStepSize_;
163  double stepSize_;
165  double scaleFactor_;
166 
169 
170  NOX::StatusTest::FiniteValue fvTest_;
171 
172  //! Type of check to use for status tests.
173  NOX::StatusTest::CheckType checkType;
174 
175 };
176 }}} // namespace NOX
177 
178 #endif
179 
NOX::StatusTest::StatusType status
Status of nonlinear solver.
Teuchos::RCP< NOX::StatusTest::Generic > testPtr
Stopping test.
Pure virtual class to augment a linear system.
Teuchos::RCP< NOX::Abstract::Vector > dirPtr
Current search direction.pointer.
NOX::Solver::PrePostOperator prePostOperator
Pointer to a user defined NOX::Abstract::PrePostOperator object.
Teuchos::RCP< NOX::GlobalData > globalData
Global Data.
NOX::Abstract::Vector & dir
Current search direction.reference.
Teuchos::RCP< NOX::Abstract::Group > solnPtr
Current solution.
virtual double getStepSize() const
Return the line search step size from the current iteration.
virtual const NOX::Abstract::Group & getPreviousSolutionGroup() const
Teuchos::RCP< AugmentLinSys > augmentLSStrategy
RCP to the strategy for augmenting the linear system.
Teuchos::RCP< NOX::LineSearch::Generic > lineSearch
Linesearch.
virtual void reset(const NOX::Abstract::Vector &initial_guess)
virtual const Teuchos::ParameterList & getList() const
NOX::Abstract::Group & oldSoln
Previous solution reference.
virtual void init()
Print out initialization information and calcuation the RHS.
Teuchos::RCP< Teuchos::ParameterList > paramsPtr
Input parameters.
NOX::StatusTest::CheckType checkType
Type of check to use for status tests.
PseudoTransientBased(const Teuchos::RCP< AugmentLinSys > &als, const Teuchos::RCP< NOX::Abstract::Group > &grp, const Teuchos::RCP< NOX::StatusTest::Generic > &tests, const Teuchos::RCP< Teuchos::ParameterList > &params, double initialStepSize, double minStepSize, double maxStepSize)
Constructor.
virtual void printUpdate()
Prints the current iteration information.
virtual const NOX::Abstract::Group & getSolutionGroup() const
Teuchos::RCP< NOX::Direction::Generic > direction
Search Direction.
Teuchos::RCP< NOX::Abstract::Group > oldSolnPtr
Previous solution pointer.
virtual double getPseudoTransientStepSize() const
Return the pseudo transient step size.