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