46 #include <Xyce_config.h>
50 #include "LOCA_Continuation_ExtendedGroup.H"
51 #include "LOCA_Stepper.H"
52 #include "NOX_Solver_Generic.H"
53 #include "LOCA_Utils.H"
54 #include "LOCA_MultiContinuation_AbstractStrategy.H"
55 #include "LOCA_MultiContinuation_ExtendedVector.H"
56 #include "LOCA_NewStepper.H"
60 namespace N_NLS_LOCA {
74 NOX::Abstract::Group::ReturnType
77 maxStepSize = params.getParameter(
"Max Step Size", 1.0e+12);
78 minStepSize = params.getParameter(
"Min Step Size", 1.0e-12);
79 startStepSize = params.getParameter(
"Initial Step Size", 1.0);
80 failedFactor = params.getParameter(
"Failed Step Reduction Factor", 0.5);
81 successFactor = params.getParameter(
"Successful Step Increase Factor", 1.26);
84 agrValue = params.getParameter(
"Aggressiveness", 0.0);
86 return NOX::Abstract::Group::Ok;
89 NOX::Abstract::Group::ReturnType
91 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,
100 double dpds = predictor.getParam();
113 if (stepStatus == LOCA::Abstract::Iterator::Unsuccessful) {
118 double ds_ratio = curGroup.getStepSizeScaleFactor();
124 const NOX::Parameter::List& p = LOCA::Utils::getSublist(
"Stepper");
125 double maxNonlinearSteps
126 =
static_cast<double>(p.getParameter(
"Max Nonlinear Iterations", 15));
129 double numNonlinearSteps =
130 static_cast<double>(solver.getNumIterations());
136 double factor = (maxNonlinearSteps - numNonlinearSteps)
137 / (maxNonlinearSteps);
139 stepSize *= (1.0 +
agrValue * factor * factor);
141 stepSize *= ds_ratio;
146 NOX::Abstract::Group::ReturnType res =
clipStepSize(stepSize);
151 NOX::Abstract::Group::ReturnType
153 LOCA::MultiContinuation::AbstractStrategy& curGroup,
154 const LOCA::MultiContinuation::ExtendedVector& predictor,
155 const NOX::Solver::Generic& solver,
156 const LOCA::Abstract::Iterator::StepStatus& stepStatus,
157 const LOCA::NewStepper& stepper,
162 double dpds = predictor.getScalar(0);
175 if (stepStatus == LOCA::Abstract::Iterator::Unsuccessful) {
180 double ds_ratio = curGroup.getStepSizeScaleFactor();
186 const NOX::Parameter::List& p = LOCA::Utils::getSublist(
"Stepper");
187 double maxNonlinearSteps
188 =
static_cast<double>(p.getParameter(
"Max Nonlinear Iterations", 15));
191 double numNonlinearSteps =
192 static_cast<double>(solver.getNumIterations());
198 double factor = (maxNonlinearSteps - numNonlinearSteps)
199 / (maxNonlinearSteps);
201 stepSize *= (1.0 +
agrValue * factor * factor);
203 stepSize *= ds_ratio;
208 NOX::Abstract::Group::ReturnType res =
clipStepSize(stepSize);
214 NOX::Abstract::Group::ReturnType
217 NOX::Abstract::Group::ReturnType res = NOX::Abstract::Group::Ok;
220 double signStep = 1.0;
230 res = NOX::Abstract::Group::Failed;
232 if (LOCA::Utils::doPrint(LOCA::Utils::Error)) {
233 cout <<
"\n\tStep size reached minimum step size bound"
virtual double getPrevStepSize() const
virtual ~StepSizeControl()
Destructor.
double successFactor
Factor by which step size is increased after a successful step.
Pure virtual class to augment a linear system.
double prevStepSize
Previous step size.
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 double getStartStepSize() const
double maxStepSize
Maximum step size.
virtual NOX::Abstract::Group::ReturnType clipStepSize(double &stepSize)
double agrValue
Stores the aggressiveness factor .
virtual NOX::Abstract::Group::ReturnType reset(NOX::Parameter::List ¶ms)
double startStepSize
Initial step size.
double minStepSize
Minimum step size.
double failedFactor
Factor by which step size is reduced after a failed step.
StepSizeControl()
Constructor.