46 #include <Xyce_config.h>
54 #include <LOCA_GlobalData.H>
55 #include <LOCA_StatusTest_Wrapper.H>
56 #include <NOX_Solver_Factory.H>
58 #include <N_ERH_ErrorMgr.h>
59 #include <N_IO_CmdParse.h>
60 #include <N_IO_OutputMgr.h>
61 #include <N_LAS_Builder.h>
62 #include <N_LAS_QueryUtil.h>
63 #include <N_LAS_Solver.h>
64 #include <N_LAS_System.h>
74 #include <N_UTL_FeatureTest.h>
76 #ifdef Xyce_PARALLEL_MPI
77 #include <N_PDS_ParComm.h>
79 #include <N_PDS_SerialComm.h>
101 dcParams_(Nonlinear::
DC_OP),
105 mode_(Nonlinear::
DC_OP),
106 lastParametersMode_(Nonlinear::
DC_OP),
107 parametersMode_(Nonlinear::
DC_OP),
109 copiedGroupFlag_(false),
112 NODESETspecified_(false),
113 isFirstContinuationParam_(true),
114 firstSolveComplete_(false),
283 int myPID =
pdsMgrPtr_->getPDSComm()->procID();
290 bool testsok =
false;
291 if (NLS_MASKED_WRMS_NORMS)
314 .get(
"Forcing Term Method",
"Constant") == std::string(
"Constant")))
319 .get(
"Forcing Term Method",
"Constant") == std::string(
"Constant")))
324 .get(
"Forcing Term Method",
"Constant") == std::string(
"Constant")))
346 groupPtr_->setNonContinuationFlag (
true);
353 groupPtr_->setNonContinuationFlag (
false);
358 (*nextSolVectorPtrPtr_)->putScalar(0.0);
375 groupPtr_->setNonContinuationFlag (
false);
380 (*nextSolVectorPtrPtr_)->putScalar(0.0);
418 if (found > 0 && icType == IO::InitialConditionsData::IC_TYPE_DCOP_RESTART)
421 Teuchos::RCP<AugmentLinSys> als =
423 groupPtr_->setAugmentLinearSystem(
true, als);
424 NOX::StatusTest::StatusType status =
solverPtr_->solve();
430 groupPtr_->setAugmentLinearSystem(
false, Teuchos::null);
432 #ifdef Xyce_DEBUG_OP_START
433 groupPtr_->setOutputLinear (&op, &allNodes, pdsCommPtr);
434 #endif // debug op start
454 bool usedNODESET=
false;
470 dout() <<
"Creating new NLS solver b/c it is 0." <<std::endl;
472 dout() <<
"Creating new NLS solver b/c starting next phase, post-DC." <<std::endl;
482 dout() <<
"NOT Creating new NLS solver, just resetting." <<std::endl;
493 usedIC=
icCont (paramsPtr);
511 NOX::StatusTest::StatusType status =
solverPtr_->solve();
516 groupPtr_->setAugmentLinearSystem(
false, Teuchos::null);
539 std::vector<std::string> pars;
544 bool usedNODESET=
false;
551 usedIC=
icCont (paramsPtr);
563 Teuchos::RCP<Teuchos::ParameterList> locaList =
567 LOCA::ParameterVector locaPVec;
568 Teuchos::ParameterList& stepperList = locaList->sublist(
"Stepper");
569 Teuchos::ParameterList& stepSizeList = locaList->sublist(
"Step Size");
578 if ( numParam == 0 ) {
579 std::string message =
"Using \"continuation=1\" requires a parameter to be set with the conparam keyword in the loca option block!";
580 N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::USR_FATAL, message);
583 Teuchos::RCP<AugmentLinSys> als;
585 std::vector<double> minValue(numParam, 0.);
586 std::vector<double> maxValue(numParam, 0.);
587 std::vector<double> initialValue(numParam, 0.);
588 std::vector<double> initialStepSize(numParam, 0.);
589 std::vector<double> minStepSize(numParam, 0.);
590 std::vector<double> maxStepSize(numParam, 0.);
591 std::vector<double> aggressiveness(numParam, 0.);
594 std::vector<std::string> paramNames(0);
595 paramNames.push_back(
"MINVALUE");
596 paramNames.push_back(
"MAXVALUE");
597 paramNames.push_back(
"INITIALVALUE");
598 paramNames.push_back(
"INITIALSTEPSIZE");
599 paramNames.push_back(
"MINSTEPSIZE");
600 paramNames.push_back(
"MAXSTEPSIZE");
601 paramNames.push_back(
"AGGRESSIVENESS");
603 for (std::size_t p = 0 ; p < paramNames.size() ; ++p) {
605 std::string msg =
"The parameter \"" +
607 "\" must have a list of values with size equal to the numParamber of parameters specified in \"conparam\".";
608 N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL, msg);
635 locaPVec.addParameter (pars[
iParam_], initialValue[iParam_]);
639 if (usedOP || usedNODESET)
649 LOCA::Abstract::Iterator::IteratorStatus locaStatus;
659 stepperList.set(
"Continuation Parameter", pars[
iParam_]);
660 stepperList.set(
"Initial Value", initialValue[iParam_]);
661 stepperList.set(
"Max Value", maxValue[iParam_]);
662 stepperList.set(
"Min Value", minValue[iParam_]);
663 stepSizeList.set(
"Initial Step Size", initialStepSize[iParam_]);
664 stepSizeList.set(
"Min Step Size", minStepSize[iParam_]);
665 stepSizeList.set(
"Max Step Size", maxStepSize[iParam_]);
666 stepSizeList.set(
"Aggressiveness", aggressiveness[iParam_]);
670 locaPVec.setValue(pars[j], maxValue[j]);
672 for (j=iParam_ ; j<numParam ; ++j)
674 locaPVec.setValue(pars[j], initialValue[j]);
680 if (!usedOP && !usedNODESET)
690 if (pars[iParam_] !=
"GSTEPPING")
695 if (usedIC || usedNODESET)
697 groupPtr_->setAugmentLinearSystem(
false, Teuchos::null);
704 std::string message =
"'.dcop input=' and gstepping are incompatible";
705 N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::USR_FATAL, message);
707 Teuchos::RCP<AugmentLinSys> als =
709 groupPtr_->setAugmentLinearSystem(
true, als);
715 groupPtr_->setAugmentLinearSystem(
false, Teuchos::null);
719 if (locaStatus != LOCA::Abstract::Iterator::Finished)
742 bool usedNODESET=
false;
749 usedIC=
icCont (paramsPtr);
762 std::vector<std::string> pars;
771 if ( numParam > 1 ) {
772 Report::UserWarning() <<
"Using \"continuation=2\" currently does not support vectorized loca parameters. Only the first values in each list will be used";
775 Teuchos::RCP<Teuchos::ParameterList> locaList = paramsPtr->
getLocaParams();
778 std::string gain =
"mosfet:gainscale";
779 std::string nonlinear =
"mosfet:nltermscale";
782 LOCA::ParameterVector locaPVec;
783 Teuchos::ParameterList& stepperList = locaList->sublist(
"Stepper");
784 Teuchos::ParameterList& predictorList = locaList->sublist(
"Predictor");
785 Teuchos::ParameterList& stepSizeList = locaList->sublist(
"Step Size");
789 locaPVec.addParameter(gain, 0.0);
790 locaPVec.addParameter(nonlinear, 0.0);
792 stepperList.set(
"Continuation Parameter", gain);
794 stepperList.set(
"Initial Value", 0.0);
795 stepperList.set(
"Max Value", 1.0);
796 stepperList.set(
"Min Value",-1.0);
798 stepSizeList.set(
"Initial Step Size", 0.2);
799 stepSizeList.set(
"Min Step Size", 1.0e-4);
800 stepSizeList.set(
"Max Step Size", 1.0);
801 stepSizeList.set(
"Aggressiveness", 1.0);
807 if (!usedOP && !usedNODESET)
815 LOCA::Abstract::Iterator::IteratorStatus locaStatus =
stepperPtr_->run();
818 if (locaStatus != LOCA::Abstract::Iterator::Finished)
830 stepperList.set(
"Continuation Parameter", nonlinear);
832 stepperList.set(
"Initial Value", 0.0);
833 stepperList.set(
"Max Value", 1.0);
834 stepperList.set(
"Min Value",-1.0);
836 stepSizeList.set(
"Initial Step Size", 0.2);
837 stepSizeList.set(
"Min Step Size", 1.0e-4);
838 stepSizeList.set(
"Max Step Size", 1.0);
839 stepSizeList.set(
"Aggressiveness", 1.0);
844 locaPVec.setValue(gain, 1.0);
845 locaPVec.setValue(nonlinear, 0.0);
855 groupPtr_->setAugmentLinearSystem(
false, Teuchos::null);
859 if (locaStatus != LOCA::Abstract::Iterator::Finished)
878 Teuchos::RCP<Teuchos::ParameterList> locaList = paramsPtr->
getLocaParams();
881 std::string gain =
"mosfet:gainscale";
882 std::string nonlinear =
"mosfet:nltermscale";
883 std::string size =
"mosfet:sizescale";
886 LOCA::ParameterVector locaPVec;
887 Teuchos::ParameterList& stepperList = locaList->sublist(
"Stepper");
892 locaPVec.addParameter(gain, 0.0);
893 locaPVec.addParameter(nonlinear, 0.0);
894 locaPVec.addParameter(size, 0.0);
896 stepperList.set(
"Continuation Parameter", gain);
897 stepperList.set(
"Initial Value", 0.0);
898 stepperList.set(
"Max Value", 1.0);
905 LOCA::Abstract::Iterator::IteratorStatus locaStatus =
stepperPtr_->run();
908 if (locaStatus != LOCA::Abstract::Iterator::Finished)
921 stepperList.set(
"Continuation Parameter", nonlinear);
922 stepperList.set(
"Initial Value", 0.0);
923 stepperList.set(
"Max Value", 1.0);
924 locaPVec.setValue(gain, 1.0);
925 locaPVec.setValue(nonlinear, 0.0);
926 locaPVec.setValue(size, 0.0);
934 if (locaStatus != LOCA::Abstract::Iterator::Finished)
943 stepperList.set(
"Continuation Parameter", size);
944 stepperList.set(
"Initial Value", 0.0);
945 stepperList.set(
"Max Value", 1.0);
946 locaPVec.setValue(gain, 1.0);
947 locaPVec.setValue(nonlinear, 1.0);
948 locaPVec.setValue(size, 0.0);
956 if (locaStatus != LOCA::Abstract::Iterator::Finished)
974 Teuchos::RCP<Teuchos::ParameterList> locaList = paramsPtr->
getLocaParams();
978 std::string nonlinear =
"mosfet:nltermscale";
979 std::string size =
"mosfet:sizescale";
982 LOCA::ParameterVector locaPVec;
983 Teuchos::ParameterList& stepperList = locaList->sublist(
"Stepper");
989 locaPVec.addParameter(nonlinear, 0.0);
990 locaPVec.addParameter(size, 0.0);
992 stepperList.set(
"Continuation Parameter", nonlinear);
993 stepperList.set(
"Initial Value", 0.0);
994 stepperList.set(
"Max Value", 1.0);
1001 LOCA::Abstract::Iterator::IteratorStatus locaStatus =
stepperPtr_->run();
1004 if (locaStatus != LOCA::Abstract::Iterator::Finished)
1017 stepperList.set(
"Continuation Parameter", size);
1018 stepperList.set(
"Initial Value", 0.0);
1019 stepperList.set(
"Max Value", 1.0);
1021 locaPVec.setValue(nonlinear, 1.0);
1022 locaPVec.setValue(size, 0.0);
1030 if (locaStatus != LOCA::Abstract::Iterator::Finished)
1048 Teuchos::RCP<Teuchos::ParameterList> locaList = paramsPtr->
getLocaParams();
1051 std::string gain =
"mosfet:gainscale";
1052 std::string nonlinear =
"mosfet:nltermscale";
1053 std::string size =
"mosfet:sizescale";
1056 LOCA::ParameterVector locaPVec;
1057 Teuchos::ParameterList& stepperList = locaList->sublist(
"Stepper");
1060 locaPVec.addParameter(gain, 1.0);
1061 locaPVec.addParameter(nonlinear, 1.0);
1062 locaPVec.addParameter(size, 0.0);
1064 stepperList.set(
"Continuation Parameter", size);
1065 stepperList.set(
"Initial Value", 0.0);
1066 stepperList.set(
"Max Value", 1.0);
1073 LOCA::Abstract::Iterator::IteratorStatus locaStatus =
stepperPtr_->run();
1076 if (locaStatus != LOCA::Abstract::Iterator::Finished)
1099 Teuchos::RCP<Teuchos::ParameterList> locaList = paramsPtr->
getLocaParams();
1100 Teuchos::ParameterList& stepperList = locaList->sublist(
"Stepper");
1101 LOCA::ParameterVector locaPVec;
1104 int numHomotopyContinuationRuns = 1;
1105 std::vector<std::string> names(numHomotopyContinuationRuns);
1106 std::vector<double> initialVal(numHomotopyContinuationRuns);
1107 std::vector<double> finalVal(numHomotopyContinuationRuns);
1108 std::vector<double> minVal(numHomotopyContinuationRuns);
1109 std::vector<double> maxVal(numHomotopyContinuationRuns);
1115 names[0] =
"mosfet:gainscale";
1119 initialVal[0] = 0.0;
1126 std::string n1 =
"mosfet:nltermscale";
1127 locaPVec.addParameter(n1, 0.0);
1134 for (
int i = 0; i < names.size(); ++i) {
1135 if (finalVal[i] > initialVal[i]) {
1136 minVal[i] = initialVal[i];
1137 maxVal[i] = finalVal[i];
1140 minVal[i] = finalVal[i];
1141 maxVal[i] = initialVal[i];
1146 for (
int i = 0; i < names.size(); ++i)
1147 locaPVec.addParameter(names[i], initialVal[i]);
1149 LOCA::Abstract::Iterator::IteratorStatus locaStatus;
1154 for (
int hs = 0; hs < names.size(); ++hs) {
1155 for (
int i = 0; i < names.size(); ++i) {
1157 locaPVec.setValue(names[i], initialVal[i]);
1159 locaPVec.setValue(names[i], finalVal[i]);
1162 stepperList.set(
"Continuation Parameter", names[hs]);
1163 stepperList.set(
"Initial Value", initialVal[hs]);
1164 stepperList.set(
"Min Value", minVal[hs]);
1165 stepperList.set(
"Max Value", maxVal[hs]);
1175 if (locaStatus != LOCA::Abstract::Iterator::Finished)
1203 Teuchos::RCP<Teuchos::ParameterList> locaList = paramsPtr->
getLocaParams();
1204 Teuchos::ParameterList& stepperList = locaList->sublist(
"Stepper");
1205 LOCA::ParameterVector locaPVec;
1208 int numHomotopyContinuationRuns = 4;
1209 std::vector<std::string> names(numHomotopyContinuationRuns);
1210 std::vector<double> initialVal(numHomotopyContinuationRuns);
1211 std::vector<double> finalVal(numHomotopyContinuationRuns);
1212 std::vector<double> minVal(numHomotopyContinuationRuns);
1213 std::vector<double> maxVal(numHomotopyContinuationRuns);
1219 names[0] = stepperList.get(
"Power Node",
"VA:V0");
1220 names[1] =
"mosfet:gainscale";
1221 names[2] =
"mosfet:nltermscale";
1222 names[3] =
"mosfet:sizescale";
1223 initialVal[0] = 0.0;
1224 initialVal[1] = 0.0;
1225 initialVal[2] = 0.0;
1226 initialVal[3] = 0.0;
1240 for (
int i = 0; i < names.size(); ++i) {
1241 if (finalVal[i] > initialVal[i]) {
1242 minVal[i] = initialVal[i];
1243 maxVal[i] = finalVal[i];
1246 minVal[i] = finalVal[i];
1247 maxVal[i] = initialVal[i];
1252 for (
int i = 0; i < names.size(); ++i)
1253 locaPVec.addParameter(names[i], initialVal[i]);
1255 LOCA::Abstract::Iterator::IteratorStatus locaStatus;
1258 for (
int hs = 0; hs < names.size(); ++hs) {
1259 for (
int i = 0; i < names.size(); ++i) {
1261 locaPVec.setValue(names[i], initialVal[i]);
1263 locaPVec.setValue(names[i], finalVal[i]);
1266 stepperList.set(
"Continuation Parameter", names[hs]);
1267 stepperList.set(
"Initial Value", initialVal[hs]);
1268 stepperList.set(
"Min Value", minVal[hs]);
1269 stepperList.set(
"Max Value", maxVal[hs]);
1279 if (locaStatus != LOCA::Abstract::Iterator::Finished)
1305 Teuchos::RCP<Teuchos::ParameterList> locaList = paramsPtr->
getLocaParams();
1306 Teuchos::ParameterList& stepperList = locaList->sublist(
"Stepper");
1307 LOCA::ParameterVector locaPVec;
1311 int numHomotopyContinuationRuns = 1 + numGainBlocks;
1312 std::vector<std::string> names(numHomotopyContinuationRuns);
1313 std::vector<double> initialVal(numHomotopyContinuationRuns);
1314 std::vector<double> finalVal(numHomotopyContinuationRuns);
1315 std::vector<double> minVal(numHomotopyContinuationRuns);
1316 std::vector<double> maxVal(numHomotopyContinuationRuns);
1322 for (
int i = 0; i < numGainBlocks; ++i) {
1323 std::stringstream s;
1325 names[i] =
"mosfet:gainscale_block_" + s.str();
1326 initialVal[i] = 0.0;
1329 names[numHomotopyContinuationRuns - 1] =
"mosfet:nltermscale";
1330 initialVal[numHomotopyContinuationRuns - 1] = 0.0;
1331 finalVal[numHomotopyContinuationRuns - 1] = 1.0;
1336 for (
int i = 0; i < names.size(); ++i) {
1337 if (finalVal[i] > initialVal[i]) {
1338 minVal[i] = initialVal[i];
1339 maxVal[i] = finalVal[i];
1342 minVal[i] = finalVal[i];
1343 maxVal[i] = initialVal[i];
1348 for (
int i = 0; i < names.size(); ++i)
1349 locaPVec.addParameter(names[i], initialVal[i]);
1351 LOCA::Abstract::Iterator::IteratorStatus locaStatus;
1354 for (
int hs = 0; hs < names.size(); ++hs) {
1355 for (
int i = 0; i < names.size(); ++i) {
1357 locaPVec.setValue(names[i], initialVal[i]);
1359 locaPVec.setValue(names[i], finalVal[i]);
1362 stepperList.set(
"Continuation Parameter", names[hs]);
1363 stepperList.set(
"Initial Value", initialVal[hs]);
1364 stepperList.set(
"Min Value", minVal[hs]);
1365 stepperList.set(
"Max Value", maxVal[hs]);
1375 if (locaStatus != LOCA::Abstract::Iterator::Finished)
1402 Teuchos::RCP<Teuchos::ParameterList> locaList = paramsPtr->
getLocaParams();
1405 std::string gmin =
"GSTEPPING";
1408 LOCA::ParameterVector locaPVec;
1409 Teuchos::ParameterList& stepperList = locaList->sublist(
"Stepper");
1410 Teuchos::ParameterList& predictorList = locaList->sublist(
"Predictor");
1411 Teuchos::ParameterList& stepSizeList = locaList->sublist(
"Step Size");
1414 locaPVec.addParameter(gmin, 0.0);
1416 stepperList.set(
"Continuation Parameter", gmin);
1417 stepperList.set(
"Continuation Method",
"Natural");
1419 stepSizeList.set(
"Method",
"Adaptive");
1420 predictorList.set(
"Method",
"Constant");
1422 stepperList.set(
"Initial Value", 4.0);
1423 stepperList.set(
"Min Value", -4.0);
1425 stepperList.set(
"Max Value", 4.0);
1427 stepSizeList.set(
"Initial Step Size", -2.0);
1428 stepSizeList.set(
"Min Step Size", 1.0e-6);
1429 stepSizeList.set(
"Max Step Size", 1.0e+12);
1430 stepSizeList.set(
"Aggressiveness", 0.01);
1432 stepperList.set(
"Max Steps", 400);
1433 stepperList.set(
"Max Nonlinear Iterations", 20);
1440 bool usedNODESET=
false;
1460 if (!usedOP && !usedNODESET)
1469 std::string message =
"'.dcop input=' and gstepping are incompatible";
1470 N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::USR_FATAL, message);
1474 Teuchos::RCP<AugmentLinSys> als =
1476 groupPtr_->setAugmentLinearSystem(
true, als);
1481 LOCA::Abstract::Iterator::IteratorStatus locaStatus =
stepperPtr_->run();
1483 groupPtr_->setAugmentLinearSystem(
false, Teuchos::null);
1486 if (locaStatus != LOCA::Abstract::Iterator::Finished)
1504 Teuchos::RCP<NOX::StatusTest::Combo> ctest =
1505 Teuchos::rcp(
new NOX::StatusTest::Combo(NOX::StatusTest::Combo::OR));
1507 Teuchos::RCP<Teuchos::ParameterList> locaList =
1509 Teuchos::ParameterList& stepperList = locaList->sublist(
"Stepper");
1510 Teuchos::ParameterList& stepSizeList = locaList->sublist(
"Step Size");
1511 double initialStepSize =
1512 stepSizeList.get(
"Initial Step Size", 1.0e-3);
1513 double minStepSize = stepSizeList.get(
"Min Step Size", 1.0e-12);
1514 double maxStepSize = stepSizeList.get(
"Max Step Size", 1.0e4);
1515 Teuchos::RCP<Teuchos::ParameterList> noxList =
1520 Teuchos::RCP<NOX::StatusTest::MaxIters> mi =
1521 Teuchos::rcp(
new NOX::StatusTest::MaxIters(stepperList.get(
"Max Steps", 200)));
1522 Teuchos::RCP<NOX::StatusTest::FiniteValue> fv =
1523 Teuchos::rcp(
new NOX::StatusTest::FiniteValue);
1524 Teuchos::RCP<PseudoTransientTest> pt =
1527 ctest->addStatusTest(mi);
1528 ctest->addStatusTest(fv);
1529 ctest->addStatusTest(pt);
1533 Teuchos::RCP<AugmentLinSys> als =
1544 NOX::StatusTest::StatusType status =
solverPtr_->solve();
1555 groupPtr_->setAugmentLinearSystem(
false, Teuchos::null);
1579 #ifdef Xyce_NOX_LOCA_ARTIFICIAL_HOMOTOPY_SUPPORT
1580 Teuchos::RCP<Teuchos::ParameterList> locaList = paramsPtr->
getLocaParams();
1581 Teuchos::ParameterList& locaUtilsList = locaList->sublist(
"Utilities");
1583 Teuchos::RCP<LOCA::Homotopy::Group> hGrp =
1588 locaList->sublist(
"Predictor").set(
"Secant", 0.999);
1589 locaList->sublist(
"Stepper").set(
"Max Value", 0.999);
1593 LOCA::Abstract::Iterator::IteratorStatus locaStatus =
stepperPtr_->run();
1596 Teuchos::RCP<LOCA::Homotopy::Group> hGrp2 =
1599 locaList->sublist(
"Predictor").set(
"Secant", 0.999);
1600 locaList->sublist(
"Stepper").set(
"Initial Value", 0.999);
1601 locaList->sublist(
"Stepper").set(
"Max Value", 1.0);
1602 locaList->sublist(
"Step Size").set(
"Method",
"Constant");
1603 locaList->sublist(
"Step Size").set(
"Initial Step Size", 0.0001);
1604 locaList->sublist(
"Step Size").set(
"Min Step Size", 0.0001);
1611 if (locaStatus != LOCA::Abstract::Iterator::Finished)
1617 Report::UserFatal0() <<
"Nonlinear Solver (NOX::Interface) Artificial parameter continuation requires "
1618 <<
"building xyce with the define: -DXyce_NOX_LOCA_ARTIFICIAL_HOMOTOPY_SUPPORT to "
1619 <<
"allow LOCA to augment the diagonal of Jacobian! Either rebuild Xyce or do not "
1620 <<
"run Xyce with \"continuation=33\"";
1637 Teuchos::RCP<Teuchos::ParameterList> locaList = paramsPtr->
getLocaParams();
1640 std::string vsrcscale =
"VSRCSCALE";
1643 LOCA::ParameterVector locaPVec;
1644 Teuchos::ParameterList& stepperList = locaList->sublist(
"Stepper");
1645 Teuchos::ParameterList& predictorList = locaList->sublist(
"Predictor");
1646 Teuchos::ParameterList& stepSizeList = locaList->sublist(
"Step Size");
1649 locaPVec.addParameter(vsrcscale, 0.0);
1651 stepperList.set(
"Continuation Parameter", vsrcscale);
1652 stepperList.set(
"Continuation Method",
"Natural");
1654 stepSizeList.set(
"Method",
"Adaptive");
1655 predictorList.set(
"Method",
"Constant");
1657 stepperList.set(
"Initial Value", 0.0);
1658 stepperList.set(
"Min Value", -1.0);
1659 stepperList.set(
"Max Value", 1.0);
1661 stepSizeList.set(
"Initial Step Size", 0.2);
1662 stepSizeList.set(
"Min Step Size", 1.0e-4);
1663 stepSizeList.set(
"Max Step Size", 0.2);
1664 stepSizeList.set(
"Aggressiveness", 1.0);
1666 stepperList.set(
"Max Steps", 400);
1667 stepperList.set(
"Max Nonlinear Iterations", 20);
1674 bool usedNODESET=
false;
1694 if (!usedOP && !usedNODESET)
1701 LOCA::Abstract::Iterator::IteratorStatus locaStatus =
stepperPtr_->run();
1703 groupPtr_->setAugmentLinearSystem(
false, Teuchos::null);
1706 if (locaStatus != LOCA::Abstract::Iterator::Finished)
1737 if (DEBUG_NONLINEAR)
1847 groupPtr_->setNonContinuationFlag (
true);
1851 groupPtr_->setNonContinuationFlag (
false);
1854 if (DEBUG_NONLINEAR)
1855 dout() <<
"solverType is " << solverType << std::endl;
1859 if (solverType == 0)
1864 else if (solverType == 1)
1869 else if (solverType == 2)
1873 else if (solverType == 3)
1878 else if (solverType == 4)
1883 else if (solverType == 5)
1888 else if (solverType == 6)
1892 else if (solverType == 7)
1896 else if (solverType == 8)
1900 else if (solverType == 9)
1904 else if (solverType == 10)
1908 else if (solverType == 33)
1912 else if (solverType == 34)
1918 catch (
const char* error_msg) {
1919 std::string nox_error =
"NOX Error";
1920 std::string err_msg = std::string(error_msg);
1921 if (err_msg == nox_error) {
1922 const std::string message =
1923 "Caught a NOX Exception in Interface::solve()!";
1924 N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL, message);
1930 catch (
const std::exception& e) {
1931 dout() << e.what() << std::endl;
1932 const std::string message =
1933 "Caught std::exception in Interface::solve()!";
1934 N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL, message);
1937 const std::string message =
1938 "Caught Unknown Exception in Interface::solve()!";
1939 N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL, message);
1965 #ifdef Xyce_DEBUG_OP_START
1966 dout() <<
"NOX_Interface: Inside continuation=1 OP_START code (case 2)" << std::endl;
1973 const NodeNameMap & allNodes =
outMgrPtr_->getSolutionNodeMap();
1974 N_PDS_Comm * pdsCommPtr =
pdsMgrPtr_->getPDSComm();
1976 if (found > 0 && icType == IO::InitialConditionsData::IC_TYPE_DCOP_RESTART)
1988 Teuchos::RCP<AugmentLinSys> als =
1991 groupPtr_->setAugmentLinearSystem(
true, als);
1992 NOX::StatusTest::StatusType status =
solverPtr_->solve();
1995 groupPtr_->setAugmentLinearSystem(
false, Teuchos::null);
1998 #ifdef Xyce_DEBUG_OP_START
2000 #ifdef Xyce_PARALLEL_MPI
2001 groupPtr_->setOutputLinear (&op, &allNodes, pdsCommPtr);
2003 groupPtr_->setOutputLinear (&op, &allNodes);
2005 #endif // debug op start
2029 #ifdef Xyce_DEBUG_IC
2030 dout() <<
"NOX_Interface: Inside continuation=0 .IC code." << std::endl;
2036 usedIC = (icType==IO::InitialConditionsData::IC_TYPE_IC && found > 0);
2039 bool useGminStepping=
false;
2040 Teuchos::RCP<AugmentLinSys> als =
2042 groupPtr_->setAugmentLinearSystem(
true, als);
2064 #ifdef Xyce_DEBUG_IC
2065 dout() <<
"NOX_Interface: Inside continuation=3 .IC code." << std::endl;
2071 usedIC = (icType==IO::InitialConditionsData::IC_TYPE_IC && found > 0);
2074 bool useGminStepping=
true;
2075 Teuchos::RCP<AugmentLinSys> als =
2077 groupPtr_->setAugmentLinearSystem(
true, als);
2092 bool usedNODESET(
false);
2094 #ifdef Xyce_DEBUG_IC
2095 dout() <<
"NOX_Interface: Inside continuation=0 .NODESET code (case 1)" << std::endl;
2101 usedNODESET = (icType==IO::InitialConditionsData::IC_TYPE_NODESET && found > 0);
2104 Teuchos::RCP<AugmentLinSys> als =
2107 groupPtr_->setAugmentLinearSystem(
true, als);
2108 NOX::StatusTest::StatusType status =
solverPtr_->solve();
2111 groupPtr_->setAugmentLinearSystem(
false, Teuchos::null);
2130 bool usedNODESET(
false);
2132 #ifdef Xyce_DEBUG_IC
2133 dout() <<
"NOX_Interface: Inside continuation=1 .NODESET code (case 2)" << std::endl;
2140 usedNODESET = (icType==IO::InitialConditionsData::IC_TYPE_NODESET && found > 0);
2151 Teuchos::RCP<AugmentLinSys> als =
2154 groupPtr_->setAugmentLinearSystem(
true, als);
2155 NOX::StatusTest::StatusType status =
solverPtr_->solve();
2158 groupPtr_->setAugmentLinearSystem(
false, Teuchos::null);
2210 dout() <<
"takeFirstSolveStep: allocating a new group!" << std::endl;
2219 dout() <<
"takeFirstSolveStep: using the old group!" << std::endl;
2226 dout() <<
"takeFirstSolveStep: copying over the passed group!" << std::endl;
2241 NOX::StatusTest::StatusType status =
solverPtr_->step();
2244 return (status == NOX::StatusTest::Converged) ? 1 : -1;
2259 NOX::StatusTest::StatusType status =
solverPtr_->step();
2262 return (status == NOX::StatusTest::Converged) ? 1 : -1;
2287 if ((!Teuchos::is_null(
solverPtr_)) && (solverType == 0))
2289 else if ((!Teuchos::is_null(
solverPtr_)) && (solverType == 1))
2291 else if ((!Teuchos::is_null(
solverPtr_)) && (solverType == 9))
2293 else if ((!Teuchos::is_null(
stepperPtr_)) && (solverType != 0))
2295 return stepperPtr_->getSolver()->getNumIterations();
2361 return maxNormFindex;
2692 lasSolverPtr_->setTolerance(params.get(
"Tolerance", 1.0e-12));
2696 lasSolverPtr_->setTolerance(params.get(
"Tolerance", 1.0e-12));
2780 const Teuchos::RCP<LOCA::MultiContinuation::AbstractGroup>& initialGuess,
2781 const Teuchos::RCP<NOX::StatusTest::Generic>& test,
2782 const Teuchos::RCP<Teuchos::ParameterList>& p)
2785 Teuchos::rcp(
new LOCA::Stepper(gd, initialGuess, test, p));
2808 if (solverType != 0) retCode =
true;
2829 if (solverType != 0) retCode =
true;
int getMaxNormFindex() const
Xyce::Nonlinear::AnalysisMode lastParametersMode_
ParameterSet transientParams_
bool setLocaOptions(const Xyce::Util::OptionBlock &OB)
int getDebugMinTimeStep() const
bool setOptions(const Xyce::Util::OptionBlock &OB)
bool isFirstContinuationParam() const
bool setOutputOptions(int myPID, int outputProcess)
int getMaxNormFindex() const
bool opStartCont0(ParameterSet *paramsPtr, int found, int icType, Xyce::IO::InitialConditionsData::NodeNamePairMap &op, const Xyce::NodeNameMap &allNodes, N_PDS_Comm *pdsCommPtr)
void setAnalysisMode(Xyce::Nonlinear::AnalysisMode mode)
void reset(Xyce::Linear::Vector &x, Xyce::Linear::Vector &f, Xyce::Linear::Matrix &jacobian, Xyce::Linear::Vector &newton, Xyce::Linear::Vector &gradient, Xyce::Linear::System &lasSys, Interface &interface)
int mosfetContinuationSolve6(ParameterSet *paramsPtr)
Pure virtual class to augment a linear system.
bool setHBOptions(const Xyce::Util::OptionBlock &OB)
Teuchos::RCP< Teuchos::ParameterList > getLocaParams()
int mosfetContinuationSolve2(ParameterSet *paramsPtr)
int spiceStrategy(ParameterSet *paramsPtr)
bool setOptions(const Xyce::Util::OptionBlock &OB)
bool nodesetCont1(ParameterSet *paramsPtr)
Teuchos::RCP< NOX::Solver::Generic > solverPtr_
Teuchos::RCP< LOCA::Stepper > stepperPtr_
virtual bool applyJacobian(const Linear::Vector &input, Linear::Vector &result)
Teuchos::RCP< LOCA::StatusTest::Wrapper > locaTransientStatusTestPtr_
int getDebugLevel() const
bool getScreenOutputFlag() const
int stdNewtonSolve(ParameterSet *paramsPtr)
void setNoxSolverType(int type)
Teuchos::RCP< Teuchos::ParameterList > getNoxParams()
double getDebugMinTime() const
int mosfetContinuationSolve(ParameterSet *paramsPtr)
bool computeNewton(Teuchos::ParameterList &p)
virtual void resetCountersAndTimers_()
Linear::Vector * rhsVectorPtr_
int getHomotopyBlockSize() const
const T & value(const ParameterBase &entity, const Descriptor &descriptor)
Returns the value of the parameter for the entity.
bool getScreenOutputFlag() const
Linear::Vector * gradVectorPtr_
bool setLocaOptions(const Xyce::Util::OptionBlock &OB, bool saveCopy=true)
double getDebugMaxTime() const
int blockGainscaleMosfetSolve(ParameterSet *paramsPtr)
int naturalParameterContinuationSolve(ParameterSet *paramsPtr)
int solve(Xyce::Nonlinear::NonLinearSolver *nlsTmpPtr=NULL)
virtual bool initializeAll()
int mosfetContinuationSolve3(ParameterSet *paramsPtr)
Teuchos::RCP< LOCA::StatusTest::Wrapper > locaDCOpStatusTestPtr_
bool setTranOptions(const Xyce::Util::OptionBlock &OB)
Linear::Matrix * jacobianMatrixPtr_
Teuchos::RCP< LOCA::StatusTest::Wrapper > locaHBStatusTestPtr_
IO::OutputMgr * outMgrPtr_
bool icCont(ParameterSet *paramsPtr)
N_PDS_Manager * pdsMgrPtr_
int pseudoTransientSolve(ParameterSet *paramsPtr)
bool getVectorParam(const std::string &, int, double &)
Teuchos::RCP< N_NLS_LOCA::Group > getSolutionGroup()
const Analysis::AnalysisManager & getAnalysisManager() const
Linear::System * lasSysPtr_
void setDebugFlags(int output_step_number, double time)
virtual bool getMatrixFreeFlag()
Linear::Vector ** nextSolVectorPtrPtr_
Linear::Solver * lasSolverPtr_
double getMaxNormF() const
void set_gstepping_min_value(double val)
Teuchos::RCP< AugmentLinSys > createAugmentLinearSystem(Xyce::Linear::System *ls) const
bool isFirstContinuationParam_
int getNumIterations() const
bool opStartCont1(ParameterSet *paramsPtr)
int getContinuationStep() const
Teuchos::RCP< LOCA::StatusTest::Wrapper > locaStatusTestPtr_
bool completeOPStartStep()
Teuchos::RCP< NOX::StatusTest::Generic > getStatusTests()
double getDebugMaxTime() const
Xyce::Nonlinear::AnalysisMode parametersMode_
void setStatusTestReturnCodes(const Xyce::Nonlinear::ReturnCodes &retCodesTmp)
void resetAll(Xyce::Nonlinear::AnalysisMode mode)
int artificialParameterHomotopy(ParameterSet *paramsPtr)
int getStatusTestReturnCode() const
Interface(const Xyce::IO::CmdParse &cp)
int takeFirstSolveStep(Xyce::Nonlinear::NonLinearSolver *nlsTmpPtr=NULL)
bool applyJacobian(const Xyce::Linear::Vector &input, Xyce::Linear::Vector &result)
bool setNodeSetOptions(const Xyce::Util::OptionBlock &OB)
bool setDCOPRestartOptions(const Xyce::Util::OptionBlock &OB)
int gminSteppingSolve(ParameterSet *paramsPtr)
Xyce::Loader::NonlinearEquationLoader & getLoader() const
Linear::Vector * NewtonVectorPtr_
IO::InitialConditionsManager * initialConditionsManager_
bool setICOptions(const Xyce::Util::OptionBlock &OB)
double getDebugMinTime() const
int sourceSteppingSolve(ParameterSet *paramsPtr)
int mosfetContinuationSolve5(ParameterSet *paramsPtr)
Teuchos::RCP< Teuchos::ParameterList > getAllParams()
int getDebugMaxTimeStep() const
bool icCont3(ParameterSet *paramsPtr)
Teuchos::RCP< N_NLS_LOCA::Group > groupPtr_
double getMaxNormF() const
int getDebugMaxTimeStep() const
bool nodesetCont0(ParameterSet *paramsPtr)
bool isFirstSolveComplete() const
SharedSystem * sharedSystemPtr_
Linear::Vector ** currSolVectorPtrPtr_
int getNoxSolverType() const
bool createStatusTests(Parallel::Machine comm, N_LAS_Vector **currSolnVectorPtrPtr, Xyce::Loader::NonlinearEquationLoader &nonlinear_equation_loader, N_LAS_Vector *maskVectorPtr=0)
Only used when NLS_MASKED_WRMS_NORMS.
Loader::NonlinearEquationLoader * loaderPtr_
bool getContinuationSpecifiedFlag() const
int getVectorParamSize(const std::string &vectorName)
int getDebugMinTimeStep() const
int getDebugLevel() const
bool applySavedLocaOptions()
Xyce::Nonlinear::AnalysisMode mode_
int mosfetContinuationSolve4(ParameterSet *paramsPtr)
Teuchos::RCP< LOCA::GlobalData > globalDataPtr_
int getParameterNumber() const
void resetStepper(const Teuchos::RCP< LOCA::GlobalData > &gd, const Teuchos::RCP< LOCA::MultiContinuation::AbstractGroup > &initialGuess, const Teuchos::RCP< NOX::StatusTest::Generic > &test, const Teuchos::RCP< Teuchos::ParameterList > &p)