46 #include <Xyce_config.h>
48 #include <N_ERH_ErrorMgr.h>
49 #include <N_IO_CmdParse.h>
50 #include <N_IO_PkgOptionsMgr.h>
51 #include <N_UTL_Param.h>
56 #include <N_UTL_FeatureTest.h>
57 #include <N_UTL_OptionBlock.h>
73 printParamsFlag_(true),
76 debugMaxTimeStep_(Util::MachineDependentParams::IntMax()),
78 debugMaxTime_(Util::MachineDependentParams::DoubleMax()),
79 screenOutputFlag_(false),
152 : commandLine_(right.commandLine_),
153 absTol_(right.absTol_),
154 relTol_(right.relTol_),
155 INForcingFlag_(right.INForcingFlag_),
157 normLevel_(right.normLevel_),
158 linearOptimization_(right.linearOptimization_),
159 modeToggled_(right.modeToggled_),
160 printParamsFlag_(right.printParamsFlag_),
161 analysisMode_(right.analysisMode_),
162 maxNewtonStep_(right.maxNewtonStep_),
163 maxSearchStep_(right.maxSearchStep_),
164 nlStrategy_(right.nlStrategy_),
165 searchMethod_(right.searchMethod_),
166 direction_(right.direction_),
167 deltaXTol_(right.deltaXTol_),
168 RHSTol_(right.RHSTol_),
169 constraintBT_(right.constraintBT_),
170 globalBTMax_(right.globalBTMax_),
171 globalBTMin_(right.globalBTMin_),
172 globalBTChange_(right.globalBTChange_),
173 debugLevel_(right.debugLevel_),
174 debugMinTimeStep_(right.debugMinTimeStep_),
175 debugMaxTimeStep_(right.debugMaxTimeStep_),
176 debugMinTime_(right.debugMinTime_),
177 debugMaxTime_(right.debugMaxTime_)
210 for (Util::ParamList::const_iterator it_tpL = OB.begin();
211 it_tpL != OB.end(); ++ it_tpL)
213 if (it_tpL->uTag() ==
"ABSTOL")
215 setAbsTol(it_tpL->getImmutableValue<
double>());
217 else if (it_tpL->uTag() ==
"RELTOL")
219 setRelTol(it_tpL->getImmutableValue<
double>());
221 else if (it_tpL->uTag() ==
"DELTAXTOL")
225 else if (it_tpL->uTag() ==
"SMALLUPDATETOL")
229 else if (it_tpL->uTag() ==
"ENFORCEDEVICECONV")
233 else if (it_tpL->uTag() ==
"RHSTOL")
235 setRHSTol(it_tpL->getImmutableValue<
double>());
237 else if (it_tpL->uTag() ==
"MAXSTEP")
241 else if (it_tpL->uTag() ==
"LINOPT")
245 else if (it_tpL->uTag() ==
"CONSTRAINTBT")
249 else if (it_tpL->uTag() ==
"CONSTRAINTMAX")
253 else if (it_tpL->uTag() ==
"CONSTRAINTMIN")
257 else if (it_tpL->uTag() ==
"CONSTRAINTCHANGE")
261 else if (it_tpL->uTag() ==
"NLSTRATEGY")
265 else if (it_tpL->uTag() ==
"SEARCHMETHOD")
269 else if (it_tpL->uTag() ==
"MAXSEARCHSTEP")
273 else if (it_tpL->uTag() ==
"IN_FORCING")
277 else if (it_tpL->uTag() ==
"NORMLVL")
281 else if (it_tpL->uTag() ==
"NOX")
285 else if (it_tpL->uTag() ==
"MATRIXMARKET")
289 setMMFormat (static_cast<bool>(it_tpL->getImmutableValue<
double>()));
292 else if (it_tpL->uTag() ==
"DEBUGLEVEL")
299 else if (it_tpL->uTag() ==
"DEBUGMINTIMESTEP")
306 else if (it_tpL->uTag() ==
"DEBUGMAXTIMESTEP")
313 else if (it_tpL->uTag() ==
"DEBUGMINTIME")
320 else if (it_tpL->uTag() ==
"DEBUGMAXTIME")
327 else if (it_tpL->uTag() ==
"SCREENOUTPUT")
334 else if (NLS_MASKED_WRMS_NORMS && it_tpL->uTag() ==
"USEMASKING")
336 setMaskingFlag(static_cast<bool>(it_tpL->getImmutableValue<
double>()));
340 std::string tmp = it_tpL->uTag() +
341 " is not a recognized nonlinear solver option.\n";
342 N_ERH_ErrorMgr::report (N_ERH_ErrorMgr::USR_FATAL_0, tmp);
361 os <<
"\n" << std::endl
362 << Xyce::section_divider << std::endl;
363 os <<
"\n***** Nonlinear solver options:\n" << std::endl
364 <<
"\tabsTol:\t\t\t" <<
getAbsTol() << std::endl
365 <<
"\trelTol:\t\t\t" <<
getRelTol() << std::endl
366 <<
"\tdeltaXTol (weighted):\t" <<
getDeltaXTol() << std::endl
367 <<
"\tRHSTol:\t\t\t" <<
getRHSTol() << std::endl
372 os <<
"\tAnalysis Mode:\t\t" <<
analysisMode_ <<
"\t(DC Op)" << std::endl;
374 os <<
"\tAnalysis Mode:\t\t" <<
analysisMode_ <<
"\t(DC Sweep)" << std::endl;
376 os <<
"\tAnalysis Mode:\t\t" <<
analysisMode_ <<
"\t(Transient)" << std::endl;
380 os <<
"\tNL Strategy:\t\t" << strategy <<
"\t(None => Newton)" << std::endl;
382 os <<
"\tNL Strategy:\t\t" << strategy <<
"\t(Gradient)" << std::endl;
384 os <<
"\tNL Strategy:\t\t" << strategy <<
"\t(Newton/Gradient)" << std::endl;
386 os <<
"\tNL Strategy:\t\t" << strategy <<
"\t(Modified-Newton)" << std::endl;
388 os <<
"\tNL Strategy:\t\t" << strategy <<
"\t(Modified-Newton/Gradient)" << std::endl;
391 if (searchMethod ==
FULL)
392 os <<
"\tsearch method:\t\t" << searchMethod <<
"\t(None => Full Newton Steps)" << std::endl;
394 else if (searchMethod ==
DIVIDE)
395 os <<
"\tsearch method:\t\t" << searchMethod <<
"\t(Divide)" << std::endl;
398 os <<
"\tsearch method:\t\t" << searchMethod <<
"\t(Backtrack)" << std::endl;
401 os <<
"\tsearch method:\t\t" << searchMethod <<
"\t(Simple Backtrack)" << std::endl;
404 os <<
"\tsearch method:\t\t" << searchMethod <<
"\t(Bank and Rose Algorithm)" << std::endl;
406 else if (searchMethod ==
DESCENT)
407 os <<
"\tsearch method:\t\t" << searchMethod <<
"\t(Line Search)" << std::endl;
412 <<
"\tlinear optimization:\t" <<
getLinearOpt() << std::endl
422 os << Xyce::section_divider <<
"\n" << std::endl;
483 if (DEBUG_NONLINEAR &&
commandLine_->argExists(
"-ndl" ))
491 IO::PkgOptionsMgr& options_manager)
493 Util::ParamMap ¶meters = options_manager.addOptionsMetadataMap(
"NONLIN");
495 parameters.insert(Util::ParamMap::value_type(
"NLSTRATEGY", Util::Param(
"NLSTRATEGY", 0)));
496 parameters.insert(Util::ParamMap::value_type(
"SEARCHMETHOD", Util::Param(
"SEARCHMETHOD", 0)));
497 parameters.insert(Util::ParamMap::value_type(
"NOX", Util::Param(
"NOX", 1)));
498 parameters.insert(Util::ParamMap::value_type(
"ABSTOL", Util::Param(
"ABSTOL", 1.0E-12)));
499 parameters.insert(Util::ParamMap::value_type(
"RELTOL", Util::Param(
"RELTOL", 1.0E-3)));
500 parameters.insert(Util::ParamMap::value_type(
"DELTAXTOL", Util::Param(
"DELTAXTOL", 1.0)));
501 parameters.insert(Util::ParamMap::value_type(
"SMALLUPDATETOL", Util::Param(
"SMALLUPDATETOL", 1.0e-6)));
502 parameters.insert(Util::ParamMap::value_type(
"RHSTOL", Util::Param(
"RHSTOL", 1.0E-6)));
503 parameters.insert(Util::ParamMap::value_type(
"MAXSTEP", Util::Param(
"MAXSTEP", 200)));
504 parameters.insert(Util::ParamMap::value_type(
"MAXSEARCHSTEP", Util::Param(
"MAXSEARCHSTEP", 0)));
505 parameters.insert(Util::ParamMap::value_type(
"NORMLVL", Util::Param(
"NORMLVL", 2)));
506 parameters.insert(Util::ParamMap::value_type(
"LINOPT", Util::Param(
"LINOPT", 0)));
507 parameters.insert(Util::ParamMap::value_type(
"CONSTRAINTBT", Util::Param(
"CONSTRAINTBT", 0)));
508 parameters.insert(Util::ParamMap::value_type(
"CONSTRAINTMAX", Util::Param(
"CONSTRAINTMAX", Util::MachineDependentParams::DoubleMax())));
509 parameters.insert(Util::ParamMap::value_type(
"CONSTRAINTMIN", Util::Param(
"CONSTRAINTMIN", -Util::MachineDependentParams::DoubleMax())));
510 parameters.insert(Util::ParamMap::value_type(
"CONSTRAINTCHANGE", Util::Param(
"CONSTRAINTCHANGE", 0.0)));
511 parameters.insert(Util::ParamMap::value_type(
"IN_FORCING", Util::Param(
"IN_FORCING", 0)));
512 parameters.insert(Util::ParamMap::value_type(
"AZ_TOL", Util::Param(
"AZ_TOL", 1.0E-12)));
513 parameters.insert(Util::ParamMap::value_type(
"DLSDEBUG", Util::Param(
"DLSDEBUG", 0)));
514 parameters.insert(Util::ParamMap::value_type(
"MATRIXMARKET", Util::Param(
"MATRIXMARKET", 0)));
515 parameters.insert(Util::ParamMap::value_type(
"DEBUGLEVEL", Util::Param(
"DEBUGLEVEL", 1)));
516 parameters.insert(Util::ParamMap::value_type(
"DEBUGMINTIMESTEP", Util::Param(
"DEBUGMINTIMESTEP", 0)));
517 parameters.insert(Util::ParamMap::value_type(
"DEBUGMAXTIMESTEP", Util::Param(
"DEBUGMAXTIMESTEP", 99999999)));
518 parameters.insert(Util::ParamMap::value_type(
"DEBUGMINTIME", Util::Param(
"DEBUGMINTIME", 0.0)));
519 parameters.insert(Util::ParamMap::value_type(
"DEBUGMAXTIME", Util::Param(
"DEBUGMAXTIME", 1.0E99)));
520 parameters.insert(Util::ParamMap::value_type(
"SCREENOUTPUT", Util::Param(
"SCREENOUTPUT", 0)));
521 parameters.insert(Util::ParamMap::value_type(
"USEMASKING", Util::Param(
"USEMASKING", 0)));
522 parameters.insert(Util::ParamMap::value_type(
"RECOVERYSTEPTYPE", Util::Param(
"RECOVERYSTEPTYPE", 0)));
523 parameters.insert(Util::ParamMap::value_type(
"RECOVERYSTEP", Util::Param(
"RECOVERYSTEP", 1.0)));
524 parameters.insert(Util::ParamMap::value_type(
"MEMORY", Util::Param(
"MEMORY", 400)));
525 parameters.insert(Util::ParamMap::value_type(
"CONTINUATION", Util::Param(
"CONTINUATION", 0)));
526 parameters.insert(Util::ParamMap::value_type(
"ENFORCEDEVICECONV", Util::Param(
"ENFORCEDEVICECONV", 1)));
void setForcingFlag(bool flag)
void setSearchMethod(LineSearchMethod method)
void setGlobalBTMin(double value)
Pure virtual class to augment a linear system.
static void populateMetadata(IO::PkgOptionsMgr &options_manager)
void resetEnforceDeviceConvFlag()
double getSmallUpdateTol() const
void setDebugMinTime(double value)
unsigned getMaxNewtonStep() const
void setMaxSearchStep(unsigned maxSearchStep)
void setSmallUpdateTol(double Tolerance)
void setScreenOutputFlag(bool bval)
int getDebugLevel() const
void setEnforceDeviceConvFlag(bool flag)
void setNLStrategy(NLStrategy strategy)
void setConstraintBT(bool flag)
NLParams(AnalysisMode mode, const IO::CmdParse &cp)
void setDebugMinTimeStep(int value)
void setGlobalBTChange(double value)
AnalysisMode analysisMode_
LineSearchMethod getSearchMethod() const
void setDeltaXTol(double Tolerance)
NLParams & operator=(const NLParams &right)
bool getConstraintBT() const
LineSearchMethod searchMethod_
void setRelTol(double Tolerance)
void setDebugLevel(int value)
void setMaskingFlag(bool bval)
void resetMaxNewtonStep()
void setDebugMaxTimeStep(int value)
bool getLinearOpt() const
void setNormLevel(int level)
void resetGlobalBTChange()
void setAbsTol(double Tolerance)
void setGlobalBTMax(double value)
const IO::CmdParse * commandLine_
int getDebugMinTimeStep() const
void setMMFormat(bool value)
double getDeltaXTol() const
void printParams(std::ostream &os)
void setLinearOpt(bool flag)
void setMaxNewtonStep(unsigned maxNewtonStep)
NLStrategy getNLStrategy() const
void resetSmallUpdateTol()
bool setOptions(const Util::OptionBlock &OB)
int getDebugMaxTimeStep() const
void setRHSTol(double Tolerance)
bool getForcingFlag() const
void resetMaxSearchStep()
void setDebugMaxTime(double value)
unsigned getMaxSearchStep() const