Xyce  6.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
N_NLS_LOCA_StepSizeControl.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_LOCA_StepSizeControl.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.6 $
40 //
41 // Revision Date : $Date: 2014/08/07 23:08:54 $
42 //
43 // Current Owner : $Author: dgbaur $
44 //-------------------------------------------------------------------------
45 
46 
47 
48 
49 
50 #ifndef N_NLS_LOCA_STEPSIZECONTROL_H
51 #define N_NLS_LOCA_STEPSIZECONTROL_H
52 
53 #include <LOCA_StepSize_Generic.H> // base class
54 
55 namespace N_NLS_LOCA {
56 
57  //! %Adaptive step size control strategy
58  /*!
59  This class implements an adaptive step size control strategy derived
60  from the strategy implemented in the LOCA::StepSize::Constant class.
61  If the previous step was unsucessful, the step size is cut in half as
62  in the constant strategy, but if the step was sucessful this strategy
63  increases the step size based on the number of nonlinear solver
64  iterations required in the previous step. In particular, the new
65  step size \f$\Delta s_{new}\f$ is given by
66  \f[
67  \Delta s_{new} = \Delta s_{old}\left(1 + a\left(\frac{N_{max} - N}{N_{max}}\right)^2\right)
68  \f]
69  where \f$a\in[0,1]\f$ is an aggressiveness factor, \f$N\f$ is the
70  number of nonlinear solver iterations in the previous step, and
71  \f$N_{max}\f$ is the maximum number of nonlinear solver iterations.
72 
73  The parameters used by this class supplied in the constructor or reset
74  method are the same as used by the Constant class in addition to:
75  <ul>
76  <li> "Aggressiveness" - Aggressiveness factor \f$a\f$ (Default 0.0)
77  </ul>
78  */
79  class StepSizeControl : public LOCA::StepSize::Generic {
80 
81  public:
82 
83  //! Constructor.
85 
86  //! Destructor
87  virtual ~StepSizeControl();
88 
89  virtual NOX::Abstract::Group::ReturnType
90  reset(NOX::Parameter::List& params);
91 
92  virtual NOX::Abstract::Group::ReturnType
93  compute(LOCA::Continuation::ExtendedGroup& curGroup,
94  const LOCA::Continuation::ExtendedVector& predictor,
95  const NOX::Solver::Generic& solver,
96  const LOCA::Abstract::Iterator::StepStatus& stepStatus,
97  const LOCA::Stepper& stepper,
98  double& stepSize);
99 
100  virtual NOX::Abstract::Group::ReturnType
101  compute(LOCA::MultiContinuation::AbstractStrategy& curGroup,
102  const LOCA::MultiContinuation::ExtendedVector& predictor,
103  const NOX::Solver::Generic& solver,
104  const LOCA::Abstract::Iterator::StepStatus& stepStatus,
105  const LOCA::NewStepper& stepper,
106  double& stepSize);
107 
108  virtual double getPrevStepSize() const;
109 
110  virtual double getStartStepSize() const;
111 
112  protected:
113 
114  virtual NOX::Abstract::Group::ReturnType
115  clipStepSize(double& stepSize);
116 
117  protected:
118  //! Maximum step size
119  double maxStepSize;
120 
121  //! Minimum step size
122  double minStepSize;
123 
124  //! Initial step size
126 
127  //! Factor by which step size is reduced after a failed step
128  double failedFactor;
129 
130  //! Factor by which step size is increased after a successful step
132 
133  //! Previous step size
134  double prevStepSize;
135 
136  //! Flag indicating if this is the first step
138 
139  //! Stores the aggressiveness factor \f$a\f$
140  double agrValue;
141  };
142 }
143 
144 #endif