Xyce  6.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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-2014 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.15 $
40 //
41 // Revision Date : $Date: 2014/02/24 23:49:24 $
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_UTL_Misc.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_RefCountPtr.hpp"
61 #include "Teuchos_ParameterList.hpp"
62 
63 // Forward declarations
64 namespace N_NLS_LOCA {
65  class Group;
66 }
67 namespace NOX {
68  namespace StatusTest {
69  class Generic;
70  }
71  class GlobalData;
72 }
73 namespace N_NLS_NOX {
74  class AugmentLinSys;
75 }
76 
77 
78 namespace N_NLS_NOX {
79 
80  class PseudoTransientBased : public NOX::Solver::Generic {
81 
82 public:
83 
84  //! Constructor
85  PseudoTransientBased(const Teuchos::RefCountPtr<N_NLS_NOX::AugmentLinSys>& als,
86  const Teuchos::RefCountPtr<NOX::Abstract::Group>& grp,
87  const Teuchos::RefCountPtr<NOX::StatusTest::Generic>& tests,
88  const Teuchos::RefCountPtr<Teuchos::ParameterList>& params,
89  double initialStepSize,
90  double minStepSize,
91  double maxStepSize);
92 
93  //! Destructor
94  virtual ~PseudoTransientBased();
95 
96  virtual void reset(const NOX::Abstract::Vector& initial_guess);
97  virtual void reset(const NOX::Abstract::Vector& initial_guess,
98  const Teuchos::RCP<NOX::StatusTest::Generic>& test);
99  virtual NOX::StatusTest::StatusType getStatus();
100  virtual NOX::StatusTest::StatusType step();
101  virtual NOX::StatusTest::StatusType solve();
102  virtual const NOX::Abstract::Group& getSolutionGroup() const;
103  virtual const NOX::Abstract::Group& getPreviousSolutionGroup() const;
104  virtual int getNumIterations() const;
105  virtual const Teuchos::ParameterList& getList() const;
106 
107  //! Return the line search step size from the current iteration
108  virtual double getStepSize() const;
109 
110  //! Return the pseudo transient step size.
111  virtual double getPseudoTransientStepSize() const;
112 
113 protected:
114 
115  //! Print out initialization information and calcuation the RHS.
116  virtual void init();
117 
118  //! Prints the current iteration information.
119  virtual void printUpdate();
120 
121 protected:
122 
123  //! Global Data.
124  Teuchos::RefCountPtr<NOX::GlobalData> globalData;
125 
126  //! RCP to the strategy for augmenting the linear system.
127  Teuchos::RefCountPtr<N_NLS_NOX::AugmentLinSys> augmentLSStrategy;
128 
129  //! Current solution.
130  Teuchos::RefCountPtr<NOX::Abstract::Group> solnPtr;
131 
132  //! Previous solution pointer.
133  /*! We have both a pointer and a reference because we need to create
134  a DERIVED object and then want to have a reference to it. */
135  Teuchos::RefCountPtr<NOX::Abstract::Group> oldSolnPtr;
136  //! Previous solution reference.
137  NOX::Abstract::Group& oldSoln;
138 
139  //! Current search direction.pointer.
140  /*! We have both a pointer and a reference because we need to create
141  a DERIVED object and then want to have a reference to it. */
142  Teuchos::RefCountPtr<NOX::Abstract::Vector> dirPtr;
143  //! Current search direction.reference.
144  NOX::Abstract::Vector& dir;
145 
146  //! Stopping test.
147  Teuchos::RefCountPtr<NOX::StatusTest::Generic> testPtr;
148 
149  //! Input parameters.
150  Teuchos::RefCountPtr<Teuchos::ParameterList> paramsPtr;
151 
152  //! Utils
153  NOX::Utils& utils;
154 
155  //! Linesearch.
156  Teuchos::RCP<NOX::LineSearch::Generic> lineSearch;
157 
158  //! %Search %Direction.
159  Teuchos::RCP<NOX::Direction::Generic> direction;
160 
161  //! Current step.
162  double step_;
163 
164  //! Number of nonlinear iterations.
165  int nIter;
166 
167  //! %Status of nonlinear solver.
168  NOX::StatusTest::StatusType status;
169 
170  //! Pointer to a user defined NOX::Abstract::PrePostOperator object.
171  NOX::Solver::PrePostOperator prePostOperator;
172 
174  double minStepSize_;
175  double maxStepSize_;
176  double stepSize_;
178  double scaleFactor_;
179 
182 
183  NOX::StatusTest::FiniteValue fvTest_;
184 
185  //! Type of check to use for status tests.
186  NOX::StatusTest::CheckType checkType;
187 
188 };
189 } // namespace NOX
190 
191 #endif
192