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>
75 #include <N_UTL_FeatureTest.h>
77 #ifdef Xyce_PARALLEL_MPI
78 #include <N_PDS_ParComm.h>
80 #include <N_PDS_SerialComm.h>
102 dcParams_(Nonlinear::
DC_OP),
107 mode_(Nonlinear::
DC_OP),
108 lastParametersMode_(Nonlinear::
DC_OP),
109 parametersMode_(Nonlinear::
DC_OP),
111 copiedGroupFlag_(false),
114 NODESETspecified_(false),
115 isFirstContinuationParam_(true),
116 firstSolveComplete_(false),
297 int myPID =
pdsMgrPtr_->getPDSComm()->procID();
304 bool testsok =
false;
305 if (NLS_MASKED_WRMS_NORMS)
330 .get(
"Forcing Term Method",
"Constant") == std::string(
"Constant")))
335 .get(
"Forcing Term Method",
"Constant") == std::string(
"Constant")))
340 .get(
"Forcing Term Method",
"Constant") == std::string(
"Constant")))
345 .get(
"Forcing Term Method",
"Constant") == std::string(
"Constant")))
367 groupPtr_->setNonContinuationFlag (
true);
374 groupPtr_->setNonContinuationFlag (
false);
379 (*nextSolVectorPtrPtr_)->putScalar(0.0);
396 groupPtr_->setNonContinuationFlag (
false);
401 (*nextSolVectorPtrPtr_)->putScalar(0.0);
439 if (found > 0 && icType == IO::InitialConditionsData::IC_TYPE_DCOP_RESTART)
442 Teuchos::RCP<AugmentLinSys> als =
444 groupPtr_->setAugmentLinearSystem(
true, als);
445 NOX::StatusTest::StatusType status =
solverPtr_->solve();
451 groupPtr_->setAugmentLinearSystem(
false, Teuchos::null);
453 #ifdef Xyce_DEBUG_OP_START
454 groupPtr_->setOutputLinear (&op, &allNodes, pdsCommPtr);
455 #endif // debug op start
475 bool usedNODESET=
false;
491 dout() <<
"Creating new NLS solver b/c it is 0." <<std::endl;
493 dout() <<
"Creating new NLS solver b/c starting next phase, post-DC." <<std::endl;
503 dout() <<
"NOT Creating new NLS solver, just resetting." <<std::endl;
514 usedIC=
icCont (paramsPtr);
532 NOX::StatusTest::StatusType status =
solverPtr_->solve();
537 groupPtr_->setAugmentLinearSystem(
false, Teuchos::null);
561 std::vector<std::string> pars;
566 bool usedNODESET=
false;
573 usedIC=
icCont (paramsPtr);
585 Teuchos::RCP<Teuchos::ParameterList> locaList = paramsPtr->
getLocaParams();
588 LOCA::ParameterVector locaPVec;
589 Teuchos::ParameterList& stepperList = locaList->sublist(
"Stepper");
590 Teuchos::ParameterList& stepSizeList = locaList->sublist(
"Step Size");
599 if ( numParam == 0 ) {
600 std::string message =
"Using \"continuation=1\" requires a parameter to be set with the conparam keyword in the loca option block!";
601 N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::USR_FATAL, message);
606 const std::string strArg(
"Skip df/dp");
607 bool skipDFDP = stepperList.get(strArg,
false);
613 Teuchos::RCP<AugmentLinSys> als;
615 std::vector<double> minValue(numParam, 0.);
616 std::vector<double> maxValue(numParam, 0.);
617 std::vector<double> initialValue(numParam, 0.);
618 std::vector<double> initialStepSize(numParam, 0.);
619 std::vector<double> minStepSize(numParam, 0.);
620 std::vector<double> maxStepSize(numParam, 0.);
621 std::vector<double> aggressiveness(numParam, 0.);
624 std::vector<std::string> paramNames(0);
625 paramNames.push_back(
"MINVALUE");
626 paramNames.push_back(
"MAXVALUE");
627 paramNames.push_back(
"INITIALVALUE");
628 paramNames.push_back(
"INITIALSTEPSIZE");
629 paramNames.push_back(
"MINSTEPSIZE");
630 paramNames.push_back(
"MAXSTEPSIZE");
631 paramNames.push_back(
"AGGRESSIVENESS");
633 for (std::size_t p = 0 ; p < paramNames.size() ; ++p) {
635 std::string msg =
"The parameter \"" +
637 "\" must have a list of values with size equal to the numParamber of parameters specified in \"conparam\".";
638 N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL, msg);
665 locaPVec.addParameter (pars[
iParam_], initialValue[iParam_]);
669 if (usedOP || usedNODESET)
679 LOCA::Abstract::Iterator::IteratorStatus locaStatus;
689 stepperList.set(
"Continuation Parameter", pars[
iParam_]);
690 stepperList.set(
"Initial Value", initialValue[iParam_]);
691 stepperList.set(
"Max Value", maxValue[iParam_]);
692 stepperList.set(
"Min Value", minValue[iParam_]);
693 stepSizeList.set(
"Initial Step Size", initialStepSize[iParam_]);
694 stepSizeList.set(
"Min Step Size", minStepSize[iParam_]);
695 stepSizeList.set(
"Max Step Size", maxStepSize[iParam_]);
696 stepSizeList.set(
"Aggressiveness", aggressiveness[iParam_]);
700 locaPVec.setValue(pars[j], maxValue[j]);
702 for (j=iParam_ ; j<numParam ; ++j)
704 locaPVec.setValue(pars[j], initialValue[j]);
710 if (!usedOP && !usedNODESET)
720 if (pars[iParam_] !=
"GSTEPPING")
725 if (usedIC || usedNODESET)
727 groupPtr_->setAugmentLinearSystem(
false, Teuchos::null);
734 std::string message =
"'.dcop input=' and gstepping are incompatible";
735 N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::USR_FATAL, message);
737 Teuchos::RCP<AugmentLinSys> als =
739 groupPtr_->setAugmentLinearSystem(
true, als);
745 groupPtr_->setAugmentLinearSystem(
false, Teuchos::null);
749 if (locaStatus != LOCA::Abstract::Iterator::Finished)
772 bool usedNODESET=
false;
779 usedIC=
icCont (paramsPtr);
792 std::vector<std::string> pars;
801 if ( numParam > 1 ) {
802 Report::UserWarning() <<
"Using \"continuation=2\" currently does not support vectorized loca parameters. Only the first values in each list will be used";
805 Teuchos::RCP<Teuchos::ParameterList> locaList = paramsPtr->
getLocaParams();
808 std::string gain =
"mosfet:gainscale";
809 std::string nonlinear =
"mosfet:nltermscale";
812 LOCA::ParameterVector locaPVec;
813 Teuchos::ParameterList& stepperList = locaList->sublist(
"Stepper");
814 Teuchos::ParameterList& predictorList = locaList->sublist(
"Predictor");
815 Teuchos::ParameterList& stepSizeList = locaList->sublist(
"Step Size");
819 locaPVec.addParameter(gain, 0.0);
820 locaPVec.addParameter(nonlinear, 0.0);
822 stepperList.set(
"Continuation Parameter", gain);
824 stepperList.set(
"Initial Value", 0.0);
825 stepperList.set(
"Max Value", 1.0);
826 stepperList.set(
"Min Value",-1.0);
828 stepSizeList.set(
"Initial Step Size", 0.2);
829 stepSizeList.set(
"Min Step Size", 1.0e-4);
830 stepSizeList.set(
"Max Step Size", 1.0);
831 stepSizeList.set(
"Aggressiveness", 1.0);
837 if (!usedOP && !usedNODESET)
845 LOCA::Abstract::Iterator::IteratorStatus locaStatus =
stepperPtr_->run();
848 if (locaStatus != LOCA::Abstract::Iterator::Finished)
860 stepperList.set(
"Continuation Parameter", nonlinear);
862 stepperList.set(
"Initial Value", 0.0);
863 stepperList.set(
"Max Value", 1.0);
864 stepperList.set(
"Min Value",-1.0);
866 stepSizeList.set(
"Initial Step Size", 0.2);
867 stepSizeList.set(
"Min Step Size", 1.0e-4);
868 stepSizeList.set(
"Max Step Size", 1.0);
869 stepSizeList.set(
"Aggressiveness", 1.0);
874 locaPVec.setValue(gain, 1.0);
875 locaPVec.setValue(nonlinear, 0.0);
885 groupPtr_->setAugmentLinearSystem(
false, Teuchos::null);
889 if (locaStatus != LOCA::Abstract::Iterator::Finished)
908 Teuchos::RCP<Teuchos::ParameterList> locaList = paramsPtr->
getLocaParams();
911 std::string gain =
"mosfet:gainscale";
912 std::string nonlinear =
"mosfet:nltermscale";
913 std::string size =
"mosfet:sizescale";
916 LOCA::ParameterVector locaPVec;
917 Teuchos::ParameterList& stepperList = locaList->sublist(
"Stepper");
922 locaPVec.addParameter(gain, 0.0);
923 locaPVec.addParameter(nonlinear, 0.0);
924 locaPVec.addParameter(size, 0.0);
926 stepperList.set(
"Continuation Parameter", gain);
927 stepperList.set(
"Initial Value", 0.0);
928 stepperList.set(
"Max Value", 1.0);
935 LOCA::Abstract::Iterator::IteratorStatus locaStatus =
stepperPtr_->run();
938 if (locaStatus != LOCA::Abstract::Iterator::Finished)
951 stepperList.set(
"Continuation Parameter", nonlinear);
952 stepperList.set(
"Initial Value", 0.0);
953 stepperList.set(
"Max Value", 1.0);
954 locaPVec.setValue(gain, 1.0);
955 locaPVec.setValue(nonlinear, 0.0);
956 locaPVec.setValue(size, 0.0);
964 if (locaStatus != LOCA::Abstract::Iterator::Finished)
973 stepperList.set(
"Continuation Parameter", size);
974 stepperList.set(
"Initial Value", 0.0);
975 stepperList.set(
"Max Value", 1.0);
976 locaPVec.setValue(gain, 1.0);
977 locaPVec.setValue(nonlinear, 1.0);
978 locaPVec.setValue(size, 0.0);
986 if (locaStatus != LOCA::Abstract::Iterator::Finished)
1004 Teuchos::RCP<Teuchos::ParameterList> locaList = paramsPtr->
getLocaParams();
1008 std::string nonlinear =
"mosfet:nltermscale";
1009 std::string size =
"mosfet:sizescale";
1012 LOCA::ParameterVector locaPVec;
1013 Teuchos::ParameterList& stepperList = locaList->sublist(
"Stepper");
1019 locaPVec.addParameter(nonlinear, 0.0);
1020 locaPVec.addParameter(size, 0.0);
1022 stepperList.set(
"Continuation Parameter", nonlinear);
1023 stepperList.set(
"Initial Value", 0.0);
1024 stepperList.set(
"Max Value", 1.0);
1031 LOCA::Abstract::Iterator::IteratorStatus locaStatus =
stepperPtr_->run();
1034 if (locaStatus != LOCA::Abstract::Iterator::Finished)
1047 stepperList.set(
"Continuation Parameter", size);
1048 stepperList.set(
"Initial Value", 0.0);
1049 stepperList.set(
"Max Value", 1.0);
1051 locaPVec.setValue(nonlinear, 1.0);
1052 locaPVec.setValue(size, 0.0);
1060 if (locaStatus != LOCA::Abstract::Iterator::Finished)
1078 Teuchos::RCP<Teuchos::ParameterList> locaList = paramsPtr->
getLocaParams();
1081 std::string gain =
"mosfet:gainscale";
1082 std::string nonlinear =
"mosfet:nltermscale";
1083 std::string size =
"mosfet:sizescale";
1086 LOCA::ParameterVector locaPVec;
1087 Teuchos::ParameterList& stepperList = locaList->sublist(
"Stepper");
1090 locaPVec.addParameter(gain, 1.0);
1091 locaPVec.addParameter(nonlinear, 1.0);
1092 locaPVec.addParameter(size, 0.0);
1094 stepperList.set(
"Continuation Parameter", size);
1095 stepperList.set(
"Initial Value", 0.0);
1096 stepperList.set(
"Max Value", 1.0);
1103 LOCA::Abstract::Iterator::IteratorStatus locaStatus =
stepperPtr_->run();
1106 if (locaStatus != LOCA::Abstract::Iterator::Finished)
1129 Teuchos::RCP<Teuchos::ParameterList> locaList = paramsPtr->
getLocaParams();
1130 Teuchos::ParameterList& stepperList = locaList->sublist(
"Stepper");
1131 LOCA::ParameterVector locaPVec;
1134 int numHomotopyContinuationRuns = 1;
1135 std::vector<std::string> names(numHomotopyContinuationRuns);
1136 std::vector<double> initialVal(numHomotopyContinuationRuns);
1137 std::vector<double> finalVal(numHomotopyContinuationRuns);
1138 std::vector<double> minVal(numHomotopyContinuationRuns);
1139 std::vector<double> maxVal(numHomotopyContinuationRuns);
1145 names[0] =
"mosfet:gainscale";
1149 initialVal[0] = 0.0;
1156 std::string n1 =
"mosfet:nltermscale";
1157 locaPVec.addParameter(n1, 0.0);
1164 for (
int i = 0; i < names.size(); ++i) {
1165 if (finalVal[i] > initialVal[i]) {
1166 minVal[i] = initialVal[i];
1167 maxVal[i] = finalVal[i];
1170 minVal[i] = finalVal[i];
1171 maxVal[i] = initialVal[i];
1176 for (
int i = 0; i < names.size(); ++i)
1177 locaPVec.addParameter(names[i], initialVal[i]);
1179 LOCA::Abstract::Iterator::IteratorStatus locaStatus;
1184 for (
int hs = 0; hs < names.size(); ++hs) {
1185 for (
int i = 0; i < names.size(); ++i) {
1187 locaPVec.setValue(names[i], initialVal[i]);
1189 locaPVec.setValue(names[i], finalVal[i]);
1192 stepperList.set(
"Continuation Parameter", names[hs]);
1193 stepperList.set(
"Initial Value", initialVal[hs]);
1194 stepperList.set(
"Min Value", minVal[hs]);
1195 stepperList.set(
"Max Value", maxVal[hs]);
1205 if (locaStatus != LOCA::Abstract::Iterator::Finished)
1233 Teuchos::RCP<Teuchos::ParameterList> locaList = paramsPtr->
getLocaParams();
1234 Teuchos::ParameterList& stepperList = locaList->sublist(
"Stepper");
1235 LOCA::ParameterVector locaPVec;
1238 int numHomotopyContinuationRuns = 4;
1239 std::vector<std::string> names(numHomotopyContinuationRuns);
1240 std::vector<double> initialVal(numHomotopyContinuationRuns);
1241 std::vector<double> finalVal(numHomotopyContinuationRuns);
1242 std::vector<double> minVal(numHomotopyContinuationRuns);
1243 std::vector<double> maxVal(numHomotopyContinuationRuns);
1249 names[0] = stepperList.get(
"Power Node",
"VA:V0");
1250 names[1] =
"mosfet:gainscale";
1251 names[2] =
"mosfet:nltermscale";
1252 names[3] =
"mosfet:sizescale";
1253 initialVal[0] = 0.0;
1254 initialVal[1] = 0.0;
1255 initialVal[2] = 0.0;
1256 initialVal[3] = 0.0;
1270 for (
int i = 0; i < names.size(); ++i) {
1271 if (finalVal[i] > initialVal[i]) {
1272 minVal[i] = initialVal[i];
1273 maxVal[i] = finalVal[i];
1276 minVal[i] = finalVal[i];
1277 maxVal[i] = initialVal[i];
1282 for (
int i = 0; i < names.size(); ++i)
1283 locaPVec.addParameter(names[i], initialVal[i]);
1285 LOCA::Abstract::Iterator::IteratorStatus locaStatus;
1288 for (
int hs = 0; hs < names.size(); ++hs) {
1289 for (
int i = 0; i < names.size(); ++i) {
1291 locaPVec.setValue(names[i], initialVal[i]);
1293 locaPVec.setValue(names[i], finalVal[i]);
1296 stepperList.set(
"Continuation Parameter", names[hs]);
1297 stepperList.set(
"Initial Value", initialVal[hs]);
1298 stepperList.set(
"Min Value", minVal[hs]);
1299 stepperList.set(
"Max Value", maxVal[hs]);
1309 if (locaStatus != LOCA::Abstract::Iterator::Finished)
1335 Teuchos::RCP<Teuchos::ParameterList> locaList = paramsPtr->
getLocaParams();
1336 Teuchos::ParameterList& stepperList = locaList->sublist(
"Stepper");
1337 LOCA::ParameterVector locaPVec;
1341 int numHomotopyContinuationRuns = 1 + numGainBlocks;
1342 std::vector<std::string> names(numHomotopyContinuationRuns);
1343 std::vector<double> initialVal(numHomotopyContinuationRuns);
1344 std::vector<double> finalVal(numHomotopyContinuationRuns);
1345 std::vector<double> minVal(numHomotopyContinuationRuns);
1346 std::vector<double> maxVal(numHomotopyContinuationRuns);
1352 for (
int i = 0; i < numGainBlocks; ++i) {
1353 std::stringstream s;
1355 names[i] =
"mosfet:gainscale_block_" + s.str();
1356 initialVal[i] = 0.0;
1359 names[numHomotopyContinuationRuns - 1] =
"mosfet:nltermscale";
1360 initialVal[numHomotopyContinuationRuns - 1] = 0.0;
1361 finalVal[numHomotopyContinuationRuns - 1] = 1.0;
1366 for (
int i = 0; i < names.size(); ++i) {
1367 if (finalVal[i] > initialVal[i]) {
1368 minVal[i] = initialVal[i];
1369 maxVal[i] = finalVal[i];
1372 minVal[i] = finalVal[i];
1373 maxVal[i] = initialVal[i];
1378 for (
int i = 0; i < names.size(); ++i)
1379 locaPVec.addParameter(names[i], initialVal[i]);
1381 LOCA::Abstract::Iterator::IteratorStatus locaStatus;
1384 for (
int hs = 0; hs < names.size(); ++hs) {
1385 for (
int i = 0; i < names.size(); ++i) {
1387 locaPVec.setValue(names[i], initialVal[i]);
1389 locaPVec.setValue(names[i], finalVal[i]);
1392 stepperList.set(
"Continuation Parameter", names[hs]);
1393 stepperList.set(
"Initial Value", initialVal[hs]);
1394 stepperList.set(
"Min Value", minVal[hs]);
1395 stepperList.set(
"Max Value", maxVal[hs]);
1405 if (locaStatus != LOCA::Abstract::Iterator::Finished)
1432 Teuchos::RCP<Teuchos::ParameterList> locaList = paramsPtr->
getLocaParams();
1435 std::string gmin =
"GSTEPPING";
1438 LOCA::ParameterVector locaPVec;
1439 Teuchos::ParameterList& stepperList = locaList->sublist(
"Stepper");
1440 Teuchos::ParameterList& predictorList = locaList->sublist(
"Predictor");
1441 Teuchos::ParameterList& stepSizeList = locaList->sublist(
"Step Size");
1444 locaPVec.addParameter(gmin, 0.0);
1446 stepperList.set(
"Continuation Parameter", gmin);
1447 stepperList.set(
"Continuation Method",
"Natural");
1449 stepSizeList.set(
"Method",
"Adaptive");
1450 predictorList.set(
"Method",
"Constant");
1452 stepperList.set(
"Initial Value", 4.0);
1453 stepperList.set(
"Min Value", -4.0);
1455 stepperList.set(
"Max Value", 4.0);
1457 stepSizeList.set(
"Initial Step Size", -2.0);
1458 stepSizeList.set(
"Min Step Size", 1.0e-6);
1459 stepSizeList.set(
"Max Step Size", 1.0e+12);
1460 stepSizeList.set(
"Aggressiveness", 0.01);
1462 stepperList.set(
"Max Steps", 400);
1463 stepperList.set(
"Max Nonlinear Iterations", 20);
1470 bool usedNODESET=
false;
1490 if (!usedOP && !usedNODESET)
1499 std::string message =
"'.dcop input=' and gstepping are incompatible";
1500 N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::USR_FATAL, message);
1504 Teuchos::RCP<AugmentLinSys> als =
1506 groupPtr_->setAugmentLinearSystem(
true, als);
1511 LOCA::Abstract::Iterator::IteratorStatus locaStatus =
stepperPtr_->run();
1513 groupPtr_->setAugmentLinearSystem(
false, Teuchos::null);
1516 if (locaStatus != LOCA::Abstract::Iterator::Finished)
1534 Teuchos::RCP<NOX::StatusTest::Combo> ctest =
1537 Teuchos::RCP<Teuchos::ParameterList> locaList =
1539 Teuchos::ParameterList& stepperList = locaList->sublist(
"Stepper");
1540 Teuchos::ParameterList& stepSizeList = locaList->sublist(
"Step Size");
1541 double initialStepSize =
1542 stepSizeList.get(
"Initial Step Size", 1.0e-3);
1543 double minStepSize = stepSizeList.get(
"Min Step Size", 1.0e-12);
1544 double maxStepSize = stepSizeList.get(
"Max Step Size", 1.0e4);
1545 Teuchos::RCP<Teuchos::ParameterList> noxList =
1550 Teuchos::RCP<NOX::StatusTest::MaxIters> mi =
1551 Teuchos::rcp(
new NOX::StatusTest::MaxIters(stepperList.get(
"Max Steps", 200)));
1552 Teuchos::RCP<NOX::StatusTest::FiniteValue> fv =
1553 Teuchos::rcp(
new NOX::StatusTest::FiniteValue);
1554 Teuchos::RCP<PseudoTransientTest> pt =
1557 ctest->addStatusTest(mi);
1558 ctest->addStatusTest(fv);
1559 ctest->addStatusTest(pt);
1563 Teuchos::RCP<AugmentLinSys> als =
1574 NOX::StatusTest::StatusType status =
solverPtr_->solve();
1585 groupPtr_->setAugmentLinearSystem(
false, Teuchos::null);
1609 #ifdef Xyce_NOX_LOCA_ARTIFICIAL_HOMOTOPY_SUPPORT
1610 Teuchos::RCP<Teuchos::ParameterList> locaList = paramsPtr->
getLocaParams();
1611 Teuchos::ParameterList& locaUtilsList = locaList->sublist(
"Utilities");
1613 Teuchos::RCP<LOCA::Homotopy::Group> hGrp =
1618 locaList->sublist(
"Predictor").set(
"Secant", 0.999);
1619 locaList->sublist(
"Stepper").set(
"Max Value", 0.999);
1623 LOCA::Abstract::Iterator::IteratorStatus locaStatus =
stepperPtr_->run();
1626 Teuchos::RCP<LOCA::Homotopy::Group> hGrp2 =
1629 locaList->sublist(
"Predictor").set(
"Secant", 0.999);
1630 locaList->sublist(
"Stepper").set(
"Initial Value", 0.999);
1631 locaList->sublist(
"Stepper").set(
"Max Value", 1.0);
1632 locaList->sublist(
"Step Size").set(
"Method",
"Constant");
1633 locaList->sublist(
"Step Size").set(
"Initial Step Size", 0.0001);
1634 locaList->sublist(
"Step Size").set(
"Min Step Size", 0.0001);
1641 if (locaStatus != LOCA::Abstract::Iterator::Finished)
1647 Report::UserFatal0() <<
"Nonlinear Solver (NOX::Interface) Artificial parameter continuation requires "
1648 <<
"building xyce with the define: -DXyce_NOX_LOCA_ARTIFICIAL_HOMOTOPY_SUPPORT to "
1649 <<
"allow LOCA to augment the diagonal of Jacobian! Either rebuild Xyce or do not "
1650 <<
"run Xyce with \"continuation=33\"";
1667 Teuchos::RCP<Teuchos::ParameterList> locaList = paramsPtr->
getLocaParams();
1670 std::string vsrcscale =
"VSRCSCALE";
1673 LOCA::ParameterVector locaPVec;
1674 Teuchos::ParameterList& stepperList = locaList->sublist(
"Stepper");
1675 Teuchos::ParameterList& predictorList = locaList->sublist(
"Predictor");
1676 Teuchos::ParameterList& stepSizeList = locaList->sublist(
"Step Size");
1679 locaPVec.addParameter(vsrcscale, 0.0);
1681 stepperList.set(
"Continuation Parameter", vsrcscale);
1682 stepperList.set(
"Continuation Method",
"Natural");
1684 stepSizeList.set(
"Method",
"Adaptive");
1685 predictorList.set(
"Method",
"Constant");
1687 stepperList.set(
"Initial Value", 0.0);
1688 stepperList.set(
"Min Value", -1.0);
1689 stepperList.set(
"Max Value", 1.0);
1691 stepSizeList.set(
"Initial Step Size", 0.2);
1692 stepSizeList.set(
"Min Step Size", 1.0e-4);
1693 stepSizeList.set(
"Max Step Size", 0.2);
1694 stepSizeList.set(
"Aggressiveness", 1.0);
1696 stepperList.set(
"Max Steps", 400);
1697 stepperList.set(
"Max Nonlinear Iterations", 20);
1704 bool usedNODESET=
false;
1724 if (!usedOP && !usedNODESET)
1731 LOCA::Abstract::Iterator::IteratorStatus locaStatus =
stepperPtr_->run();
1733 groupPtr_->setAugmentLinearSystem(
false, Teuchos::null);
1736 if (locaStatus != LOCA::Abstract::Iterator::Finished)
1767 if (DEBUG_NONLINEAR)
1885 groupPtr_->setNonContinuationFlag (
true);
1889 groupPtr_->setNonContinuationFlag (
false);
1892 if (DEBUG_NONLINEAR)
1893 dout() <<
"solverType is " << solverType << std::endl;
1897 if (solverType == 0)
1902 else if (solverType == 1)
1907 else if (solverType == 2)
1911 else if (solverType == 3)
1916 else if (solverType == 4)
1921 else if (solverType == 5)
1926 else if (solverType == 6)
1930 else if (solverType == 7)
1934 else if (solverType == 8)
1938 else if (solverType == 9)
1942 else if (solverType == 10)
1946 else if (solverType == 33)
1950 else if (solverType == 34)
1956 catch (
const char* error_msg) {
1957 std::string nox_error =
"NOX Error";
1958 std::string err_msg = std::string(error_msg);
1959 if (err_msg == nox_error) {
1960 const std::string message =
1961 "Caught a NOX Exception in Interface::solve()!";
1962 N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL, message);
1968 catch (
const std::exception& e) {
1969 dout() << e.what() << std::endl;
1970 const std::string message =
1971 "Caught std::exception in Interface::solve()!";
1972 N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL, message);
1975 const std::string message =
1976 "Caught Unknown Exception in Interface::solve()!";
1977 N_ERH_ErrorMgr::report(N_ERH_ErrorMgr::DEV_FATAL, message);
2003 #ifdef Xyce_DEBUG_OP_START
2004 dout() <<
"NOX_Interface: Inside continuation=1 OP_START code (case 2)" << std::endl;
2011 const NodeNameMap & allNodes =
outMgrPtr_->getSolutionNodeMap();
2012 N_PDS_Comm * pdsCommPtr =
pdsMgrPtr_->getPDSComm();
2014 if (found > 0 && icType == IO::InitialConditionsData::IC_TYPE_DCOP_RESTART)
2026 Teuchos::RCP<AugmentLinSys> als =
2029 groupPtr_->setAugmentLinearSystem(
true, als);
2030 NOX::StatusTest::StatusType status =
solverPtr_->solve();
2033 groupPtr_->setAugmentLinearSystem(
false, Teuchos::null);
2036 #ifdef Xyce_DEBUG_OP_START
2038 #ifdef Xyce_PARALLEL_MPI
2039 groupPtr_->setOutputLinear (&op, &allNodes, pdsCommPtr);
2041 groupPtr_->setOutputLinear (&op, &allNodes);
2043 #endif // debug op start
2067 #ifdef Xyce_DEBUG_IC
2068 dout() <<
"NOX_Interface: Inside continuation=0 .IC code." << std::endl;
2074 usedIC = (icType==IO::InitialConditionsData::IC_TYPE_IC && found > 0);
2077 bool useGminStepping=
false;
2078 Teuchos::RCP<AugmentLinSys> als =
2080 groupPtr_->setAugmentLinearSystem(
true, als);
2102 #ifdef Xyce_DEBUG_IC
2103 dout() <<
"NOX_Interface: Inside continuation=3 .IC code." << std::endl;
2109 usedIC = (icType==IO::InitialConditionsData::IC_TYPE_IC && found > 0);
2112 bool useGminStepping=
true;
2113 Teuchos::RCP<AugmentLinSys> als =
2115 groupPtr_->setAugmentLinearSystem(
true, als);
2130 bool usedNODESET(
false);
2132 #ifdef Xyce_DEBUG_IC
2133 dout() <<
"NOX_Interface: Inside continuation=0 .NODESET code (case 1)" << std::endl;
2139 usedNODESET = (icType==IO::InitialConditionsData::IC_TYPE_NODESET && found > 0);
2142 Teuchos::RCP<AugmentLinSys> als =
2145 groupPtr_->setAugmentLinearSystem(
true, als);
2146 NOX::StatusTest::StatusType status =
solverPtr_->solve();
2149 groupPtr_->setAugmentLinearSystem(
false, Teuchos::null);
2168 bool usedNODESET(
false);
2170 #ifdef Xyce_DEBUG_IC
2171 dout() <<
"NOX_Interface: Inside continuation=1 .NODESET code (case 2)" << std::endl;
2178 usedNODESET = (icType==IO::InitialConditionsData::IC_TYPE_NODESET && found > 0);
2189 Teuchos::RCP<AugmentLinSys> als =
2192 groupPtr_->setAugmentLinearSystem(
true, als);
2193 NOX::StatusTest::StatusType status =
solverPtr_->solve();
2196 groupPtr_->setAugmentLinearSystem(
false, Teuchos::null);
2250 dout() <<
"takeFirstSolveStep: allocating a new group!" << std::endl;
2259 dout() <<
"takeFirstSolveStep: using the old group!" << std::endl;
2266 dout() <<
"takeFirstSolveStep: copying over the passed group!" << std::endl;
2281 NOX::StatusTest::StatusType status =
solverPtr_->step();
2284 return (status == NOX::StatusTest::Converged) ? 1 : -1;
2299 NOX::StatusTest::StatusType status =
solverPtr_->step();
2302 return (status == NOX::StatusTest::Converged) ? 1 : -1;
2329 if ((!Teuchos::is_null(
solverPtr_)) && (solverType == 0))
2331 else if ((!Teuchos::is_null(
solverPtr_)) && (solverType == 1))
2333 else if ((!Teuchos::is_null(
solverPtr_)) && (solverType == 9))
2335 else if ((!Teuchos::is_null(
stepperPtr_)) && (solverType != 0))
2337 return stepperPtr_->getSolver()->getNumIterations();
2411 return maxNormFindex;
2751 lasSolverPtr_->setTolerance(params.get(
"Tolerance", 1.0e-12));
2755 lasSolverPtr_->setTolerance(params.get(
"Tolerance", 1.0e-12));
2811 (
const std::vector< int > & paramIDs,
2812 NOX::Abstract::MultiVector & dfdp,
2819 paramsPtr = &transientParams_;
2823 paramsPtr = &hbParams_;
2827 paramsPtr = &nlpParams_;
2831 paramsPtr = &dcParams_;
2834 Teuchos::RCP<Teuchos::ParameterList> locaList = paramsPtr->
getLocaParams();
2835 Teuchos::ParameterList& stepperList = locaList->sublist(
"Stepper");
2836 const std::string strArg(
"Skip df/dp");
2837 bool skipDFDP = stepperList.get(strArg,
false);
2843 bool forceFD =
false;
2845 double sqrtEta = 1.0e-8;
2848 LOCA::ParameterVector locaPVec = groupPtr_->getParams();
2850 int size = locaPVec.length();
2851 std::vector<std::string> paramNameVec(size);
2853 for (
int i = 0; i < locaPVec.length(); ++i)
2855 int index = paramIDs[i];
2856 paramNameVec[i] = locaPVec.getLabel(index);
2860 *dsPtr_, *nonlinearEquationLoader_, paramNameVec, getAnalysisManager());
2863 nonlinearEquationLoader_->loadSensitivityResiduals();
2866 std::vector<Linear::Vector *> & sensRHSPtrVector = dsPtr_->sensRHSPtrVector;
2867 for (
int i = 0; i < locaPVec.length(); ++i)
2870 int index = paramIDs[i];
2871 NOX::Abstract::Vector *DFDP = &dfdp[index+1];
2874 Linear::Vector & tmp = *(sensRHSPtrVector[index]);
2875 Vector tmpNox(tmp, *lasSysPtr_);
2924 const Teuchos::RCP<LOCA::MultiContinuation::AbstractGroup>& initialGuess,
2925 const Teuchos::RCP<NOX::StatusTest::Generic>& test,
2926 const Teuchos::RCP<Teuchos::ParameterList>& p)
2929 Teuchos::rcp(
new LOCA::Stepper(gd, initialGuess, test, p));
2952 if (solverType != 0) retCode =
true;
2977 if (solverType != 0) retCode =
true;
bool loadSensitivityResiduals(int difference, bool forceFD_, double sqrtEta_, std::string &netlistFilename_, TimeIntg::DataStore &ds, Loader::NonlinearEquationLoader &nonlinearEquationLoader_, const std::vector< std::string > ¶mNameVec_, const Analysis::AnalysisManager &analysisManager_)
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 createStatusTests(Parallel::Machine comm, Xyce::Linear::Vector **currSolnVectorPtrPtr, Xyce::Loader::NonlinearEquationLoader &nonlinear_equation_loader, Xyce::Linear::Vector *maskVectorPtr=0)
Only used when NLS_MASKED_WRMS_NORMS.
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_
void allocateSensitivityArrays(Linear::Builder &builder, int numParams)
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_
Teuchos::RCP< LOCA::StatusTest::Wrapper > locaDC_NLPStatusTestPtr_
int getHomotopyBlockSize() const
TimeIntg::DataStore * dsPtr_
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)
NOX::Abstract::Vector & scale(double gamma)
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_
bool computeDfDpMulti(const std::vector< int > ¶mIDs, NOX::Abstract::MultiVector &dfdp, bool isValidF)
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)
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)
Loader::NonlinearEquationLoader * nonlinearEquationLoader_
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 setNLPOptions(const Xyce::Util::OptionBlock &OB)
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)