49 #include <Xyce_config.h>
55 #include "LOCA_Continuation_ExtendedGroup.H"
56 #include "LOCA_Stepper.H"
57 #include "NOX_Solver_Generic.H"
58 #include "LOCA_Utils.H"
59 #include "LOCA_MultiContinuation_AbstractStrategy.H"
60 #include "LOCA_MultiContinuation_ExtendedVector.H"
61 #include "LOCA_NewStepper.H"
75 NOX::Abstract::Group::ReturnType
78 maxStepSize = params.getParameter(
"Max Step Size", 1.0e+12);
79 minStepSize = params.getParameter(
"Min Step Size", 1.0e-12);
80 startStepSize = params.getParameter(
"Initial Step Size", 1.0);
81 failedFactor = params.getParameter(
"Failed Step Reduction Factor", 0.5);
82 successFactor = params.getParameter(
"Successful Step Increase Factor", 1.26);
85 agrValue = params.getParameter(
"Aggressiveness", 0.0);
87 return NOX::Abstract::Group::Ok;
90 NOX::Abstract::Group::ReturnType
92 LOCA::Continuation::ExtendedGroup& curGroup,
93 const LOCA::Continuation::ExtendedVector& predictor,
94 const NOX::Solver::Generic& solver,
95 const LOCA::Abstract::Iterator::StepStatus& stepStatus,
96 const LOCA::Stepper& stepper,
101 double dpds = predictor.getParam();
103 startStepSize /= dpds;
108 stepSize = startStepSize;
114 if (stepStatus == LOCA::Abstract::Iterator::Unsuccessful) {
115 stepSize *= failedFactor;
119 double ds_ratio = curGroup.getStepSizeScaleFactor();
120 startStepSize *= ds_ratio;
121 maxStepSize *= ds_ratio;
122 minStepSize *= ds_ratio;
125 const NOX::Parameter::List& p = LOCA::Utils::getSublist(
"Stepper");
126 double maxNonlinearSteps
127 =
static_cast<double>(p.getParameter(
"Max Nonlinear Iterations", 15));
130 double numNonlinearSteps =
131 static_cast<double>(solver.getNumIterations());
134 prevStepSize = stepSize;
137 double factor = (maxNonlinearSteps - numNonlinearSteps)
138 / (maxNonlinearSteps);
140 stepSize *= (1.0 + agrValue * factor * factor);
142 stepSize *= ds_ratio;
147 NOX::Abstract::Group::ReturnType res = clipStepSize(stepSize);
152 NOX::Abstract::Group::ReturnType
154 LOCA::MultiContinuation::AbstractStrategy& curGroup,
155 const LOCA::MultiContinuation::ExtendedVector& predictor,
156 const NOX::Solver::Generic& solver,
157 const LOCA::Abstract::Iterator::StepStatus& stepStatus,
158 const LOCA::NewStepper& stepper,
163 double dpds = predictor.getScalar(0);
165 startStepSize /= dpds;
170 stepSize = startStepSize;
176 if (stepStatus == LOCA::Abstract::Iterator::Unsuccessful) {
177 stepSize *= failedFactor;
181 double ds_ratio = curGroup.getStepSizeScaleFactor();
182 startStepSize *= ds_ratio;
183 maxStepSize *= ds_ratio;
184 minStepSize *= ds_ratio;
187 const NOX::Parameter::List& p = LOCA::Utils::getSublist(
"Stepper");
188 double maxNonlinearSteps
189 =
static_cast<double>(p.getParameter(
"Max Nonlinear Iterations", 15));
192 double numNonlinearSteps =
193 static_cast<double>(solver.getNumIterations());
196 prevStepSize = stepSize;
199 double factor = (maxNonlinearSteps - numNonlinearSteps)
200 / (maxNonlinearSteps);
202 stepSize *= (1.0 + agrValue * factor * factor);
204 stepSize *= ds_ratio;
209 NOX::Abstract::Group::ReturnType res = clipStepSize(stepSize);
215 NOX::Abstract::Group::ReturnType
218 NOX::Abstract::Group::ReturnType res = NOX::Abstract::Group::Ok;
221 double signStep = 1.0;
226 if (fabs(stepSize) > maxStepSize)
227 stepSize = signStep*maxStepSize;
230 if (fabs(stepSize) < minStepSize) {
231 res = NOX::Abstract::Group::Failed;
232 stepSize = signStep*minStepSize;
233 if (LOCA::Utils::doPrint(LOCA::Utils::Error)) {
234 cout <<
"\n\tStep size reached minimum step size bound"
249 return startStepSize;